[PATCH] D100136: Allow applying attributes to subset of allowed subjects.
Bruno De Fraine via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 5 03:20:05 PDT 2021
brunodf added a comment.
This change is important make better use of `#pragma clang attribute` (which is cool!), but for some uses the check still seems to restrictive.
Concretely, for an attribute where `Subjects` includes `FunctionLike`, I can only match it using the rule `hasType(functionType)` but not with a `function` rule. E.g. if I want to apply it to C++ methods, the rule `function(is_member)` is rejected (as `attribute ... can't be applied to 'function(is_member)'`).
If I change the subject list of my attribute to include `Function` in addition to `FunctionLike`, it does work, but I don't know if there are other effects.
I'm not exactly sure what is the purpose of the check, since there is already a warning when your pragma does not match anything? If an attribute is updated to allow more subjects, how does that affect matching of existing rules?
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