aboutsummaryrefslogtreecommitdiff
path: root/clang/docs
diff options
context:
space:
mode:
authorZiqing Luo <ziqing@udel.edu>2022-07-21 13:20:19 -0700
committerZiqing Luo <ziqingluo@Ziqings-iMac-Pro.local>2022-07-21 13:35:31 -0700
commitb17baa1db613a2ce777aa122feb87488750a64d0 (patch)
treefeef68260d507bcd635f380f8f1d5350a205f6ab /clang/docs
parent7c666c14f82ee13ddd222aba9543a5579e608e03 (diff)
downloadllvm-b17baa1db613a2ce777aa122feb87488750a64d0.zip
llvm-b17baa1db613a2ce777aa122feb87488750a64d0.tar.gz
llvm-b17baa1db613a2ce777aa122feb87488750a64d0.tar.bz2
[ASTMatchers] Adding a new matcher for callee declarations of Obj-C
message expressions For an Obj-C message expression `[o m]`, the adding matcher will match the declaration of the method `m`. This commit overloads the existing `callee` ASTMatcher, which originally was only for C/C++ nodes but also applies to Obj-C messages now. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D129398
Diffstat (limited to 'clang/docs')
-rw-r--r--clang/docs/LibASTMatchersReference.html37
1 files changed, 34 insertions, 3 deletions
diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html
index 03ca48c..4ac9ab0 100644
--- a/clang/docs/LibASTMatchersReference.html
+++ b/clang/docs/LibASTMatchersReference.html
@@ -7255,14 +7255,24 @@ Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Bloc
</pre></td></tr>
-<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('callee1')"><a name="callee1Anchor">callee</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
-<tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
-given matcher.
+<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('callee2')"><a name="callee2Anchor">callee</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
+<tr><td colspan="4" class="doc" id="callee2"><pre>Matches 1) if the call expression's callee's declaration matches the
+given matcher; or 2) if the Obj-C message expression's callee's method
+declaration matches the given matcher.
Example matches y.x() (matcher = callExpr(callee(
cxxMethodDecl(hasName("x")))))
class Y { public: void x(); };
void z() { Y y; y.x(); }
+
+Example 2. Matches [I foo] with
+objcMessageExpr(callee(objcMethodDecl(hasName("foo"))))
+
+ @interface I: NSObject
+ +(void)foo;
+ @end
+ ...
+ [I foo]
</pre></td></tr>
@@ -8814,6 +8824,27 @@ match Base.
</pre></td></tr>
+<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('callee1')"><a name="callee1Anchor">callee</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
+<tr><td colspan="4" class="doc" id="callee1"><pre>Matches 1) if the call expression's callee's declaration matches the
+given matcher; or 2) if the Obj-C message expression's callee's method
+declaration matches the given matcher.
+
+Example matches y.x() (matcher = callExpr(callee(
+ cxxMethodDecl(hasName("x")))))
+ class Y { public: void x(); };
+ void z() { Y y; y.x(); }
+
+Example 2. Matches [I foo] with
+objcMessageExpr(callee(objcMethodDecl(hasName("foo"))))
+
+ @interface I: NSObject
+ +(void)foo;
+ @end
+ ...
+ [I foo]
+</pre></td></tr>
+
+
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyArgument3')"><a name="hasAnyArgument3Anchor">hasAnyArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
<tr><td colspan="4" class="doc" id="hasAnyArgument3"><pre>Matches any argument of a call expression or a constructor call
expression, or an ObjC-message-send expression.