@@ -307,6 +307,19 @@ <h2 id="decl-matchers">Node Matchers</h2>
307
307
</ pre > </ td > </ tr >
308
308
309
309
310
+ < tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1Decl.html "> Decl</ a > ></ td > < td class ="name " onclick ="toggle('translationUnitDecl0') "> < a name ="translationUnitDecl0Anchor "> translationUnitDecl</ a > </ td > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1TranslationUnitDecl.html "> TranslationUnitDecl</ a > >...</ td > </ tr >
311
+ < tr > < td colspan ="4 " class ="doc " id ="translationUnitDecl0 "> < pre > Matches the top declaration context.
312
+
313
+ Given
314
+ int X;
315
+ namespace NS {
316
+ int Y;
317
+ } namespace NS
318
+ decl(hasDeclContext(translationUnitDecl()))
319
+ matches "int X", but not "int Y".
320
+ </ pre > </ td > </ tr >
321
+
322
+
310
323
< tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1Decl.html "> Decl</ a > ></ td > < td class ="name " onclick ="toggle('typedefDecl0') "> < a name ="typedefDecl0Anchor "> typedefDecl</ a > </ td > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1TypedefDecl.html "> TypedefDecl</ a > >...</ td > </ tr >
311
324
< tr > < td colspan ="4 " class ="doc " id ="typedefDecl0 "> < pre > Matches typedef declarations.
312
325
@@ -1525,7 +1538,7 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
1525
1538
</ pre > </ td > </ tr >
1526
1539
1527
1540
1528
- < tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html "> CXXRecordDecl</ a > ></ td > < td class ="name " onclick ="toggle('isDerivedFrom1') "> < a name ="isDerivedFrom1Anchor "> isDerivedFrom</ a > </ td > < td > StringRef BaseName</ td > </ tr >
1541
+ < tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html "> CXXRecordDecl</ a > ></ td > < td class ="name " onclick ="toggle('isDerivedFrom1') "> < a name ="isDerivedFrom1Anchor "> isDerivedFrom</ a > </ td > < td > std::string BaseName</ td > </ tr >
1529
1542
< tr > < td colspan ="4 " class ="doc " id ="isDerivedFrom1 "> < pre > Overloaded method as shortcut for isDerivedFrom(hasName(...)).
1530
1543
</ pre > </ td > </ tr >
1531
1544
@@ -1544,7 +1557,7 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
1544
1557
</ pre > </ td > </ tr >
1545
1558
1546
1559
1547
- < tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html "> CXXRecordDecl</ a > ></ td > < td class ="name " onclick ="toggle('isSameOrDerivedFrom1') "> < a name ="isSameOrDerivedFrom1Anchor "> isSameOrDerivedFrom</ a > </ td > < td > StringRef BaseName</ td > </ tr >
1560
+ < tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html "> CXXRecordDecl</ a > ></ td > < td class ="name " onclick ="toggle('isSameOrDerivedFrom1') "> < a name ="isSameOrDerivedFrom1Anchor "> isSameOrDerivedFrom</ a > </ td > < td > std::string BaseName</ td > </ tr >
1548
1561
< tr > < td colspan ="4 " class ="doc " id ="isSameOrDerivedFrom1 "> < pre > Overloaded method as shortcut for
1549
1562
isSameOrDerivedFrom(hasName(...)).
1550
1563
</ pre > </ td > </ tr >
@@ -1721,19 +1734,6 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
1721
1734
</ pre > </ td > </ tr >
1722
1735
1723
1736
1724
- < tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1Decl.html "> Decl</ a > ></ td > < td class ="name " onclick ="toggle('isInstantiated0') "> < a name ="isInstantiated0Anchor "> isInstantiated</ a > </ td > < td > </ td > </ tr >
1725
- < tr > < td colspan ="4 " class ="doc " id ="isInstantiated0 "> < pre > Matches declarations that are template instantiations or are inside
1726
- template instantiations.
1727
-
1728
- Given
1729
- template<typename T> void A(T t) { T i; }
1730
- A(0);
1731
- A(0U);
1732
- functionDecl(isInstantiated())
1733
- matches 'A(int) {...};' and 'A(unsigned) {...}'.
1734
- </ pre > </ td > </ tr >
1735
-
1736
-
1737
1737
< tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1Decl.html "> Decl</ a > ></ td > < td class ="name " onclick ="toggle('isPrivate0') "> < a name ="isPrivate0Anchor "> isPrivate</ a > </ td > < td > </ td > </ tr >
1738
1738
< tr > < td colspan ="4 " class ="doc " id ="isPrivate0 "> < pre > Matches private C++ declarations.
1739
1739
@@ -2093,22 +2093,6 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
2093
2093
</ pre > </ td > </ tr >
2094
2094
2095
2095
2096
- < tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html "> Stmt</ a > ></ td > < td class ="name " onclick ="toggle('isInTemplateInstantiation0') "> < a name ="isInTemplateInstantiation0Anchor "> isInTemplateInstantiation</ a > </ td > < td > </ td > </ tr >
2097
- < tr > < td colspan ="4 " class ="doc " id ="isInTemplateInstantiation0 "> < pre > Matches statements inside of a template instantiation.
2098
-
2099
- Given
2100
- int j;
2101
- template<typename T> void A(T t) { T i; j += 42;}
2102
- A(0);
2103
- A(0U);
2104
- declStmt(isInTemplateInstantiation())
2105
- matches 'int i;' and 'unsigned i'.
2106
- unless(stmt(isInTemplateInstantiation()))
2107
- will NOT match j += 42; as it's shared between the template definition and
2108
- instantiation.
2109
- </ pre > </ td > </ tr >
2110
-
2111
-
2112
2096
< tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html "> TagDecl</ a > ></ td > < td class ="name " onclick ="toggle('isDefinition0') "> < a name ="isDefinition0Anchor "> isDefinition</ a > </ td > < td > </ td > </ tr >
2113
2097
< tr > < td colspan ="4 " class ="doc " id ="isDefinition0 "> < pre > Matches if a declaration has a body attached.
2114
2098
@@ -2229,6 +2213,16 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
2229
2213
</ pre > </ td > </ tr >
2230
2214
2231
2215
2216
+ < tr > < td > Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1Type.html "> Type</ a > ></ td > < td class ="name " onclick ="toggle('voidType0') "> < a name ="voidType0Anchor "> voidType</ a > </ td > < td > </ td > </ tr >
2217
+ < tr > < td colspan ="4 " class ="doc " id ="voidType0 "> < pre > Matches type void.
2218
+
2219
+ Given
2220
+ struct S { void func(); };
2221
+ functionDecl(returns(voidType()))
2222
+ matches "void func();"
2223
+ </ pre > </ td > </ tr >
2224
+
2225
+
2232
2226
< 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 >
2233
2227
< tr > < td colspan ="4 " class ="doc " id ="ofKind0 "> < pre > Matches unary expressions of a certain kind.
2234
2228
@@ -2323,6 +2317,35 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
2323
2317
Usable as: Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html "> FunctionDecl</ a > >, Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html "> VarDecl</ a > >, Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html "> CXXRecordDecl</ a > >
2324
2318
</ pre > </ td > </ tr >
2325
2319
2320
+
2321
+ < tr > < td > Matcher<internal::Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1Decl.html "> Decl</ a > >></ td > < td class ="name " onclick ="toggle('isInstantiated0') "> < a name ="isInstantiated0Anchor "> isInstantiated</ a > </ td > < td > </ td > </ tr >
2322
+ < tr > < td colspan ="4 " class ="doc " id ="isInstantiated0 "> < pre > Matches declarations that are template instantiations or are inside
2323
+ template instantiations.
2324
+
2325
+ Given
2326
+ template<typename T> void A(T t) { T i; }
2327
+ A(0);
2328
+ A(0U);
2329
+ functionDecl(isInstantiated())
2330
+ matches 'A(int) {...};' and 'A(unsigned) {...}'.
2331
+ </ pre > </ td > </ tr >
2332
+
2333
+
2334
+ < tr > < td > Matcher<internal::Matcher<< a href ="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html "> Stmt</ a > >></ td > < td class ="name " onclick ="toggle('isInTemplateInstantiation0') "> < a name ="isInTemplateInstantiation0Anchor "> isInTemplateInstantiation</ a > </ td > < td > </ td > </ tr >
2335
+ < tr > < td colspan ="4 " class ="doc " id ="isInTemplateInstantiation0 "> < pre > Matches statements inside of a template instantiation.
2336
+
2337
+ Given
2338
+ int j;
2339
+ template<typename T> void A(T t) { T i; j += 42;}
2340
+ A(0);
2341
+ A(0U);
2342
+ declStmt(isInTemplateInstantiation())
2343
+ matches 'int i;' and 'unsigned i'.
2344
+ unless(stmt(isInTemplateInstantiation()))
2345
+ will NOT match j += 42; as it's shared between the template definition and
2346
+ instantiation.
2347
+ </ pre > </ td > </ tr >
2348
+
2326
2349
<!--END_NARROWING_MATCHERS -->
2327
2350
</ table >
2328
2351
0 commit comments