1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 2 "http://www.w3.org/TR/html4/strict.dtd"> 3 <html> 4 <head> 5 <title>AST Matcher Reference</title> 6 <link type="text/css" rel="stylesheet" href="../menu.css" /> 7 <link type="text/css" rel="stylesheet" href="../content.css" /> 8 <style type="text/css"> 9 td { 10 padding: .33em; 11 } 12 td.doc { 13 display: none; 14 border-bottom: 1px solid black; 15 } 16 td.name:hover { 17 color: blue; 18 cursor: pointer; 19 } 20 </style> 21 <script type="text/javascript"> 22 function toggle(id) { 23 if (!id) return; 24 row = document.getElementById(id); 25 if (row.style.display != 'table-cell') 26 row.style.display = 'table-cell'; 27 else 28 row.style.display = 'none'; 29 } 30 </script> 31 </head> 32 <body onLoad="toggle(location.hash.substring(1, location.hash.length - 6))"> 33 34 <!--#include virtual="../menu.html.incl"--> 35 36 <div id="content"> 37 38 <h1>AST Matcher Reference</h1> 39 40 <p>This document shows all currently implemented matchers. The matchers are grouped 41 by category and node type they match. You can click on matcher names to show the 42 matcher's source documentation.</p> 43 44 <p>There are three different basic categories of matchers: 45 <ul> 46 <li><a href="#decl-matchers">Node Matchers:</a> Matchers that match a specific type of AST node.</li> 47 <li><a href="#narrowing-matchers">Narrowing Matchers:</a> Matchers that match attributes on AST nodes.</li> 48 <li><a href="#traversal-matchers">Traversal Matchers:</a> Matchers that allow traversal between AST nodes.</li> 49 </ul> 50 </p> 51 52 <p>Within each category the matchers are ordered by node type they match on. 53 Note that if a matcher can match multiple node types, it will it will appear 54 multiple times. This means that by searching for Matcher<Stmt> you can 55 find all matchers that can be used to match on Stmt nodes.</p> 56 57 <p>The exception to that rule are matchers that can match on any node. Those 58 are marked with a * and are listed in the beginning of each category.</p> 59 60 <p>Note that the categorization of matchers is a great help when you combine 61 them into matcher expressions. You will usually want to form matcher expressions 62 that read like english sentences by alternating between node matchers and 63 narrowing or traversal matchers, like this: 64 <pre> 65 recordDecl(hasDescendant( 66 ifStmt(hasTrueExpression( 67 expr(hasDescendant( 68 ifStmt())))))) 69 </pre> 70 </p> 71 72 <!-- ======================================================================= --> 73 <h2 id="decl-matchers">Node Matchers</h2> 74 <!-- ======================================================================= --> 75 76 <p>Node matchers are at the core of matcher expressions - they specify the type 77 of node that is expected. Every match expression starts with a node matcher, 78 which can then be further refined with a narrowing or traversal matcher. All 79 traversal matchers take node matchers as their arguments.</p> 80 81 <p>For convenience, all node matchers take an arbitrary number of arguments 82 and implicitly act as allOf matchers.</p> 83 84 <p>Node matchers are the only matchers that support the bind("id") call to 85 bind the matched node to the given string, to be later retrieved from the 86 match callback.</p> 87 88 <p>It is important to remember that the arguments to node matchers are 89 predicates on the same node, just with additional information about the type. 90 This is often useful to make matcher expression more readable by inlining bind 91 calls into redundant node matchers inside another node matcher: 92 <pre> 93 // This binds the CXXRecordDecl to "id", as the decl() matcher will stay on 94 // the same node. 95 recordDecl(decl().bind("id"), hasName("::MyClass")) 96 </pre> 97 </p> 98 99 <table> 100 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr> 101 <!-- START_DECL_MATCHERS --> 102 103 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>></td><td class="name" onclick="toggle('ctorInitializer0')"><a name="ctorInitializer0Anchor">ctorInitializer</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>>...</td></tr> 104 <tr><td colspan="4" class="doc" id="ctorInitializer0"><pre>Matches constructor initializers. 105 106 Examples matches i(42). 107 class C { 108 C() : i(42) {} 109 int i; 110 }; 111 </pre></td></tr> 112 113 114 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('accessSpecDecl0')"><a name="accessSpecDecl0Anchor">accessSpecDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AccessSpecDecl.html">AccessSpecDecl</a>>...</td></tr> 115 <tr><td colspan="4" class="doc" id="accessSpecDecl0"><pre>Matches C++ access specifier declarations. 116 117 Given 118 class C { 119 public: 120 int a; 121 }; 122 accessSpecDecl() 123 matches 'public:' 124 </pre></td></tr> 125 126 127 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('classTemplateDecl0')"><a name="classTemplateDecl0Anchor">classTemplateDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateDecl.html">ClassTemplateDecl</a>>...</td></tr> 128 <tr><td colspan="4" class="doc" id="classTemplateDecl0"><pre>Matches C++ class template declarations. 129 130 Example matches Z 131 template<class T> class Z {}; 132 </pre></td></tr> 133 134 135 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('classTemplateSpecializationDecl0')"><a name="classTemplateSpecializationDecl0Anchor">classTemplateSpecializationDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>>...</td></tr> 136 <tr><td colspan="4" class="doc" id="classTemplateSpecializationDecl0"><pre>Matches C++ class template specializations. 137 138 Given 139 template<typename T> class A {}; 140 template<> class A<double> {}; 141 A<int> a; 142 classTemplateSpecializationDecl() 143 matches the specializations A<int> and A<double> 144 </pre></td></tr> 145 146 147 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('constructorDecl0')"><a name="constructorDecl0Anchor">constructorDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>>...</td></tr> 148 <tr><td colspan="4" class="doc" id="constructorDecl0"><pre>Matches C++ constructor declarations. 149 150 Example matches Foo::Foo() and Foo::Foo(int) 151 class Foo { 152 public: 153 Foo(); 154 Foo(int); 155 int DoSomething(); 156 }; 157 </pre></td></tr> 158 159 160 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('decl0')"><a name="decl0Anchor">decl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>...</td></tr> 161 <tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations. 162 163 Examples matches X, C, and the friend declaration inside C; 164 void X(); 165 class C { 166 friend X; 167 }; 168 </pre></td></tr> 169 170 171 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('declaratorDecl0')"><a name="declaratorDecl0Anchor">declaratorDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>>...</td></tr> 172 <tr><td colspan="4" class="doc" id="declaratorDecl0"><pre>Matches declarator declarations (field, variable, function 173 and non-type template parameter declarations). 174 175 Given 176 class X { int y; }; 177 declaratorDecl() 178 matches int y. 179 </pre></td></tr> 180 181 182 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('destructorDecl0')"><a name="destructorDecl0Anchor">destructorDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDestructorDecl.html">CXXDestructorDecl</a>>...</td></tr> 183 <tr><td colspan="4" class="doc" id="destructorDecl0"><pre>Matches explicit C++ destructor declarations. 184 185 Example matches Foo::~Foo() 186 class Foo { 187 public: 188 virtual ~Foo(); 189 }; 190 </pre></td></tr> 191 192 193 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('enumConstantDecl0')"><a name="enumConstantDecl0Anchor">enumConstantDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumConstantDecl.html">EnumConstantDecl</a>>...</td></tr> 194 <tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants. 195 196 Example matches A, B, C 197 enum X { 198 A, B, C 199 }; 200 </pre></td></tr> 201 202 203 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('enumDecl0')"><a name="enumDecl0Anchor">enumDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumDecl.html">EnumDecl</a>>...</td></tr> 204 <tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations. 205 206 Example matches X 207 enum X { 208 A, B, C 209 }; 210 </pre></td></tr> 211 212 213 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('fieldDecl0')"><a name="fieldDecl0Anchor">fieldDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>>...</td></tr> 214 <tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations. 215 216 Given 217 class X { int m; }; 218 fieldDecl() 219 matches 'm'. 220 </pre></td></tr> 221 222 223 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('friendDecl0')"><a name="friendDecl0Anchor">friendDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FriendDecl.html">FriendDecl</a>>...</td></tr> 224 <tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations. 225 226 Given 227 class X { friend void foo(); }; 228 friendDecl() 229 matches 'friend void foo()'. 230 </pre></td></tr> 231 232 233 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('functionDecl0')"><a name="functionDecl0Anchor">functionDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>>...</td></tr> 234 <tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations. 235 236 Example matches f 237 void f(); 238 </pre></td></tr> 239 240 241 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('functionTemplateDecl0')"><a name="functionTemplateDecl0Anchor">functionTemplateDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionTemplateDecl.html">FunctionTemplateDecl</a>>...</td></tr> 242 <tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations. 243 244 Example matches f 245 template<class T> void f(T t) {} 246 </pre></td></tr> 247 248 249 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('linkageSpecDecl0')"><a name="linkageSpecDecl0Anchor">linkageSpecDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LinkageSpecDecl.html">LinkageSpecDecl</a>>...</td></tr> 250 <tr><td colspan="4" class="doc" id="linkageSpecDecl0"><pre>Matches a declaration of a linkage specification. 251 252 Given 253 extern "C" {} 254 linkageSpecDecl() 255 matches "extern "C" {}" 256 </pre></td></tr> 257 258 259 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('methodDecl0')"><a name="methodDecl0Anchor">methodDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>>...</td></tr> 260 <tr><td colspan="4" class="doc" id="methodDecl0"><pre>Matches method declarations. 261 262 Example matches y 263 class X { void y(); }; 264 </pre></td></tr> 265 266 267 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('namedDecl0')"><a name="namedDecl0Anchor">namedDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>>...</td></tr> 268 <tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name. 269 270 Example matches X, S, the anonymous union type, i, and U; 271 typedef int X; 272 struct S { 273 union { 274 int i; 275 } U; 276 }; 277 </pre></td></tr> 278 279 280 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('namespaceDecl0')"><a name="namespaceDecl0Anchor">namespaceDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>>...</td></tr> 281 <tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace. 282 283 Given 284 namespace {} 285 namespace test {} 286 namespaceDecl() 287 matches "namespace {}" and "namespace test {}" 288 </pre></td></tr> 289 290 291 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('parmVarDecl0')"><a name="parmVarDecl0Anchor">parmVarDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>>...</td></tr> 292 <tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations. 293 294 Given 295 void f(int x); 296 parmVarDecl() 297 matches int x. 298 </pre></td></tr> 299 300 301 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('recordDecl0')"><a name="recordDecl0Anchor">recordDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>>...</td></tr> 302 <tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches C++ class declarations. 303 304 Example matches X, Z 305 class X; 306 template<class T> class Z {}; 307 </pre></td></tr> 308 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 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> 324 <tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef declarations. 325 326 Given 327 typedef int X; 328 typedefDecl() 329 matches "typedef int X" 330 </pre></td></tr> 331 332 333 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('unresolvedUsingValueDecl0')"><a name="unresolvedUsingValueDecl0Anchor">unresolvedUsingValueDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingValueDecl.html">UnresolvedUsingValueDecl</a>>...</td></tr> 334 <tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations. 335 336 Given 337 template<typename X> 338 class C : private X { 339 using X::x; 340 }; 341 unresolvedUsingValueDecl() 342 matches using X::x </pre></td></tr> 343 344 345 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('usingDecl0')"><a name="usingDecl0Anchor">usingDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingDecl.html">UsingDecl</a>>...</td></tr> 346 <tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations. 347 348 Given 349 namespace X { int x; } 350 using X::x; 351 usingDecl() 352 matches using X::x </pre></td></tr> 353 354 355 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('usingDirectiveDecl0')"><a name="usingDirectiveDecl0Anchor">usingDirectiveDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingDirectiveDecl.html">UsingDirectiveDecl</a>>...</td></tr> 356 <tr><td colspan="4" class="doc" id="usingDirectiveDecl0"><pre>Matches using namespace declarations. 357 358 Given 359 namespace X { int x; } 360 using namespace X; 361 usingDirectiveDecl() 362 matches using namespace X </pre></td></tr> 363 364 365 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('valueDecl0')"><a name="valueDecl0Anchor">valueDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>>...</td></tr> 366 <tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value declaration. 367 368 Example matches A, B, C and F 369 enum X { A, B, C }; 370 void F(); 371 </pre></td></tr> 372 373 374 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('varDecl0')"><a name="varDecl0Anchor">varDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>>...</td></tr> 375 <tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations. 376 377 Note: this does not match declarations of member variables, which are 378 "field" declarations in Clang parlance. 379 380 Example matches a 381 int a; 382 </pre></td></tr> 383 384 385 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>></td><td class="name" onclick="toggle('nestedNameSpecifierLoc0')"><a name="nestedNameSpecifierLoc0Anchor">nestedNameSpecifierLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>>...</td></tr> 386 <tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc. 387 </pre></td></tr> 388 389 390 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>></td><td class="name" onclick="toggle('nestedNameSpecifier0')"><a name="nestedNameSpecifier0Anchor">nestedNameSpecifier</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>>...</td></tr> 391 <tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers. 392 393 Given 394 namespace ns { 395 struct A { static void f(); }; 396 void A::f() {} 397 void g() { A::f(); } 398 } 399 ns::A a; 400 nestedNameSpecifier() 401 matches "ns::" and both "A::" 402 </pre></td></tr> 403 404 405 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('qualType0')"><a name="qualType0Anchor">qualType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>...</td></tr> 406 <tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST. 407 </pre></td></tr> 408 409 410 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('CUDAKernelCallExpr0')"><a name="CUDAKernelCallExpr0Anchor">CUDAKernelCallExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CUDAKernelCallExpr.html">CUDAKernelCallExpr</a>>...</td></tr> 411 <tr><td colspan="4" class="doc" id="CUDAKernelCallExpr0"><pre>Matches CUDA kernel call expression. 412 413 Example matches, 414 kernel<<<i,j>>>(); 415 </pre></td></tr> 416 417 418 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('arraySubscriptExpr0')"><a name="arraySubscriptExpr0Anchor">arraySubscriptExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>>...</td></tr> 419 <tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions. 420 421 Given 422 int i = a[1]; 423 arraySubscriptExpr() 424 matches "a[1]" 425 </pre></td></tr> 426 427 428 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('asmStmt0')"><a name="asmStmt0Anchor">asmStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AsmStmt.html">AsmStmt</a>>...</td></tr> 429 <tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements. 430 431 int i = 100; 432 __asm("mov al, 2"); 433 asmStmt() 434 matches '__asm("mov al, 2")' 435 </pre></td></tr> 436 437 438 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('binaryOperator0')"><a name="binaryOperator0Anchor">binaryOperator</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>>...</td></tr> 439 <tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions. 440 441 Example matches a || b 442 !(a || b) 443 </pre></td></tr> 444 445 446 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('bindTemporaryExpr0')"><a name="bindTemporaryExpr0Anchor">bindTemporaryExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBindTemporaryExpr.html">CXXBindTemporaryExpr</a>>...</td></tr> 447 <tr><td colspan="4" class="doc" id="bindTemporaryExpr0"><pre>Matches nodes where temporaries are created. 448 449 Example matches FunctionTakesString(GetStringByValue()) 450 (matcher = bindTemporaryExpr()) 451 FunctionTakesString(GetStringByValue()); 452 FunctionTakesStringByPointer(GetStringPointer()); 453 </pre></td></tr> 454 455 456 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('boolLiteral0')"><a name="boolLiteral0Anchor">boolLiteral</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>>...</td></tr> 457 <tr><td colspan="4" class="doc" id="boolLiteral0"><pre>Matches bool literals. 458 459 Example matches true 460 true 461 </pre></td></tr> 462 463 464 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('breakStmt0')"><a name="breakStmt0Anchor">breakStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BreakStmt.html">BreakStmt</a>>...</td></tr> 465 <tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements. 466 467 Given 468 while (true) { break; } 469 breakStmt() 470 matches 'break' 471 </pre></td></tr> 472 473 474 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('cStyleCastExpr0')"><a name="cStyleCastExpr0Anchor">cStyleCastExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CStyleCastExpr.html">CStyleCastExpr</a>>...</td></tr> 475 <tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression. 476 477 Example: Matches (int*) 2.2f in 478 int i = (int) 2.2f; 479 </pre></td></tr> 480 481 482 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('callExpr0')"><a name="callExpr0Anchor">callExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>...</td></tr> 483 <tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions. 484 485 Example matches x.y() and y() 486 X x; 487 x.y(); 488 y(); 489 </pre></td></tr> 490 491 492 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('caseStmt0')"><a name="caseStmt0Anchor">caseStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CaseStmt.html">CaseStmt</a>>...</td></tr> 493 <tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements. 494 495 Given 496 switch(a) { case 42: break; default: break; } 497 caseStmt() 498 matches 'case 42: break;'. 499 </pre></td></tr> 500 501 502 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('castExpr0')"><a name="castExpr0Anchor">castExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html">CastExpr</a>>...</td></tr> 503 <tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST. 504 505 Example: castExpr() matches each of the following: 506 (int) 3; 507 const_cast<Expr *>(SubExpr); 508 char c = 0; 509 but does not match 510 int i = (0); 511 int k = 0; 512 </pre></td></tr> 513 514 515 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('catchStmt0')"><a name="catchStmt0Anchor">catchStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCatchStmt.html">CXXCatchStmt</a>>...</td></tr> 516 <tr><td colspan="4" class="doc" id="catchStmt0"><pre>Matches catch statements. 517 518 try {} catch(int i) {} 519 catchStmt() 520 matches 'catch(int i)' 521 </pre></td></tr> 522 523 524 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('characterLiteral0')"><a name="characterLiteral0Anchor">characterLiteral</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>>...</td></tr> 525 <tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t). 526 527 Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral), 528 though. 529 530 Example matches 'a', L'a' 531 char ch = 'a'; wchar_t chw = L'a'; 532 </pre></td></tr> 533 534 535 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('compoundLiteralExpr0')"><a name="compoundLiteralExpr0Anchor">compoundLiteralExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>>...</td></tr> 536 <tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals 537 538 Example match: {1}, (1, 2) 539 int array[4] = {1}; vector int myvec = (vector int)(1, 2); 540 </pre></td></tr> 541 542 543 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('compoundStmt0')"><a name="compoundStmt0Anchor">compoundStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CompoundStmt.html">CompoundStmt</a>>...</td></tr> 544 <tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements. 545 546 Example matches '{}' and '{{}}'in 'for (;;) {{}}' 547 for (;;) {{}} 548 </pre></td></tr> 549 550 551 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('conditionalOperator0')"><a name="conditionalOperator0Anchor">conditionalOperator</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>>...</td></tr> 552 <tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions. 553 554 Example matches a ? b : c 555 (a ? b : c) + 42 556 </pre></td></tr> 557 558 559 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('constCastExpr0')"><a name="constCastExpr0Anchor">constCastExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstCastExpr.html">CXXConstCastExpr</a>>...</td></tr> 560 <tr><td colspan="4" class="doc" id="constCastExpr0"><pre>Matches a const_cast expression. 561 562 Example: Matches const_cast<int*>(&r) in 563 int n = 42; 564 const int &r(n); 565 int* p = const_cast<int*>(&r); 566 </pre></td></tr> 567 568 569 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('constructExpr0')"><a name="constructExpr0Anchor">constructExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>...</td></tr> 570 <tr><td colspan="4" class="doc" id="constructExpr0"><pre>Matches constructor call expressions (including implicit ones). 571 572 Example matches string(ptr, n) and ptr within arguments of f 573 (matcher = constructExpr()) 574 void f(const string &a, const string &b); 575 char *ptr; 576 int n; 577 f(string(ptr, n), ptr); 578 </pre></td></tr> 579 580 581 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('continueStmt0')"><a name="continueStmt0Anchor">continueStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ContinueStmt.html">ContinueStmt</a>>...</td></tr> 582 <tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements. 583 584 Given 585 while (true) { continue; } 586 continueStmt() 587 matches 'continue' 588 </pre></td></tr> 589 590 591 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('declRefExpr0')"><a name="declRefExpr0Anchor">declRefExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>...</td></tr> 592 <tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations. 593 594 Example matches x in if (x) 595 bool x; 596 if (x) {} 597 </pre></td></tr> 598 599 600 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('declStmt0')"><a name="declStmt0Anchor">declStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>>...</td></tr> 601 <tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements. 602 603 Given 604 int a; 605 declStmt() 606 matches 'int a'. 607 </pre></td></tr> 608 609 610 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('defaultArgExpr0')"><a name="defaultArgExpr0Anchor">defaultArgExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDefaultArgExpr.html">CXXDefaultArgExpr</a>>...</td></tr> 611 <tr><td colspan="4" class="doc" id="defaultArgExpr0"><pre>Matches the value of a default argument at the call site. 612 613 Example matches the CXXDefaultArgExpr placeholder inserted for the 614 default value of the second parameter in the call expression f(42) 615 (matcher = defaultArgExpr()) 616 void f(int x, int y = 0); 617 f(42); 618 </pre></td></tr> 619 620 621 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('defaultStmt0')"><a name="defaultStmt0Anchor">defaultStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DefaultStmt.html">DefaultStmt</a>>...</td></tr> 622 <tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements. 623 624 Given 625 switch(a) { case 42: break; default: break; } 626 defaultStmt() 627 matches 'default: break;'. 628 </pre></td></tr> 629 630 631 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('deleteExpr0')"><a name="deleteExpr0Anchor">deleteExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDeleteExpr.html">CXXDeleteExpr</a>>...</td></tr> 632 <tr><td colspan="4" class="doc" id="deleteExpr0"><pre>Matches delete expressions. 633 634 Given 635 delete X; 636 deleteExpr() 637 matches 'delete X'. 638 </pre></td></tr> 639 640 641 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('doStmt0')"><a name="doStmt0Anchor">doStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DoStmt.html">DoStmt</a>>...</td></tr> 642 <tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements. 643 644 Given 645 do {} while (true); 646 doStmt() 647 matches 'do {} while(true)' 648 </pre></td></tr> 649 650 651 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('dynamicCastExpr0')"><a name="dynamicCastExpr0Anchor">dynamicCastExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDynamicCastExpr.html">CXXDynamicCastExpr</a>>...</td></tr> 652 <tr><td colspan="4" class="doc" id="dynamicCastExpr0"><pre>Matches a dynamic_cast expression. 653 654 Example: 655 dynamicCastExpr() 656 matches 657 dynamic_cast<D*>(&b); 658 in 659 struct B { virtual ~B() {} }; struct D : B {}; 660 B b; 661 D* p = dynamic_cast<D*>(&b); 662 </pre></td></tr> 663 664 665 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('explicitCastExpr0')"><a name="explicitCastExpr0Anchor">explicitCastExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>>...</td></tr> 666 <tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions. 667 668 Matches any cast expression written in user code, whether it be a 669 C-style cast, a functional-style cast, or a keyword cast. 670 671 Does not match implicit conversions. 672 673 Note: the name "explicitCast" is chosen to match Clang's terminology, as 674 Clang uses the term "cast" to apply to implicit conversions as well as to 675 actual cast expressions. 676 677 hasDestinationType. 678 679 Example: matches all five of the casts in 680 int((int)(reinterpret_cast<int>(static_cast<int>(const_cast<int>(42))))) 681 but does not match the implicit conversion in 682 long ell = 42; 683 </pre></td></tr> 684 685 686 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('expr0')"><a name="expr0Anchor">expr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>>...</td></tr> 687 <tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions. 688 689 Example matches x() 690 void f() { x(); } 691 </pre></td></tr> 692 693 694 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('exprWithCleanups0')"><a name="exprWithCleanups0Anchor">exprWithCleanups</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ExprWithCleanups.html">ExprWithCleanups</a>>...</td></tr> 695 <tr><td colspan="4" class="doc" id="exprWithCleanups0"><pre>Matches expressions that introduce cleanups to be run at the end 696 of the sub-expression's evaluation. 697 698 Example matches std::string() 699 const std::string str = std::string(); 700 </pre></td></tr> 701 702 703 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('floatLiteral0')"><a name="floatLiteral0Anchor">floatLiteral</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>>...</td></tr> 704 <tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes encodings, e.g. 705 1.0, 1.0f, 1.0L and 1e10. 706 707 Does not match implicit conversions such as 708 float a = 10; 709 </pre></td></tr> 710 711 712 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('forRangeStmt0')"><a name="forRangeStmt0Anchor">forRangeStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>>...</td></tr> 713 <tr><td colspan="4" class="doc" id="forRangeStmt0"><pre>Matches range-based for statements. 714 715 forRangeStmt() matches 'for (auto a : i)' 716 int i[] = {1, 2, 3}; for (auto a : i); 717 for(int j = 0; j < 5; ++j); 718 </pre></td></tr> 719 720 721 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('forStmt0')"><a name="forStmt0Anchor">forStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>>...</td></tr> 722 <tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements. 723 724 Example matches 'for (;;) {}' 725 for (;;) {} 726 int i[] = {1, 2, 3}; for (auto a : i); 727 </pre></td></tr> 728 729 730 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('functionalCastExpr0')"><a name="functionalCastExpr0Anchor">functionalCastExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>>...</td></tr> 731 <tr><td colspan="4" class="doc" id="functionalCastExpr0"><pre>Matches functional cast expressions 732 733 Example: Matches Foo(bar); 734 Foo f = bar; 735 Foo g = (Foo) bar; 736 Foo h = Foo(bar); 737 </pre></td></tr> 738 739 740 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('gotoStmt0')"><a name="gotoStmt0Anchor">gotoStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1GotoStmt.html">GotoStmt</a>>...</td></tr> 741 <tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements. 742 743 Given 744 goto FOO; 745 FOO: bar(); 746 gotoStmt() 747 matches 'goto FOO' 748 </pre></td></tr> 749 750 751 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('ifStmt0')"><a name="ifStmt0Anchor">ifStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>>...</td></tr> 752 <tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements. 753 754 Example matches 'if (x) {}' 755 if (x) {} 756 </pre></td></tr> 757 758 759 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('implicitCastExpr0')"><a name="implicitCastExpr0Anchor">implicitCastExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ImplicitCastExpr.html">ImplicitCastExpr</a>>...</td></tr> 760 <tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST. 761 762 This matches many different places, including function call return value 763 eliding, as well as any type conversions. 764 </pre></td></tr> 765 766 767 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('initListExpr0')"><a name="initListExpr0Anchor">initListExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InitListExpr.html">InitListExpr</a>>...</td></tr> 768 <tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions. 769 770 Given 771 int a[] = { 1, 2 }; 772 struct B { int x, y; }; 773 B b = { 5, 6 }; 774 initListExpr() 775 matches "{ 1, 2 }" and "{ 5, 6 }" 776 </pre></td></tr> 777 778 779 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('integerLiteral0')"><a name="integerLiteral0Anchor">integerLiteral</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>>...</td></tr> 780 <tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes encodings, e.g. 781 1, 1L, 0x1 and 1U. 782 783 Does not match character-encoded integers such as L'a'. 784 </pre></td></tr> 785 786 787 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('labelStmt0')"><a name="labelStmt0Anchor">labelStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>...</td></tr> 788 <tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements. 789 790 Given 791 goto FOO; 792 FOO: bar(); 793 labelStmt() 794 matches 'FOO:' 795 </pre></td></tr> 796 797 798 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('lambdaExpr0')"><a name="lambdaExpr0Anchor">lambdaExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LambdaExpr.html">LambdaExpr</a>>...</td></tr> 799 <tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions. 800 801 Example matches [&](){return 5;} 802 [&](){return 5;} 803 </pre></td></tr> 804 805 806 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('materializeTemporaryExpr0')"><a name="materializeTemporaryExpr0Anchor">materializeTemporaryExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MaterializeTemporaryExpr.html">MaterializeTemporaryExpr</a>>...</td></tr> 807 <tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized. 808 809 Example: Given 810 struct T {void func()}; 811 T f(); 812 void g(T); 813 materializeTemporaryExpr() matches 'f()' in these statements 814 T u(f()); 815 g(f()); 816 but does not match 817 f(); 818 f().func(); 819 </pre></td></tr> 820 821 822 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('memberCallExpr0')"><a name="memberCallExpr0Anchor">memberCallExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>>...</td></tr> 823 <tr><td colspan="4" class="doc" id="memberCallExpr0"><pre>Matches member call expressions. 824 825 Example matches x.y() 826 X x; 827 x.y(); 828 </pre></td></tr> 829 830 831 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('memberExpr0')"><a name="memberExpr0Anchor">memberExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>...</td></tr> 832 <tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions. 833 834 Given 835 class Y { 836 void x() { this->x(); x(); Y y; y.x(); a; this->b; Y::b; } 837 int a; static int b; 838 }; 839 memberExpr() 840 matches this->x, x, y.x, a, this->b 841 </pre></td></tr> 842 843 844 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('newExpr0')"><a name="newExpr0Anchor">newExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>...</td></tr> 845 <tr><td colspan="4" class="doc" id="newExpr0"><pre>Matches new expressions. 846 847 Given 848 new X; 849 newExpr() 850 matches 'new X'. 851 </pre></td></tr> 852 853 854 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('nullPtrLiteralExpr0')"><a name="nullPtrLiteralExpr0Anchor">nullPtrLiteralExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNullPtrLiteralExpr.html">CXXNullPtrLiteralExpr</a>>...</td></tr> 855 <tr><td colspan="4" class="doc" id="nullPtrLiteralExpr0"><pre>Matches nullptr literal. 856 </pre></td></tr> 857 858 859 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('nullStmt0')"><a name="nullStmt0Anchor">nullStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NullStmt.html">NullStmt</a>>...</td></tr> 860 <tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements. 861 862 foo();; 863 nullStmt() 864 matches the second ';' 865 </pre></td></tr> 866 867 868 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('operatorCallExpr0')"><a name="operatorCallExpr0Anchor">operatorCallExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>>...</td></tr> 869 <tr><td colspan="4" class="doc" id="operatorCallExpr0"><pre>Matches overloaded operator calls. 870 871 Note that if an operator isn't overloaded, it won't match. Instead, use 872 binaryOperator matcher. 873 Currently it does not match operators such as new delete. 874 FIXME: figure out why these do not match? 875 876 Example matches both operator<<((o << b), c) and operator<<(o, b) 877 (matcher = operatorCallExpr()) 878 ostream &operator<< (ostream &out, int i) { }; 879 ostream &o; int b = 1, c = 1; 880 o << b << c; 881 </pre></td></tr> 882 883 884 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('reinterpretCastExpr0')"><a name="reinterpretCastExpr0Anchor">reinterpretCastExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXReinterpretCastExpr.html">CXXReinterpretCastExpr</a>>...</td></tr> 885 <tr><td colspan="4" class="doc" id="reinterpretCastExpr0"><pre>Matches a reinterpret_cast expression. 886 887 Either the source expression or the destination type can be matched 888 using has(), but hasDestinationType() is more specific and can be 889 more readable. 890 891 Example matches reinterpret_cast<char*>(&p) in 892 void* p = reinterpret_cast<char*>(&p); 893 </pre></td></tr> 894 895 896 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('returnStmt0')"><a name="returnStmt0Anchor">returnStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReturnStmt.html">ReturnStmt</a>>...</td></tr> 897 <tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements. 898 899 Given 900 return 1; 901 returnStmt() 902 matches 'return 1' 903 </pre></td></tr> 904 905 906 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('staticCastExpr0')"><a name="staticCastExpr0Anchor">staticCastExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXStaticCastExpr.html">CXXStaticCastExpr</a>>...</td></tr> 907 <tr><td colspan="4" class="doc" id="staticCastExpr0"><pre>Matches a C++ static_cast expression. 908 909 hasDestinationType 910 reinterpretCast 911 912 Example: 913 staticCastExpr() 914 matches 915 static_cast<long>(8) 916 in 917 long eight(static_cast<long>(8)); 918 </pre></td></tr> 919 920 921 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('stmt0')"><a name="stmt0Anchor">stmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>...</td></tr> 922 <tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements. 923 924 Given 925 { ++a; } 926 stmt() 927 matches both the compound statement '{ ++a; }' and '++a'. 928 </pre></td></tr> 929 930 931 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('stringLiteral0')"><a name="stringLiteral0Anchor">stringLiteral</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1StringLiteral.html">StringLiteral</a>>...</td></tr> 932 <tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals). 933 934 Example matches "abcd", L"abcd" 935 char *s = "abcd"; wchar_t *ws = L"abcd" 936 </pre></td></tr> 937 938 939 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('substNonTypeTemplateParmExpr0')"><a name="substNonTypeTemplateParmExpr0Anchor">substNonTypeTemplateParmExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1SubstNonTypeTemplateParmExpr.html">SubstNonTypeTemplateParmExpr</a>>...</td></tr> 940 <tr><td colspan="4" class="doc" id="substNonTypeTemplateParmExpr0"><pre>Matches substitutions of non-type template parameters. 941 942 Given 943 template <int N> 944 struct A { static const int n = N; }; 945 struct B : public A<42> {}; 946 substNonTypeTemplateParmExpr() 947 matches "N" in the right-hand side of "static const int n = N;" 948 </pre></td></tr> 949 950 951 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('switchCase0')"><a name="switchCase0Anchor">switchCase</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1SwitchCase.html">SwitchCase</a>>...</td></tr> 952 <tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements. 953 954 Given 955 switch(a) { case 42: break; default: break; } 956 switchCase() 957 matches 'case 42: break;' and 'default: break;'. 958 </pre></td></tr> 959 960 961 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('switchStmt0')"><a name="switchStmt0Anchor">switchStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1SwitchStmt.html">SwitchStmt</a>>...</td></tr> 962 <tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements. 963 964 Given 965 switch(a) { case 42: break; default: break; } 966 switchStmt() 967 matches 'switch(a)'. 968 </pre></td></tr> 969 970 971 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('temporaryObjectExpr0')"><a name="temporaryObjectExpr0Anchor">temporaryObjectExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>>...</td></tr> 972 <tr><td colspan="4" class="doc" id="temporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments 973 974 Example: Matches Foo(bar, bar) 975 Foo h = Foo(bar, bar); 976 </pre></td></tr> 977 978 979 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('thisExpr0')"><a name="thisExpr0Anchor">thisExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXThisExpr.html">CXXThisExpr</a>>...</td></tr> 980 <tr><td colspan="4" class="doc" id="thisExpr0"><pre>Matches implicit and explicit this expressions. 981 982 Example matches the implicit this expression in "return i". 983 (matcher = thisExpr()) 984 struct foo { 985 int i; 986 int f() { return i; } 987 }; 988 </pre></td></tr> 989 990 991 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('throwExpr0')"><a name="throwExpr0Anchor">throwExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXThrowExpr.html">CXXThrowExpr</a>>...</td></tr> 992 <tr><td colspan="4" class="doc" id="throwExpr0"><pre>Matches throw expressions. 993 994 try { throw 5; } catch(int i) {} 995 throwExpr() 996 matches 'throw 5' 997 </pre></td></tr> 998 999 1000 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('tryStmt0')"><a name="tryStmt0Anchor">tryStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXTryStmt.html">CXXTryStmt</a>>...</td></tr> 1001 <tr><td colspan="4" class="doc" id="tryStmt0"><pre>Matches try statements. 1002 1003 try {} catch(int i) {} 1004 tryStmt() 1005 matches 'try {}' 1006 </pre></td></tr> 1007 1008 1009 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('unaryExprOrTypeTraitExpr0')"><a name="unaryExprOrTypeTraitExpr0Anchor">unaryExprOrTypeTraitExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>>...</td></tr> 1010 <tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL) 1011 1012 Given 1013 Foo x = bar; 1014 int y = sizeof(x) + alignof(x); 1015 unaryExprOrTypeTraitExpr() 1016 matches sizeof(x) and alignof(x) 1017 </pre></td></tr> 1018 1019 1020 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('unaryOperator0')"><a name="unaryOperator0Anchor">unaryOperator</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>>...</td></tr> 1021 <tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions. 1022 1023 Example matches !a 1024 !a || b 1025 </pre></td></tr> 1026 1027 1028 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('unresolvedConstructExpr0')"><a name="unresolvedConstructExpr0Anchor">unresolvedConstructExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>>...</td></tr> 1029 <tr><td colspan="4" class="doc" id="unresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions. 1030 1031 Example matches T(t) in return statement of f 1032 (matcher = unresolvedConstructExpr()) 1033 template <typename T> 1034 void f(const T& t) { return T(t); } 1035 </pre></td></tr> 1036 1037 1038 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('userDefinedLiteral0')"><a name="userDefinedLiteral0Anchor">userDefinedLiteral</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UserDefinedLiteral.html">UserDefinedLiteral</a>>...</td></tr> 1039 <tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call. 1040 1041 Example match: "foo"_suffix 1042 </pre></td></tr> 1043 1044 1045 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('whileStmt0')"><a name="whileStmt0Anchor">whileStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1WhileStmt.html">WhileStmt</a>>...</td></tr> 1046 <tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements. 1047 1048 Given 1049 while (true) {} 1050 whileStmt() 1051 matches 'while (true) {}'. 1052 </pre></td></tr> 1053 1054 1055 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>></td><td class="name" onclick="toggle('templateArgument0')"><a name="templateArgument0Anchor">templateArgument</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>>...</td></tr> 1056 <tr><td colspan="4" class="doc" id="templateArgument0"><pre>Matches template arguments. 1057 1058 Given 1059 template <typename T> struct C {}; 1060 C<int> c; 1061 templateArgument() 1062 matches 'int' in C<int>. 1063 </pre></td></tr> 1064 1065 1066 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td><td class="name" onclick="toggle('typeLoc0')"><a name="typeLoc0Anchor">typeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>>...</td></tr> 1067 <tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST. 1068 </pre></td></tr> 1069 1070 1071 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('arrayType0')"><a name="arrayType0Anchor">arrayType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>>...</td></tr> 1072 <tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays. 1073 1074 Given 1075 int a[] = { 2, 3 }; 1076 int b[4]; 1077 void f() { int c[a[0]]; } 1078 arrayType() 1079 matches "int a[]", "int b[4]" and "int c[a[0]]"; 1080 </pre></td></tr> 1081 1082 1083 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('atomicType0')"><a name="atomicType0Anchor">atomicType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>>...</td></tr> 1084 <tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types. 1085 1086 Given 1087 _Atomic(int) i; 1088 atomicType() 1089 matches "_Atomic(int) i" 1090 </pre></td></tr> 1091 1092 1093 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('autoType0')"><a name="autoType0Anchor">autoType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>>...</td></tr> 1094 <tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types. 1095 1096 Given: 1097 auto n = 4; 1098 int v[] = { 2, 3 } 1099 for (auto i : v) { } 1100 autoType() 1101 matches "auto n" and "auto i" 1102 </pre></td></tr> 1103 1104 1105 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('blockPointerType0')"><a name="blockPointerType0Anchor">blockPointerType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>>...</td></tr> 1106 <tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as 1107 "void (^)(int)". 1108 1109 The pointee is always required to be a FunctionType. 1110 </pre></td></tr> 1111 1112 1113 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('builtinType0')"><a name="builtinType0Anchor">builtinType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BuiltinType.html">BuiltinType</a>>...</td></tr> 1114 <tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types. 1115 1116 Given 1117 struct A {}; 1118 A a; 1119 int b; 1120 float c; 1121 bool d; 1122 builtinType() 1123 matches "int b", "float c" and "bool d" 1124 </pre></td></tr> 1125 1126 1127 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('complexType0')"><a name="complexType0Anchor">complexType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>>...</td></tr> 1128 <tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types. 1129 1130 Given 1131 _Complex float f; 1132 complexType() 1133 matches "_Complex float f" 1134 </pre></td></tr> 1135 1136 1137 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('constantArrayType0')"><a name="constantArrayType0Anchor">constantArrayType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ConstantArrayType.html">ConstantArrayType</a>>...</td></tr> 1138 <tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size. 1139 1140 Given 1141 void() { 1142 int a[2]; 1143 int b[] = { 2, 3 }; 1144 int c[b[0]]; 1145 } 1146 constantArrayType() 1147 matches "int a[2]" 1148 </pre></td></tr> 1149 1150 1151 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('dependentSizedArrayType0')"><a name="dependentSizedArrayType0Anchor">dependentSizedArrayType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DependentSizedArrayType.html">DependentSizedArrayType</a>>...</td></tr> 1152 <tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression. 1153 1154 Given 1155 template<typename T, int Size> 1156 class array { 1157 T data[Size]; 1158 }; 1159 dependentSizedArrayType 1160 matches "T data[Size]" 1161 </pre></td></tr> 1162 1163 1164 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('elaboratedType0')"><a name="elaboratedType0Anchor">elaboratedType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ElaboratedType.html">ElaboratedType</a>>...</td></tr> 1165 <tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a 1166 qualified name. 1167 1168 Given 1169 namespace N { 1170 namespace M { 1171 class D {}; 1172 } 1173 } 1174 class C {}; 1175 1176 class C c; 1177 N::M::D d; 1178 1179 elaboratedType() matches the type of the variable declarations of both 1180 c and d. 1181 </pre></td></tr> 1182 1183 1184 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('functionType0')"><a name="functionType0Anchor">functionType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionType.html">FunctionType</a>>...</td></tr> 1185 <tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes. 1186 1187 Given 1188 int (*f)(int); 1189 void g(); 1190 functionType() 1191 matches "int (*f)(int)" and the type of "g". 1192 </pre></td></tr> 1193 1194 1195 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('incompleteArrayType0')"><a name="incompleteArrayType0Anchor">incompleteArrayType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IncompleteArrayType.html">IncompleteArrayType</a>>...</td></tr> 1196 <tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size. 1197 1198 Given 1199 int a[] = { 2, 3 }; 1200 int b[42]; 1201 void f(int c[]) { int d[a[0]]; }; 1202 incompleteArrayType() 1203 matches "int a[]" and "int c[]" 1204 </pre></td></tr> 1205 1206 1207 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('lValueReferenceType0')"><a name="lValueReferenceType0Anchor">lValueReferenceType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LValueReferenceType.html">LValueReferenceType</a>>...</td></tr> 1208 <tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types. 1209 1210 Given: 1211 int *a; 1212 int &b = *a; 1213 int &&c = 1; 1214 auto &d = b; 1215 auto &&e = c; 1216 auto &&f = 2; 1217 int g = 5; 1218 1219 lValueReferenceType() matches the types of b, d, and e. e is 1220 matched since the type is deduced as int& by reference collapsing rules. 1221 </pre></td></tr> 1222 1223 1224 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('memberPointerType0')"><a name="memberPointerType0Anchor">memberPointerType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>>...</td></tr> 1225 <tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types. 1226 Given 1227 struct A { int i; } 1228 A::* ptr = A::i; 1229 memberPointerType() 1230 matches "A::* ptr" 1231 </pre></td></tr> 1232 1233 1234 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('parenType0')"><a name="parenType0Anchor">parenType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>>...</td></tr> 1235 <tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes. 1236 1237 Given 1238 int (*ptr_to_array)[4]; 1239 int *array_of_ptrs[4]; 1240 1241 varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not 1242 array_of_ptrs. 1243 </pre></td></tr> 1244 1245 1246 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('pointerType0')"><a name="pointerType0Anchor">pointerType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>>...</td></tr> 1247 <tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types. 1248 1249 Given 1250 int *a; 1251 int &b = *a; 1252 int c = 5; 1253 pointerType() 1254 matches "int *a" 1255 </pre></td></tr> 1256 1257 1258 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('rValueReferenceType0')"><a name="rValueReferenceType0Anchor">rValueReferenceType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RValueReferenceType.html">RValueReferenceType</a>>...</td></tr> 1259 <tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types. 1260 1261 Given: 1262 int *a; 1263 int &b = *a; 1264 int &&c = 1; 1265 auto &d = b; 1266 auto &&e = c; 1267 auto &&f = 2; 1268 int g = 5; 1269 1270 rValueReferenceType() matches the types of c and f. e is not 1271 matched as it is deduced to int& by reference collapsing rules. 1272 </pre></td></tr> 1273 1274 1275 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('recordType0')"><a name="recordType0Anchor">recordType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>...</td></tr> 1276 <tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes). 1277 1278 Given 1279 class C {}; 1280 struct S {}; 1281 1282 C c; 1283 S s; 1284 1285 recordType() matches the type of the variable declarations of both c 1286 and s. 1287 </pre></td></tr> 1288 1289 1290 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('referenceType0')"><a name="referenceType0Anchor">referenceType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>>...</td></tr> 1291 <tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types. 1292 1293 Given 1294 int *a; 1295 int &b = *a; 1296 int &&c = 1; 1297 auto &d = b; 1298 auto &&e = c; 1299 auto &&f = 2; 1300 int g = 5; 1301 1302 referenceType() matches the types of b, c, d, e, and f. 1303 </pre></td></tr> 1304 1305 1306 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('templateSpecializationType0')"><a name="templateSpecializationType0Anchor">templateSpecializationType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>...</td></tr> 1307 <tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types. 1308 1309 Given 1310 template <typename T> 1311 class C { }; 1312 1313 template class C<int>; A 1314 C<char> var; B 1315 1316 templateSpecializationType() matches the type of the explicit 1317 instantiation in A and the type of the variable declaration in B. 1318 </pre></td></tr> 1319 1320 1321 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('type0')"><a name="type0Anchor">type</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>>...</td></tr> 1322 <tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST. 1323 </pre></td></tr> 1324 1325 1326 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('typedefType0')"><a name="typedefType0Anchor">typedefType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>...</td></tr> 1327 <tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types. 1328 1329 Given 1330 typedef int X; 1331 typedefType() 1332 matches "typedef int X" 1333 </pre></td></tr> 1334 1335 1336 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('unaryTransformType0')"><a name="unaryTransformType0Anchor">unaryTransformType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryTransformType.html">UnaryTransformType</a>>...</td></tr> 1337 <tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations. 1338 1339 Given: 1340 typedef __underlying_type(T) type; 1341 unaryTransformType() 1342 matches "__underlying_type(T)" 1343 </pre></td></tr> 1344 1345 1346 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td><td class="name" onclick="toggle('variableArrayType0')"><a name="variableArrayType0Anchor">variableArrayType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VariableArrayType.html">VariableArrayType</a>>...</td></tr> 1347 <tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an 1348 integer-constant-expression. 1349 1350 Given 1351 void f() { 1352 int a[] = { 2, 3 } 1353 int b[42]; 1354 int c[a[0]]; 1355 } 1356 variableArrayType() 1357 matches "int c[a[0]]" 1358 </pre></td></tr> 1359 1360 <!--END_DECL_MATCHERS --> 1361 </table> 1362 1363 <!-- ======================================================================= --> 1364 <h2 id="narrowing-matchers">Narrowing Matchers</h2> 1365 <!-- ======================================================================= --> 1366 1367 <p>Narrowing matchers match certain attributes on the current node, thus 1368 narrowing down the set of nodes of the current type to match on.</p> 1369 1370 <p>There are special logical narrowing matchers (allOf, anyOf, anything and unless) 1371 which allow users to create more powerful match expressions.</p> 1372 1373 <table> 1374 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr> 1375 <!-- START_NARROWING_MATCHERS --> 1376 1377 <tr><td>Matcher<*></td><td class="name" onclick="toggle('allOf0')"><a name="allOf0Anchor">allOf</a></td><td>Matcher<*>, ..., Matcher<*></td></tr> 1378 <tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match. 1379 1380 Usable as: Any Matcher 1381 </pre></td></tr> 1382 1383 1384 <tr><td>Matcher<*></td><td class="name" onclick="toggle('anyOf0')"><a name="anyOf0Anchor">anyOf</a></td><td>Matcher<*>, ..., Matcher<*></td></tr> 1385 <tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches. 1386 1387 Usable as: Any Matcher 1388 </pre></td></tr> 1389 1390 1391 <tr><td>Matcher<*></td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr> 1392 <tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node. 1393 1394 Useful when another matcher requires a child matcher, but there's no 1395 additional constraint. This will often be used with an explicit conversion 1396 to an internal::Matcher<> type such as TypeMatcher. 1397 1398 Example: DeclarationMatcher(anything()) matches all declarations, e.g., 1399 "int* p" and "void f()" in 1400 int* p; 1401 void f(); 1402 1403 Usable as: Any Matcher 1404 </pre></td></tr> 1405 1406 1407 <tr><td>Matcher<*></td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher<*></td></tr> 1408 <tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match. 1409 1410 Example matches Y (matcher = recordDecl(unless(hasName("X")))) 1411 class X {}; 1412 class Y {}; 1413 1414 Usable as: Any Matcher 1415 </pre></td></tr> 1416 1417 1418 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>></td><td class="name" onclick="toggle('hasOperatorName0')"><a name="hasOperatorName0Anchor">hasOperatorName</a></td><td>std::string Name</td></tr> 1419 <tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions (binary or 1420 unary). 1421 1422 Example matches a || b (matcher = binaryOperator(hasOperatorName("||"))) 1423 !(a || b) 1424 </pre></td></tr> 1425 1426 1427 <tr><td>Matcher<CXXBoolLiteral></td><td class="name" onclick="toggle('equals2')"><a name="equals2Anchor">equals</a></td><td>ValueT Value</td></tr> 1428 <tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value. 1429 1430 Example matches true (matcher = boolLiteral(equals(true))) 1431 true 1432 1433 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>>, Matcher<CXXBoolLiteral>, 1434 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>> 1435 </pre></td></tr> 1436 1437 1438 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>></td><td class="name" onclick="toggle('argumentCountIs1')"><a name="argumentCountIs1Anchor">argumentCountIs</a></td><td>unsigned N</td></tr> 1439 <tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has 1440 a specific number of arguments (including absent default arguments). 1441 1442 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2))) 1443 void f(int x, int y); 1444 f(0, 0); 1445 </pre></td></tr> 1446 1447 1448 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>></td><td class="name" onclick="toggle('isListInitialization0')"><a name="isListInitialization0Anchor">isListInitialization</a></td><td></td></tr> 1449 <tr><td colspan="4" class="doc" id="isListInitialization0"><pre>Matches a constructor call expression which uses list initialization. 1450 </pre></td></tr> 1451 1452 1453 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>></td><td class="name" onclick="toggle('isWritten0')"><a name="isWritten0Anchor">isWritten</a></td><td></td></tr> 1454 <tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in 1455 code (as opposed to implicitly added by the compiler). 1456 1457 Given 1458 struct Foo { 1459 Foo() { } 1460 Foo(int) : foo_("A") { } 1461 string foo_; 1462 }; 1463 constructorDecl(hasAnyConstructorInitializer(isWritten())) 1464 will match Foo(int), but not Foo() 1465 </pre></td></tr> 1466 1467 1468 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>></td><td class="name" onclick="toggle('isConst0')"><a name="isConst0Anchor">isConst</a></td><td></td></tr> 1469 <tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const. 1470 1471 Given 1472 struct A { 1473 void foo() const; 1474 void bar(); 1475 }; 1476 1477 methodDecl(isConst()) matches A::foo() but not A::bar() 1478 </pre></td></tr> 1479 1480 1481 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>></td><td class="name" onclick="toggle('isOverride0')"><a name="isOverride0Anchor">isOverride</a></td><td></td></tr> 1482 <tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method. 1483 1484 Given 1485 class A { 1486 public: 1487 virtual void x(); 1488 }; 1489 class B : public A { 1490 public: 1491 virtual void x(); 1492 }; 1493 matches B::x 1494 </pre></td></tr> 1495 1496 1497 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>></td><td class="name" onclick="toggle('isPure0')"><a name="isPure0Anchor">isPure</a></td><td></td></tr> 1498 <tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure. 1499 1500 Given 1501 class A { 1502 public: 1503 virtual void x() = 0; 1504 }; 1505 matches A::x 1506 </pre></td></tr> 1507 1508 1509 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>></td><td class="name" onclick="toggle('isVirtual0')"><a name="isVirtual0Anchor">isVirtual</a></td><td></td></tr> 1510 <tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches if the given method declaration is virtual. 1511 1512 Given 1513 class A { 1514 public: 1515 virtual void x(); 1516 }; 1517 matches A::x 1518 </pre></td></tr> 1519 1520 1521 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>></td><td class="name" onclick="toggle('hasOverloadedOperatorName1')"><a name="hasOverloadedOperatorName1Anchor">hasOverloadedOperatorName</a></td><td>StringRef Name</td></tr> 1522 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names. 1523 1524 Matches overloaded operator names specified in strings without the 1525 "operator" prefix: e.g. "<<". 1526 1527 Given: 1528 class A { int operator*(); }; 1529 const A &operator<<(const A &a, const A &b); 1530 A a; 1531 a << a; <-- This matches 1532 1533 operatorCallExpr(hasOverloadedOperatorName("<<"))) matches the specified 1534 line and recordDecl(hasMethod(hasOverloadedOperatorName("*"))) matches 1535 the declaration of A. 1536 1537 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>> 1538 </pre></td></tr> 1539 1540 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> 1542 <tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)). 1543 </pre></td></tr> 1544 1545 1546 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>></td><td class="name" onclick="toggle('isExplicitTemplateSpecialization2')"><a name="isExplicitTemplateSpecialization2Anchor">isExplicitTemplateSpecialization</a></td><td></td></tr> 1547 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or 1548 static member variable template instantiations. 1549 1550 Given 1551 template<typename T> void A(T t) { } 1552 template<> void A(int N) { } 1553 functionDecl(isExplicitTemplateSpecialization()) 1554 matches the specialization A<int>(). 1555 1556 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>> 1557 </pre></td></tr> 1558 1559 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> 1561 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Overloaded method as shortcut for 1562 isSameOrDerivedFrom(hasName(...)). 1563 </pre></td></tr> 1564 1565 1566 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>></td><td class="name" onclick="toggle('isTemplateInstantiation2')"><a name="isTemplateInstantiation2Anchor">isTemplateInstantiation</a></td><td></td></tr> 1567 <tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static 1568 member variable template instantiations. 1569 1570 Given 1571 template <typename T> class X {}; class A {}; X<A> x; 1572 or 1573 template <typename T> class X {}; class A {}; template class X<A>; 1574 recordDecl(hasName("::X"), isTemplateInstantiation()) 1575 matches the template instantiation of X<A>. 1576 1577 But given 1578 template <typename T> class X {}; class A {}; 1579 template <> class X<A> {}; X<A> x; 1580 recordDecl(hasName("::X"), isTemplateInstantiation()) 1581 does not match, as X<A> is an explicit template specialization. 1582 1583 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>> 1584 </pre></td></tr> 1585 1586 1587 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>></td><td class="name" onclick="toggle('argumentCountIs0')"><a name="argumentCountIs0Anchor">argumentCountIs</a></td><td>unsigned N</td></tr> 1588 <tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has 1589 a specific number of arguments (including absent default arguments). 1590 1591 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2))) 1592 void f(int x, int y); 1593 f(0, 0); 1594 </pre></td></tr> 1595 1596 1597 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>></td><td class="name" onclick="toggle('equals3')"><a name="equals3Anchor">equals</a></td><td>ValueT Value</td></tr> 1598 <tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value. 1599 1600 Example matches true (matcher = boolLiteral(equals(true))) 1601 true 1602 1603 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>>, Matcher<CXXBoolLiteral>, 1604 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>> 1605 </pre></td></tr> 1606 1607 1608 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>></td><td class="name" onclick="toggle('templateArgumentCountIs0')"><a name="templateArgumentCountIs0Anchor">templateArgumentCountIs</a></td><td>unsigned N</td></tr> 1609 <tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N. 1610 1611 Given 1612 template<typename T> struct C {}; 1613 C<int> c; 1614 classTemplateSpecializationDecl(templateArgumentCountIs(1)) 1615 matches C<int>. 1616 </pre></td></tr> 1617 1618 1619 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CompoundStmt.html">CompoundStmt</a>></td><td class="name" onclick="toggle('statementCountIs0')"><a name="statementCountIs0Anchor">statementCountIs</a></td><td>unsigned N</td></tr> 1620 <tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of 1621 child statements. 1622 1623 Example: Given 1624 { for (;;) {} } 1625 compoundStmt(statementCountIs(0))) 1626 matches '{}' 1627 but does not match the outer compound statement. 1628 </pre></td></tr> 1629 1630 1631 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ConstantArrayType.html">ConstantArrayType</a>></td><td class="name" onclick="toggle('hasSize0')"><a name="hasSize0Anchor">hasSize</a></td><td>unsigned N</td></tr> 1632 <tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches ConstantArrayType nodes that have the specified size. 1633 1634 Given 1635 int a[42]; 1636 int b[2 * 21]; 1637 int c[41], d[43]; 1638 constantArrayType(hasSize(42)) 1639 matches "int a[42]" and "int b[2 * 21]" 1640 </pre></td></tr> 1641 1642 1643 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>></td><td class="name" onclick="toggle('declCountIs0')"><a name="declCountIs0Anchor">declCountIs</a></td><td>unsigned N</td></tr> 1644 <tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of 1645 declarations. 1646 1647 Example: Given 1648 int a, b; 1649 int c; 1650 int d = 2, e; 1651 declCountIs(2) 1652 matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'. 1653 </pre></td></tr> 1654 1655 1656 <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> 1657 <tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node. 1658 1659 Matches a node if it equals the node previously bound to ID. 1660 1661 Given 1662 class X { int a; int b; }; 1663 recordDecl( 1664 has(fieldDecl(hasName("a"), hasType(type().bind("t")))), 1665 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) 1666 matches the class X, as a and b have the same type. 1667 1668 Note that when multiple matches are involved via forEach* matchers, 1669 equalsBoundNodes acts as a filter. 1670 For example: 1671 compoundStmt( 1672 forEachDescendant(varDecl().bind("d")), 1673 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))) 1674 will trigger a match for each combination of variable declaration 1675 and reference to that variable declaration within a compound statement. 1676 </pre></td></tr> 1677 1678 1679 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('hasAttr0')"><a name="hasAttr0Anchor">hasAttr</a></td><td>attr::Kind AttrKind</td></tr> 1680 <tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute. 1681 1682 Given 1683 __attribute__((device)) void f() { ... } 1684 decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of 1685 f. 1686 </pre></td></tr> 1687 1688 1689 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isExpansionInFileMatching0')"><a name="isExpansionInFileMatching0Anchor">isExpansionInFileMatching</a></td><td>std::string RegExp</td></tr> 1690 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is 1691 partially matching a given regex. 1692 1693 Example matches Y but not X 1694 (matcher = recordDecl(isExpansionInFileMatching("AST.*")) 1695 #include "ASTMatcher.h" 1696 class X {}; 1697 ASTMatcher.h: 1698 class Y {}; 1699 1700 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> 1701 </pre></td></tr> 1702 1703 1704 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isExpansionInMainFile0')"><a name="isExpansionInMainFile0Anchor">isExpansionInMainFile</a></td><td></td></tr> 1705 <tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file. 1706 1707 Example matches X but not Y (matcher = recordDecl(isExpansionInMainFile()) 1708 #include <Y.h> 1709 class X {}; 1710 Y.h: 1711 class Y {}; 1712 1713 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> 1714 </pre></td></tr> 1715 1716 1717 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isExpansionInSystemHeader0')"><a name="isExpansionInSystemHeader0Anchor">isExpansionInSystemHeader</a></td><td></td></tr> 1718 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files. 1719 1720 Example matches Y but not X 1721 (matcher = recordDecl(isExpansionInSystemHeader()) 1722 #include <SystemHeader.h> 1723 class X {}; 1724 SystemHeader.h: 1725 class Y {}; 1726 1727 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> 1728 </pre></td></tr> 1729 1730 1731 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isImplicit0')"><a name="isImplicit0Anchor">isImplicit</a></td><td></td></tr> 1732 <tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a declaration that has been implicitly added 1733 by the compiler (eg. implicit defaultcopy constructors). 1734 </pre></td></tr> 1735 1736 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 <tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations. 1739 1740 Given 1741 class C { 1742 public: int a; 1743 protected: int b; 1744 private: int c; 1745 }; 1746 fieldDecl(isPrivate()) 1747 matches 'int c;' 1748 </pre></td></tr> 1749 1750 1751 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isProtected0')"><a name="isProtected0Anchor">isProtected</a></td><td></td></tr> 1752 <tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations. 1753 1754 Given 1755 class C { 1756 public: int a; 1757 protected: int b; 1758 private: int c; 1759 }; 1760 fieldDecl(isProtected()) 1761 matches 'int b;' 1762 </pre></td></tr> 1763 1764 1765 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isPublic0')"><a name="isPublic0Anchor">isPublic</a></td><td></td></tr> 1766 <tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations. 1767 1768 Given 1769 class C { 1770 public: int a; 1771 protected: int b; 1772 private: int c; 1773 }; 1774 fieldDecl(isPublic()) 1775 matches 'int a;' 1776 </pre></td></tr> 1777 1778 1779 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>></td><td class="name" onclick="toggle('equals1')"><a name="equals1Anchor">equals</a></td><td>ValueT Value</td></tr> 1780 <tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value. 1781 1782 Example matches true (matcher = boolLiteral(equals(true))) 1783 true 1784 1785 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>>, Matcher<CXXBoolLiteral>, 1786 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>> 1787 </pre></td></tr> 1788 1789 1790 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('hasOverloadedOperatorName0')"><a name="hasOverloadedOperatorName0Anchor">hasOverloadedOperatorName</a></td><td>StringRef Name</td></tr> 1791 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names. 1792 1793 Matches overloaded operator names specified in strings without the 1794 "operator" prefix: e.g. "<<". 1795 1796 Given: 1797 class A { int operator*(); }; 1798 const A &operator<<(const A &a, const A &b); 1799 A a; 1800 a << a; <-- This matches 1801 1802 operatorCallExpr(hasOverloadedOperatorName("<<"))) matches the specified 1803 line and recordDecl(hasMethod(hasOverloadedOperatorName("*"))) matches 1804 the declaration of A. 1805 1806 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>> 1807 </pre></td></tr> 1808 1809 1810 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('isDefinition2')"><a name="isDefinition2Anchor">isDefinition</a></td><td></td></tr> 1811 <tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached. 1812 1813 Example matches A, va, fa 1814 class A {}; 1815 class B; Doesn't match, as it has no body. 1816 int va; 1817 extern int vb; Doesn't match, as it doesn't define the variable. 1818 void fa() {} 1819 void fb(); Doesn't match, as it has no body. 1820 1821 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</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_1FunctionDecl.html">FunctionDecl</a>> 1822 </pre></td></tr> 1823 1824 1825 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('isDeleted0')"><a name="isDeleted0Anchor">isDeleted</a></td><td></td></tr> 1826 <tr><td colspan="4" class="doc" id="isDeleted0"><pre>Matches deleted function declarations. 1827 1828 Given: 1829 void Func(); 1830 void DeletedFunc() = delete; 1831 functionDecl(isDeleted()) 1832 matches the declaration of DeletedFunc, but not Func. 1833 </pre></td></tr> 1834 1835 1836 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('isExplicitTemplateSpecialization0')"><a name="isExplicitTemplateSpecialization0Anchor">isExplicitTemplateSpecialization</a></td><td></td></tr> 1837 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or 1838 static member variable template instantiations. 1839 1840 Given 1841 template<typename T> void A(T t) { } 1842 template<> void A(int N) { } 1843 functionDecl(isExplicitTemplateSpecialization()) 1844 matches the specialization A<int>(). 1845 1846 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>> 1847 </pre></td></tr> 1848 1849 1850 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('isExternC0')"><a name="isExternC0Anchor">isExternC</a></td><td></td></tr> 1851 <tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function declarations. 1852 1853 Given: 1854 extern "C" void f() {} 1855 extern "C" { void g() {} } 1856 void h() {} 1857 functionDecl(isExternC()) 1858 matches the declaration of f and g, but not the declaration h 1859 </pre></td></tr> 1860 1861 1862 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('isTemplateInstantiation0')"><a name="isTemplateInstantiation0Anchor">isTemplateInstantiation</a></td><td></td></tr> 1863 <tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static 1864 member variable template instantiations. 1865 1866 Given 1867 template <typename T> class X {}; class A {}; X<A> x; 1868 or 1869 template <typename T> class X {}; class A {}; template class X<A>; 1870 recordDecl(hasName("::X"), isTemplateInstantiation()) 1871 matches the template instantiation of X<A>. 1872 1873 But given 1874 template <typename T> class X {}; class A {}; 1875 template <> class X<A> {}; X<A> x; 1876 recordDecl(hasName("::X"), isTemplateInstantiation()) 1877 does not match, as X<A> is an explicit template specialization. 1878 1879 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>> 1880 </pre></td></tr> 1881 1882 1883 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('parameterCountIs0')"><a name="parameterCountIs0Anchor">parameterCountIs</a></td><td>unsigned N</td></tr> 1884 <tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls that have a specific parameter count. 1885 1886 Given 1887 void f(int i) {} 1888 void g(int i, int j) {} 1889 functionDecl(parameterCountIs(2)) 1890 matches g(int i, int j) {} 1891 </pre></td></tr> 1892 1893 1894 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>></td><td class="name" onclick="toggle('equals0')"><a name="equals0Anchor">equals</a></td><td>ValueT Value</td></tr> 1895 <tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value. 1896 1897 Example matches true (matcher = boolLiteral(equals(true))) 1898 true 1899 1900 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>>, Matcher<CXXBoolLiteral>, 1901 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>> 1902 </pre></td></tr> 1903 1904 1905 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>></td><td class="name" onclick="toggle('isArrow0')"><a name="isArrow0Anchor">isArrow</a></td><td></td></tr> 1906 <tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '->' as opposed 1907 to '.'. 1908 1909 Member calls on the implicit this pointer match as called with '->'. 1910 1911 Given 1912 class Y { 1913 void x() { this->x(); x(); Y y; y.x(); a; this->b; Y::b; } 1914 int a; 1915 static int b; 1916 }; 1917 memberExpr(isArrow()) 1918 matches this->x, x, y.x, a, this->b 1919 </pre></td></tr> 1920 1921 1922 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>></td><td class="name" onclick="toggle('hasName0')"><a name="hasName0Anchor">hasName</a></td><td>std::string Name</td></tr> 1923 <tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name. 1924 1925 Supports specifying enclosing namespaces or classes by prefixing the name 1926 with '<enclosing>::'. 1927 Does not match typedefs of an underlying type with the given name. 1928 1929 Example matches X (Name == "X") 1930 class X; 1931 1932 Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X") 1933 namespace a { namespace b { class X; } } 1934 </pre></td></tr> 1935 1936 1937 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>></td><td class="name" onclick="toggle('matchesName0')"><a name="matchesName0Anchor">matchesName</a></td><td>std::string RegExp</td></tr> 1938 <tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain 1939 a substring matched by the given RegExp. 1940 1941 Supports specifying enclosing namespaces or classes by 1942 prefixing the name with '<enclosing>::'. Does not match typedefs 1943 of an underlying type with the given name. 1944 1945 Example matches X (regexp == "::X") 1946 class X; 1947 1948 Example matches X (regexp is one of "::X", "^foo::.*X", among others) 1949 namespace foo { namespace bar { class X; } } 1950 </pre></td></tr> 1951 1952 1953 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('asString0')"><a name="asString0Anchor">asString</a></td><td>std::string Name</td></tr> 1954 <tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string. 1955 1956 Given 1957 class Y { public: void x(); }; 1958 void z() { Y* y; y->x(); } 1959 callExpr(on(hasType(asString("class Y *")))) 1960 matches y->x() 1961 </pre></td></tr> 1962 1963 1964 <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> 1965 <tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node. 1966 1967 Matches a node if it equals the node previously bound to ID. 1968 1969 Given 1970 class X { int a; int b; }; 1971 recordDecl( 1972 has(fieldDecl(hasName("a"), hasType(type().bind("t")))), 1973 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) 1974 matches the class X, as a and b have the same type. 1975 1976 Note that when multiple matches are involved via forEach* matchers, 1977 equalsBoundNodes acts as a filter. 1978 For example: 1979 compoundStmt( 1980 forEachDescendant(varDecl().bind("d")), 1981 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))) 1982 will trigger a match for each combination of variable declaration 1983 and reference to that variable declaration within a compound statement. 1984 </pre></td></tr> 1985 1986 1987 <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> 1988 <tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to 1989 the node, not hidden within a typedef. 1990 1991 Given 1992 typedef const int const_int; 1993 const_int i; 1994 int *const j; 1995 int *volatile k; 1996 int m; 1997 varDecl(hasType(hasLocalQualifiers())) matches only j and k. 1998 i is const-qualified but the qualifier is not local. 1999 </pre></td></tr> 2000 2001 2002 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('isConstQualified0')"><a name="isConstQualified0Anchor">isConstQualified</a></td><td></td></tr> 2003 <tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that 2004 include "top-level" const. 2005 2006 Given 2007 void a(int); 2008 void b(int const); 2009 void c(const int); 2010 void d(const int*); 2011 void e(int const) {}; 2012 functionDecl(hasAnyParameter(hasType(isConstQualified()))) 2013 matches "void b(int const)", "void c(const int)" and 2014 "void e(int const) {}". It does not match d as there 2015 is no top-level const on the parameter type "const int *". 2016 </pre></td></tr> 2017 2018 2019 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('isInteger0')"><a name="isInteger0Anchor">isInteger</a></td><td></td></tr> 2020 <tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type. 2021 2022 Given 2023 void a(int); 2024 void b(long); 2025 void c(double); 2026 functionDecl(hasAnyParameter(hasType(isInteger()))) 2027 matches "a(int)", "b(long)", but not "c(double)". 2028 </pre></td></tr> 2029 2030 2031 <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> 2032 <tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node. 2033 2034 Matches a node if it equals the node previously bound to ID. 2035 2036 Given 2037 class X { int a; int b; }; 2038 recordDecl( 2039 has(fieldDecl(hasName("a"), hasType(type().bind("t")))), 2040 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) 2041 matches the class X, as a and b have the same type. 2042 2043 Note that when multiple matches are involved via forEach* matchers, 2044 equalsBoundNodes acts as a filter. 2045 For example: 2046 compoundStmt( 2047 forEachDescendant(varDecl().bind("d")), 2048 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))) 2049 will trigger a match for each combination of variable declaration 2050 and reference to that variable declaration within a compound statement. 2051 </pre></td></tr> 2052 2053 2054 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('isExpansionInFileMatching1')"><a name="isExpansionInFileMatching1Anchor">isExpansionInFileMatching</a></td><td>std::string RegExp</td></tr> 2055 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches AST nodes that were expanded within files whose name is 2056 partially matching a given regex. 2057 2058 Example matches Y but not X 2059 (matcher = recordDecl(isExpansionInFileMatching("AST.*")) 2060 #include "ASTMatcher.h" 2061 class X {}; 2062 ASTMatcher.h: 2063 class Y {}; 2064 2065 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> 2066 </pre></td></tr> 2067 2068 2069 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('isExpansionInMainFile1')"><a name="isExpansionInMainFile1Anchor">isExpansionInMainFile</a></td><td></td></tr> 2070 <tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches AST nodes that were expanded within the main-file. 2071 2072 Example matches X but not Y (matcher = recordDecl(isExpansionInMainFile()) 2073 #include <Y.h> 2074 class X {}; 2075 Y.h: 2076 class Y {}; 2077 2078 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> 2079 </pre></td></tr> 2080 2081 2082 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('isExpansionInSystemHeader1')"><a name="isExpansionInSystemHeader1Anchor">isExpansionInSystemHeader</a></td><td></td></tr> 2083 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches AST nodes that were expanded within system-header-files. 2084 2085 Example matches Y but not X 2086 (matcher = recordDecl(isExpansionInSystemHeader()) 2087 #include <SystemHeader.h> 2088 class X {}; 2089 SystemHeader.h: 2090 class Y {}; 2091 2092 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> 2093 </pre></td></tr> 2094 2095 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> 2097 <tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached. 2098 2099 Example matches A, va, fa 2100 class A {}; 2101 class B; Doesn't match, as it has no body. 2102 int va; 2103 extern int vb; Doesn't match, as it doesn't define the variable. 2104 void fa() {} 2105 void fb(); Doesn't match, as it has no body. 2106 2107 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</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_1FunctionDecl.html">FunctionDecl</a>> 2108 </pre></td></tr> 2109 2110 2111 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>></td><td class="name" onclick="toggle('equalsIntegralValue0')"><a name="equalsIntegralValue0Anchor">equalsIntegralValue</a></td><td>std::string Value</td></tr> 2112 <tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value. 2113 2114 Note that 'Value' is a string as the template argument's value is 2115 an arbitrary precision integer. 'Value' must be euqal to the canonical 2116 representation of that integral value in base 10. 2117 2118 Given 2119 template<int T> struct A {}; 2120 C<42> c; 2121 classTemplateSpecializationDecl( 2122 hasAnyTemplateArgument(equalsIntegralValue("42"))) 2123 matches the implicit instantiation of C in C<42>. 2124 </pre></td></tr> 2125 2126 2127 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>></td><td class="name" onclick="toggle('isIntegral0')"><a name="isIntegral0Anchor">isIntegral</a></td><td></td></tr> 2128 <tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value. 2129 2130 Given 2131 template<int T> struct A {}; 2132 C<42> c; 2133 classTemplateSpecializationDecl( 2134 hasAnyTemplateArgument(isIntegral())) 2135 matches the implicit instantiation of C in C<42> 2136 with isIntegral() matching 42. 2137 </pre></td></tr> 2138 2139 2140 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>></td><td class="name" onclick="toggle('templateArgumentCountIs1')"><a name="templateArgumentCountIs1Anchor">templateArgumentCountIs</a></td><td>unsigned N</td></tr> 2141 <tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N. 2142 2143 Given 2144 template<typename T> struct C {}; 2145 C<int> c; 2146 classTemplateSpecializationDecl(templateArgumentCountIs(1)) 2147 matches C<int>. 2148 </pre></td></tr> 2149 2150 2151 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td><td class="name" onclick="toggle('isExpansionInFileMatching2')"><a name="isExpansionInFileMatching2Anchor">isExpansionInFileMatching</a></td><td>std::string RegExp</td></tr> 2152 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is 2153 partially matching a given regex. 2154 2155 Example matches Y but not X 2156 (matcher = recordDecl(isExpansionInFileMatching("AST.*")) 2157 #include "ASTMatcher.h" 2158 class X {}; 2159 ASTMatcher.h: 2160 class Y {}; 2161 2162 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> 2163 </pre></td></tr> 2164 2165 2166 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td><td class="name" onclick="toggle('isExpansionInMainFile2')"><a name="isExpansionInMainFile2Anchor">isExpansionInMainFile</a></td><td></td></tr> 2167 <tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file. 2168 2169 Example matches X but not Y (matcher = recordDecl(isExpansionInMainFile()) 2170 #include <Y.h> 2171 class X {}; 2172 Y.h: 2173 class Y {}; 2174 2175 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> 2176 </pre></td></tr> 2177 2178 2179 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td><td class="name" onclick="toggle('isExpansionInSystemHeader2')"><a name="isExpansionInSystemHeader2Anchor">isExpansionInSystemHeader</a></td><td></td></tr> 2180 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files. 2181 2182 Example matches Y but not X 2183 (matcher = recordDecl(isExpansionInSystemHeader()) 2184 #include <SystemHeader.h> 2185 class X {}; 2186 SystemHeader.h: 2187 class Y {}; 2188 2189 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> 2190 </pre></td></tr> 2191 2192 2193 <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> 2194 <tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node. 2195 2196 Matches a node if it equals the node previously bound to ID. 2197 2198 Given 2199 class X { int a; int b; }; 2200 recordDecl( 2201 has(fieldDecl(hasName("a"), hasType(type().bind("t")))), 2202 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) 2203 matches the class X, as a and b have the same type. 2204 2205 Note that when multiple matches are involved via forEach* matchers, 2206 equalsBoundNodes acts as a filter. 2207 For example: 2208 compoundStmt( 2209 forEachDescendant(varDecl().bind("d")), 2210 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))) 2211 will trigger a match for each combination of variable declaration 2212 and reference to that variable declaration within a compound statement. 2213 </pre></td></tr> 2214 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 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> 2227 <tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind. 2228 2229 Given 2230 int x; 2231 int s = sizeof(x) + alignof(x) 2232 unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf)) 2233 matches sizeof(x) 2234 </pre></td></tr> 2235 2236 2237 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>></td><td class="name" onclick="toggle('hasOperatorName1')"><a name="hasOperatorName1Anchor">hasOperatorName</a></td><td>std::string Name</td></tr> 2238 <tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or 2239 unary). 2240 2241 Example matches a || b (matcher = binaryOperator(hasOperatorName("||"))) 2242 !(a || b) 2243 </pre></td></tr> 2244 2245 2246 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('hasGlobalStorage0')"><a name="hasGlobalStorage0Anchor">hasGlobalStorage</a></td><td></td></tr> 2247 <tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage. 2248 2249 Example matches y and z (matcher = varDecl(hasGlobalStorage()) 2250 void f() { 2251 int x; 2252 static int y; 2253 } 2254 int z; 2255 </pre></td></tr> 2256 2257 2258 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('hasLocalStorage0')"><a name="hasLocalStorage0Anchor">hasLocalStorage</a></td><td></td></tr> 2259 <tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a 2260 non-static local variable. 2261 2262 Example matches x (matcher = varDecl(hasLocalStorage()) 2263 void f() { 2264 int x; 2265 static int y; 2266 } 2267 int z; 2268 </pre></td></tr> 2269 2270 2271 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('isDefinition1')"><a name="isDefinition1Anchor">isDefinition</a></td><td></td></tr> 2272 <tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached. 2273 2274 Example matches A, va, fa 2275 class A {}; 2276 class B; Doesn't match, as it has no body. 2277 int va; 2278 extern int vb; Doesn't match, as it doesn't define the variable. 2279 void fa() {} 2280 void fb(); Doesn't match, as it has no body. 2281 2282 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</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_1FunctionDecl.html">FunctionDecl</a>> 2283 </pre></td></tr> 2284 2285 2286 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('isExplicitTemplateSpecialization1')"><a name="isExplicitTemplateSpecialization1Anchor">isExplicitTemplateSpecialization</a></td><td></td></tr> 2287 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or 2288 static member variable template instantiations. 2289 2290 Given 2291 template<typename T> void A(T t) { } 2292 template<> void A(int N) { } 2293 functionDecl(isExplicitTemplateSpecialization()) 2294 matches the specialization A<int>(). 2295 2296 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>> 2297 </pre></td></tr> 2298 2299 2300 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('isTemplateInstantiation1')"><a name="isTemplateInstantiation1Anchor">isTemplateInstantiation</a></td><td></td></tr> 2301 <tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static 2302 member variable template instantiations. 2303 2304 Given 2305 template <typename T> class X {}; class A {}; X<A> x; 2306 or 2307 template <typename T> class X {}; class A {}; template class X<A>; 2308 recordDecl(hasName("::X"), isTemplateInstantiation()) 2309 matches the template instantiation of X<A>. 2310 2311 But given 2312 template <typename T> class X {}; class A {}; 2313 template <> class X<A> {}; X<A> x; 2314 recordDecl(hasName("::X"), isTemplateInstantiation()) 2315 does not match, as X<A> is an explicit template specialization. 2316 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>> 2318 </pre></td></tr> 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 2349 <!--END_NARROWING_MATCHERS --> 2350 </table> 2351 2352 <!-- ======================================================================= --> 2353 <h2 id="traversal-matchers">AST Traversal Matchers</h2> 2354 <!-- ======================================================================= --> 2355 2356 <p>Traversal matchers specify the relationship to other nodes that are 2357 reachable from the current node.</p> 2358 2359 <p>Note that there are special traversal matchers (has, hasDescendant, forEach and 2360 forEachDescendant) which work on all nodes and allow users to write more generic 2361 match expressions.</p> 2362 2363 <table> 2364 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr> 2365 <!-- START_TRAVERSAL_MATCHERS --> 2366 2367 <tr><td>Matcher<*></td><td class="name" onclick="toggle('eachOf0')"><a name="eachOf0Anchor">eachOf</a></td><td>Matcher<*>, ..., Matcher<*></td></tr> 2368 <tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches. 2369 2370 Unlike anyOf, eachOf will generate a match result for each 2371 matching submatcher. 2372 2373 For example, in: 2374 class A { int a; int b; }; 2375 The matcher: 2376 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")), 2377 has(fieldDecl(hasName("b")).bind("v")))) 2378 will generate two results binding "v", the first of which binds 2379 the field declaration of a, the second the field declaration of 2380 b. 2381 2382 Usable as: Any Matcher 2383 </pre></td></tr> 2384 2385 2386 <tr><td>Matcher<*></td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher<*></td></tr> 2387 <tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the 2388 provided matcher. 2389 2390 Example matches X, A, B, C 2391 (matcher = recordDecl(forEachDescendant(recordDecl(hasName("X"))))) 2392 class X {}; Matches X, because X::X is a class of name X inside X. 2393 class A { class X {}; }; 2394 class B { class C { class X {}; }; }; 2395 2396 DescendantT must be an AST base type. 2397 2398 As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for 2399 each result that matches instead of only on the first one. 2400 2401 Note: Recursively combined ForEachDescendant can cause many matches: 2402 recordDecl(forEachDescendant(recordDecl(forEachDescendant(recordDecl())))) 2403 will match 10 times (plus injected class name matches) on: 2404 class A { class B { class C { class D { class E {}; }; }; }; }; 2405 2406 Usable as: Any Matcher 2407 </pre></td></tr> 2408 2409 2410 <tr><td>Matcher<*></td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher<*></td></tr> 2411 <tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the 2412 provided matcher. 2413 2414 Example matches X, Y (matcher = recordDecl(forEach(recordDecl(hasName("X"))) 2415 class X {}; Matches X, because X::X is a class of name X inside X. 2416 class Y { class X {}; }; 2417 class Z { class Y { class X {}; }; }; Does not match Z. 2418 2419 ChildT must be an AST base type. 2420 2421 As opposed to 'has', 'forEach' will cause a match for each result that 2422 matches instead of only on the first one. 2423 2424 Usable as: Any Matcher 2425 </pre></td></tr> 2426 2427 2428 <tr><td>Matcher<*></td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher<*></td></tr> 2429 <tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided 2430 matcher. 2431 2432 Given 2433 void f() { if (true) { int x = 42; } } 2434 void g() { for (;;) { int x = 43; } } 2435 expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43. 2436 2437 Usable as: Any Matcher 2438 </pre></td></tr> 2439 2440 2441 <tr><td>Matcher<*></td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher<*></td></tr> 2442 <tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the 2443 provided matcher. 2444 2445 Example matches X, Y, Z 2446 (matcher = recordDecl(hasDescendant(recordDecl(hasName("X"))))) 2447 class X {}; Matches X, because X::X is a class of name X inside X. 2448 class Y { class X {}; }; 2449 class Z { class Y { class X {}; }; }; 2450 2451 DescendantT must be an AST base type. 2452 2453 Usable as: Any Matcher 2454 </pre></td></tr> 2455 2456 2457 <tr><td>Matcher<*></td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher<*></td></tr> 2458 <tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the 2459 provided matcher. 2460 2461 Example matches X, Y (matcher = recordDecl(has(recordDecl(hasName("X"))) 2462 class X {}; Matches X, because X::X is a class of name X inside X. 2463 class Y { class X {}; }; 2464 class Z { class Y { class X {}; }; }; Does not match Z. 2465 2466 ChildT must be an AST base type. 2467 2468 Usable as: Any Matcher 2469 </pre></td></tr> 2470 2471 2472 <tr><td>Matcher<*></td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher<*></td></tr> 2473 <tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided 2474 matcher. 2475 2476 Given 2477 void f() { for (;;) { int x = 42; if (true) { int x = 43; } } } 2478 compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }". 2479 2480 Usable as: Any Matcher 2481 </pre></td></tr> 2482 2483 2484 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>></td><td class="name" onclick="toggle('hasBase0')"><a name="hasBase0Anchor">hasBase</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2485 <tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression. 2486 2487 Given 2488 int i[5]; 2489 void f() { i[1] = 42; } 2490 arraySubscriptExpression(hasBase(implicitCastExpr( 2491 hasSourceExpression(declRefExpr())))) 2492 matches i[1] with the declRefExpr() matching i 2493 </pre></td></tr> 2494 2495 2496 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>></td><td class="name" onclick="toggle('hasIndex0')"><a name="hasIndex0Anchor">hasIndex</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2497 <tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression. 2498 2499 Given 2500 int i[5]; 2501 void f() { i[1] = 42; } 2502 arraySubscriptExpression(hasIndex(integerLiteral())) 2503 matches i[1] with the integerLiteral() matching 1 2504 </pre></td></tr> 2505 2506 2507 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayTypeLoc.html">ArrayTypeLoc</a>></td><td class="name" onclick="toggle('hasElementTypeLoc0')"><a name="hasElementTypeLoc0Anchor">hasElementTypeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td></tr> 2508 <tr><td colspan="4" class="doc" id="hasElementTypeLoc0"><pre>Matches arrays and C99 complex types that have a specific element 2509 type. 2510 2511 Given 2512 struct A {}; 2513 A a[7]; 2514 int b[7]; 2515 arrayType(hasElementType(builtinType())) 2516 matches "int b[7]" 2517 2518 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>> 2519 </pre></td></tr> 2520 2521 2522 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>></td><td class="name" onclick="toggle('hasElementType0')"><a name="hasElementType0Anchor">hasElementType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td></tr> 2523 <tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element 2524 type. 2525 2526 Given 2527 struct A {}; 2528 A a[7]; 2529 int b[7]; 2530 arrayType(hasElementType(builtinType())) 2531 matches "int b[7]" 2532 2533 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>> 2534 </pre></td></tr> 2535 2536 2537 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicTypeLoc.html">AtomicTypeLoc</a>></td><td class="name" onclick="toggle('hasValueTypeLoc0')"><a name="hasValueTypeLoc0Anchor">hasValueTypeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td></tr> 2538 <tr><td colspan="4" class="doc" id="hasValueTypeLoc0"><pre>Matches atomic types with a specific value type. 2539 2540 Given 2541 _Atomic(int) i; 2542 _Atomic(float) f; 2543 atomicType(hasValueType(isInteger())) 2544 matches "_Atomic(int) i" 2545 2546 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>> 2547 </pre></td></tr> 2548 2549 2550 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>></td><td class="name" onclick="toggle('hasValueType0')"><a name="hasValueType0Anchor">hasValueType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td></tr> 2551 <tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type. 2552 2553 Given 2554 _Atomic(int) i; 2555 _Atomic(float) f; 2556 atomicType(hasValueType(isInteger())) 2557 matches "_Atomic(int) i" 2558 2559 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>> 2560 </pre></td></tr> 2561 2562 2563 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>></td><td class="name" onclick="toggle('hasDeducedType0')"><a name="hasDeducedType0Anchor">hasDeducedType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td></tr> 2564 <tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type. 2565 2566 Note: There is no TypeLoc for the deduced type and thus no 2567 getDeducedLoc() matcher. 2568 2569 Given 2570 auto a = 1; 2571 auto b = 2.0; 2572 autoType(hasDeducedType(isInteger())) 2573 matches "auto a" 2574 2575 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>> 2576 </pre></td></tr> 2577 2578 2579 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>></td><td class="name" onclick="toggle('hasEitherOperand0')"><a name="hasEitherOperand0Anchor">hasEitherOperand</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2580 <tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a 2581 binary operator matches. 2582 </pre></td></tr> 2583 2584 2585 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>></td><td class="name" onclick="toggle('hasLHS0')"><a name="hasLHS0Anchor">hasLHS</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2586 <tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions. 2587 2588 Example matches a (matcher = binaryOperator(hasLHS())) 2589 a || b 2590 </pre></td></tr> 2591 2592 2593 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>></td><td class="name" onclick="toggle('hasRHS0')"><a name="hasRHS0Anchor">hasRHS</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2594 <tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions. 2595 2596 Example matches b (matcher = binaryOperator(hasRHS())) 2597 a || b 2598 </pre></td></tr> 2599 2600 2601 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerTypeLoc.html">BlockPointerTypeLoc</a>></td><td class="name" onclick="toggle('pointeeLoc0')"><a name="pointeeLoc0Anchor">pointeeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td></tr> 2602 <tr><td colspan="4" class="doc" id="pointeeLoc0"><pre>Narrows PointerType (and similar) matchers to those where the 2603 pointee matches a given matcher. 2604 2605 Given 2606 int *a; 2607 int const *b; 2608 float const *f; 2609 pointerType(pointee(isConstQualified(), isInteger())) 2610 matches "int const *b" 2611 2612 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>>, 2613 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>> 2614 </pre></td></tr> 2615 2616 2617 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>></td><td class="name" onclick="toggle('pointee0')"><a name="pointee0Anchor">pointee</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td></tr> 2618 <tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the 2619 pointee matches a given matcher. 2620 2621 Given 2622 int *a; 2623 int const *b; 2624 float const *f; 2625 pointerType(pointee(isConstQualified(), isInteger())) 2626 matches "int const *b" 2627 2628 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>>, 2629 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>> 2630 </pre></td></tr> 2631 2632 2633 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>></td><td class="name" onclick="toggle('hasAnyArgument1')"><a name="hasAnyArgument1Anchor">hasAnyArgument</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2634 <tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call 2635 expression. 2636 2637 Given 2638 void x(int, int, int) { int y; x(1, y, 42); } 2639 callExpr(hasAnyArgument(declRefExpr())) 2640 matches x(1, y, 42) 2641 with hasAnyArgument(...) 2642 matching y 2643 2644 FIXME: Currently this will ignore parentheses and implicit casts on 2645 the argument before applying the inner matcher. We'll want to remove 2646 this to allow for greater control by the user once ignoreImplicit() 2647 has been implemented. 2648 </pre></td></tr> 2649 2650 2651 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>></td><td class="name" onclick="toggle('hasArgument1')"><a name="hasArgument1Anchor">hasArgument</a></td><td>unsigned N, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2652 <tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor 2653 call expression. 2654 2655 Example matches y in x(y) 2656 (matcher = callExpr(hasArgument(0, declRefExpr()))) 2657 void x(int) { int y; x(y); } 2658 </pre></td></tr> 2659 2660 2661 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>></td><td class="name" onclick="toggle('hasDeclaration12')"><a name="hasDeclaration12Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 2662 <tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node 2663 matches the given matcher. 2664 2665 The associated declaration is: 2666 - for type nodes, the declaration of the underlying type 2667 - for CallExpr, the declaration of the callee 2668 - for MemberExpr, the declaration of the referenced member 2669 - for CXXConstructExpr, the declaration of the constructor 2670 2671 Also usable as Matcher<T> for any T supporting the getDecl() member 2672 function. e.g. various subtypes of clang::Type and various expressions. 2673 2674 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 2675 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 2676 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 2677 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 2678 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 2679 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 2680 </pre></td></tr> 2681 2682 2683 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>></td><td class="name" onclick="toggle('forEachConstructorInitializer0')"><a name="forEachConstructorInitializer0Anchor">forEachConstructorInitializer</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>> InnerMatcher</td></tr> 2684 <tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition. 2685 2686 Given 2687 class A { A() : i(42), j(42) {} int i; int j; }; 2688 constructorDecl(forEachConstructorInitializer(forField(decl().bind("x")))) 2689 will trigger two matches, binding for 'i' and 'j' respectively. 2690 </pre></td></tr> 2691 2692 2693 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>></td><td class="name" onclick="toggle('hasAnyConstructorInitializer0')"><a name="hasAnyConstructorInitializer0Anchor">hasAnyConstructorInitializer</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>> InnerMatcher</td></tr> 2694 <tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer. 2695 2696 Given 2697 struct Foo { 2698 Foo() : foo_(1) { } 2699 int foo_; 2700 }; 2701 recordDecl(has(constructorDecl(hasAnyConstructorInitializer(anything())))) 2702 record matches Foo, hasAnyConstructorInitializer matches foo_(1) 2703 </pre></td></tr> 2704 2705 2706 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>></td><td class="name" onclick="toggle('forField0')"><a name="forField0Anchor">forField</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>> InnerMatcher</td></tr> 2707 <tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer. 2708 2709 Given 2710 struct Foo { 2711 Foo() : foo_(1) { } 2712 int foo_; 2713 }; 2714 recordDecl(has(constructorDecl(hasAnyConstructorInitializer( 2715 forField(hasName("foo_")))))) 2716 matches Foo 2717 with forField matching foo_ 2718 </pre></td></tr> 2719 2720 2721 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>></td><td class="name" onclick="toggle('withInitializer0')"><a name="withInitializer0Anchor">withInitializer</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2722 <tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer. 2723 2724 Given 2725 struct Foo { 2726 Foo() : foo_(1) { } 2727 int foo_; 2728 }; 2729 recordDecl(has(constructorDecl(hasAnyConstructorInitializer( 2730 withInitializer(integerLiteral(equals(1))))))) 2731 matches Foo 2732 with withInitializer matching (1) 2733 </pre></td></tr> 2734 2735 2736 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>></td><td class="name" onclick="toggle('hasBody3')"><a name="hasBody3Anchor">hasBody</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 2737 <tr><td colspan="4" class="doc" id="hasBody3"><pre>Matches a 'for', 'while', or 'do while' statement that has 2738 a given body. 2739 2740 Given 2741 for (;;) {} 2742 hasBody(compoundStmt()) 2743 matches 'for (;;) {}' 2744 with compoundStmt() 2745 matching '{}' 2746 </pre></td></tr> 2747 2748 2749 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>></td><td class="name" onclick="toggle('hasLoopVariable0')"><a name="hasLoopVariable0Anchor">hasLoopVariable</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>> InnerMatcher</td></tr> 2750 <tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop. 2751 2752 Example: 2753 forStmt(hasLoopVariable(anything())) 2754 matches 'int x' in 2755 for (int x : a) { } 2756 </pre></td></tr> 2757 2758 2759 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>></td><td class="name" onclick="toggle('hasRangeInit0')"><a name="hasRangeInit0Anchor">hasRangeInit</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2760 <tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop. 2761 2762 Example: 2763 forStmt(hasRangeInit(anything())) 2764 matches 'a' in 2765 for (int x : a) { } 2766 </pre></td></tr> 2767 2768 2769 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>></td><td class="name" onclick="toggle('onImplicitObjectArgument0')"><a name="onImplicitObjectArgument0Anchor">onImplicitObjectArgument</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2770 <tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre></pre></td></tr> 2771 2772 2773 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>></td><td class="name" onclick="toggle('on0')"><a name="on0Anchor">on</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2774 <tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression. 2775 2776 Example matches y.x() (matcher = callExpr(on(hasType(recordDecl(hasName("Y")))))) 2777 class Y { public: void x(); }; 2778 void z() { Y y; y.x(); }", 2779 2780 FIXME: Overload to allow directly matching types? 2781 </pre></td></tr> 2782 2783 2784 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>></td><td class="name" onclick="toggle('thisPointerType1')"><a name="thisPointerType1Anchor">thisPointerType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 2785 <tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration. 2786 </pre></td></tr> 2787 2788 2789 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>></td><td class="name" onclick="toggle('thisPointerType0')"><a name="thisPointerType0Anchor">thisPointerType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 2790 <tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the expression's type either matches the specified 2791 matcher, or is a pointer to a type that matches the InnerMatcher. 2792 </pre></td></tr> 2793 2794 2795 <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> 2796 <tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration 2797 belongs to. 2798 2799 FIXME: Generalize this for other kinds of declarations. 2800 FIXME: What other kind of declarations would we need to generalize 2801 this to? 2802 2803 Example matches A() in the last line 2804 (matcher = constructExpr(hasDeclaration(methodDecl( 2805 ofClass(hasName("A")))))) 2806 class A { 2807 public: 2808 A(); 2809 }; 2810 A a = A(); 2811 </pre></td></tr> 2812 2813 2814 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>></td><td class="name" onclick="toggle('hasMethod0')"><a name="hasMethod0Anchor">hasMethod</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>> InnerMatcher</td></tr> 2815 <tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher. 2816 2817 Given: 2818 class A { void func(); }; 2819 class B { void member(); }; 2820 2821 recordDecl(hasMethod(hasName("func"))) matches the declaration of A 2822 but not B. 2823 </pre></td></tr> 2824 2825 2826 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>></td><td class="name" onclick="toggle('isDerivedFrom0')"><a name="isDerivedFrom0Anchor">isDerivedFrom</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>> Base</td></tr> 2827 <tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from 2828 a class matching Base. 2829 2830 Note that a class is not considered to be derived from itself. 2831 2832 Example matches Y, Z, C (Base == hasName("X")) 2833 class X; 2834 class Y : public X {}; directly derived 2835 class Z : public Y {}; indirectly derived 2836 typedef X A; 2837 typedef A B; 2838 class C : public B {}; derived from a typedef of X 2839 2840 In the following example, Bar matches isDerivedFrom(hasName("X")): 2841 class Foo; 2842 typedef Foo X; 2843 class Bar : public Foo {}; derived from a type that X is a typedef of 2844 </pre></td></tr> 2845 2846 2847 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>></td><td class="name" onclick="toggle('isSameOrDerivedFrom0')"><a name="isSameOrDerivedFrom0Anchor">isSameOrDerivedFrom</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>> Base</td></tr> 2848 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly 2849 match Base. 2850 </pre></td></tr> 2851 2852 2853 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>></td><td class="name" onclick="toggle('callee1')"><a name="callee1Anchor">callee</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 2854 <tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the 2855 given matcher. 2856 2857 Example matches y.x() (matcher = callExpr(callee(methodDecl(hasName("x"))))) 2858 class Y { public: void x(); }; 2859 void z() { Y y; y.x(); } 2860 </pre></td></tr> 2861 2862 2863 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>></td><td class="name" onclick="toggle('callee0')"><a name="callee0Anchor">callee</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 2864 <tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches. 2865 2866 Given 2867 class Y { void x() { this->x(); x(); Y y; y.x(); } }; 2868 void f() { f(); } 2869 callExpr(callee(expr())) 2870 matches this->x(), x(), y.x(), f() 2871 with callee(...) 2872 matching this->x, x, y.x, f respectively 2873 2874 Note: Callee cannot take the more general internal::Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> 2875 because this introduces ambiguous overloads with calls to Callee taking a 2876 internal::Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>>, as the matcher hierarchy is purely 2877 implemented in terms of implicit casts. 2878 </pre></td></tr> 2879 2880 2881 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>></td><td class="name" onclick="toggle('hasAnyArgument0')"><a name="hasAnyArgument0Anchor">hasAnyArgument</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2882 <tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call 2883 expression. 2884 2885 Given 2886 void x(int, int, int) { int y; x(1, y, 42); } 2887 callExpr(hasAnyArgument(declRefExpr())) 2888 matches x(1, y, 42) 2889 with hasAnyArgument(...) 2890 matching y 2891 2892 FIXME: Currently this will ignore parentheses and implicit casts on 2893 the argument before applying the inner matcher. We'll want to remove 2894 this to allow for greater control by the user once ignoreImplicit() 2895 has been implemented. 2896 </pre></td></tr> 2897 2898 2899 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>></td><td class="name" onclick="toggle('hasArgument0')"><a name="hasArgument0Anchor">hasArgument</a></td><td>unsigned N, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2900 <tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor 2901 call expression. 2902 2903 Example matches y in x(y) 2904 (matcher = callExpr(hasArgument(0, declRefExpr()))) 2905 void x(int) { int y; x(y); } 2906 </pre></td></tr> 2907 2908 2909 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>></td><td class="name" onclick="toggle('hasDeclaration13')"><a name="hasDeclaration13Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 2910 <tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node 2911 matches the given matcher. 2912 2913 The associated declaration is: 2914 - for type nodes, the declaration of the underlying type 2915 - for CallExpr, the declaration of the callee 2916 - for MemberExpr, the declaration of the referenced member 2917 - for CXXConstructExpr, the declaration of the constructor 2918 2919 Also usable as Matcher<T> for any T supporting the getDecl() member 2920 function. e.g. various subtypes of clang::Type and various expressions. 2921 2922 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 2923 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 2924 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 2925 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 2926 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 2927 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 2928 </pre></td></tr> 2929 2930 2931 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CaseStmt.html">CaseStmt</a>></td><td class="name" onclick="toggle('hasCaseConstant0')"><a name="hasCaseConstant0Anchor">hasCaseConstant</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2932 <tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range 2933 extension, matches the constant given in the statement. 2934 2935 Given 2936 switch (1) { case 1: case 1+1: case 3 ... 4: ; } 2937 caseStmt(hasCaseConstant(integerLiteral())) 2938 matches "case 1:" 2939 </pre></td></tr> 2940 2941 2942 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html">CastExpr</a>></td><td class="name" onclick="toggle('hasSourceExpression0')"><a name="hasSourceExpression0Anchor">hasSourceExpression</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 2943 <tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression matches the given matcher. 2944 2945 Example: matches "a string" (matcher = 2946 hasSourceExpression(constructExpr())) 2947 class URL { URL(string); }; 2948 URL url = "a string"; 2949 </pre></td></tr> 2950 2951 2952 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>></td><td class="name" onclick="toggle('hasAnyTemplateArgument0')"><a name="hasAnyTemplateArgument0Anchor">hasAnyTemplateArgument</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>> InnerMatcher</td></tr> 2953 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations that have at least one 2954 TemplateArgument matching the given InnerMatcher. 2955 2956 Given 2957 template<typename T> class A {}; 2958 template<> class A<double> {}; 2959 A<int> a; 2960 classTemplateSpecializationDecl(hasAnyTemplateArgument( 2961 refersToType(asString("int")))) 2962 matches the specialization A<int> 2963 </pre></td></tr> 2964 2965 2966 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>></td><td class="name" onclick="toggle('hasTemplateArgument0')"><a name="hasTemplateArgument0Anchor">hasTemplateArgument</a></td><td>unsigned N, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>> InnerMatcher</td></tr> 2967 <tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations where the n'th TemplateArgument 2968 matches the given InnerMatcher. 2969 2970 Given 2971 template<typename T, typename U> class A {}; 2972 A<bool, int> b; 2973 A<int, bool> c; 2974 classTemplateSpecializationDecl(hasTemplateArgument( 2975 1, refersToType(asString("int")))) 2976 matches the specialization A<bool, int> 2977 </pre></td></tr> 2978 2979 2980 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexTypeLoc.html">ComplexTypeLoc</a>></td><td class="name" onclick="toggle('hasElementTypeLoc1')"><a name="hasElementTypeLoc1Anchor">hasElementTypeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td></tr> 2981 <tr><td colspan="4" class="doc" id="hasElementTypeLoc1"><pre>Matches arrays and C99 complex types that have a specific element 2982 type. 2983 2984 Given 2985 struct A {}; 2986 A a[7]; 2987 int b[7]; 2988 arrayType(hasElementType(builtinType())) 2989 matches "int b[7]" 2990 2991 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>> 2992 </pre></td></tr> 2993 2994 2995 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>></td><td class="name" onclick="toggle('hasElementType1')"><a name="hasElementType1Anchor">hasElementType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td></tr> 2996 <tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element 2997 type. 2998 2999 Given 3000 struct A {}; 3001 A a[7]; 3002 int b[7]; 3003 arrayType(hasElementType(builtinType())) 3004 matches "int b[7]" 3005 3006 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>> 3007 </pre></td></tr> 3008 3009 3010 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CompoundStmt.html">CompoundStmt</a>></td><td class="name" onclick="toggle('hasAnySubstatement0')"><a name="hasAnySubstatement0Anchor">hasAnySubstatement</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 3011 <tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches 3012 a given matcher. 3013 3014 Given 3015 { {}; 1+2; } 3016 hasAnySubstatement(compoundStmt()) 3017 matches '{ {}; 1+2; }' 3018 with compoundStmt() 3019 matching '{}' 3020 </pre></td></tr> 3021 3022 3023 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>></td><td class="name" onclick="toggle('hasCondition4')"><a name="hasCondition4Anchor">hasCondition</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3024 <tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop, 3025 or conditional operator. 3026 3027 Example matches true (matcher = hasCondition(boolLiteral(equals(true)))) 3028 if (true) {} 3029 </pre></td></tr> 3030 3031 3032 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>></td><td class="name" onclick="toggle('hasFalseExpression0')"><a name="hasFalseExpression0Anchor">hasFalseExpression</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3033 <tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator. 3034 3035 Example matches b 3036 condition ? a : b 3037 </pre></td></tr> 3038 3039 3040 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>></td><td class="name" onclick="toggle('hasTrueExpression0')"><a name="hasTrueExpression0Anchor">hasTrueExpression</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3041 <tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator. 3042 3043 Example matches a 3044 condition ? a : b 3045 </pre></td></tr> 3046 3047 3048 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>></td><td class="name" onclick="toggle('hasDeclaration11')"><a name="hasDeclaration11Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3049 <tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node 3050 matches the given matcher. 3051 3052 The associated declaration is: 3053 - for type nodes, the declaration of the underlying type 3054 - for CallExpr, the declaration of the callee 3055 - for MemberExpr, the declaration of the referenced member 3056 - for CXXConstructExpr, the declaration of the constructor 3057 3058 Also usable as Matcher<T> for any T supporting the getDecl() member 3059 function. e.g. various subtypes of clang::Type and various expressions. 3060 3061 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3062 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3063 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3064 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3065 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3066 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3067 </pre></td></tr> 3068 3069 3070 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>></td><td class="name" onclick="toggle('throughUsingDecl0')"><a name="throughUsingDecl0Anchor">throughUsingDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>> InnerMatcher</td></tr> 3071 <tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a 3072 specific using shadow declaration. 3073 3074 FIXME: This currently only works for functions. Fix. 3075 3076 Given 3077 namespace a { void f() {} } 3078 using a::f; 3079 void g() { 3080 f(); Matches this .. 3081 a::f(); .. but not this. 3082 } 3083 declRefExpr(throughUsingDeclaration(anything())) 3084 matches f() 3085 </pre></td></tr> 3086 3087 3088 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>></td><td class="name" onclick="toggle('to0')"><a name="to0Anchor">to</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3089 <tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the 3090 specified matcher. 3091 3092 Example matches x in if(x) 3093 (matcher = declRefExpr(to(varDecl(hasName("x"))))) 3094 bool x; 3095 if (x) {} 3096 </pre></td></tr> 3097 3098 3099 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>></td><td class="name" onclick="toggle('containsDeclaration0')"><a name="containsDeclaration0Anchor">containsDeclaration</a></td><td>unsigned N, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3100 <tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement. 3101 3102 Note that this does not work for global declarations because the AST 3103 breaks up multiple-declaration DeclStmt's into multiple single-declaration 3104 DeclStmt's. 3105 Example: Given non-global declarations 3106 int a, b = 0; 3107 int c; 3108 int d = 2, e; 3109 declStmt(containsDeclaration( 3110 0, varDecl(hasInitializer(anything())))) 3111 matches only 'int d = 2, e;', and 3112 declStmt(containsDeclaration(1, varDecl())) 3113 matches 'int a, b = 0' as well as 'int d = 2, e;' 3114 but 'int c;' is not matched. 3115 </pre></td></tr> 3116 3117 3118 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>></td><td class="name" onclick="toggle('hasSingleDecl0')"><a name="hasSingleDecl0Anchor">hasSingleDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3119 <tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration. 3120 3121 Given 3122 int a, b; 3123 int c; 3124 declStmt(hasSingleDecl(anything())) 3125 matches 'int c;' but not 'int a, b;'. 3126 </pre></td></tr> 3127 3128 3129 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>></td><td class="name" onclick="toggle('hasTypeLoc0')"><a name="hasTypeLoc0Anchor">hasTypeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> Inner</td></tr> 3130 <tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches 3131 the inner matcher. 3132 3133 Given 3134 int x; 3135 declaratorDecl(hasTypeLoc(loc(asString("int")))) 3136 matches int x 3137 </pre></td></tr> 3138 3139 3140 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('hasDeclContext0')"><a name="hasDeclContext0Anchor">hasDeclContext</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3141 <tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a 3142 Decl, matches InnerMatcher. 3143 3144 Given 3145 namespace N { 3146 namespace M { 3147 class D {}; 3148 } 3149 } 3150 3151 recordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the 3152 declaration of class D. 3153 </pre></td></tr> 3154 3155 3156 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DoStmt.html">DoStmt</a>></td><td class="name" onclick="toggle('hasBody0')"><a name="hasBody0Anchor">hasBody</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 3157 <tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', or 'do while' statement that has 3158 a given body. 3159 3160 Given 3161 for (;;) {} 3162 hasBody(compoundStmt()) 3163 matches 'for (;;) {}' 3164 with compoundStmt() 3165 matching '{}' 3166 </pre></td></tr> 3167 3168 3169 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DoStmt.html">DoStmt</a>></td><td class="name" onclick="toggle('hasCondition3')"><a name="hasCondition3Anchor">hasCondition</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3170 <tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop, 3171 or conditional operator. 3172 3173 Example matches true (matcher = hasCondition(boolLiteral(equals(true)))) 3174 if (true) {} 3175 </pre></td></tr> 3176 3177 3178 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ElaboratedType.html">ElaboratedType</a>></td><td class="name" onclick="toggle('hasQualifier0')"><a name="hasQualifier0Anchor">hasQualifier</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>> InnerMatcher</td></tr> 3179 <tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier, 3180 matches InnerMatcher if the qualifier exists. 3181 3182 Given 3183 namespace N { 3184 namespace M { 3185 class D {}; 3186 } 3187 } 3188 N::M::D d; 3189 3190 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N")))) 3191 matches the type of the variable declaration of d. 3192 </pre></td></tr> 3193 3194 3195 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ElaboratedType.html">ElaboratedType</a>></td><td class="name" onclick="toggle('namesType0')"><a name="namesType0Anchor">namesType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3196 <tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher. 3197 3198 Given 3199 namespace N { 3200 namespace M { 3201 class D {}; 3202 } 3203 } 3204 N::M::D d; 3205 3206 elaboratedType(namesType(recordType( 3207 hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable 3208 declaration of d. 3209 </pre></td></tr> 3210 3211 3212 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>></td><td class="name" onclick="toggle('hasDeclaration10')"><a name="hasDeclaration10Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3213 <tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node 3214 matches the given matcher. 3215 3216 The associated declaration is: 3217 - for type nodes, the declaration of the underlying type 3218 - for CallExpr, the declaration of the callee 3219 - for MemberExpr, the declaration of the referenced member 3220 - for CXXConstructExpr, the declaration of the constructor 3221 3222 Also usable as Matcher<T> for any T supporting the getDecl() member 3223 function. e.g. various subtypes of clang::Type and various expressions. 3224 3225 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3226 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3227 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3228 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3229 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3230 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3231 </pre></td></tr> 3232 3233 3234 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>></td><td class="name" onclick="toggle('hasDestinationType0')"><a name="hasDestinationType0Anchor">hasDestinationType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3235 <tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher. 3236 3237 (Note: Clang's AST refers to other conversions as "casts" too, and calls 3238 actual casts "explicit" casts.) 3239 </pre></td></tr> 3240 3241 3242 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>></td><td class="name" onclick="toggle('hasType2')"><a name="hasType2Anchor">hasType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3243 <tr><td colspan="4" class="doc" id="hasType2"><pre>Overloaded to match the declaration of the expression's or value 3244 declaration's type. 3245 3246 In case of a value declaration (for example a variable declaration), 3247 this resolves one layer of indirection. For example, in the value 3248 declaration "X x;", recordDecl(hasName("X")) matches the declaration of X, 3249 while varDecl(hasType(recordDecl(hasName("X")))) matches the declaration 3250 of x." 3251 3252 Example matches x (matcher = expr(hasType(recordDecl(hasName("X"))))) 3253 and z (matcher = varDecl(hasType(recordDecl(hasName("X"))))) 3254 class X {}; 3255 void y(X &x) { x; X z; } 3256 3257 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>> 3258 </pre></td></tr> 3259 3260 3261 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>></td><td class="name" onclick="toggle('hasType0')"><a name="hasType0Anchor">hasType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3262 <tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type 3263 matcher. 3264 3265 Example matches x (matcher = expr(hasType(recordDecl(hasName("X"))))) 3266 and z (matcher = varDecl(hasType(recordDecl(hasName("X"))))) 3267 class X {}; 3268 void y(X &x) { x; X z; } 3269 </pre></td></tr> 3270 3271 3272 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>></td><td class="name" onclick="toggle('ignoringImpCasts0')"><a name="ignoringImpCasts0Anchor">ignoringImpCasts</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3273 <tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts 3274 are stripped off. 3275 3276 Parentheses and explicit casts are not discarded. 3277 Given 3278 int arr[5]; 3279 int a = 0; 3280 char b = 0; 3281 const int c = a; 3282 int *d = arr; 3283 long e = (long) 0l; 3284 The matchers 3285 varDecl(hasInitializer(ignoringImpCasts(integerLiteral()))) 3286 varDecl(hasInitializer(ignoringImpCasts(declRefExpr()))) 3287 would match the declarations for a, b, c, and d, but not e. 3288 While 3289 varDecl(hasInitializer(integerLiteral())) 3290 varDecl(hasInitializer(declRefExpr())) 3291 only match the declarations for b, c, and d. 3292 </pre></td></tr> 3293 3294 3295 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>></td><td class="name" onclick="toggle('ignoringParenCasts0')"><a name="ignoringParenCasts0Anchor">ignoringParenCasts</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3296 <tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and 3297 casts are stripped off. 3298 3299 Implicit and non-C Style casts are also discarded. 3300 Given 3301 int a = 0; 3302 char b = (0); 3303 void* c = reinterpret_cast<char*>(0); 3304 char d = char(0); 3305 The matcher 3306 varDecl(hasInitializer(ignoringParenCasts(integerLiteral()))) 3307 would match the declarations for a, b, c, and d. 3308 while 3309 varDecl(hasInitializer(integerLiteral())) 3310 only match the declaration for a. 3311 </pre></td></tr> 3312 3313 3314 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>></td><td class="name" onclick="toggle('ignoringParenImpCasts0')"><a name="ignoringParenImpCasts0Anchor">ignoringParenImpCasts</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3315 <tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and 3316 parentheses are stripped off. 3317 3318 Explicit casts are not discarded. 3319 Given 3320 int arr[5]; 3321 int a = 0; 3322 char b = (0); 3323 const int c = a; 3324 int *d = (arr); 3325 long e = ((long) 0l); 3326 The matchers 3327 varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral()))) 3328 varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr()))) 3329 would match the declarations for a, b, c, and d, but not e. 3330 while 3331 varDecl(hasInitializer(integerLiteral())) 3332 varDecl(hasInitializer(declRefExpr())) 3333 would only match the declaration for a. 3334 </pre></td></tr> 3335 3336 3337 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>></td><td class="name" onclick="toggle('hasBody1')"><a name="hasBody1Anchor">hasBody</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 3338 <tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', or 'do while' statement that has 3339 a given body. 3340 3341 Given 3342 for (;;) {} 3343 hasBody(compoundStmt()) 3344 matches 'for (;;) {}' 3345 with compoundStmt() 3346 matching '{}' 3347 </pre></td></tr> 3348 3349 3350 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>></td><td class="name" onclick="toggle('hasCondition1')"><a name="hasCondition1Anchor">hasCondition</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3351 <tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop, 3352 or conditional operator. 3353 3354 Example matches true (matcher = hasCondition(boolLiteral(equals(true)))) 3355 if (true) {} 3356 </pre></td></tr> 3357 3358 3359 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>></td><td class="name" onclick="toggle('hasIncrement0')"><a name="hasIncrement0Anchor">hasIncrement</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 3360 <tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop. 3361 3362 Example: 3363 forStmt(hasIncrement(unaryOperator(hasOperatorName("++")))) 3364 matches '++x' in 3365 for (x; x < N; ++x) { } 3366 </pre></td></tr> 3367 3368 3369 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>></td><td class="name" onclick="toggle('hasLoopInit0')"><a name="hasLoopInit0Anchor">hasLoopInit</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 3370 <tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop. 3371 3372 Example: 3373 forStmt(hasLoopInit(declStmt())) 3374 matches 'int x = 0' in 3375 for (int x = 0; x < N; ++x) { } 3376 </pre></td></tr> 3377 3378 3379 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('hasAnyParameter0')"><a name="hasAnyParameter0Anchor">hasAnyParameter</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>> InnerMatcher</td></tr> 3380 <tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function declaration. 3381 3382 Does not match the 'this' parameter of a method. 3383 3384 Given 3385 class X { void f(int x, int y, int z) {} }; 3386 methodDecl(hasAnyParameter(hasName("y"))) 3387 matches f(int x, int y, int z) {} 3388 with hasAnyParameter(...) 3389 matching int y 3390 </pre></td></tr> 3391 3392 3393 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('hasParameter0')"><a name="hasParameter0Anchor">hasParameter</a></td><td>unsigned N, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>> InnerMatcher</td></tr> 3394 <tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function declaration. 3395 3396 Given 3397 class X { void f(int x) {} }; 3398 methodDecl(hasParameter(0, hasType(varDecl()))) 3399 matches f(int x) {} 3400 with hasParameter(...) 3401 matching int x 3402 </pre></td></tr> 3403 3404 3405 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('returns0')"><a name="returns0Anchor">returns</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3406 <tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration. 3407 3408 Given: 3409 class X { int f() { return 1; } }; 3410 methodDecl(returns(asString("int"))) 3411 matches int f() { return 1; } 3412 </pre></td></tr> 3413 3414 3415 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>></td><td class="name" onclick="toggle('hasCondition0')"><a name="hasCondition0Anchor">hasCondition</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3416 <tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop, 3417 or conditional operator. 3418 3419 Example matches true (matcher = hasCondition(boolLiteral(equals(true)))) 3420 if (true) {} 3421 </pre></td></tr> 3422 3423 3424 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>></td><td class="name" onclick="toggle('hasConditionVariableStatement0')"><a name="hasConditionVariableStatement0Anchor">hasConditionVariableStatement</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>> InnerMatcher</td></tr> 3425 <tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement. 3426 3427 Given 3428 if (A* a = GetAPointer()) {} 3429 hasConditionVariableStatement(...) 3430 matches 'A* a = GetAPointer()'. 3431 </pre></td></tr> 3432 3433 3434 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>></td><td class="name" onclick="toggle('hasElse0')"><a name="hasElse0Anchor">hasElse</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 3435 <tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement. 3436 3437 Examples matches the if statement 3438 (matcher = ifStmt(hasElse(boolLiteral(equals(true))))) 3439 if (false) false; else true; 3440 </pre></td></tr> 3441 3442 3443 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>></td><td class="name" onclick="toggle('hasThen0')"><a name="hasThen0Anchor">hasThen</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 3444 <tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement. 3445 3446 Examples matches the if statement 3447 (matcher = ifStmt(hasThen(boolLiteral(equals(true))))) 3448 if (false) true; else false; 3449 </pre></td></tr> 3450 3451 3452 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ImplicitCastExpr.html">ImplicitCastExpr</a>></td><td class="name" onclick="toggle('hasImplicitDestinationType0')"><a name="hasImplicitDestinationType0Anchor">hasImplicitDestinationType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3453 <tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given 3454 matcher. 3455 3456 FIXME: Unit test this matcher 3457 </pre></td></tr> 3458 3459 3460 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>></td><td class="name" onclick="toggle('hasDeclaration9')"><a name="hasDeclaration9Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3461 <tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node 3462 matches the given matcher. 3463 3464 The associated declaration is: 3465 - for type nodes, the declaration of the underlying type 3466 - for CallExpr, the declaration of the callee 3467 - for MemberExpr, the declaration of the referenced member 3468 - for CXXConstructExpr, the declaration of the constructor 3469 3470 Also usable as Matcher<T> for any T supporting the getDecl() member 3471 function. e.g. various subtypes of clang::Type and various expressions. 3472 3473 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3474 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3475 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3476 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3477 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3478 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3479 </pre></td></tr> 3480 3481 3482 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>></td><td class="name" onclick="toggle('hasDeclaration8')"><a name="hasDeclaration8Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3483 <tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node 3484 matches the given matcher. 3485 3486 The associated declaration is: 3487 - for type nodes, the declaration of the underlying type 3488 - for CallExpr, the declaration of the callee 3489 - for MemberExpr, the declaration of the referenced member 3490 - for CXXConstructExpr, the declaration of the constructor 3491 3492 Also usable as Matcher<T> for any T supporting the getDecl() member 3493 function. e.g. various subtypes of clang::Type and various expressions. 3494 3495 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3496 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3497 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3498 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3499 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3500 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3501 </pre></td></tr> 3502 3503 3504 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>></td><td class="name" onclick="toggle('hasDeclaration7')"><a name="hasDeclaration7Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3505 <tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node 3506 matches the given matcher. 3507 3508 The associated declaration is: 3509 - for type nodes, the declaration of the underlying type 3510 - for CallExpr, the declaration of the callee 3511 - for MemberExpr, the declaration of the referenced member 3512 - for CXXConstructExpr, the declaration of the constructor 3513 3514 Also usable as Matcher<T> for any T supporting the getDecl() member 3515 function. e.g. various subtypes of clang::Type and various expressions. 3516 3517 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3518 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3519 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3520 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3521 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3522 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3523 </pre></td></tr> 3524 3525 3526 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>></td><td class="name" onclick="toggle('hasObjectExpression0')"><a name="hasObjectExpression0Anchor">hasObjectExpression</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3527 <tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is 3528 matched by a given matcher. 3529 3530 Given 3531 struct X { int m; }; 3532 void f(X x) { x.m; m; } 3533 memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X"))))))) 3534 matches "x.m" and "m" 3535 with hasObjectExpression(...) 3536 matching "x" and the implicit object expression of "m" which has type X*. 3537 </pre></td></tr> 3538 3539 3540 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>></td><td class="name" onclick="toggle('member0')"><a name="member0Anchor">member</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>> InnerMatcher</td></tr> 3541 <tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a 3542 given matcher. 3543 3544 Given 3545 struct { int first, second; } first, second; 3546 int i(second.first); 3547 int j(first.second); 3548 memberExpr(member(hasName("first"))) 3549 matches second.first 3550 but not first.second (because the member name there is "second"). 3551 </pre></td></tr> 3552 3553 3554 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerTypeLoc.html">MemberPointerTypeLoc</a>></td><td class="name" onclick="toggle('pointeeLoc1')"><a name="pointeeLoc1Anchor">pointeeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td></tr> 3555 <tr><td colspan="4" class="doc" id="pointeeLoc1"><pre>Narrows PointerType (and similar) matchers to those where the 3556 pointee matches a given matcher. 3557 3558 Given 3559 int *a; 3560 int const *b; 3561 float const *f; 3562 pointerType(pointee(isConstQualified(), isInteger())) 3563 matches "int const *b" 3564 3565 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>>, 3566 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>> 3567 </pre></td></tr> 3568 3569 3570 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>></td><td class="name" onclick="toggle('pointee1')"><a name="pointee1Anchor">pointee</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td></tr> 3571 <tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the 3572 pointee matches a given matcher. 3573 3574 Given 3575 int *a; 3576 int const *b; 3577 float const *f; 3578 pointerType(pointee(isConstQualified(), isInteger())) 3579 matches "int const *b" 3580 3581 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>>, 3582 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>> 3583 </pre></td></tr> 3584 3585 3586 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>></td><td class="name" onclick="toggle('hasPrefix1')"><a name="hasPrefix1Anchor">hasPrefix</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>> InnerMatcher</td></tr> 3587 <tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc. 3588 3589 Given 3590 struct A { struct B { struct C {}; }; }; 3591 A::B::C c; 3592 nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A"))))) 3593 matches "A::" 3594 </pre></td></tr> 3595 3596 3597 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>></td><td class="name" onclick="toggle('specifiesTypeLoc0')"><a name="specifiesTypeLoc0Anchor">specifiesTypeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>> InnerMatcher</td></tr> 3598 <tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the 3599 given TypeLoc. 3600 3601 Given 3602 struct A { struct B { struct C {}; }; }; 3603 A::B::C c; 3604 nestedNameSpecifierLoc(specifiesTypeLoc(loc(type( 3605 hasDeclaration(recordDecl(hasName("A"))))))) 3606 matches "A::" 3607 </pre></td></tr> 3608 3609 3610 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>></td><td class="name" onclick="toggle('hasPrefix0')"><a name="hasPrefix0Anchor">hasPrefix</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>> InnerMatcher</td></tr> 3611 <tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier. 3612 3613 Given 3614 struct A { struct B { struct C {}; }; }; 3615 A::B::C c; 3616 nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and 3617 matches "A::" 3618 </pre></td></tr> 3619 3620 3621 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>></td><td class="name" onclick="toggle('specifiesNamespace0')"><a name="specifiesNamespace0Anchor">specifiesNamespace</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>> InnerMatcher</td></tr> 3622 <tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the 3623 given namespace matcher. 3624 3625 Given 3626 namespace ns { struct A {}; } 3627 ns::A a; 3628 nestedNameSpecifier(specifiesNamespace(hasName("ns"))) 3629 matches "ns::" 3630 </pre></td></tr> 3631 3632 3633 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>></td><td class="name" onclick="toggle('specifiesType0')"><a name="specifiesType0Anchor">specifiesType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3634 <tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the 3635 given QualType matcher without qualifiers. 3636 3637 Given 3638 struct A { struct B { struct C {}; }; }; 3639 A::B::C c; 3640 nestedNameSpecifier(specifiesType(hasDeclaration(recordDecl(hasName("A"))))) 3641 matches "A::" 3642 </pre></td></tr> 3643 3644 3645 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>></td><td class="name" onclick="toggle('innerType0')"><a name="innerType0Anchor">innerType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td></tr> 3646 <tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type. 3647 3648 Given 3649 int (*ptr_to_array)[4]; 3650 int (*ptr_to_func)(int); 3651 3652 varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches 3653 ptr_to_func but not ptr_to_array. 3654 3655 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>> 3656 </pre></td></tr> 3657 3658 3659 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerTypeLoc.html">PointerTypeLoc</a>></td><td class="name" onclick="toggle('pointeeLoc2')"><a name="pointeeLoc2Anchor">pointeeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td></tr> 3660 <tr><td colspan="4" class="doc" id="pointeeLoc2"><pre>Narrows PointerType (and similar) matchers to those where the 3661 pointee matches a given matcher. 3662 3663 Given 3664 int *a; 3665 int const *b; 3666 float const *f; 3667 pointerType(pointee(isConstQualified(), isInteger())) 3668 matches "int const *b" 3669 3670 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>>, 3671 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>> 3672 </pre></td></tr> 3673 3674 3675 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>></td><td class="name" onclick="toggle('pointee2')"><a name="pointee2Anchor">pointee</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td></tr> 3676 <tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the 3677 pointee matches a given matcher. 3678 3679 Given 3680 int *a; 3681 int const *b; 3682 float const *f; 3683 pointerType(pointee(isConstQualified(), isInteger())) 3684 matches "int const *b" 3685 3686 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>>, 3687 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>> 3688 </pre></td></tr> 3689 3690 3691 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('hasCanonicalType0')"><a name="hasCanonicalType0Anchor">hasCanonicalType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3692 <tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher. 3693 3694 Given: 3695 typedef int &int_ref; 3696 int a; 3697 int_ref b = a; 3698 3699 varDecl(hasType(qualType(referenceType()))))) will not match the 3700 declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does. 3701 </pre></td></tr> 3702 3703 3704 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('hasDeclaration6')"><a name="hasDeclaration6Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3705 <tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node 3706 matches the given matcher. 3707 3708 The associated declaration is: 3709 - for type nodes, the declaration of the underlying type 3710 - for CallExpr, the declaration of the callee 3711 - for MemberExpr, the declaration of the referenced member 3712 - for CXXConstructExpr, the declaration of the constructor 3713 3714 Also usable as Matcher<T> for any T supporting the getDecl() member 3715 function. e.g. various subtypes of clang::Type and various expressions. 3716 3717 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3718 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3719 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3720 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3721 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3722 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3723 </pre></td></tr> 3724 3725 3726 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('pointsTo1')"><a name="pointsTo1Anchor">pointsTo</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3727 <tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration. 3728 </pre></td></tr> 3729 3730 3731 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('pointsTo0')"><a name="pointsTo0Anchor">pointsTo</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3732 <tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type 3733 matches the specified matcher. 3734 3735 Example matches y->x() 3736 (matcher = callExpr(on(hasType(pointsTo(recordDecl(hasName("Y"))))))) 3737 class Y { public: void x(); }; 3738 void z() { Y *y; y->x(); } 3739 </pre></td></tr> 3740 3741 3742 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('references1')"><a name="references1Anchor">references</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3743 <tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration. 3744 </pre></td></tr> 3745 3746 3747 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('references0')"><a name="references0Anchor">references</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3748 <tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced 3749 type matches the specified matcher. 3750 3751 Example matches X &x and const X &y 3752 (matcher = varDecl(hasType(references(recordDecl(hasName("X")))))) 3753 class X { 3754 void a(X b) { 3755 X &x = b; 3756 const X &y = b; 3757 } 3758 }; 3759 </pre></td></tr> 3760 3761 3762 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>></td><td class="name" onclick="toggle('hasDeclaration5')"><a name="hasDeclaration5Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3763 <tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node 3764 matches the given matcher. 3765 3766 The associated declaration is: 3767 - for type nodes, the declaration of the underlying type 3768 - for CallExpr, the declaration of the callee 3769 - for MemberExpr, the declaration of the referenced member 3770 - for CXXConstructExpr, the declaration of the constructor 3771 3772 Also usable as Matcher<T> for any T supporting the getDecl() member 3773 function. e.g. various subtypes of clang::Type and various expressions. 3774 3775 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3776 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3777 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3778 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3779 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3780 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3781 </pre></td></tr> 3782 3783 3784 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceTypeLoc.html">ReferenceTypeLoc</a>></td><td class="name" onclick="toggle('pointeeLoc3')"><a name="pointeeLoc3Anchor">pointeeLoc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>></td></tr> 3785 <tr><td colspan="4" class="doc" id="pointeeLoc3"><pre>Narrows PointerType (and similar) matchers to those where the 3786 pointee matches a given matcher. 3787 3788 Given 3789 int *a; 3790 int const *b; 3791 float const *f; 3792 pointerType(pointee(isConstQualified(), isInteger())) 3793 matches "int const *b" 3794 3795 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>>, 3796 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>> 3797 </pre></td></tr> 3798 3799 3800 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>></td><td class="name" onclick="toggle('pointee3')"><a name="pointee3Anchor">pointee</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>></td></tr> 3801 <tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the 3802 pointee matches a given matcher. 3803 3804 Given 3805 int *a; 3806 int const *b; 3807 float const *f; 3808 pointerType(pointee(isConstQualified(), isInteger())) 3809 matches "int const *b" 3810 3811 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>>, 3812 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>> 3813 </pre></td></tr> 3814 3815 3816 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('alignOfExpr0')"><a name="alignOfExpr0Anchor">alignOfExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>> InnerMatcher</td></tr> 3817 <tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching 3818 alignof. 3819 </pre></td></tr> 3820 3821 3822 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('sizeOfExpr0')"><a name="sizeOfExpr0Anchor">sizeOfExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>> InnerMatcher</td></tr> 3823 <tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching 3824 sizeof. 3825 </pre></td></tr> 3826 3827 3828 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1SwitchStmt.html">SwitchStmt</a>></td><td class="name" onclick="toggle('forEachSwitchCase0')"><a name="forEachSwitchCase0Anchor">forEachSwitchCase</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1SwitchCase.html">SwitchCase</a>> InnerMatcher</td></tr> 3829 <tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch 3830 statement. This matcher may produce multiple matches. 3831 3832 Given 3833 switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } } 3834 switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s") 3835 matches four times, with "c" binding each of "case 1:", "case 2:", 3836 "case 3:" and "case 4:", and "s" respectively binding "switch (1)", 3837 "switch (1)", "switch (2)" and "switch (2)". 3838 </pre></td></tr> 3839 3840 3841 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>></td><td class="name" onclick="toggle('hasDeclaration4')"><a name="hasDeclaration4Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3842 <tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node 3843 matches the given matcher. 3844 3845 The associated declaration is: 3846 - for type nodes, the declaration of the underlying type 3847 - for CallExpr, the declaration of the callee 3848 - for MemberExpr, the declaration of the referenced member 3849 - for CXXConstructExpr, the declaration of the constructor 3850 3851 Also usable as Matcher<T> for any T supporting the getDecl() member 3852 function. e.g. various subtypes of clang::Type and various expressions. 3853 3854 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3855 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3856 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3857 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3858 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3859 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3860 </pre></td></tr> 3861 3862 3863 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>></td><td class="name" onclick="toggle('isExpr0')"><a name="isExpr0Anchor">isExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 3864 <tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression. 3865 3866 Given 3867 template<typename T> struct A {}; 3868 struct B { B* next; }; 3869 A<&B::next> a; 3870 templateSpecializationType(hasAnyTemplateArgument( 3871 isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next")))))))) 3872 matches the specialization A<&B::next> with fieldDecl(...) matching 3873 B::next 3874 </pre></td></tr> 3875 3876 3877 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>></td><td class="name" onclick="toggle('refersToDeclaration0')"><a name="refersToDeclaration0Anchor">refersToDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3878 <tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain 3879 declaration. 3880 3881 Given 3882 template<typename T> struct A {}; 3883 struct B { B* next; }; 3884 A<&B::next> a; 3885 classTemplateSpecializationDecl(hasAnyTemplateArgument( 3886 refersToDeclaration(fieldDecl(hasName("next")))) 3887 matches the specialization A<&B::next> with fieldDecl(...) matching 3888 B::next 3889 </pre></td></tr> 3890 3891 3892 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>></td><td class="name" onclick="toggle('refersToIntegralType0')"><a name="refersToIntegralType0Anchor">refersToIntegralType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3893 <tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that referes to an integral type. 3894 3895 Given 3896 template<int T> struct A {}; 3897 C<42> c; 3898 classTemplateSpecializationDecl( 3899 hasAnyTemplateArgument(refersToIntegralType(asString("int")))) 3900 matches the implicit instantiation of C in C<42>. 3901 </pre></td></tr> 3902 3903 3904 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>></td><td class="name" onclick="toggle('refersToType0')"><a name="refersToType0Anchor">refersToType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 3905 <tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type. 3906 3907 Given 3908 struct X {}; 3909 template<typename T> struct A {}; 3910 A<X> a; 3911 classTemplateSpecializationDecl(hasAnyTemplateArgument( 3912 refersToType(class(hasName("X"))))) 3913 matches the specialization A<X> 3914 </pre></td></tr> 3915 3916 3917 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>></td><td class="name" onclick="toggle('hasAnyTemplateArgument1')"><a name="hasAnyTemplateArgument1Anchor">hasAnyTemplateArgument</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>> InnerMatcher</td></tr> 3918 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations that have at least one 3919 TemplateArgument matching the given InnerMatcher. 3920 3921 Given 3922 template<typename T> class A {}; 3923 template<> class A<double> {}; 3924 A<int> a; 3925 classTemplateSpecializationDecl(hasAnyTemplateArgument( 3926 refersToType(asString("int")))) 3927 matches the specialization A<int> 3928 </pre></td></tr> 3929 3930 3931 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>></td><td class="name" onclick="toggle('hasDeclaration3')"><a name="hasDeclaration3Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3932 <tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node 3933 matches the given matcher. 3934 3935 The associated declaration is: 3936 - for type nodes, the declaration of the underlying type 3937 - for CallExpr, the declaration of the callee 3938 - for MemberExpr, the declaration of the referenced member 3939 - for CXXConstructExpr, the declaration of the constructor 3940 3941 Also usable as Matcher<T> for any T supporting the getDecl() member 3942 function. e.g. various subtypes of clang::Type and various expressions. 3943 3944 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3945 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3946 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3947 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3948 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3949 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3950 </pre></td></tr> 3951 3952 3953 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>></td><td class="name" onclick="toggle('hasTemplateArgument1')"><a name="hasTemplateArgument1Anchor">hasTemplateArgument</a></td><td>unsigned N, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>> InnerMatcher</td></tr> 3954 <tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations where the n'th TemplateArgument 3955 matches the given InnerMatcher. 3956 3957 Given 3958 template<typename T, typename U> class A {}; 3959 A<bool, int> b; 3960 A<int, bool> c; 3961 classTemplateSpecializationDecl(hasTemplateArgument( 3962 1, refersToType(asString("int")))) 3963 matches the specialization A<bool, int> 3964 </pre></td></tr> 3965 3966 3967 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>></td><td class="name" onclick="toggle('hasDeclaration2')"><a name="hasDeclaration2Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 3968 <tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node 3969 matches the given matcher. 3970 3971 The associated declaration is: 3972 - for type nodes, the declaration of the underlying type 3973 - for CallExpr, the declaration of the callee 3974 - for MemberExpr, the declaration of the referenced member 3975 - for CXXConstructExpr, the declaration of the constructor 3976 3977 Also usable as Matcher<T> for any T supporting the getDecl() member 3978 function. e.g. various subtypes of clang::Type and various expressions. 3979 3980 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 3981 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 3982 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 3983 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 3984 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 3985 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 3986 </pre></td></tr> 3987 3988 3989 <tr><td>Matcher<T></td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>Matcher<T> Matcher</td></tr> 3990 <tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches. 3991 3992 Generates results for each match. 3993 3994 For example, in: 3995 class A { class B {}; class C {}; }; 3996 The matcher: 3997 recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("m"))) 3998 will generate results for A, B and C. 3999 4000 Usable as: Any Matcher 4001 </pre></td></tr> 4002 4003 4004 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>></td><td class="name" onclick="toggle('hasDeclaration1')"><a name="hasDeclaration1Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 4005 <tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node 4006 matches the given matcher. 4007 4008 The associated declaration is: 4009 - for type nodes, the declaration of the underlying type 4010 - for CallExpr, the declaration of the callee 4011 - for MemberExpr, the declaration of the referenced member 4012 - for CXXConstructExpr, the declaration of the constructor 4013 4014 Also usable as Matcher<T> for any T supporting the getDecl() member 4015 function. e.g. various subtypes of clang::Type and various expressions. 4016 4017 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 4018 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 4019 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 4020 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 4021 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 4022 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 4023 </pre></td></tr> 4024 4025 4026 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>></td><td class="name" onclick="toggle('hasArgumentOfType0')"><a name="hasArgumentOfType0Anchor">hasArgumentOfType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 4027 <tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument. 4028 4029 Given 4030 int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c); 4031 unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int")) 4032 matches sizeof(a) and alignof(c) 4033 </pre></td></tr> 4034 4035 4036 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>></td><td class="name" onclick="toggle('hasUnaryOperand0')"><a name="hasUnaryOperand0Anchor">hasUnaryOperand</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 4037 <tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches. 4038 4039 Example matches true (matcher = hasUnaryOperand(boolLiteral(equals(true)))) 4040 !true 4041 </pre></td></tr> 4042 4043 4044 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>></td><td class="name" onclick="toggle('hasDeclaration0')"><a name="hasDeclaration0Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 4045 <tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node 4046 matches the given matcher. 4047 4048 The associated declaration is: 4049 - for type nodes, the declaration of the underlying type 4050 - for CallExpr, the declaration of the callee 4051 - for MemberExpr, the declaration of the referenced member 4052 - for CXXConstructExpr, the declaration of the constructor 4053 4054 Also usable as Matcher<T> for any T supporting the getDecl() member 4055 function. e.g. various subtypes of clang::Type and various expressions. 4056 4057 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, 4058 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>>, 4059 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>>, 4060 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>>, 4061 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>>, 4062 Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>> 4063 </pre></td></tr> 4064 4065 4066 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingDecl.html">UsingDecl</a>></td><td class="name" onclick="toggle('hasAnyUsingShadowDecl0')"><a name="hasAnyUsingShadowDecl0Anchor">hasAnyUsingShadowDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>> InnerMatcher</td></tr> 4067 <tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration. 4068 4069 Given 4070 namespace X { void b(); } 4071 using X::b; 4072 usingDecl(hasAnyUsingShadowDecl(hasName("b")))) 4073 matches using X::b </pre></td></tr> 4074 4075 4076 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>></td><td class="name" onclick="toggle('hasTargetDecl0')"><a name="hasTargetDecl0Anchor">hasTargetDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>> InnerMatcher</td></tr> 4077 <tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is 4078 matched by the given matcher. 4079 4080 Given 4081 namespace X { int a; void b(); } 4082 using X::a; 4083 using X::b; 4084 usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl()))) 4085 matches using X::b but not using X::a </pre></td></tr> 4086 4087 4088 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>></td><td class="name" onclick="toggle('hasType3')"><a name="hasType3Anchor">hasType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> 4089 <tr><td colspan="4" class="doc" id="hasType3"><pre>Overloaded to match the declaration of the expression's or value 4090 declaration's type. 4091 4092 In case of a value declaration (for example a variable declaration), 4093 this resolves one layer of indirection. For example, in the value 4094 declaration "X x;", recordDecl(hasName("X")) matches the declaration of X, 4095 while varDecl(hasType(recordDecl(hasName("X")))) matches the declaration 4096 of x." 4097 4098 Example matches x (matcher = expr(hasType(recordDecl(hasName("X"))))) 4099 and z (matcher = varDecl(hasType(recordDecl(hasName("X"))))) 4100 class X {}; 4101 void y(X &x) { x; X z; } 4102 4103 Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>> 4104 </pre></td></tr> 4105 4106 4107 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>></td><td class="name" onclick="toggle('hasType1')"><a name="hasType1Anchor">hasType</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 4108 <tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type 4109 matcher. 4110 4111 Example matches x (matcher = expr(hasType(recordDecl(hasName("X"))))) 4112 and z (matcher = varDecl(hasType(recordDecl(hasName("X"))))) 4113 class X {}; 4114 void y(X &x) { x; X z; } 4115 </pre></td></tr> 4116 4117 4118 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('hasInitializer0')"><a name="hasInitializer0Anchor">hasInitializer</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 4119 <tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression 4120 that matches the given matcher. 4121 4122 Example matches x (matcher = varDecl(hasInitializer(callExpr()))) 4123 bool y() { return true; } 4124 bool x = y(); 4125 </pre></td></tr> 4126 4127 4128 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VariableArrayType.html">VariableArrayType</a>></td><td class="name" onclick="toggle('hasSizeExpr0')"><a name="hasSizeExpr0Anchor">hasSizeExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 4129 <tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size 4130 expression. 4131 4132 Given 4133 void f(int b) { 4134 int a[b]; 4135 } 4136 variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to( 4137 varDecl(hasName("b"))))))) 4138 matches "int a[b]" 4139 </pre></td></tr> 4140 4141 4142 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1WhileStmt.html">WhileStmt</a>></td><td class="name" onclick="toggle('hasBody2')"><a name="hasBody2Anchor">hasBody</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>> InnerMatcher</td></tr> 4143 <tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', or 'do while' statement that has 4144 a given body. 4145 4146 Given 4147 for (;;) {} 4148 hasBody(compoundStmt()) 4149 matches 'for (;;) {}' 4150 with compoundStmt() 4151 matching '{}' 4152 </pre></td></tr> 4153 4154 4155 <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1WhileStmt.html">WhileStmt</a>></td><td class="name" onclick="toggle('hasCondition2')"><a name="hasCondition2Anchor">hasCondition</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> 4156 <tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop, 4157 or conditional operator. 4158 4159 Example matches true (matcher = hasCondition(boolLiteral(equals(true)))) 4160 if (true) {} 4161 </pre></td></tr> 4162 4163 4164 <tr><td>Matcher<internal::BindableMatcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>>></td><td class="name" onclick="toggle('loc1')"><a name="loc1Anchor">loc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>> InnerMatcher</td></tr> 4165 <tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner 4166 NestedNameSpecifier-matcher matches. 4167 </pre></td></tr> 4168 4169 4170 <tr><td>Matcher<internal::BindableMatcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>>></td><td class="name" onclick="toggle('loc0')"><a name="loc0Anchor">loc</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>> InnerMatcher</td></tr> 4171 <tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner 4172 QualType-matcher matches. 4173 </pre></td></tr> 4174 4175 <!--END_TRAVERSAL_MATCHERS --> 4176 </table> 4177 4178 </div> 4179 </body> 4180 </html> 4181 4182 4183