[PATCH] D100136: Allow applying attributes to subset of allowed subjects.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 8 14:13:49 PDT 2021


rsmith added inline comments.


================
Comment at: clang/lib/Sema/SemaAttr.cpp:896
+      attr::SubjectMatchRule MatchRule = attr::SubjectMatchRule(Rule.first);
+      if (auto ParentRule = getParentAttrMatcherRule(MatchRule)) {
+        if (llvm::any_of(StrictSubjectMatchRuleSet,
----------------
Does this need to be a loop? (Can we have a grandparent matcher rule?)


================
Comment at: clang/test/Sema/pragma-attribute-strict-subjects.c:59
 #pragma clang attribute push (__attribute__((abi_tag("a"))), apply_to = any(enum_constant, function, record(unless(is_union)), variable, variable(is_parameter)))
 // FIXME: comma in this diagnostic is wrong.
+// expected-error at -2 {{attribute 'abi_tag' can't be applied to 'enum_constant'}}
----------------
The FIXME here is "fixed" now. Please can you add another example that shows the incorrect comma and move the FIXME there?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100136/new/

https://reviews.llvm.org/D100136



More information about the cfe-commits mailing list