diff options
| author | Manuel Klimek <klimek@google.com> | 2013-06-20 14:06:32 +0000 |
|---|---|---|
| committer | Manuel Klimek <klimek@google.com> | 2013-06-20 14:06:32 +0000 |
| commit | bbb758577f0acac2f5c3481c41824dc44a4e426b (patch) | |
| tree | a854b43566ae4844a969331c266c82105115295b /clang/docs/LibASTMatchersReference.html | |
| parent | 736e2e20e55a06098937b518a70be949b610fedb (diff) | |
| download | bcm5719-llvm-bbb758577f0acac2f5c3481c41824dc44a4e426b.tar.gz bcm5719-llvm-bbb758577f0acac2f5c3481c41824dc44a4e426b.zip | |
Adds the equalsBoundNode matcher.
Most of the tests contributed by Edwin Vane.
llvm-svn: 184427
Diffstat (limited to 'clang/docs/LibASTMatchersReference.html')
| -rw-r--r-- | clang/docs/LibASTMatchersReference.html | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index 8e31d583cb7..50ff38edfad 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -1730,6 +1730,29 @@ declCountIs(2) </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('equalsBoundNode1')"><a name="equalsBoundNode1Anchor">equalsBoundNode</a></td><td>std::string ID</td></tr> +<tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node. + +Matches a node if it equals the node previously bound to ID. + +Given + class X { int a; int b; }; +recordDecl( + has(fieldDecl(hasName("a"), hasType(type().bind("t")))), + has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) + matches the class X, as a and b have the same type. + +Note that when multiple matches are involved via forEach* matchers, +equalsBoundNodes acts as a filter. +For example: +compoundStmt( + forEachDescendant(varDecl().bind("d")), + forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))) +will trigger a match for each combination of variable declaration +and reference to that variable declaration within a compound statement. +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('equalsNode0')"><a name="equalsNode0Anchor">equalsNode</a></td><td>Decl* Other</td></tr> <tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node. @@ -1933,6 +1956,29 @@ callExpr(on(hasType(asString("class Y *")))) </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('equalsBoundNode3')"><a name="equalsBoundNode3Anchor">equalsBoundNode</a></td><td>std::string ID</td></tr> +<tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node. + +Matches a node if it equals the node previously bound to ID. + +Given + class X { int a; int b; }; +recordDecl( + has(fieldDecl(hasName("a"), hasType(type().bind("t")))), + has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) + matches the class X, as a and b have the same type. + +Note that when multiple matches are involved via forEach* matchers, +equalsBoundNodes acts as a filter. +For example: +compoundStmt( + forEachDescendant(varDecl().bind("d")), + forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))) +will trigger a match for each combination of variable declaration +and reference to that variable declaration within a compound statement. +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('hasLocalQualifiers0')"><a name="hasLocalQualifiers0Anchor">hasLocalQualifiers</a></td><td></td></tr> <tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to the node, not hidden within a typedef. @@ -1977,6 +2023,29 @@ matches "a(int)", "b(long)", but not "c(double)". </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('equalsBoundNode0')"><a name="equalsBoundNode0Anchor">equalsBoundNode</a></td><td>std::string ID</td></tr> +<tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node. + +Matches a node if it equals the node previously bound to ID. + +Given + class X { int a; int b; }; +recordDecl( + has(fieldDecl(hasName("a"), hasType(type().bind("t")))), + has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) + matches the class X, as a and b have the same type. + +Note that when multiple matches are involved via forEach* matchers, +equalsBoundNodes acts as a filter. +For example: +compoundStmt( + forEachDescendant(varDecl().bind("d")), + forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))) +will trigger a match for each combination of variable declaration +and reference to that variable declaration within a compound statement. +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('equalsNode1')"><a name="equalsNode1Anchor">equalsNode</a></td><td>Stmt* Other</td></tr> <tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node. @@ -2000,6 +2069,29 @@ Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDec </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('equalsBoundNode2')"><a name="equalsBoundNode2Anchor">equalsBoundNode</a></td><td>std::string ID</td></tr> +<tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node. + +Matches a node if it equals the node previously bound to ID. + +Given + class X { int a; int b; }; +recordDecl( + has(fieldDecl(hasName("a"), hasType(type().bind("t")))), + has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) + matches the class X, as a and b have the same type. + +Note that when multiple matches are involved via forEach* matchers, +equalsBoundNodes acts as a filter. +For example: +compoundStmt( + forEachDescendant(varDecl().bind("d")), + forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))) +will trigger a match for each combination of variable declaration +and reference to that variable declaration within a compound statement. +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>></td><td class="name" onclick="toggle('ofKind0')"><a name="ofKind0Anchor">ofKind</a></td><td>UnaryExprOrTypeTrait Kind</td></tr> <tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind. |

