summaryrefslogtreecommitdiffstats
path: root/clang/docs/LibASTMatchersReference.html
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-02-04 10:59:20 +0000
committerManuel Klimek <klimek@google.com>2013-02-04 10:59:20 +0000
commitabf4371339862cb739ae7dc8595e12cba7b7d6c3 (patch)
treecb8136b629998c8c7ed672362f32f2dd562cf0c7 /clang/docs/LibASTMatchersReference.html
parentfa67ed47e1e87be650afb4d242ec8e44019437a0 (diff)
downloadbcm5719-llvm-abf4371339862cb739ae7dc8595e12cba7b7d6c3.tar.gz
bcm5719-llvm-abf4371339862cb739ae7dc8595e12cba7b7d6c3.zip
Implements the convenience matcher findAll.
We found that findAll has been implemented incorrectly multiple times by various people using the matchers. To prevent further wasted development effort, it makes sense to add it as convenience matcher implemented as eachOf(m, forEachDescendant(m)). This patch also updates the docs with the new matchers. llvm-svn: 174320
Diffstat (limited to 'clang/docs/LibASTMatchersReference.html')
-rw-r--r--clang/docs/LibASTMatchersReference.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html
index 163743cdc9d..672c12d9b9d 100644
--- a/clang/docs/LibASTMatchersReference.html
+++ b/clang/docs/LibASTMatchersReference.html
@@ -1675,6 +1675,40 @@ match expressions.</p>
<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
<!-- START_TRAVERSAL_MATCHERS -->
+<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('eachOf0')"><a name="eachOf0Anchor">eachOf</a></td><td>Matcher&lt;*&gt; P1, Matcher&lt;*&gt; P2</td></tr>
+<tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
+
+Unlike anyOf, eachOf will generate a match result for each
+matching submatcher.
+
+For example, in:
+ class A { int a; int b; };
+The matcher:
+ recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
+ has(fieldDecl(hasName("b")).bind("v"))))
+will generate two results binding "v", the first of which binds
+the field declaration of a, the second the field declaration of
+b.
+
+Usable as: Any Matcher
+</pre></td></tr>
+
+
+<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>Matcher&lt;T&gt; Matcher</td></tr>
+<tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
+
+Generates results for each match.
+
+For example, in:
+ class A { class B {}; class C {}; };
+The matcher:
+ recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("m")))
+will generate results for A, B and C.
+
+Usable as: Any Matcher
+</pre></td></tr>
+
+
<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;ChildT&gt; ChildMatcher</td></tr>
<tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
provided matcher.
OpenPOWER on IntegriCloud