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;
40 const auto &expr = annotation->getExpr();
42 ::P4::error(ErrorType::ERR_INVALID,
"%1%: annotation must have exactly 1 argument",
45 auto type = typeMap->getType(e0,
true);
46 if (type ==
nullptr)
return;
47 if (!type->is<IR::Type_MatchKind>())
48 ::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