diff options
author | Clement Courbet <courbet@google.com> | 2016-06-10 11:54:43 +0000 |
---|---|---|
committer | Clement Courbet <courbet@google.com> | 2016-06-10 11:54:43 +0000 |
commit | 7975d6ddc34c5a0eeeb57b748e235cd48b12b258 (patch) | |
tree | 444aaec31195b6ae549f905bca6339de0f4b5559 /docs | |
parent | 22a3dfea02651451188643abeb6a720e655d80ae (diff) | |
download | clang-7975d6ddc34c5a0eeeb57b748e235cd48b12b258.tar.gz |
[ASTMatchers] New forEachOverriden matcher.
Matches methods overridden by the given method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272386 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/LibASTMatchersReference.html | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/LibASTMatchersReference.html b/docs/LibASTMatchersReference.html index 3606367d2f..5ab3556890 100644 --- a/docs/LibASTMatchersReference.html +++ b/docs/LibASTMatchersReference.html @@ -3968,6 +3968,30 @@ matcher, or is a pointer to a type that matches the InnerMatcher. </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>></td><td class="name" onclick="toggle('forEachOverridden0')"><a name="forEachOverridden0Anchor">forEachOverridden</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>> InnerMatcher</td></tr> +<tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overriden by the given method. This matcher may +produce multiple matches. + +Given + class A { virtual void f(); }; + class B : public A { void f(); }; + class C : public B { void f(); }; +cxxMethodDecl(ofClass(hasName("C")), + forEachOverridden(cxxMethodDecl().bind("b"))).bind("d") + matches once, with "b" binding "A::f" and "d" binding "C::f" (Note + that B::f is not overridden by C::f). + +The check can produce multiple matches in case of multiple inheritance, e.g. + class A1 { virtual void f(); }; + class A2 { virtual void f(); }; + class C : public A1, public A2 { void f(); }; +cxxMethodDecl(ofClass(hasName("C")), + forEachOverridden(cxxMethodDecl().bind("b"))).bind("d") + matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and + once with "b" binding "A2::f" and "d" binding "C::f". +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>></td><td class="name" onclick="toggle('ofClass0')"><a name="ofClass0Anchor">ofClass</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration belongs to. |