34 setName(
"ValidateMatchAnnotations");
36 void postorder(
const IR::Annotation *annotation)
override {
37 if (annotation->name != IR::Annotation::matchAnnotation)
return;
38 if (!findContext<IR::StructField>())
return;
39 if (annotation->expr.size() != 1)
40 ::P4::error(ErrorType::ERR_INVALID,
"%1%: annotation must have exactly 1 argument",
42 auto e0 = annotation->expr.at(0);
43 auto type = typeMap->getType(e0,
true);
44 if (type ==
nullptr)
return;
45 if (!type->is<IR::Type_MatchKind>())
46 ::P4::error(ErrorType::ERR_TYPE_ERROR,
"%1%: value must be a match_kind", e0);
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
void error(const char *format, Args &&...args)
Report an error with the given message.
Definition lib/error.h:51