[PATCH] D144405: [clang][pp] Handle attributes defined by plugin in __has_attribute
Anders Waldenborg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 10 08:30:34 PST 2023
wanders added a comment.
In D144405#4184964 <https://reviews.llvm.org/D144405#4184964>, @erichkeane wrote:
> So here's a potential idea for future development: It isn't uncommon/untypical for an attribute to want to return something other than '1', for 'version' (usually an integral value representing a date). The standard attributes all do this. It might be worth looking into some infrastructure to do that.
Adding this to my list of things to look into. Thanks.
I see that D144403 <https://reviews.llvm.org/D144403> in the stack is not accepted, is there anything I need to fix that I have missed?
My current plan after this is to look into making it possible to attach custom attributes to the AST nodes, and in the end use plugin-defined attributes in ASTMatchers.
So I'll probably be poking around in that area anyway.
My imaginary API for that is something like:
/* find all calls to functions with my-attribute from functions without my-attribute
Finder->addMatcher(callExpr(
callee(
functionDecl(
hasAttr(MyAttribute)
)
)
hasAncestor(
functionDecl(
unless(hasAttr(MyAttribute))
).bind("containing-function")
)
).bind("call"), this);
where "MyAttribute" is the plugin defined attribute.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144405/new/
https://reviews.llvm.org/D144405
More information about the cfe-commits
mailing list