[PATCH] D129398: [ASTMatchers] Add a new matcher for callee declarations of Obj-C message expressions
Ziqing Luo via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 11 11:42:57 PDT 2022
ziqingluo-90 added inline comments.
================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:3853
+/// objcMessageExpr(objcMessageCallee(objcMethodDecl(hasName("foo"))))
+AST_MATCHER_P(ObjCMessageExpr, objcMessageCallee,
+ internal::Matcher<ObjCMethodDecl>, InnerMatcher) {
----------------
aaron.ballman wrote:
> Is there a reason why we want a separate matcher here instead of overloading `callee()`?
This is a good question!
`callee` has already been overloaded to accept both `Matcher<Decl>` and `Matcher<Stmt>` as the parameter. In my case, I will need `callee` to be polymorphic in returning both `Matcher<CallExpr>` and `Matcher<ObjCMessageExpr>` types. So that will end up in 4 definitions of `callee`, one of which has different return type and parameter type from one of the others.
Is this achievable? I know I can overload parameters or make return types polymorphic, but can I mix them together?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129398/new/
https://reviews.llvm.org/D129398
More information about the cfe-commits
mailing list