etc/services - sync with NetBSD-8
[minix.git] / external / bsd / llvm / dist / clang / docs / LibASTMatchersReference.html
blobe70d1ec3fac70069ae5fe7e1d31bacb50aee90b6
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;
12 td.doc {
13 display: none;
14 border-bottom: 1px solid black;
16 td.name:hover {
17 color: blue;
18 cursor: pointer;
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';
30 </script>
31 </head>
32 <body onLoad="toggle(location.hash.substring(1, location.hash.length - 6))">
34 <!--#include virtual="../menu.html.incl"-->
36 <div id="content">
38 <h1>AST Matcher Reference</h1>
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>
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>
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&lt;Stmt&gt; you can
55 find all matchers that can be used to match on Stmt nodes.</p>
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>
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>
72 <!-- ======================================================================= -->
73 <h2 id="decl-matchers">Node Matchers</h2>
74 <!-- ======================================================================= -->
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>
81 <p>For convenience, all node matchers take an arbitrary number of arguments
82 and implicitly act as allOf matchers.</p>
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>
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>
99 <table>
100 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
101 <!-- START_DECL_MATCHERS -->
103 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;</td><td class="name" onclick="toggle('ctorInitializer0')"><a name="ctorInitializer0Anchor">ctorInitializer</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;...</td></tr>
104 <tr><td colspan="4" class="doc" id="ctorInitializer0"><pre>Matches constructor initializers.
106 Examples matches i(42).
107 class C {
108 C() : i(42) {}
109 int i;
111 </pre></td></tr>
114 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('accessSpecDecl0')"><a name="accessSpecDecl0Anchor">accessSpecDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AccessSpecDecl.html">AccessSpecDecl</a>&gt;...</td></tr>
115 <tr><td colspan="4" class="doc" id="accessSpecDecl0"><pre>Matches C++ access specifier declarations.
117 Given
118 class C {
119 public:
120 int a;
122 accessSpecDecl()
123 matches 'public:'
124 </pre></td></tr>
127 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('classTemplateDecl0')"><a name="classTemplateDecl0Anchor">classTemplateDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateDecl.html">ClassTemplateDecl</a>&gt;...</td></tr>
128 <tr><td colspan="4" class="doc" id="classTemplateDecl0"><pre>Matches C++ class template declarations.
130 Example matches Z
131 template&lt;class T&gt; class Z {};
132 </pre></td></tr>
135 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('classTemplateSpecializationDecl0')"><a name="classTemplateSpecializationDecl0Anchor">classTemplateSpecializationDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;...</td></tr>
136 <tr><td colspan="4" class="doc" id="classTemplateSpecializationDecl0"><pre>Matches C++ class template specializations.
138 Given
139 template&lt;typename T&gt; class A {};
140 template&lt;&gt; class A&lt;double&gt; {};
141 A&lt;int&gt; a;
142 classTemplateSpecializationDecl()
143 matches the specializations A&lt;int&gt; and A&lt;double&gt;
144 </pre></td></tr>
147 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('constructorDecl0')"><a name="constructorDecl0Anchor">constructorDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;...</td></tr>
148 <tr><td colspan="4" class="doc" id="constructorDecl0"><pre>Matches C++ constructor declarations.
150 Example matches Foo::Foo() and Foo::Foo(int)
151 class Foo {
152 public:
153 Foo();
154 Foo(int);
155 int DoSomething();
157 </pre></td></tr>
160 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('decl0')"><a name="decl0Anchor">decl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;...</td></tr>
161 <tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations.
163 Examples matches X, C, and the friend declaration inside C;
164 void X();
165 class C {
166 friend X;
168 </pre></td></tr>
171 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('declaratorDecl0')"><a name="declaratorDecl0Anchor">declaratorDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;...</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).
175 Given
176 class X { int y; };
177 declaratorDecl()
178 matches int y.
179 </pre></td></tr>
182 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('destructorDecl0')"><a name="destructorDecl0Anchor">destructorDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDestructorDecl.html">CXXDestructorDecl</a>&gt;...</td></tr>
183 <tr><td colspan="4" class="doc" id="destructorDecl0"><pre>Matches explicit C++ destructor declarations.
185 Example matches Foo::~Foo()
186 class Foo {
187 public:
188 virtual ~Foo();
190 </pre></td></tr>
193 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('enumConstantDecl0')"><a name="enumConstantDecl0Anchor">enumConstantDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumConstantDecl.html">EnumConstantDecl</a>&gt;...</td></tr>
194 <tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants.
196 Example matches A, B, C
197 enum X {
198 A, B, C
200 </pre></td></tr>
203 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('enumDecl0')"><a name="enumDecl0Anchor">enumDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumDecl.html">EnumDecl</a>&gt;...</td></tr>
204 <tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations.
206 Example matches X
207 enum X {
208 A, B, C
210 </pre></td></tr>
213 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('fieldDecl0')"><a name="fieldDecl0Anchor">fieldDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt;...</td></tr>
214 <tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations.
216 Given
217 class X { int m; };
218 fieldDecl()
219 matches 'm'.
220 </pre></td></tr>
223 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('friendDecl0')"><a name="friendDecl0Anchor">friendDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FriendDecl.html">FriendDecl</a>&gt;...</td></tr>
224 <tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations.
226 Given
227 class X { friend void foo(); };
228 friendDecl()
229 matches 'friend void foo()'.
230 </pre></td></tr>
233 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('functionDecl0')"><a name="functionDecl0Anchor">functionDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;...</td></tr>
234 <tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations.
236 Example matches f
237 void f();
238 </pre></td></tr>
241 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('functionTemplateDecl0')"><a name="functionTemplateDecl0Anchor">functionTemplateDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionTemplateDecl.html">FunctionTemplateDecl</a>&gt;...</td></tr>
242 <tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations.
244 Example matches f
245 template&lt;class T&gt; void f(T t) {}
246 </pre></td></tr>
249 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('linkageSpecDecl0')"><a name="linkageSpecDecl0Anchor">linkageSpecDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LinkageSpecDecl.html">LinkageSpecDecl</a>&gt;...</td></tr>
250 <tr><td colspan="4" class="doc" id="linkageSpecDecl0"><pre>Matches a declaration of a linkage specification.
252 Given
253 extern "C" {}
254 linkageSpecDecl()
255 matches "extern "C" {}"
256 </pre></td></tr>
259 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('methodDecl0')"><a name="methodDecl0Anchor">methodDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;...</td></tr>
260 <tr><td colspan="4" class="doc" id="methodDecl0"><pre>Matches method declarations.
262 Example matches y
263 class X { void y(); };
264 </pre></td></tr>
267 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('namedDecl0')"><a name="namedDecl0Anchor">namedDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;...</td></tr>
268 <tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name.
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;
277 </pre></td></tr>
280 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('namespaceDecl0')"><a name="namespaceDecl0Anchor">namespaceDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>&gt;...</td></tr>
281 <tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace.
283 Given
284 namespace {}
285 namespace test {}
286 namespaceDecl()
287 matches "namespace {}" and "namespace test {}"
288 </pre></td></tr>
291 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('parmVarDecl0')"><a name="parmVarDecl0Anchor">parmVarDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt;...</td></tr>
292 <tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations.
294 Given
295 void f(int x);
296 parmVarDecl()
297 matches int x.
298 </pre></td></tr>
301 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('recordDecl0')"><a name="recordDecl0Anchor">recordDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;...</td></tr>
302 <tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches C++ class declarations.
304 Example matches X, Z
305 class X;
306 template&lt;class T&gt; class Z {};
307 </pre></td></tr>
310 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('typedefDecl0')"><a name="typedefDecl0Anchor">typedefDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefDecl.html">TypedefDecl</a>&gt;...</td></tr>
311 <tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef declarations.
313 Given
314 typedef int X;
315 typedefDecl()
316 matches "typedef int X"
317 </pre></td></tr>
320 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('unresolvedUsingValueDecl0')"><a name="unresolvedUsingValueDecl0Anchor">unresolvedUsingValueDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingValueDecl.html">UnresolvedUsingValueDecl</a>&gt;...</td></tr>
321 <tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations.
323 Given
324 template&lt;typename X&gt;
325 class C : private X {
326 using X::x;
328 unresolvedUsingValueDecl()
329 matches using X::x </pre></td></tr>
332 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('usingDecl0')"><a name="usingDecl0Anchor">usingDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingDecl.html">UsingDecl</a>&gt;...</td></tr>
333 <tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations.
335 Given
336 namespace X { int x; }
337 using X::x;
338 usingDecl()
339 matches using X::x </pre></td></tr>
342 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('usingDirectiveDecl0')"><a name="usingDirectiveDecl0Anchor">usingDirectiveDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingDirectiveDecl.html">UsingDirectiveDecl</a>&gt;...</td></tr>
343 <tr><td colspan="4" class="doc" id="usingDirectiveDecl0"><pre>Matches using namespace declarations.
345 Given
346 namespace X { int x; }
347 using namespace X;
348 usingDirectiveDecl()
349 matches using namespace X </pre></td></tr>
352 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('valueDecl0')"><a name="valueDecl0Anchor">valueDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;...</td></tr>
353 <tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value declaration.
355 Example matches A, B, C and F
356 enum X { A, B, C };
357 void F();
358 </pre></td></tr>
361 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('varDecl0')"><a name="varDecl0Anchor">varDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;...</td></tr>
362 <tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations.
364 Note: this does not match declarations of member variables, which are
365 "field" declarations in Clang parlance.
367 Example matches a
368 int a;
369 </pre></td></tr>
372 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt;</td><td class="name" onclick="toggle('nestedNameSpecifierLoc0')"><a name="nestedNameSpecifierLoc0Anchor">nestedNameSpecifierLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt;...</td></tr>
373 <tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
374 </pre></td></tr>
377 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt;</td><td class="name" onclick="toggle('nestedNameSpecifier0')"><a name="nestedNameSpecifier0Anchor">nestedNameSpecifier</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt;...</td></tr>
378 <tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers.
380 Given
381 namespace ns {
382 struct A { static void f(); };
383 void A::f() {}
384 void g() { A::f(); }
386 ns::A a;
387 nestedNameSpecifier()
388 matches "ns::" and both "A::"
389 </pre></td></tr>
392 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('qualType0')"><a name="qualType0Anchor">qualType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;...</td></tr>
393 <tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST.
394 </pre></td></tr>
397 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('CUDAKernelCallExpr0')"><a name="CUDAKernelCallExpr0Anchor">CUDAKernelCallExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CUDAKernelCallExpr.html">CUDAKernelCallExpr</a>&gt;...</td></tr>
398 <tr><td colspan="4" class="doc" id="CUDAKernelCallExpr0"><pre>Matches CUDA kernel call expression.
400 Example matches,
401 kernel&lt;&lt;&lt;i,j&gt;&gt;&gt;();
402 </pre></td></tr>
405 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('arraySubscriptExpr0')"><a name="arraySubscriptExpr0Anchor">arraySubscriptExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>&gt;...</td></tr>
406 <tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions.
408 Given
409 int i = a[1];
410 arraySubscriptExpr()
411 matches "a[1]"
412 </pre></td></tr>
415 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('asmStmt0')"><a name="asmStmt0Anchor">asmStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AsmStmt.html">AsmStmt</a>&gt;...</td></tr>
416 <tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements.
418 int i = 100;
419 __asm("mov al, 2");
420 asmStmt()
421 matches '__asm("mov al, 2")'
422 </pre></td></tr>
425 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('binaryOperator0')"><a name="binaryOperator0Anchor">binaryOperator</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;...</td></tr>
426 <tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions.
428 Example matches a || b
429 !(a || b)
430 </pre></td></tr>
433 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('bindTemporaryExpr0')"><a name="bindTemporaryExpr0Anchor">bindTemporaryExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBindTemporaryExpr.html">CXXBindTemporaryExpr</a>&gt;...</td></tr>
434 <tr><td colspan="4" class="doc" id="bindTemporaryExpr0"><pre>Matches nodes where temporaries are created.
436 Example matches FunctionTakesString(GetStringByValue())
437 (matcher = bindTemporaryExpr())
438 FunctionTakesString(GetStringByValue());
439 FunctionTakesStringByPointer(GetStringPointer());
440 </pre></td></tr>
443 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('boolLiteral0')"><a name="boolLiteral0Anchor">boolLiteral</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;...</td></tr>
444 <tr><td colspan="4" class="doc" id="boolLiteral0"><pre>Matches bool literals.
446 Example matches true
447 true
448 </pre></td></tr>
451 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('breakStmt0')"><a name="breakStmt0Anchor">breakStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BreakStmt.html">BreakStmt</a>&gt;...</td></tr>
452 <tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements.
454 Given
455 while (true) { break; }
456 breakStmt()
457 matches 'break'
458 </pre></td></tr>
461 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cStyleCastExpr0')"><a name="cStyleCastExpr0Anchor">cStyleCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CStyleCastExpr.html">CStyleCastExpr</a>&gt;...</td></tr>
462 <tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression.
464 Example: Matches (int*) 2.2f in
465 int i = (int) 2.2f;
466 </pre></td></tr>
469 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('callExpr0')"><a name="callExpr0Anchor">callExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;...</td></tr>
470 <tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions.
472 Example matches x.y() and y()
473 X x;
474 x.y();
475 y();
476 </pre></td></tr>
479 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('caseStmt0')"><a name="caseStmt0Anchor">caseStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CaseStmt.html">CaseStmt</a>&gt;...</td></tr>
480 <tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements.
482 Given
483 switch(a) { case 42: break; default: break; }
484 caseStmt()
485 matches 'case 42: break;'.
486 </pre></td></tr>
489 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('castExpr0')"><a name="castExpr0Anchor">castExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html">CastExpr</a>&gt;...</td></tr>
490 <tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST.
492 Example: castExpr() matches each of the following:
493 (int) 3;
494 const_cast&lt;Expr *&gt;(SubExpr);
495 char c = 0;
496 but does not match
497 int i = (0);
498 int k = 0;
499 </pre></td></tr>
502 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('catchStmt0')"><a name="catchStmt0Anchor">catchStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCatchStmt.html">CXXCatchStmt</a>&gt;...</td></tr>
503 <tr><td colspan="4" class="doc" id="catchStmt0"><pre>Matches catch statements.
505 try {} catch(int i) {}
506 catchStmt()
507 matches 'catch(int i)'
508 </pre></td></tr>
511 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('characterLiteral0')"><a name="characterLiteral0Anchor">characterLiteral</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;...</td></tr>
512 <tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t).
514 Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
515 though.
517 Example matches 'a', L'a'
518 char ch = 'a'; wchar_t chw = L'a';
519 </pre></td></tr>
522 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('compoundLiteralExpr0')"><a name="compoundLiteralExpr0Anchor">compoundLiteralExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;...</td></tr>
523 <tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
525 Example match: {1}, (1, 2)
526 int array[4] = {1}; vector int myvec = (vector int)(1, 2);
527 </pre></td></tr>
530 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('compoundStmt0')"><a name="compoundStmt0Anchor">compoundStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CompoundStmt.html">CompoundStmt</a>&gt;...</td></tr>
531 <tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements.
533 Example matches '{}' and '{{}}'in 'for (;;) {{}}'
534 for (;;) {{}}
535 </pre></td></tr>
538 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('conditionalOperator0')"><a name="conditionalOperator0Anchor">conditionalOperator</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>&gt;...</td></tr>
539 <tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions.
541 Example matches a ? b : c
542 (a ? b : c) + 42
543 </pre></td></tr>
546 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('constCastExpr0')"><a name="constCastExpr0Anchor">constCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstCastExpr.html">CXXConstCastExpr</a>&gt;...</td></tr>
547 <tr><td colspan="4" class="doc" id="constCastExpr0"><pre>Matches a const_cast expression.
549 Example: Matches const_cast&lt;int*&gt;(&amp;r) in
550 int n = 42;
551 const int &amp;r(n);
552 int* p = const_cast&lt;int*&gt;(&amp;r);
553 </pre></td></tr>
556 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('constructExpr0')"><a name="constructExpr0Anchor">constructExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;...</td></tr>
557 <tr><td colspan="4" class="doc" id="constructExpr0"><pre>Matches constructor call expressions (including implicit ones).
559 Example matches string(ptr, n) and ptr within arguments of f
560 (matcher = constructExpr())
561 void f(const string &amp;a, const string &amp;b);
562 char *ptr;
563 int n;
564 f(string(ptr, n), ptr);
565 </pre></td></tr>
568 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('continueStmt0')"><a name="continueStmt0Anchor">continueStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ContinueStmt.html">ContinueStmt</a>&gt;...</td></tr>
569 <tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements.
571 Given
572 while (true) { continue; }
573 continueStmt()
574 matches 'continue'
575 </pre></td></tr>
578 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('declRefExpr0')"><a name="declRefExpr0Anchor">declRefExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;...</td></tr>
579 <tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations.
581 Example matches x in if (x)
582 bool x;
583 if (x) {}
584 </pre></td></tr>
587 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('declStmt0')"><a name="declStmt0Anchor">declStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>&gt;...</td></tr>
588 <tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements.
590 Given
591 int a;
592 declStmt()
593 matches 'int a'.
594 </pre></td></tr>
597 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('defaultArgExpr0')"><a name="defaultArgExpr0Anchor">defaultArgExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDefaultArgExpr.html">CXXDefaultArgExpr</a>&gt;...</td></tr>
598 <tr><td colspan="4" class="doc" id="defaultArgExpr0"><pre>Matches the value of a default argument at the call site.
600 Example matches the CXXDefaultArgExpr placeholder inserted for the
601 default value of the second parameter in the call expression f(42)
602 (matcher = defaultArgExpr())
603 void f(int x, int y = 0);
604 f(42);
605 </pre></td></tr>
608 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('defaultStmt0')"><a name="defaultStmt0Anchor">defaultStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DefaultStmt.html">DefaultStmt</a>&gt;...</td></tr>
609 <tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements.
611 Given
612 switch(a) { case 42: break; default: break; }
613 defaultStmt()
614 matches 'default: break;'.
615 </pre></td></tr>
618 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('deleteExpr0')"><a name="deleteExpr0Anchor">deleteExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDeleteExpr.html">CXXDeleteExpr</a>&gt;...</td></tr>
619 <tr><td colspan="4" class="doc" id="deleteExpr0"><pre>Matches delete expressions.
621 Given
622 delete X;
623 deleteExpr()
624 matches 'delete X'.
625 </pre></td></tr>
628 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('doStmt0')"><a name="doStmt0Anchor">doStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DoStmt.html">DoStmt</a>&gt;...</td></tr>
629 <tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements.
631 Given
632 do {} while (true);
633 doStmt()
634 matches 'do {} while(true)'
635 </pre></td></tr>
638 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('dynamicCastExpr0')"><a name="dynamicCastExpr0Anchor">dynamicCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDynamicCastExpr.html">CXXDynamicCastExpr</a>&gt;...</td></tr>
639 <tr><td colspan="4" class="doc" id="dynamicCastExpr0"><pre>Matches a dynamic_cast expression.
641 Example:
642 dynamicCastExpr()
643 matches
644 dynamic_cast&lt;D*&gt;(&amp;b);
646 struct B { virtual ~B() {} }; struct D : B {};
647 B b;
648 D* p = dynamic_cast&lt;D*&gt;(&amp;b);
649 </pre></td></tr>
652 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('explicitCastExpr0')"><a name="explicitCastExpr0Anchor">explicitCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;...</td></tr>
653 <tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions.
655 Matches any cast expression written in user code, whether it be a
656 C-style cast, a functional-style cast, or a keyword cast.
658 Does not match implicit conversions.
660 Note: the name "explicitCast" is chosen to match Clang's terminology, as
661 Clang uses the term "cast" to apply to implicit conversions as well as to
662 actual cast expressions.
664 hasDestinationType.
666 Example: matches all five of the casts in
667 int((int)(reinterpret_cast&lt;int&gt;(static_cast&lt;int&gt;(const_cast&lt;int&gt;(42)))))
668 but does not match the implicit conversion in
669 long ell = 42;
670 </pre></td></tr>
673 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('expr0')"><a name="expr0Anchor">expr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;...</td></tr>
674 <tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions.
676 Example matches x()
677 void f() { x(); }
678 </pre></td></tr>
681 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('exprWithCleanups0')"><a name="exprWithCleanups0Anchor">exprWithCleanups</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ExprWithCleanups.html">ExprWithCleanups</a>&gt;...</td></tr>
682 <tr><td colspan="4" class="doc" id="exprWithCleanups0"><pre>Matches expressions that introduce cleanups to be run at the end
683 of the sub-expression's evaluation.
685 Example matches std::string()
686 const std::string str = std::string();
687 </pre></td></tr>
690 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('floatLiteral0')"><a name="floatLiteral0Anchor">floatLiteral</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;...</td></tr>
691 <tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes encodings, e.g.
692 1.0, 1.0f, 1.0L and 1e10.
694 Does not match implicit conversions such as
695 float a = 10;
696 </pre></td></tr>
699 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('forRangeStmt0')"><a name="forRangeStmt0Anchor">forRangeStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>&gt;...</td></tr>
700 <tr><td colspan="4" class="doc" id="forRangeStmt0"><pre>Matches range-based for statements.
702 forRangeStmt() matches 'for (auto a : i)'
703 int i[] = {1, 2, 3}; for (auto a : i);
704 for(int j = 0; j &lt; 5; ++j);
705 </pre></td></tr>
708 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('forStmt0')"><a name="forStmt0Anchor">forStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>&gt;...</td></tr>
709 <tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements.
711 Example matches 'for (;;) {}'
712 for (;;) {}
713 int i[] = {1, 2, 3}; for (auto a : i);
714 </pre></td></tr>
717 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('functionalCastExpr0')"><a name="functionalCastExpr0Anchor">functionalCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;...</td></tr>
718 <tr><td colspan="4" class="doc" id="functionalCastExpr0"><pre>Matches functional cast expressions
720 Example: Matches Foo(bar);
721 Foo f = bar;
722 Foo g = (Foo) bar;
723 Foo h = Foo(bar);
724 </pre></td></tr>
727 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('gotoStmt0')"><a name="gotoStmt0Anchor">gotoStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1GotoStmt.html">GotoStmt</a>&gt;...</td></tr>
728 <tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements.
730 Given
731 goto FOO;
732 FOO: bar();
733 gotoStmt()
734 matches 'goto FOO'
735 </pre></td></tr>
738 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('ifStmt0')"><a name="ifStmt0Anchor">ifStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;...</td></tr>
739 <tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements.
741 Example matches 'if (x) {}'
742 if (x) {}
743 </pre></td></tr>
746 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('implicitCastExpr0')"><a name="implicitCastExpr0Anchor">implicitCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ImplicitCastExpr.html">ImplicitCastExpr</a>&gt;...</td></tr>
747 <tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST.
749 This matches many different places, including function call return value
750 eliding, as well as any type conversions.
751 </pre></td></tr>
754 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('initListExpr0')"><a name="initListExpr0Anchor">initListExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InitListExpr.html">InitListExpr</a>&gt;...</td></tr>
755 <tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions.
757 Given
758 int a[] = { 1, 2 };
759 struct B { int x, y; };
760 B b = { 5, 6 };
761 initListExpr()
762 matches "{ 1, 2 }" and "{ 5, 6 }"
763 </pre></td></tr>
766 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('integerLiteral0')"><a name="integerLiteral0Anchor">integerLiteral</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;...</td></tr>
767 <tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes encodings, e.g.
768 1, 1L, 0x1 and 1U.
770 Does not match character-encoded integers such as L'a'.
771 </pre></td></tr>
774 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('labelStmt0')"><a name="labelStmt0Anchor">labelStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;...</td></tr>
775 <tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements.
777 Given
778 goto FOO;
779 FOO: bar();
780 labelStmt()
781 matches 'FOO:'
782 </pre></td></tr>
785 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('lambdaExpr0')"><a name="lambdaExpr0Anchor">lambdaExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LambdaExpr.html">LambdaExpr</a>&gt;...</td></tr>
786 <tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions.
788 Example matches [&amp;](){return 5;}
789 [&amp;](){return 5;}
790 </pre></td></tr>
793 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('materializeTemporaryExpr0')"><a name="materializeTemporaryExpr0Anchor">materializeTemporaryExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MaterializeTemporaryExpr.html">MaterializeTemporaryExpr</a>&gt;...</td></tr>
794 <tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized.
796 Example: Given
797 struct T {void func()};
798 T f();
799 void g(T);
800 materializeTemporaryExpr() matches 'f()' in these statements
801 T u(f());
802 g(f());
803 but does not match
804 f();
805 f().func();
806 </pre></td></tr>
809 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('memberCallExpr0')"><a name="memberCallExpr0Anchor">memberCallExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>&gt;...</td></tr>
810 <tr><td colspan="4" class="doc" id="memberCallExpr0"><pre>Matches member call expressions.
812 Example matches x.y()
813 X x;
814 x.y();
815 </pre></td></tr>
818 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('memberExpr0')"><a name="memberExpr0Anchor">memberExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;...</td></tr>
819 <tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions.
821 Given
822 class Y {
823 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
824 int a; static int b;
826 memberExpr()
827 matches this-&gt;x, x, y.x, a, this-&gt;b
828 </pre></td></tr>
831 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('newExpr0')"><a name="newExpr0Anchor">newExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;...</td></tr>
832 <tr><td colspan="4" class="doc" id="newExpr0"><pre>Matches new expressions.
834 Given
835 new X;
836 newExpr()
837 matches 'new X'.
838 </pre></td></tr>
841 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('nullPtrLiteralExpr0')"><a name="nullPtrLiteralExpr0Anchor">nullPtrLiteralExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNullPtrLiteralExpr.html">CXXNullPtrLiteralExpr</a>&gt;...</td></tr>
842 <tr><td colspan="4" class="doc" id="nullPtrLiteralExpr0"><pre>Matches nullptr literal.
843 </pre></td></tr>
846 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('nullStmt0')"><a name="nullStmt0Anchor">nullStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NullStmt.html">NullStmt</a>&gt;...</td></tr>
847 <tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements.
849 foo();;
850 nullStmt()
851 matches the second ';'
852 </pre></td></tr>
855 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('operatorCallExpr0')"><a name="operatorCallExpr0Anchor">operatorCallExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;...</td></tr>
856 <tr><td colspan="4" class="doc" id="operatorCallExpr0"><pre>Matches overloaded operator calls.
858 Note that if an operator isn't overloaded, it won't match. Instead, use
859 binaryOperator matcher.
860 Currently it does not match operators such as new delete.
861 FIXME: figure out why these do not match?
863 Example matches both operator&lt;&lt;((o &lt;&lt; b), c) and operator&lt;&lt;(o, b)
864 (matcher = operatorCallExpr())
865 ostream &amp;operator&lt;&lt; (ostream &amp;out, int i) { };
866 ostream &amp;o; int b = 1, c = 1;
867 o &lt;&lt; b &lt;&lt; c;
868 </pre></td></tr>
871 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('reinterpretCastExpr0')"><a name="reinterpretCastExpr0Anchor">reinterpretCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXReinterpretCastExpr.html">CXXReinterpretCastExpr</a>&gt;...</td></tr>
872 <tr><td colspan="4" class="doc" id="reinterpretCastExpr0"><pre>Matches a reinterpret_cast expression.
874 Either the source expression or the destination type can be matched
875 using has(), but hasDestinationType() is more specific and can be
876 more readable.
878 Example matches reinterpret_cast&lt;char*&gt;(&amp;p) in
879 void* p = reinterpret_cast&lt;char*&gt;(&amp;p);
880 </pre></td></tr>
883 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('returnStmt0')"><a name="returnStmt0Anchor">returnStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReturnStmt.html">ReturnStmt</a>&gt;...</td></tr>
884 <tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements.
886 Given
887 return 1;
888 returnStmt()
889 matches 'return 1'
890 </pre></td></tr>
893 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('staticCastExpr0')"><a name="staticCastExpr0Anchor">staticCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXStaticCastExpr.html">CXXStaticCastExpr</a>&gt;...</td></tr>
894 <tr><td colspan="4" class="doc" id="staticCastExpr0"><pre>Matches a C++ static_cast expression.
896 hasDestinationType
897 reinterpretCast
899 Example:
900 staticCastExpr()
901 matches
902 static_cast&lt;long&gt;(8)
904 long eight(static_cast&lt;long&gt;(8));
905 </pre></td></tr>
908 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('stmt0')"><a name="stmt0Anchor">stmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;...</td></tr>
909 <tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements.
911 Given
912 { ++a; }
913 stmt()
914 matches both the compound statement '{ ++a; }' and '++a'.
915 </pre></td></tr>
918 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('stringLiteral0')"><a name="stringLiteral0Anchor">stringLiteral</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1StringLiteral.html">StringLiteral</a>&gt;...</td></tr>
919 <tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
921 Example matches "abcd", L"abcd"
922 char *s = "abcd"; wchar_t *ws = L"abcd"
923 </pre></td></tr>
926 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('substNonTypeTemplateParmExpr0')"><a name="substNonTypeTemplateParmExpr0Anchor">substNonTypeTemplateParmExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1SubstNonTypeTemplateParmExpr.html">SubstNonTypeTemplateParmExpr</a>&gt;...</td></tr>
927 <tr><td colspan="4" class="doc" id="substNonTypeTemplateParmExpr0"><pre>Matches substitutions of non-type template parameters.
929 Given
930 template &lt;int N&gt;
931 struct A { static const int n = N; };
932 struct B : public A&lt;42&gt; {};
933 substNonTypeTemplateParmExpr()
934 matches "N" in the right-hand side of "static const int n = N;"
935 </pre></td></tr>
938 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('switchCase0')"><a name="switchCase0Anchor">switchCase</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1SwitchCase.html">SwitchCase</a>&gt;...</td></tr>
939 <tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements.
941 Given
942 switch(a) { case 42: break; default: break; }
943 switchCase()
944 matches 'case 42: break;' and 'default: break;'.
945 </pre></td></tr>
948 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('switchStmt0')"><a name="switchStmt0Anchor">switchStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1SwitchStmt.html">SwitchStmt</a>&gt;...</td></tr>
949 <tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements.
951 Given
952 switch(a) { case 42: break; default: break; }
953 switchStmt()
954 matches 'switch(a)'.
955 </pre></td></tr>
958 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('temporaryObjectExpr0')"><a name="temporaryObjectExpr0Anchor">temporaryObjectExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;...</td></tr>
959 <tr><td colspan="4" class="doc" id="temporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments
961 Example: Matches Foo(bar, bar)
962 Foo h = Foo(bar, bar);
963 </pre></td></tr>
966 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('thisExpr0')"><a name="thisExpr0Anchor">thisExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXThisExpr.html">CXXThisExpr</a>&gt;...</td></tr>
967 <tr><td colspan="4" class="doc" id="thisExpr0"><pre>Matches implicit and explicit this expressions.
969 Example matches the implicit this expression in "return i".
970 (matcher = thisExpr())
971 struct foo {
972 int i;
973 int f() { return i; }
975 </pre></td></tr>
978 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('throwExpr0')"><a name="throwExpr0Anchor">throwExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXThrowExpr.html">CXXThrowExpr</a>&gt;...</td></tr>
979 <tr><td colspan="4" class="doc" id="throwExpr0"><pre>Matches throw expressions.
981 try { throw 5; } catch(int i) {}
982 throwExpr()
983 matches 'throw 5'
984 </pre></td></tr>
987 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('tryStmt0')"><a name="tryStmt0Anchor">tryStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXTryStmt.html">CXXTryStmt</a>&gt;...</td></tr>
988 <tr><td colspan="4" class="doc" id="tryStmt0"><pre>Matches try statements.
990 try {} catch(int i) {}
991 tryStmt()
992 matches 'try {}'
993 </pre></td></tr>
996 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('unaryExprOrTypeTraitExpr0')"><a name="unaryExprOrTypeTraitExpr0Anchor">unaryExprOrTypeTraitExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;...</td></tr>
997 <tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
999 Given
1000 Foo x = bar;
1001 int y = sizeof(x) + alignof(x);
1002 unaryExprOrTypeTraitExpr()
1003 matches sizeof(x) and alignof(x)
1004 </pre></td></tr>
1007 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('unaryOperator0')"><a name="unaryOperator0Anchor">unaryOperator</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;...</td></tr>
1008 <tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions.
1010 Example matches !a
1011 !a || b
1012 </pre></td></tr>
1015 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('unresolvedConstructExpr0')"><a name="unresolvedConstructExpr0Anchor">unresolvedConstructExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;...</td></tr>
1016 <tr><td colspan="4" class="doc" id="unresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions.
1018 Example matches T(t) in return statement of f
1019 (matcher = unresolvedConstructExpr())
1020 template &lt;typename T&gt;
1021 void f(const T&amp; t) { return T(t); }
1022 </pre></td></tr>
1025 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('userDefinedLiteral0')"><a name="userDefinedLiteral0Anchor">userDefinedLiteral</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UserDefinedLiteral.html">UserDefinedLiteral</a>&gt;...</td></tr>
1026 <tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call.
1028 Example match: "foo"_suffix
1029 </pre></td></tr>
1032 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('whileStmt0')"><a name="whileStmt0Anchor">whileStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1WhileStmt.html">WhileStmt</a>&gt;...</td></tr>
1033 <tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements.
1035 Given
1036 while (true) {}
1037 whileStmt()
1038 matches 'while (true) {}'.
1039 </pre></td></tr>
1042 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;</td><td class="name" onclick="toggle('templateArgument0')"><a name="templateArgument0Anchor">templateArgument</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;...</td></tr>
1043 <tr><td colspan="4" class="doc" id="templateArgument0"><pre>Matches template arguments.
1045 Given
1046 template &lt;typename T&gt; struct C {};
1047 C&lt;int&gt; c;
1048 templateArgument()
1049 matches 'int' in C&lt;int&gt;.
1050 </pre></td></tr>
1053 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('typeLoc0')"><a name="typeLoc0Anchor">typeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;...</td></tr>
1054 <tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST.
1055 </pre></td></tr>
1058 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('arrayType0')"><a name="arrayType0Anchor">arrayType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;...</td></tr>
1059 <tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays.
1061 Given
1062 int a[] = { 2, 3 };
1063 int b[4];
1064 void f() { int c[a[0]]; }
1065 arrayType()
1066 matches "int a[]", "int b[4]" and "int c[a[0]]";
1067 </pre></td></tr>
1070 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('atomicType0')"><a name="atomicType0Anchor">atomicType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;...</td></tr>
1071 <tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types.
1073 Given
1074 _Atomic(int) i;
1075 atomicType()
1076 matches "_Atomic(int) i"
1077 </pre></td></tr>
1080 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('autoType0')"><a name="autoType0Anchor">autoType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;...</td></tr>
1081 <tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types.
1083 Given:
1084 auto n = 4;
1085 int v[] = { 2, 3 }
1086 for (auto i : v) { }
1087 autoType()
1088 matches "auto n" and "auto i"
1089 </pre></td></tr>
1092 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('blockPointerType0')"><a name="blockPointerType0Anchor">blockPointerType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;...</td></tr>
1093 <tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as
1094 "void (^)(int)".
1096 The pointee is always required to be a FunctionType.
1097 </pre></td></tr>
1100 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('builtinType0')"><a name="builtinType0Anchor">builtinType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BuiltinType.html">BuiltinType</a>&gt;...</td></tr>
1101 <tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types.
1103 Given
1104 struct A {};
1105 A a;
1106 int b;
1107 float c;
1108 bool d;
1109 builtinType()
1110 matches "int b", "float c" and "bool d"
1111 </pre></td></tr>
1114 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('complexType0')"><a name="complexType0Anchor">complexType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;...</td></tr>
1115 <tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types.
1117 Given
1118 _Complex float f;
1119 complexType()
1120 matches "_Complex float f"
1121 </pre></td></tr>
1124 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('constantArrayType0')"><a name="constantArrayType0Anchor">constantArrayType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ConstantArrayType.html">ConstantArrayType</a>&gt;...</td></tr>
1125 <tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size.
1127 Given
1128 void() {
1129 int a[2];
1130 int b[] = { 2, 3 };
1131 int c[b[0]];
1133 constantArrayType()
1134 matches "int a[2]"
1135 </pre></td></tr>
1138 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('dependentSizedArrayType0')"><a name="dependentSizedArrayType0Anchor">dependentSizedArrayType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DependentSizedArrayType.html">DependentSizedArrayType</a>&gt;...</td></tr>
1139 <tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression.
1141 Given
1142 template&lt;typename T, int Size&gt;
1143 class array {
1144 T data[Size];
1146 dependentSizedArrayType
1147 matches "T data[Size]"
1148 </pre></td></tr>
1151 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('elaboratedType0')"><a name="elaboratedType0Anchor">elaboratedType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ElaboratedType.html">ElaboratedType</a>&gt;...</td></tr>
1152 <tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a
1153 qualified name.
1155 Given
1156 namespace N {
1157 namespace M {
1158 class D {};
1161 class C {};
1163 class C c;
1164 N::M::D d;
1166 elaboratedType() matches the type of the variable declarations of both
1167 c and d.
1168 </pre></td></tr>
1171 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('functionType0')"><a name="functionType0Anchor">functionType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionType.html">FunctionType</a>&gt;...</td></tr>
1172 <tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes.
1174 Given
1175 int (*f)(int);
1176 void g();
1177 functionType()
1178 matches "int (*f)(int)" and the type of "g".
1179 </pre></td></tr>
1182 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('incompleteArrayType0')"><a name="incompleteArrayType0Anchor">incompleteArrayType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IncompleteArrayType.html">IncompleteArrayType</a>&gt;...</td></tr>
1183 <tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size.
1185 Given
1186 int a[] = { 2, 3 };
1187 int b[42];
1188 void f(int c[]) { int d[a[0]]; };
1189 incompleteArrayType()
1190 matches "int a[]" and "int c[]"
1191 </pre></td></tr>
1194 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('lValueReferenceType0')"><a name="lValueReferenceType0Anchor">lValueReferenceType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LValueReferenceType.html">LValueReferenceType</a>&gt;...</td></tr>
1195 <tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types.
1197 Given:
1198 int *a;
1199 int &amp;b = *a;
1200 int &amp;&amp;c = 1;
1201 auto &amp;d = b;
1202 auto &amp;&amp;e = c;
1203 auto &amp;&amp;f = 2;
1204 int g = 5;
1206 lValueReferenceType() matches the types of b, d, and e. e is
1207 matched since the type is deduced as int&amp; by reference collapsing rules.
1208 </pre></td></tr>
1211 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('memberPointerType0')"><a name="memberPointerType0Anchor">memberPointerType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;...</td></tr>
1212 <tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types.
1213 Given
1214 struct A { int i; }
1215 A::* ptr = A::i;
1216 memberPointerType()
1217 matches "A::* ptr"
1218 </pre></td></tr>
1221 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('parenType0')"><a name="parenType0Anchor">parenType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;...</td></tr>
1222 <tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes.
1224 Given
1225 int (*ptr_to_array)[4];
1226 int *array_of_ptrs[4];
1228 varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
1229 array_of_ptrs.
1230 </pre></td></tr>
1233 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('pointerType0')"><a name="pointerType0Anchor">pointerType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;...</td></tr>
1234 <tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types.
1236 Given
1237 int *a;
1238 int &amp;b = *a;
1239 int c = 5;
1240 pointerType()
1241 matches "int *a"
1242 </pre></td></tr>
1245 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('rValueReferenceType0')"><a name="rValueReferenceType0Anchor">rValueReferenceType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RValueReferenceType.html">RValueReferenceType</a>&gt;...</td></tr>
1246 <tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types.
1248 Given:
1249 int *a;
1250 int &amp;b = *a;
1251 int &amp;&amp;c = 1;
1252 auto &amp;d = b;
1253 auto &amp;&amp;e = c;
1254 auto &amp;&amp;f = 2;
1255 int g = 5;
1257 rValueReferenceType() matches the types of c and f. e is not
1258 matched as it is deduced to int&amp; by reference collapsing rules.
1259 </pre></td></tr>
1262 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('recordType0')"><a name="recordType0Anchor">recordType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;...</td></tr>
1263 <tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes).
1265 Given
1266 class C {};
1267 struct S {};
1269 C c;
1270 S s;
1272 recordType() matches the type of the variable declarations of both c
1273 and s.
1274 </pre></td></tr>
1277 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('referenceType0')"><a name="referenceType0Anchor">referenceType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;...</td></tr>
1278 <tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types.
1280 Given
1281 int *a;
1282 int &amp;b = *a;
1283 int &amp;&amp;c = 1;
1284 auto &amp;d = b;
1285 auto &amp;&amp;e = c;
1286 auto &amp;&amp;f = 2;
1287 int g = 5;
1289 referenceType() matches the types of b, c, d, e, and f.
1290 </pre></td></tr>
1293 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('templateSpecializationType0')"><a name="templateSpecializationType0Anchor">templateSpecializationType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;...</td></tr>
1294 <tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types.
1296 Given
1297 template &lt;typename T&gt;
1298 class C { };
1300 template class C&lt;int&gt;; A
1301 C&lt;char&gt; var; B
1303 templateSpecializationType() matches the type of the explicit
1304 instantiation in A and the type of the variable declaration in B.
1305 </pre></td></tr>
1308 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('type0')"><a name="type0Anchor">type</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;...</td></tr>
1309 <tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST.
1310 </pre></td></tr>
1313 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('typedefType0')"><a name="typedefType0Anchor">typedefType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;...</td></tr>
1314 <tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types.
1316 Given
1317 typedef int X;
1318 typedefType()
1319 matches "typedef int X"
1320 </pre></td></tr>
1323 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('unaryTransformType0')"><a name="unaryTransformType0Anchor">unaryTransformType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryTransformType.html">UnaryTransformType</a>&gt;...</td></tr>
1324 <tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations.
1326 Given:
1327 typedef __underlying_type(T) type;
1328 unaryTransformType()
1329 matches "__underlying_type(T)"
1330 </pre></td></tr>
1333 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('variableArrayType0')"><a name="variableArrayType0Anchor">variableArrayType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VariableArrayType.html">VariableArrayType</a>&gt;...</td></tr>
1334 <tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an
1335 integer-constant-expression.
1337 Given
1338 void f() {
1339 int a[] = { 2, 3 }
1340 int b[42];
1341 int c[a[0]];
1343 variableArrayType()
1344 matches "int c[a[0]]"
1345 </pre></td></tr>
1347 <!--END_DECL_MATCHERS -->
1348 </table>
1350 <!-- ======================================================================= -->
1351 <h2 id="narrowing-matchers">Narrowing Matchers</h2>
1352 <!-- ======================================================================= -->
1354 <p>Narrowing matchers match certain attributes on the current node, thus
1355 narrowing down the set of nodes of the current type to match on.</p>
1357 <p>There are special logical narrowing matchers (allOf, anyOf, anything and unless)
1358 which allow users to create more powerful match expressions.</p>
1360 <table>
1361 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
1362 <!-- START_NARROWING_MATCHERS -->
1364 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('allOf0')"><a name="allOf0Anchor">allOf</a></td><td>Matcher&lt;*&gt;, ..., Matcher&lt;*&gt;</td></tr>
1365 <tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match.
1367 Usable as: Any Matcher
1368 </pre></td></tr>
1371 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anyOf0')"><a name="anyOf0Anchor">anyOf</a></td><td>Matcher&lt;*&gt;, ..., Matcher&lt;*&gt;</td></tr>
1372 <tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches.
1374 Usable as: Any Matcher
1375 </pre></td></tr>
1378 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr>
1379 <tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node.
1381 Useful when another matcher requires a child matcher, but there's no
1382 additional constraint. This will often be used with an explicit conversion
1383 to an internal::Matcher&lt;&gt; type such as TypeMatcher.
1385 Example: DeclarationMatcher(anything()) matches all declarations, e.g.,
1386 "int* p" and "void f()" in
1387 int* p;
1388 void f();
1390 Usable as: Any Matcher
1391 </pre></td></tr>
1394 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher&lt;*&gt;</td></tr>
1395 <tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match.
1397 Example matches Y (matcher = recordDecl(unless(hasName("X"))))
1398 class X {};
1399 class Y {};
1401 Usable as: Any Matcher
1402 </pre></td></tr>
1405 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperatorName0')"><a name="hasOperatorName0Anchor">hasOperatorName</a></td><td>std::string Name</td></tr>
1406 <tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions (binary or
1407 unary).
1409 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
1410 !(a || b)
1411 </pre></td></tr>
1414 <tr><td>Matcher&lt;CXXBoolLiteral&gt;</td><td class="name" onclick="toggle('equals2')"><a name="equals2Anchor">equals</a></td><td>ValueT Value</td></tr>
1415 <tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value.
1417 Example matches true (matcher = boolLiteral(equals(true)))
1418 true
1420 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
1421 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
1422 </pre></td></tr>
1425 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountIs1')"><a name="argumentCountIs1Anchor">argumentCountIs</a></td><td>unsigned N</td></tr>
1426 <tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has
1427 a specific number of arguments (including absent default arguments).
1429 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
1430 void f(int x, int y);
1431 f(0, 0);
1432 </pre></td></tr>
1435 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('isListInitialization0')"><a name="isListInitialization0Anchor">isListInitialization</a></td><td></td></tr>
1436 <tr><td colspan="4" class="doc" id="isListInitialization0"><pre>Matches a constructor call expression which uses list initialization.
1437 </pre></td></tr>
1440 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;</td><td class="name" onclick="toggle('isWritten0')"><a name="isWritten0Anchor">isWritten</a></td><td></td></tr>
1441 <tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in
1442 code (as opposed to implicitly added by the compiler).
1444 Given
1445 struct Foo {
1446 Foo() { }
1447 Foo(int) : foo_("A") { }
1448 string foo_;
1450 constructorDecl(hasAnyConstructorInitializer(isWritten()))
1451 will match Foo(int), but not Foo()
1452 </pre></td></tr>
1455 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isConst0')"><a name="isConst0Anchor">isConst</a></td><td></td></tr>
1456 <tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
1458 Given
1459 struct A {
1460 void foo() const;
1461 void bar();
1464 methodDecl(isConst()) matches A::foo() but not A::bar()
1465 </pre></td></tr>
1468 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isOverride0')"><a name="isOverride0Anchor">isOverride</a></td><td></td></tr>
1469 <tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
1471 Given
1472 class A {
1473 public:
1474 virtual void x();
1476 class B : public A {
1477 public:
1478 virtual void x();
1480 matches B::x
1481 </pre></td></tr>
1484 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isPure0')"><a name="isPure0Anchor">isPure</a></td><td></td></tr>
1485 <tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure.
1487 Given
1488 class A {
1489 public:
1490 virtual void x() = 0;
1492 matches A::x
1493 </pre></td></tr>
1496 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isVirtual0')"><a name="isVirtual0Anchor">isVirtual</a></td><td></td></tr>
1497 <tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches if the given method declaration is virtual.
1499 Given
1500 class A {
1501 public:
1502 virtual void x();
1504 matches A::x
1505 </pre></td></tr>
1508 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('hasOverloadedOperatorName1')"><a name="hasOverloadedOperatorName1Anchor">hasOverloadedOperatorName</a></td><td>StringRef Name</td></tr>
1509 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
1511 Matches overloaded operator names specified in strings without the
1512 "operator" prefix: e.g. "&lt;&lt;".
1514 Given:
1515 class A { int operator*(); };
1516 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
1517 A a;
1518 a &lt;&lt; a; &lt;-- This matches
1520 operatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the specified
1521 line and recordDecl(hasMethod(hasOverloadedOperatorName("*"))) matches
1522 the declaration of A.
1524 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
1525 </pre></td></tr>
1528 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isDerivedFrom1')"><a name="isDerivedFrom1Anchor">isDerivedFrom</a></td><td>StringRef BaseName</td></tr>
1529 <tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
1530 </pre></td></tr>
1533 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isExplicitTemplateSpecialization2')"><a name="isExplicitTemplateSpecialization2Anchor">isExplicitTemplateSpecialization</a></td><td></td></tr>
1534 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
1535 static member variable template instantiations.
1537 Given
1538 template&lt;typename T&gt; void A(T t) { }
1539 template&lt;&gt; void A(int N) { }
1540 functionDecl(isExplicitTemplateSpecialization())
1541 matches the specialization A&lt;int&gt;().
1543 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1544 </pre></td></tr>
1547 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isSameOrDerivedFrom1')"><a name="isSameOrDerivedFrom1Anchor">isSameOrDerivedFrom</a></td><td>StringRef BaseName</td></tr>
1548 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Overloaded method as shortcut for
1549 isSameOrDerivedFrom(hasName(...)).
1550 </pre></td></tr>
1553 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isTemplateInstantiation2')"><a name="isTemplateInstantiation2Anchor">isTemplateInstantiation</a></td><td></td></tr>
1554 <tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
1555 member variable template instantiations.
1557 Given
1558 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
1560 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
1561 recordDecl(hasName("::X"), isTemplateInstantiation())
1562 matches the template instantiation of X&lt;A&gt;.
1564 But given
1565 template &lt;typename T&gt; class X {}; class A {};
1566 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
1567 recordDecl(hasName("::X"), isTemplateInstantiation())
1568 does not match, as X&lt;A&gt; is an explicit template specialization.
1570 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1571 </pre></td></tr>
1574 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountIs0')"><a name="argumentCountIs0Anchor">argumentCountIs</a></td><td>unsigned N</td></tr>
1575 <tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
1576 a specific number of arguments (including absent default arguments).
1578 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
1579 void f(int x, int y);
1580 f(0, 0);
1581 </pre></td></tr>
1584 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;</td><td class="name" onclick="toggle('equals3')"><a name="equals3Anchor">equals</a></td><td>ValueT Value</td></tr>
1585 <tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value.
1587 Example matches true (matcher = boolLiteral(equals(true)))
1588 true
1590 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
1591 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
1592 </pre></td></tr>
1595 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('templateArgumentCountIs0')"><a name="templateArgumentCountIs0Anchor">templateArgumentCountIs</a></td><td>unsigned N</td></tr>
1596 <tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N.
1598 Given
1599 template&lt;typename T&gt; struct C {};
1600 C&lt;int&gt; c;
1601 classTemplateSpecializationDecl(templateArgumentCountIs(1))
1602 matches C&lt;int&gt;.
1603 </pre></td></tr>
1606 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CompoundStmt.html">CompoundStmt</a>&gt;</td><td class="name" onclick="toggle('statementCountIs0')"><a name="statementCountIs0Anchor">statementCountIs</a></td><td>unsigned N</td></tr>
1607 <tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
1608 child statements.
1610 Example: Given
1611 { for (;;) {} }
1612 compoundStmt(statementCountIs(0)))
1613 matches '{}'
1614 but does not match the outer compound statement.
1615 </pre></td></tr>
1618 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ConstantArrayType.html">ConstantArrayType</a>&gt;</td><td class="name" onclick="toggle('hasSize0')"><a name="hasSize0Anchor">hasSize</a></td><td>unsigned N</td></tr>
1619 <tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches ConstantArrayType nodes that have the specified size.
1621 Given
1622 int a[42];
1623 int b[2 * 21];
1624 int c[41], d[43];
1625 constantArrayType(hasSize(42))
1626 matches "int a[42]" and "int b[2 * 21]"
1627 </pre></td></tr>
1630 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>&gt;</td><td class="name" onclick="toggle('declCountIs0')"><a name="declCountIs0Anchor">declCountIs</a></td><td>unsigned N</td></tr>
1631 <tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
1632 declarations.
1634 Example: Given
1635 int a, b;
1636 int c;
1637 int d = 2, e;
1638 declCountIs(2)
1639 matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
1640 </pre></td></tr>
1643 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('equalsBoundNode1')"><a name="equalsBoundNode1Anchor">equalsBoundNode</a></td><td>std::string ID</td></tr>
1644 <tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
1646 Matches a node if it equals the node previously bound to ID.
1648 Given
1649 class X { int a; int b; };
1650 recordDecl(
1651 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
1652 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
1653 matches the class X, as a and b have the same type.
1655 Note that when multiple matches are involved via forEach* matchers,
1656 equalsBoundNodes acts as a filter.
1657 For example:
1658 compoundStmt(
1659 forEachDescendant(varDecl().bind("d")),
1660 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
1661 will trigger a match for each combination of variable declaration
1662 and reference to that variable declaration within a compound statement.
1663 </pre></td></tr>
1666 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('hasAttr0')"><a name="hasAttr0Anchor">hasAttr</a></td><td>attr::Kind AttrKind</td></tr>
1667 <tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute.
1669 Given
1670 __attribute__((device)) void f() { ... }
1671 decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
1673 </pre></td></tr>
1676 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isExpansionInFileMatching0')"><a name="isExpansionInFileMatching0Anchor">isExpansionInFileMatching</a></td><td>std::string RegExp</td></tr>
1677 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is
1678 partially matching a given regex.
1680 Example matches Y but not X
1681 (matcher = recordDecl(isExpansionInFileMatching("AST.*"))
1682 #include "ASTMatcher.h"
1683 class X {};
1684 ASTMatcher.h:
1685 class Y {};
1687 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
1688 </pre></td></tr>
1691 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isExpansionInMainFile0')"><a name="isExpansionInMainFile0Anchor">isExpansionInMainFile</a></td><td></td></tr>
1692 <tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file.
1694 Example matches X but not Y (matcher = recordDecl(isExpansionInMainFile())
1695 #include &lt;Y.h&gt;
1696 class X {};
1697 Y.h:
1698 class Y {};
1700 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
1701 </pre></td></tr>
1704 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isExpansionInSystemHeader0')"><a name="isExpansionInSystemHeader0Anchor">isExpansionInSystemHeader</a></td><td></td></tr>
1705 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files.
1707 Example matches Y but not X
1708 (matcher = recordDecl(isExpansionInSystemHeader())
1709 #include &lt;SystemHeader.h&gt;
1710 class X {};
1711 SystemHeader.h:
1712 class Y {};
1714 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
1715 </pre></td></tr>
1718 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isImplicit0')"><a name="isImplicit0Anchor">isImplicit</a></td><td></td></tr>
1719 <tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a declaration that has been implicitly added
1720 by the compiler (eg. implicit defaultcopy constructors).
1721 </pre></td></tr>
1724 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isInstantiated0')"><a name="isInstantiated0Anchor">isInstantiated</a></td><td></td></tr>
1725 <tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
1726 template instantiations.
1728 Given
1729 template&lt;typename T&gt; void A(T t) { T i; }
1730 A(0);
1731 A(0U);
1732 functionDecl(isInstantiated())
1733 matches 'A(int) {...};' and 'A(unsigned) {...}'.
1734 </pre></td></tr>
1737 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</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.
1740 Given
1741 class C {
1742 public: int a;
1743 protected: int b;
1744 private: int c;
1746 fieldDecl(isPrivate())
1747 matches 'int c;'
1748 </pre></td></tr>
1751 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</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.
1754 Given
1755 class C {
1756 public: int a;
1757 protected: int b;
1758 private: int c;
1760 fieldDecl(isProtected())
1761 matches 'int b;'
1762 </pre></td></tr>
1765 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</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.
1768 Given
1769 class C {
1770 public: int a;
1771 protected: int b;
1772 private: int c;
1774 fieldDecl(isPublic())
1775 matches 'int a;'
1776 </pre></td></tr>
1779 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;</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.
1782 Example matches true (matcher = boolLiteral(equals(true)))
1783 true
1785 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
1786 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
1787 </pre></td></tr>
1790 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</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.
1793 Matches overloaded operator names specified in strings without the
1794 "operator" prefix: e.g. "&lt;&lt;".
1796 Given:
1797 class A { int operator*(); };
1798 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
1799 A a;
1800 a &lt;&lt; a; &lt;-- This matches
1802 operatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the specified
1803 line and recordDecl(hasMethod(hasOverloadedOperatorName("*"))) matches
1804 the declaration of A.
1806 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
1807 </pre></td></tr>
1810 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</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.
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.
1821 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
1822 </pre></td></tr>
1825 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</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.
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>
1836 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</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.
1840 Given
1841 template&lt;typename T&gt; void A(T t) { }
1842 template&lt;&gt; void A(int N) { }
1843 functionDecl(isExplicitTemplateSpecialization())
1844 matches the specialization A&lt;int&gt;().
1846 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1847 </pre></td></tr>
1850 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</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.
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>
1862 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</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.
1866 Given
1867 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
1869 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
1870 recordDecl(hasName("::X"), isTemplateInstantiation())
1871 matches the template instantiation of X&lt;A&gt;.
1873 But given
1874 template &lt;typename T&gt; class X {}; class A {};
1875 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
1876 recordDecl(hasName("::X"), isTemplateInstantiation())
1877 does not match, as X&lt;A&gt; is an explicit template specialization.
1879 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1880 </pre></td></tr>
1883 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</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.
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>
1894 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;</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.
1897 Example matches true (matcher = boolLiteral(equals(true)))
1898 true
1900 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
1901 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
1902 </pre></td></tr>
1905 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;</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 '-&gt;' as opposed
1907 to '.'.
1909 Member calls on the implicit this pointer match as called with '-&gt;'.
1911 Given
1912 class Y {
1913 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
1914 int a;
1915 static int b;
1917 memberExpr(isArrow())
1918 matches this-&gt;x, x, y.x, a, this-&gt;b
1919 </pre></td></tr>
1922 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</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.
1925 Supports specifying enclosing namespaces or classes by prefixing the name
1926 with '&lt;enclosing&gt;::'.
1927 Does not match typedefs of an underlying type with the given name.
1929 Example matches X (Name == "X")
1930 class X;
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>
1937 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</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.
1941 Supports specifying enclosing namespaces or classes by
1942 prefixing the name with '&lt;enclosing&gt;::'. Does not match typedefs
1943 of an underlying type with the given name.
1945 Example matches X (regexp == "::X")
1946 class X;
1948 Example matches X (regexp is one of "::X", "^foo::.*X", among others)
1949 namespace foo { namespace bar { class X; } }
1950 </pre></td></tr>
1953 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</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.
1956 Given
1957 class Y { public: void x(); };
1958 void z() { Y* y; y-&gt;x(); }
1959 callExpr(on(hasType(asString("class Y *"))))
1960 matches y-&gt;x()
1961 </pre></td></tr>
1964 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</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.
1967 Matches a node if it equals the node previously bound to ID.
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.
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>
1987 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</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.
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>
2002 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</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.
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>
2019 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</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.
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>
2031 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</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.
2034 Matches a node if it equals the node previously bound to ID.
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.
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>
2054 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</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.
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 {};
2065 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
2066 </pre></td></tr>
2069 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</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.
2072 Example matches X but not Y (matcher = recordDecl(isExpansionInMainFile())
2073 #include &lt;Y.h&gt;
2074 class X {};
2075 Y.h:
2076 class Y {};
2078 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
2079 </pre></td></tr>
2082 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</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.
2085 Example matches Y but not X
2086 (matcher = recordDecl(isExpansionInSystemHeader())
2087 #include &lt;SystemHeader.h&gt;
2088 class X {};
2089 SystemHeader.h:
2090 class Y {};
2092 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
2093 </pre></td></tr>
2096 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('isInTemplateInstantiation0')"><a name="isInTemplateInstantiation0Anchor">isInTemplateInstantiation</a></td><td></td></tr>
2097 <tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
2099 Given
2100 int j;
2101 template&lt;typename T&gt; void A(T t) { T i; j += 42;}
2102 A(0);
2103 A(0U);
2104 declStmt(isInTemplateInstantiation())
2105 matches 'int i;' and 'unsigned i'.
2106 unless(stmt(isInTemplateInstantiation()))
2107 will NOT match j += 42; as it's shared between the template definition and
2108 instantiation.
2109 </pre></td></tr>
2112 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;</td><td class="name" onclick="toggle('isDefinition0')"><a name="isDefinition0Anchor">isDefinition</a></td><td></td></tr>
2113 <tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
2115 Example matches A, va, fa
2116 class A {};
2117 class B; Doesn't match, as it has no body.
2118 int va;
2119 extern int vb; Doesn't match, as it doesn't define the variable.
2120 void fa() {}
2121 void fb(); Doesn't match, as it has no body.
2123 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
2124 </pre></td></tr>
2127 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;</td><td class="name" onclick="toggle('equalsIntegralValue0')"><a name="equalsIntegralValue0Anchor">equalsIntegralValue</a></td><td>std::string Value</td></tr>
2128 <tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value.
2130 Note that 'Value' is a string as the template argument's value is
2131 an arbitrary precision integer. 'Value' must be euqal to the canonical
2132 representation of that integral value in base 10.
2134 Given
2135 template&lt;int T&gt; struct A {};
2136 C&lt;42&gt; c;
2137 classTemplateSpecializationDecl(
2138 hasAnyTemplateArgument(equalsIntegralValue("42")))
2139 matches the implicit instantiation of C in C&lt;42&gt;.
2140 </pre></td></tr>
2143 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;</td><td class="name" onclick="toggle('isIntegral0')"><a name="isIntegral0Anchor">isIntegral</a></td><td></td></tr>
2144 <tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value.
2146 Given
2147 template&lt;int T&gt; struct A {};
2148 C&lt;42&gt; c;
2149 classTemplateSpecializationDecl(
2150 hasAnyTemplateArgument(isIntegral()))
2151 matches the implicit instantiation of C in C&lt;42&gt;
2152 with isIntegral() matching 42.
2153 </pre></td></tr>
2156 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('templateArgumentCountIs1')"><a name="templateArgumentCountIs1Anchor">templateArgumentCountIs</a></td><td>unsigned N</td></tr>
2157 <tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N.
2159 Given
2160 template&lt;typename T&gt; struct C {};
2161 C&lt;int&gt; c;
2162 classTemplateSpecializationDecl(templateArgumentCountIs(1))
2163 matches C&lt;int&gt;.
2164 </pre></td></tr>
2167 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('isExpansionInFileMatching2')"><a name="isExpansionInFileMatching2Anchor">isExpansionInFileMatching</a></td><td>std::string RegExp</td></tr>
2168 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is
2169 partially matching a given regex.
2171 Example matches Y but not X
2172 (matcher = recordDecl(isExpansionInFileMatching("AST.*"))
2173 #include "ASTMatcher.h"
2174 class X {};
2175 ASTMatcher.h:
2176 class Y {};
2178 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
2179 </pre></td></tr>
2182 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('isExpansionInMainFile2')"><a name="isExpansionInMainFile2Anchor">isExpansionInMainFile</a></td><td></td></tr>
2183 <tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file.
2185 Example matches X but not Y (matcher = recordDecl(isExpansionInMainFile())
2186 #include &lt;Y.h&gt;
2187 class X {};
2188 Y.h:
2189 class Y {};
2191 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
2192 </pre></td></tr>
2195 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('isExpansionInSystemHeader2')"><a name="isExpansionInSystemHeader2Anchor">isExpansionInSystemHeader</a></td><td></td></tr>
2196 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files.
2198 Example matches Y but not X
2199 (matcher = recordDecl(isExpansionInSystemHeader())
2200 #include &lt;SystemHeader.h&gt;
2201 class X {};
2202 SystemHeader.h:
2203 class Y {};
2205 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
2206 </pre></td></tr>
2209 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('equalsBoundNode2')"><a name="equalsBoundNode2Anchor">equalsBoundNode</a></td><td>std::string ID</td></tr>
2210 <tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
2212 Matches a node if it equals the node previously bound to ID.
2214 Given
2215 class X { int a; int b; };
2216 recordDecl(
2217 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
2218 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
2219 matches the class X, as a and b have the same type.
2221 Note that when multiple matches are involved via forEach* matchers,
2222 equalsBoundNodes acts as a filter.
2223 For example:
2224 compoundStmt(
2225 forEachDescendant(varDecl().bind("d")),
2226 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
2227 will trigger a match for each combination of variable declaration
2228 and reference to that variable declaration within a compound statement.
2229 </pre></td></tr>
2232 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;</td><td class="name" onclick="toggle('ofKind0')"><a name="ofKind0Anchor">ofKind</a></td><td>UnaryExprOrTypeTrait Kind</td></tr>
2233 <tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
2235 Given
2236 int x;
2237 int s = sizeof(x) + alignof(x)
2238 unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
2239 matches sizeof(x)
2240 </pre></td></tr>
2243 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperatorName1')"><a name="hasOperatorName1Anchor">hasOperatorName</a></td><td>std::string Name</td></tr>
2244 <tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or
2245 unary).
2247 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
2248 !(a || b)
2249 </pre></td></tr>
2252 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('hasGlobalStorage0')"><a name="hasGlobalStorage0Anchor">hasGlobalStorage</a></td><td></td></tr>
2253 <tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
2255 Example matches y and z (matcher = varDecl(hasGlobalStorage())
2256 void f() {
2257 int x;
2258 static int y;
2260 int z;
2261 </pre></td></tr>
2264 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('hasLocalStorage0')"><a name="hasLocalStorage0Anchor">hasLocalStorage</a></td><td></td></tr>
2265 <tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a
2266 non-static local variable.
2268 Example matches x (matcher = varDecl(hasLocalStorage())
2269 void f() {
2270 int x;
2271 static int y;
2273 int z;
2274 </pre></td></tr>
2277 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isDefinition1')"><a name="isDefinition1Anchor">isDefinition</a></td><td></td></tr>
2278 <tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
2280 Example matches A, va, fa
2281 class A {};
2282 class B; Doesn't match, as it has no body.
2283 int va;
2284 extern int vb; Doesn't match, as it doesn't define the variable.
2285 void fa() {}
2286 void fb(); Doesn't match, as it has no body.
2288 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
2289 </pre></td></tr>
2292 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isExplicitTemplateSpecialization1')"><a name="isExplicitTemplateSpecialization1Anchor">isExplicitTemplateSpecialization</a></td><td></td></tr>
2293 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
2294 static member variable template instantiations.
2296 Given
2297 template&lt;typename T&gt; void A(T t) { }
2298 template&lt;&gt; void A(int N) { }
2299 functionDecl(isExplicitTemplateSpecialization())
2300 matches the specialization A&lt;int&gt;().
2302 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
2303 </pre></td></tr>
2306 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isTemplateInstantiation1')"><a name="isTemplateInstantiation1Anchor">isTemplateInstantiation</a></td><td></td></tr>
2307 <tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
2308 member variable template instantiations.
2310 Given
2311 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
2313 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
2314 recordDecl(hasName("::X"), isTemplateInstantiation())
2315 matches the template instantiation of X&lt;A&gt;.
2317 But given
2318 template &lt;typename T&gt; class X {}; class A {};
2319 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
2320 recordDecl(hasName("::X"), isTemplateInstantiation())
2321 does not match, as X&lt;A&gt; is an explicit template specialization.
2323 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
2324 </pre></td></tr>
2326 <!--END_NARROWING_MATCHERS -->
2327 </table>
2329 <!-- ======================================================================= -->
2330 <h2 id="traversal-matchers">AST Traversal Matchers</h2>
2331 <!-- ======================================================================= -->
2333 <p>Traversal matchers specify the relationship to other nodes that are
2334 reachable from the current node.</p>
2336 <p>Note that there are special traversal matchers (has, hasDescendant, forEach and
2337 forEachDescendant) which work on all nodes and allow users to write more generic
2338 match expressions.</p>
2340 <table>
2341 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
2342 <!-- START_TRAVERSAL_MATCHERS -->
2344 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('eachOf0')"><a name="eachOf0Anchor">eachOf</a></td><td>Matcher&lt;*&gt;, ..., Matcher&lt;*&gt;</td></tr>
2345 <tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
2347 Unlike anyOf, eachOf will generate a match result for each
2348 matching submatcher.
2350 For example, in:
2351 class A { int a; int b; };
2352 The matcher:
2353 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
2354 has(fieldDecl(hasName("b")).bind("v"))))
2355 will generate two results binding "v", the first of which binds
2356 the field declaration of a, the second the field declaration of
2359 Usable as: Any Matcher
2360 </pre></td></tr>
2363 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
2364 <tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
2365 provided matcher.
2367 Example matches X, A, B, C
2368 (matcher = recordDecl(forEachDescendant(recordDecl(hasName("X")))))
2369 class X {}; Matches X, because X::X is a class of name X inside X.
2370 class A { class X {}; };
2371 class B { class C { class X {}; }; };
2373 DescendantT must be an AST base type.
2375 As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
2376 each result that matches instead of only on the first one.
2378 Note: Recursively combined ForEachDescendant can cause many matches:
2379 recordDecl(forEachDescendant(recordDecl(forEachDescendant(recordDecl()))))
2380 will match 10 times (plus injected class name matches) on:
2381 class A { class B { class C { class D { class E {}; }; }; }; };
2383 Usable as: Any Matcher
2384 </pre></td></tr>
2387 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
2388 <tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
2389 provided matcher.
2391 Example matches X, Y (matcher = recordDecl(forEach(recordDecl(hasName("X")))
2392 class X {}; Matches X, because X::X is a class of name X inside X.
2393 class Y { class X {}; };
2394 class Z { class Y { class X {}; }; }; Does not match Z.
2396 ChildT must be an AST base type.
2398 As opposed to 'has', 'forEach' will cause a match for each result that
2399 matches instead of only on the first one.
2401 Usable as: Any Matcher
2402 </pre></td></tr>
2405 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
2406 <tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
2407 matcher.
2409 Given
2410 void f() { if (true) { int x = 42; } }
2411 void g() { for (;;) { int x = 43; } }
2412 expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
2414 Usable as: Any Matcher
2415 </pre></td></tr>
2418 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
2419 <tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
2420 provided matcher.
2422 Example matches X, Y, Z
2423 (matcher = recordDecl(hasDescendant(recordDecl(hasName("X")))))
2424 class X {}; Matches X, because X::X is a class of name X inside X.
2425 class Y { class X {}; };
2426 class Z { class Y { class X {}; }; };
2428 DescendantT must be an AST base type.
2430 Usable as: Any Matcher
2431 </pre></td></tr>
2434 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
2435 <tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
2436 provided matcher.
2438 Example matches X, Y (matcher = recordDecl(has(recordDecl(hasName("X")))
2439 class X {}; Matches X, because X::X is a class of name X inside X.
2440 class Y { class X {}; };
2441 class Z { class Y { class X {}; }; }; Does not match Z.
2443 ChildT must be an AST base type.
2445 Usable as: Any Matcher
2446 </pre></td></tr>
2449 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
2450 <tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
2451 matcher.
2453 Given
2454 void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
2455 compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
2457 Usable as: Any Matcher
2458 </pre></td></tr>
2461 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>&gt;</td><td class="name" onclick="toggle('hasBase0')"><a name="hasBase0Anchor">hasBase</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2462 <tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
2464 Given
2465 int i[5];
2466 void f() { i[1] = 42; }
2467 arraySubscriptExpression(hasBase(implicitCastExpr(
2468 hasSourceExpression(declRefExpr()))))
2469 matches i[1] with the declRefExpr() matching i
2470 </pre></td></tr>
2473 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>&gt;</td><td class="name" onclick="toggle('hasIndex0')"><a name="hasIndex0Anchor">hasIndex</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2474 <tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
2476 Given
2477 int i[5];
2478 void f() { i[1] = 42; }
2479 arraySubscriptExpression(hasIndex(integerLiteral()))
2480 matches i[1] with the integerLiteral() matching 1
2481 </pre></td></tr>
2484 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayTypeLoc.html">ArrayTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasElementTypeLoc0')"><a name="hasElementTypeLoc0Anchor">hasElementTypeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
2485 <tr><td colspan="4" class="doc" id="hasElementTypeLoc0"><pre>Matches arrays and C99 complex types that have a specific element
2486 type.
2488 Given
2489 struct A {};
2490 A a[7];
2491 int b[7];
2492 arrayType(hasElementType(builtinType()))
2493 matches "int b[7]"
2495 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
2496 </pre></td></tr>
2499 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;</td><td class="name" onclick="toggle('hasElementType0')"><a name="hasElementType0Anchor">hasElementType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2500 <tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
2501 type.
2503 Given
2504 struct A {};
2505 A a[7];
2506 int b[7];
2507 arrayType(hasElementType(builtinType()))
2508 matches "int b[7]"
2510 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
2511 </pre></td></tr>
2514 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicTypeLoc.html">AtomicTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasValueTypeLoc0')"><a name="hasValueTypeLoc0Anchor">hasValueTypeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
2515 <tr><td colspan="4" class="doc" id="hasValueTypeLoc0"><pre>Matches atomic types with a specific value type.
2517 Given
2518 _Atomic(int) i;
2519 _Atomic(float) f;
2520 atomicType(hasValueType(isInteger()))
2521 matches "_Atomic(int) i"
2523 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
2524 </pre></td></tr>
2527 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;</td><td class="name" onclick="toggle('hasValueType0')"><a name="hasValueType0Anchor">hasValueType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2528 <tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
2530 Given
2531 _Atomic(int) i;
2532 _Atomic(float) f;
2533 atomicType(hasValueType(isInteger()))
2534 matches "_Atomic(int) i"
2536 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
2537 </pre></td></tr>
2540 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;</td><td class="name" onclick="toggle('hasDeducedType0')"><a name="hasDeducedType0Anchor">hasDeducedType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2541 <tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
2543 Note: There is no TypeLoc for the deduced type and thus no
2544 getDeducedLoc() matcher.
2546 Given
2547 auto a = 1;
2548 auto b = 2.0;
2549 autoType(hasDeducedType(isInteger()))
2550 matches "auto a"
2552 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
2553 </pre></td></tr>
2556 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasEitherOperand0')"><a name="hasEitherOperand0Anchor">hasEitherOperand</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2557 <tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
2558 binary operator matches.
2559 </pre></td></tr>
2562 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasLHS0')"><a name="hasLHS0Anchor">hasLHS</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2563 <tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
2565 Example matches a (matcher = binaryOperator(hasLHS()))
2566 a || b
2567 </pre></td></tr>
2570 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasRHS0')"><a name="hasRHS0Anchor">hasRHS</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2571 <tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
2573 Example matches b (matcher = binaryOperator(hasRHS()))
2574 a || b
2575 </pre></td></tr>
2578 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerTypeLoc.html">BlockPointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc0')"><a name="pointeeLoc0Anchor">pointeeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
2579 <tr><td colspan="4" class="doc" id="pointeeLoc0"><pre>Narrows PointerType (and similar) matchers to those where the
2580 pointee matches a given matcher.
2582 Given
2583 int *a;
2584 int const *b;
2585 float const *f;
2586 pointerType(pointee(isConstQualified(), isInteger()))
2587 matches "int const *b"
2589 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
2590 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
2591 </pre></td></tr>
2594 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;</td><td class="name" onclick="toggle('pointee0')"><a name="pointee0Anchor">pointee</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2595 <tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
2596 pointee matches a given matcher.
2598 Given
2599 int *a;
2600 int const *b;
2601 float const *f;
2602 pointerType(pointee(isConstQualified(), isInteger()))
2603 matches "int const *b"
2605 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
2606 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
2607 </pre></td></tr>
2610 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyArgument1')"><a name="hasAnyArgument1Anchor">hasAnyArgument</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2611 <tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
2612 expression.
2614 Given
2615 void x(int, int, int) { int y; x(1, y, 42); }
2616 callExpr(hasAnyArgument(declRefExpr()))
2617 matches x(1, y, 42)
2618 with hasAnyArgument(...)
2619 matching y
2621 FIXME: Currently this will ignore parentheses and implicit casts on
2622 the argument before applying the inner matcher. We'll want to remove
2623 this to allow for greater control by the user once ignoreImplicit()
2624 has been implemented.
2625 </pre></td></tr>
2628 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('hasArgument1')"><a name="hasArgument1Anchor">hasArgument</a></td><td>unsigned N, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2629 <tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
2630 call expression.
2632 Example matches y in x(y)
2633 (matcher = callExpr(hasArgument(0, declRefExpr())))
2634 void x(int) { int y; x(y); }
2635 </pre></td></tr>
2638 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration12')"><a name="hasDeclaration12Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2639 <tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
2640 matches the given matcher.
2642 The associated declaration is:
2643 - for type nodes, the declaration of the underlying type
2644 - for CallExpr, the declaration of the callee
2645 - for MemberExpr, the declaration of the referenced member
2646 - for CXXConstructExpr, the declaration of the constructor
2648 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
2649 function. e.g. various subtypes of clang::Type and various expressions.
2651 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
2652 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
2653 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
2654 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
2655 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
2656 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
2657 </pre></td></tr>
2660 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;</td><td class="name" onclick="toggle('forEachConstructorInitializer0')"><a name="forEachConstructorInitializer0Anchor">forEachConstructorInitializer</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt; InnerMatcher</td></tr>
2661 <tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
2663 Given
2664 class A { A() : i(42), j(42) {} int i; int j; };
2665 constructorDecl(forEachConstructorInitializer(forField(decl().bind("x"))))
2666 will trigger two matches, binding for 'i' and 'j' respectively.
2667 </pre></td></tr>
2670 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyConstructorInitializer0')"><a name="hasAnyConstructorInitializer0Anchor">hasAnyConstructorInitializer</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt; InnerMatcher</td></tr>
2671 <tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
2673 Given
2674 struct Foo {
2675 Foo() : foo_(1) { }
2676 int foo_;
2678 recordDecl(has(constructorDecl(hasAnyConstructorInitializer(anything()))))
2679 record matches Foo, hasAnyConstructorInitializer matches foo_(1)
2680 </pre></td></tr>
2683 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;</td><td class="name" onclick="toggle('forField0')"><a name="forField0Anchor">forField</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt; InnerMatcher</td></tr>
2684 <tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
2686 Given
2687 struct Foo {
2688 Foo() : foo_(1) { }
2689 int foo_;
2691 recordDecl(has(constructorDecl(hasAnyConstructorInitializer(
2692 forField(hasName("foo_"))))))
2693 matches Foo
2694 with forField matching foo_
2695 </pre></td></tr>
2698 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;</td><td class="name" onclick="toggle('withInitializer0')"><a name="withInitializer0Anchor">withInitializer</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2699 <tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
2701 Given
2702 struct Foo {
2703 Foo() : foo_(1) { }
2704 int foo_;
2706 recordDecl(has(constructorDecl(hasAnyConstructorInitializer(
2707 withInitializer(integerLiteral(equals(1)))))))
2708 matches Foo
2709 with withInitializer matching (1)
2710 </pre></td></tr>
2713 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>&gt;</td><td class="name" onclick="toggle('hasBody3')"><a name="hasBody3Anchor">hasBody</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
2714 <tr><td colspan="4" class="doc" id="hasBody3"><pre>Matches a 'for', 'while', or 'do while' statement that has
2715 a given body.
2717 Given
2718 for (;;) {}
2719 hasBody(compoundStmt())
2720 matches 'for (;;) {}'
2721 with compoundStmt()
2722 matching '{}'
2723 </pre></td></tr>
2726 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>&gt;</td><td class="name" onclick="toggle('hasLoopVariable0')"><a name="hasLoopVariable0Anchor">hasLoopVariable</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt; InnerMatcher</td></tr>
2727 <tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
2729 Example:
2730 forStmt(hasLoopVariable(anything()))
2731 matches 'int x' in
2732 for (int x : a) { }
2733 </pre></td></tr>
2736 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>&gt;</td><td class="name" onclick="toggle('hasRangeInit0')"><a name="hasRangeInit0Anchor">hasRangeInit</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2737 <tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
2739 Example:
2740 forStmt(hasRangeInit(anything()))
2741 matches 'a' in
2742 for (int x : a) { }
2743 </pre></td></tr>
2746 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>&gt;</td><td class="name" onclick="toggle('onImplicitObjectArgument0')"><a name="onImplicitObjectArgument0Anchor">onImplicitObjectArgument</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2747 <tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre></pre></td></tr>
2750 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>&gt;</td><td class="name" onclick="toggle('on0')"><a name="on0Anchor">on</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2751 <tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression.
2753 Example matches y.x() (matcher = callExpr(on(hasType(recordDecl(hasName("Y"))))))
2754 class Y { public: void x(); };
2755 void z() { Y y; y.x(); }",
2757 FIXME: Overload to allow directly matching types?
2758 </pre></td></tr>
2761 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>&gt;</td><td class="name" onclick="toggle('thisPointerType1')"><a name="thisPointerType1Anchor">thisPointerType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2762 <tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
2763 </pre></td></tr>
2766 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>&gt;</td><td class="name" onclick="toggle('thisPointerType0')"><a name="thisPointerType0Anchor">thisPointerType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
2767 <tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the expression's type either matches the specified
2768 matcher, or is a pointer to a type that matches the InnerMatcher.
2769 </pre></td></tr>
2772 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('ofClass0')"><a name="ofClass0Anchor">ofClass</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt; InnerMatcher</td></tr>
2773 <tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
2774 belongs to.
2776 FIXME: Generalize this for other kinds of declarations.
2777 FIXME: What other kind of declarations would we need to generalize
2778 this to?
2780 Example matches A() in the last line
2781 (matcher = constructExpr(hasDeclaration(methodDecl(
2782 ofClass(hasName("A"))))))
2783 class A {
2784 public:
2785 A();
2787 A a = A();
2788 </pre></td></tr>
2791 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('hasMethod0')"><a name="hasMethod0Anchor">hasMethod</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt; InnerMatcher</td></tr>
2792 <tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
2794 Given:
2795 class A { void func(); };
2796 class B { void member(); };
2798 recordDecl(hasMethod(hasName("func"))) matches the declaration of A
2799 but not B.
2800 </pre></td></tr>
2803 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isDerivedFrom0')"><a name="isDerivedFrom0Anchor">isDerivedFrom</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
2804 <tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from
2805 a class matching Base.
2807 Note that a class is not considered to be derived from itself.
2809 Example matches Y, Z, C (Base == hasName("X"))
2810 class X;
2811 class Y : public X {}; directly derived
2812 class Z : public Y {}; indirectly derived
2813 typedef X A;
2814 typedef A B;
2815 class C : public B {}; derived from a typedef of X
2817 In the following example, Bar matches isDerivedFrom(hasName("X")):
2818 class Foo;
2819 typedef Foo X;
2820 class Bar : public Foo {}; derived from a type that X is a typedef of
2821 </pre></td></tr>
2824 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isSameOrDerivedFrom0')"><a name="isSameOrDerivedFrom0Anchor">isSameOrDerivedFrom</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
2825 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
2826 match Base.
2827 </pre></td></tr>
2830 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('callee1')"><a name="callee1Anchor">callee</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2831 <tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
2832 given matcher.
2834 Example matches y.x() (matcher = callExpr(callee(methodDecl(hasName("x")))))
2835 class Y { public: void x(); };
2836 void z() { Y y; y.x(); }
2837 </pre></td></tr>
2840 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('callee0')"><a name="callee0Anchor">callee</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
2841 <tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches.
2843 Given
2844 class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
2845 void f() { f(); }
2846 callExpr(callee(expr()))
2847 matches this-&gt;x(), x(), y.x(), f()
2848 with callee(...)
2849 matching this-&gt;x, x, y.x, f respectively
2851 Note: Callee cannot take the more general internal::Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
2852 because this introduces ambiguous overloads with calls to Callee taking a
2853 internal::Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
2854 implemented in terms of implicit casts.
2855 </pre></td></tr>
2858 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyArgument0')"><a name="hasAnyArgument0Anchor">hasAnyArgument</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2859 <tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
2860 expression.
2862 Given
2863 void x(int, int, int) { int y; x(1, y, 42); }
2864 callExpr(hasAnyArgument(declRefExpr()))
2865 matches x(1, y, 42)
2866 with hasAnyArgument(...)
2867 matching y
2869 FIXME: Currently this will ignore parentheses and implicit casts on
2870 the argument before applying the inner matcher. We'll want to remove
2871 this to allow for greater control by the user once ignoreImplicit()
2872 has been implemented.
2873 </pre></td></tr>
2876 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('hasArgument0')"><a name="hasArgument0Anchor">hasArgument</a></td><td>unsigned N, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2877 <tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
2878 call expression.
2880 Example matches y in x(y)
2881 (matcher = callExpr(hasArgument(0, declRefExpr())))
2882 void x(int) { int y; x(y); }
2883 </pre></td></tr>
2886 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration13')"><a name="hasDeclaration13Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2887 <tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
2888 matches the given matcher.
2890 The associated declaration is:
2891 - for type nodes, the declaration of the underlying type
2892 - for CallExpr, the declaration of the callee
2893 - for MemberExpr, the declaration of the referenced member
2894 - for CXXConstructExpr, the declaration of the constructor
2896 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
2897 function. e.g. various subtypes of clang::Type and various expressions.
2899 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
2900 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
2901 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
2902 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
2903 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
2904 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
2905 </pre></td></tr>
2908 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CaseStmt.html">CaseStmt</a>&gt;</td><td class="name" onclick="toggle('hasCaseConstant0')"><a name="hasCaseConstant0Anchor">hasCaseConstant</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2909 <tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
2910 extension, matches the constant given in the statement.
2912 Given
2913 switch (1) { case 1: case 1+1: case 3 ... 4: ; }
2914 caseStmt(hasCaseConstant(integerLiteral()))
2915 matches "case 1:"
2916 </pre></td></tr>
2919 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html">CastExpr</a>&gt;</td><td class="name" onclick="toggle('hasSourceExpression0')"><a name="hasSourceExpression0Anchor">hasSourceExpression</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2920 <tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression matches the given matcher.
2922 Example: matches "a string" (matcher =
2923 hasSourceExpression(constructExpr()))
2924 class URL { URL(string); };
2925 URL url = "a string";
2926 </pre></td></tr>
2929 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgument0')"><a name="hasAnyTemplateArgument0Anchor">hasAnyTemplateArgument</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
2930 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations that have at least one
2931 TemplateArgument matching the given InnerMatcher.
2933 Given
2934 template&lt;typename T&gt; class A {};
2935 template&lt;&gt; class A&lt;double&gt; {};
2936 A&lt;int&gt; a;
2937 classTemplateSpecializationDecl(hasAnyTemplateArgument(
2938 refersToType(asString("int"))))
2939 matches the specialization A&lt;int&gt;
2940 </pre></td></tr>
2943 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgument0')"><a name="hasTemplateArgument0Anchor">hasTemplateArgument</a></td><td>unsigned N, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
2944 <tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations where the n'th TemplateArgument
2945 matches the given InnerMatcher.
2947 Given
2948 template&lt;typename T, typename U&gt; class A {};
2949 A&lt;bool, int&gt; b;
2950 A&lt;int, bool&gt; c;
2951 classTemplateSpecializationDecl(hasTemplateArgument(
2952 1, refersToType(asString("int"))))
2953 matches the specialization A&lt;bool, int&gt;
2954 </pre></td></tr>
2957 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexTypeLoc.html">ComplexTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasElementTypeLoc1')"><a name="hasElementTypeLoc1Anchor">hasElementTypeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
2958 <tr><td colspan="4" class="doc" id="hasElementTypeLoc1"><pre>Matches arrays and C99 complex types that have a specific element
2959 type.
2961 Given
2962 struct A {};
2963 A a[7];
2964 int b[7];
2965 arrayType(hasElementType(builtinType()))
2966 matches "int b[7]"
2968 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
2969 </pre></td></tr>
2972 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;</td><td class="name" onclick="toggle('hasElementType1')"><a name="hasElementType1Anchor">hasElementType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2973 <tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
2974 type.
2976 Given
2977 struct A {};
2978 A a[7];
2979 int b[7];
2980 arrayType(hasElementType(builtinType()))
2981 matches "int b[7]"
2983 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
2984 </pre></td></tr>
2987 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CompoundStmt.html">CompoundStmt</a>&gt;</td><td class="name" onclick="toggle('hasAnySubstatement0')"><a name="hasAnySubstatement0Anchor">hasAnySubstatement</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
2988 <tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
2989 a given matcher.
2991 Given
2992 { {}; 1+2; }
2993 hasAnySubstatement(compoundStmt())
2994 matches '{ {}; 1+2; }'
2995 with compoundStmt()
2996 matching '{}'
2997 </pre></td></tr>
3000 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>&gt;</td><td class="name" onclick="toggle('hasCondition4')"><a name="hasCondition4Anchor">hasCondition</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3001 <tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
3002 or conditional operator.
3004 Example matches true (matcher = hasCondition(boolLiteral(equals(true))))
3005 if (true) {}
3006 </pre></td></tr>
3009 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>&gt;</td><td class="name" onclick="toggle('hasFalseExpression0')"><a name="hasFalseExpression0Anchor">hasFalseExpression</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3010 <tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator.
3012 Example matches b
3013 condition ? a : b
3014 </pre></td></tr>
3017 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>&gt;</td><td class="name" onclick="toggle('hasTrueExpression0')"><a name="hasTrueExpression0Anchor">hasTrueExpression</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3018 <tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
3020 Example matches a
3021 condition ? a : b
3022 </pre></td></tr>
3025 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration11')"><a name="hasDeclaration11Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3026 <tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
3027 matches the given matcher.
3029 The associated declaration is:
3030 - for type nodes, the declaration of the underlying type
3031 - for CallExpr, the declaration of the callee
3032 - for MemberExpr, the declaration of the referenced member
3033 - for CXXConstructExpr, the declaration of the constructor
3035 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3036 function. e.g. various subtypes of clang::Type and various expressions.
3038 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3039 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3040 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3041 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3042 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3043 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3044 </pre></td></tr>
3047 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;</td><td class="name" onclick="toggle('throughUsingDecl0')"><a name="throughUsingDecl0Anchor">throughUsingDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>&gt; InnerMatcher</td></tr>
3048 <tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a
3049 specific using shadow declaration.
3051 FIXME: This currently only works for functions. Fix.
3053 Given
3054 namespace a { void f() {} }
3055 using a::f;
3056 void g() {
3057 f(); Matches this ..
3058 a::f(); .. but not this.
3060 declRefExpr(throughUsingDeclaration(anything()))
3061 matches f()
3062 </pre></td></tr>
3065 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;</td><td class="name" onclick="toggle('to0')"><a name="to0Anchor">to</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3066 <tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
3067 specified matcher.
3069 Example matches x in if(x)
3070 (matcher = declRefExpr(to(varDecl(hasName("x")))))
3071 bool x;
3072 if (x) {}
3073 </pre></td></tr>
3076 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>&gt;</td><td class="name" onclick="toggle('containsDeclaration0')"><a name="containsDeclaration0Anchor">containsDeclaration</a></td><td>unsigned N, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3077 <tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
3079 Note that this does not work for global declarations because the AST
3080 breaks up multiple-declaration DeclStmt's into multiple single-declaration
3081 DeclStmt's.
3082 Example: Given non-global declarations
3083 int a, b = 0;
3084 int c;
3085 int d = 2, e;
3086 declStmt(containsDeclaration(
3087 0, varDecl(hasInitializer(anything()))))
3088 matches only 'int d = 2, e;', and
3089 declStmt(containsDeclaration(1, varDecl()))
3090 matches 'int a, b = 0' as well as 'int d = 2, e;'
3091 but 'int c;' is not matched.
3092 </pre></td></tr>
3095 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>&gt;</td><td class="name" onclick="toggle('hasSingleDecl0')"><a name="hasSingleDecl0Anchor">hasSingleDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3096 <tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
3098 Given
3099 int a, b;
3100 int c;
3101 declStmt(hasSingleDecl(anything()))
3102 matches 'int c;' but not 'int a, b;'.
3103 </pre></td></tr>
3106 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc0')"><a name="hasTypeLoc0Anchor">hasTypeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
3107 <tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches
3108 the inner matcher.
3110 Given
3111 int x;
3112 declaratorDecl(hasTypeLoc(loc(asString("int"))))
3113 matches int x
3114 </pre></td></tr>
3117 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('hasDeclContext0')"><a name="hasDeclContext0Anchor">hasDeclContext</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3118 <tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
3119 Decl, matches InnerMatcher.
3121 Given
3122 namespace N {
3123 namespace M {
3124 class D {};
3128 recordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
3129 declaration of class D.
3130 </pre></td></tr>
3133 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DoStmt.html">DoStmt</a>&gt;</td><td class="name" onclick="toggle('hasBody0')"><a name="hasBody0Anchor">hasBody</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
3134 <tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', or 'do while' statement that has
3135 a given body.
3137 Given
3138 for (;;) {}
3139 hasBody(compoundStmt())
3140 matches 'for (;;) {}'
3141 with compoundStmt()
3142 matching '{}'
3143 </pre></td></tr>
3146 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DoStmt.html">DoStmt</a>&gt;</td><td class="name" onclick="toggle('hasCondition3')"><a name="hasCondition3Anchor">hasCondition</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3147 <tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
3148 or conditional operator.
3150 Example matches true (matcher = hasCondition(boolLiteral(equals(true))))
3151 if (true) {}
3152 </pre></td></tr>
3155 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ElaboratedType.html">ElaboratedType</a>&gt;</td><td class="name" onclick="toggle('hasQualifier0')"><a name="hasQualifier0Anchor">hasQualifier</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt; InnerMatcher</td></tr>
3156 <tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
3157 matches InnerMatcher if the qualifier exists.
3159 Given
3160 namespace N {
3161 namespace M {
3162 class D {};
3165 N::M::D d;
3167 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
3168 matches the type of the variable declaration of d.
3169 </pre></td></tr>
3172 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ElaboratedType.html">ElaboratedType</a>&gt;</td><td class="name" onclick="toggle('namesType0')"><a name="namesType0Anchor">namesType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3173 <tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
3175 Given
3176 namespace N {
3177 namespace M {
3178 class D {};
3181 N::M::D d;
3183 elaboratedType(namesType(recordType(
3184 hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
3185 declaration of d.
3186 </pre></td></tr>
3189 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration10')"><a name="hasDeclaration10Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3190 <tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
3191 matches the given matcher.
3193 The associated declaration is:
3194 - for type nodes, the declaration of the underlying type
3195 - for CallExpr, the declaration of the callee
3196 - for MemberExpr, the declaration of the referenced member
3197 - for CXXConstructExpr, the declaration of the constructor
3199 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3200 function. e.g. various subtypes of clang::Type and various expressions.
3202 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3203 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3204 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3205 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3206 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3207 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3208 </pre></td></tr>
3211 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;</td><td class="name" onclick="toggle('hasDestinationType0')"><a name="hasDestinationType0Anchor">hasDestinationType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3212 <tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
3214 (Note: Clang's AST refers to other conversions as "casts" too, and calls
3215 actual casts "explicit" casts.)
3216 </pre></td></tr>
3219 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('hasType2')"><a name="hasType2Anchor">hasType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3220 <tr><td colspan="4" class="doc" id="hasType2"><pre>Overloaded to match the declaration of the expression's or value
3221 declaration's type.
3223 In case of a value declaration (for example a variable declaration),
3224 this resolves one layer of indirection. For example, in the value
3225 declaration "X x;", recordDecl(hasName("X")) matches the declaration of X,
3226 while varDecl(hasType(recordDecl(hasName("X")))) matches the declaration
3227 of x."
3229 Example matches x (matcher = expr(hasType(recordDecl(hasName("X")))))
3230 and z (matcher = varDecl(hasType(recordDecl(hasName("X")))))
3231 class X {};
3232 void y(X &amp;x) { x; X z; }
3234 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;
3235 </pre></td></tr>
3238 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('hasType0')"><a name="hasType0Anchor">hasType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3239 <tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
3240 matcher.
3242 Example matches x (matcher = expr(hasType(recordDecl(hasName("X")))))
3243 and z (matcher = varDecl(hasType(recordDecl(hasName("X")))))
3244 class X {};
3245 void y(X &amp;x) { x; X z; }
3246 </pre></td></tr>
3249 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('ignoringImpCasts0')"><a name="ignoringImpCasts0Anchor">ignoringImpCasts</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3250 <tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
3251 are stripped off.
3253 Parentheses and explicit casts are not discarded.
3254 Given
3255 int arr[5];
3256 int a = 0;
3257 char b = 0;
3258 const int c = a;
3259 int *d = arr;
3260 long e = (long) 0l;
3261 The matchers
3262 varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
3263 varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
3264 would match the declarations for a, b, c, and d, but not e.
3265 While
3266 varDecl(hasInitializer(integerLiteral()))
3267 varDecl(hasInitializer(declRefExpr()))
3268 only match the declarations for b, c, and d.
3269 </pre></td></tr>
3272 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('ignoringParenCasts0')"><a name="ignoringParenCasts0Anchor">ignoringParenCasts</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3273 <tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
3274 casts are stripped off.
3276 Implicit and non-C Style casts are also discarded.
3277 Given
3278 int a = 0;
3279 char b = (0);
3280 void* c = reinterpret_cast&lt;char*&gt;(0);
3281 char d = char(0);
3282 The matcher
3283 varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
3284 would match the declarations for a, b, c, and d.
3285 while
3286 varDecl(hasInitializer(integerLiteral()))
3287 only match the declaration for a.
3288 </pre></td></tr>
3291 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('ignoringParenImpCasts0')"><a name="ignoringParenImpCasts0Anchor">ignoringParenImpCasts</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3292 <tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
3293 parentheses are stripped off.
3295 Explicit casts are not discarded.
3296 Given
3297 int arr[5];
3298 int a = 0;
3299 char b = (0);
3300 const int c = a;
3301 int *d = (arr);
3302 long e = ((long) 0l);
3303 The matchers
3304 varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
3305 varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
3306 would match the declarations for a, b, c, and d, but not e.
3307 while
3308 varDecl(hasInitializer(integerLiteral()))
3309 varDecl(hasInitializer(declRefExpr()))
3310 would only match the declaration for a.
3311 </pre></td></tr>
3314 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>&gt;</td><td class="name" onclick="toggle('hasBody1')"><a name="hasBody1Anchor">hasBody</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
3315 <tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', or 'do while' statement that has
3316 a given body.
3318 Given
3319 for (;;) {}
3320 hasBody(compoundStmt())
3321 matches 'for (;;) {}'
3322 with compoundStmt()
3323 matching '{}'
3324 </pre></td></tr>
3327 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>&gt;</td><td class="name" onclick="toggle('hasCondition1')"><a name="hasCondition1Anchor">hasCondition</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3328 <tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
3329 or conditional operator.
3331 Example matches true (matcher = hasCondition(boolLiteral(equals(true))))
3332 if (true) {}
3333 </pre></td></tr>
3336 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>&gt;</td><td class="name" onclick="toggle('hasIncrement0')"><a name="hasIncrement0Anchor">hasIncrement</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
3337 <tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
3339 Example:
3340 forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
3341 matches '++x' in
3342 for (x; x &lt; N; ++x) { }
3343 </pre></td></tr>
3346 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>&gt;</td><td class="name" onclick="toggle('hasLoopInit0')"><a name="hasLoopInit0Anchor">hasLoopInit</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
3347 <tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
3349 Example:
3350 forStmt(hasLoopInit(declStmt()))
3351 matches 'int x = 0' in
3352 for (int x = 0; x &lt; N; ++x) { }
3353 </pre></td></tr>
3356 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyParameter0')"><a name="hasAnyParameter0Anchor">hasAnyParameter</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
3357 <tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function declaration.
3359 Does not match the 'this' parameter of a method.
3361 Given
3362 class X { void f(int x, int y, int z) {} };
3363 methodDecl(hasAnyParameter(hasName("y")))
3364 matches f(int x, int y, int z) {}
3365 with hasAnyParameter(...)
3366 matching int y
3367 </pre></td></tr>
3370 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasParameter0')"><a name="hasParameter0Anchor">hasParameter</a></td><td>unsigned N, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
3371 <tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function declaration.
3373 Given
3374 class X { void f(int x) {} };
3375 methodDecl(hasParameter(0, hasType(varDecl())))
3376 matches f(int x) {}
3377 with hasParameter(...)
3378 matching int x
3379 </pre></td></tr>
3382 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('returns0')"><a name="returns0Anchor">returns</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3383 <tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
3385 Given:
3386 class X { int f() { return 1; } };
3387 methodDecl(returns(asString("int")))
3388 matches int f() { return 1; }
3389 </pre></td></tr>
3392 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;</td><td class="name" onclick="toggle('hasCondition0')"><a name="hasCondition0Anchor">hasCondition</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3393 <tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
3394 or conditional operator.
3396 Example matches true (matcher = hasCondition(boolLiteral(equals(true))))
3397 if (true) {}
3398 </pre></td></tr>
3401 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;</td><td class="name" onclick="toggle('hasConditionVariableStatement0')"><a name="hasConditionVariableStatement0Anchor">hasConditionVariableStatement</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>&gt; InnerMatcher</td></tr>
3402 <tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
3404 Given
3405 if (A* a = GetAPointer()) {}
3406 hasConditionVariableStatement(...)
3407 matches 'A* a = GetAPointer()'.
3408 </pre></td></tr>
3411 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;</td><td class="name" onclick="toggle('hasElse0')"><a name="hasElse0Anchor">hasElse</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
3412 <tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
3414 Examples matches the if statement
3415 (matcher = ifStmt(hasElse(boolLiteral(equals(true)))))
3416 if (false) false; else true;
3417 </pre></td></tr>
3420 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;</td><td class="name" onclick="toggle('hasThen0')"><a name="hasThen0Anchor">hasThen</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
3421 <tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
3423 Examples matches the if statement
3424 (matcher = ifStmt(hasThen(boolLiteral(equals(true)))))
3425 if (false) true; else false;
3426 </pre></td></tr>
3429 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ImplicitCastExpr.html">ImplicitCastExpr</a>&gt;</td><td class="name" onclick="toggle('hasImplicitDestinationType0')"><a name="hasImplicitDestinationType0Anchor">hasImplicitDestinationType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3430 <tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
3431 matcher.
3433 FIXME: Unit test this matcher
3434 </pre></td></tr>
3437 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration9')"><a name="hasDeclaration9Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3438 <tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
3439 matches the given matcher.
3441 The associated declaration is:
3442 - for type nodes, the declaration of the underlying type
3443 - for CallExpr, the declaration of the callee
3444 - for MemberExpr, the declaration of the referenced member
3445 - for CXXConstructExpr, the declaration of the constructor
3447 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3448 function. e.g. various subtypes of clang::Type and various expressions.
3450 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3451 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3452 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3453 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3454 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3455 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3456 </pre></td></tr>
3459 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration8')"><a name="hasDeclaration8Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3460 <tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
3461 matches the given matcher.
3463 The associated declaration is:
3464 - for type nodes, the declaration of the underlying type
3465 - for CallExpr, the declaration of the callee
3466 - for MemberExpr, the declaration of the referenced member
3467 - for CXXConstructExpr, the declaration of the constructor
3469 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3470 function. e.g. various subtypes of clang::Type and various expressions.
3472 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3473 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3474 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3475 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3476 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3477 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3478 </pre></td></tr>
3481 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration7')"><a name="hasDeclaration7Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3482 <tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
3483 matches the given matcher.
3485 The associated declaration is:
3486 - for type nodes, the declaration of the underlying type
3487 - for CallExpr, the declaration of the callee
3488 - for MemberExpr, the declaration of the referenced member
3489 - for CXXConstructExpr, the declaration of the constructor
3491 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3492 function. e.g. various subtypes of clang::Type and various expressions.
3494 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3495 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3496 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3497 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3498 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3499 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3500 </pre></td></tr>
3503 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;</td><td class="name" onclick="toggle('hasObjectExpression0')"><a name="hasObjectExpression0Anchor">hasObjectExpression</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3504 <tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is
3505 matched by a given matcher.
3507 Given
3508 struct X { int m; };
3509 void f(X x) { x.m; m; }
3510 memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))))
3511 matches "x.m" and "m"
3512 with hasObjectExpression(...)
3513 matching "x" and the implicit object expression of "m" which has type X*.
3514 </pre></td></tr>
3517 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;</td><td class="name" onclick="toggle('member0')"><a name="member0Anchor">member</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt; InnerMatcher</td></tr>
3518 <tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
3519 given matcher.
3521 Given
3522 struct { int first, second; } first, second;
3523 int i(second.first);
3524 int j(first.second);
3525 memberExpr(member(hasName("first")))
3526 matches second.first
3527 but not first.second (because the member name there is "second").
3528 </pre></td></tr>
3531 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerTypeLoc.html">MemberPointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc1')"><a name="pointeeLoc1Anchor">pointeeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
3532 <tr><td colspan="4" class="doc" id="pointeeLoc1"><pre>Narrows PointerType (and similar) matchers to those where the
3533 pointee matches a given matcher.
3535 Given
3536 int *a;
3537 int const *b;
3538 float const *f;
3539 pointerType(pointee(isConstQualified(), isInteger()))
3540 matches "int const *b"
3542 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3543 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3544 </pre></td></tr>
3547 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;</td><td class="name" onclick="toggle('pointee1')"><a name="pointee1Anchor">pointee</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
3548 <tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
3549 pointee matches a given matcher.
3551 Given
3552 int *a;
3553 int const *b;
3554 float const *f;
3555 pointerType(pointee(isConstQualified(), isInteger()))
3556 matches "int const *b"
3558 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3559 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3560 </pre></td></tr>
3563 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt;</td><td class="name" onclick="toggle('hasPrefix1')"><a name="hasPrefix1Anchor">hasPrefix</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt; InnerMatcher</td></tr>
3564 <tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
3566 Given
3567 struct A { struct B { struct C {}; }; };
3568 A::B::C c;
3569 nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
3570 matches "A::"
3571 </pre></td></tr>
3574 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt;</td><td class="name" onclick="toggle('specifiesTypeLoc0')"><a name="specifiesTypeLoc0Anchor">specifiesTypeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; InnerMatcher</td></tr>
3575 <tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
3576 given TypeLoc.
3578 Given
3579 struct A { struct B { struct C {}; }; };
3580 A::B::C c;
3581 nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
3582 hasDeclaration(recordDecl(hasName("A")))))))
3583 matches "A::"
3584 </pre></td></tr>
3587 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt;</td><td class="name" onclick="toggle('hasPrefix0')"><a name="hasPrefix0Anchor">hasPrefix</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt; InnerMatcher</td></tr>
3588 <tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
3590 Given
3591 struct A { struct B { struct C {}; }; };
3592 A::B::C c;
3593 nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
3594 matches "A::"
3595 </pre></td></tr>
3598 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt;</td><td class="name" onclick="toggle('specifiesNamespace0')"><a name="specifiesNamespace0Anchor">specifiesNamespace</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>&gt; InnerMatcher</td></tr>
3599 <tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
3600 given namespace matcher.
3602 Given
3603 namespace ns { struct A {}; }
3604 ns::A a;
3605 nestedNameSpecifier(specifiesNamespace(hasName("ns")))
3606 matches "ns::"
3607 </pre></td></tr>
3610 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt;</td><td class="name" onclick="toggle('specifiesType0')"><a name="specifiesType0Anchor">specifiesType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3611 <tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
3612 given QualType matcher without qualifiers.
3614 Given
3615 struct A { struct B { struct C {}; }; };
3616 A::B::C c;
3617 nestedNameSpecifier(specifiesType(hasDeclaration(recordDecl(hasName("A")))))
3618 matches "A::"
3619 </pre></td></tr>
3622 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;</td><td class="name" onclick="toggle('innerType0')"><a name="innerType0Anchor">innerType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
3623 <tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
3625 Given
3626 int (*ptr_to_array)[4];
3627 int (*ptr_to_func)(int);
3629 varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
3630 ptr_to_func but not ptr_to_array.
3632 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
3633 </pre></td></tr>
3636 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerTypeLoc.html">PointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc2')"><a name="pointeeLoc2Anchor">pointeeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
3637 <tr><td colspan="4" class="doc" id="pointeeLoc2"><pre>Narrows PointerType (and similar) matchers to those where the
3638 pointee matches a given matcher.
3640 Given
3641 int *a;
3642 int const *b;
3643 float const *f;
3644 pointerType(pointee(isConstQualified(), isInteger()))
3645 matches "int const *b"
3647 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3648 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3649 </pre></td></tr>
3652 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;</td><td class="name" onclick="toggle('pointee2')"><a name="pointee2Anchor">pointee</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
3653 <tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
3654 pointee matches a given matcher.
3656 Given
3657 int *a;
3658 int const *b;
3659 float const *f;
3660 pointerType(pointee(isConstQualified(), isInteger()))
3661 matches "int const *b"
3663 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3664 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3665 </pre></td></tr>
3668 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('hasCanonicalType0')"><a name="hasCanonicalType0Anchor">hasCanonicalType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3669 <tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
3671 Given:
3672 typedef int &amp;int_ref;
3673 int a;
3674 int_ref b = a;
3676 varDecl(hasType(qualType(referenceType()))))) will not match the
3677 declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
3678 </pre></td></tr>
3681 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration6')"><a name="hasDeclaration6Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3682 <tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
3683 matches the given matcher.
3685 The associated declaration is:
3686 - for type nodes, the declaration of the underlying type
3687 - for CallExpr, the declaration of the callee
3688 - for MemberExpr, the declaration of the referenced member
3689 - for CXXConstructExpr, the declaration of the constructor
3691 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3692 function. e.g. various subtypes of clang::Type and various expressions.
3694 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3695 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3696 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3697 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3698 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3699 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3700 </pre></td></tr>
3703 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('pointsTo1')"><a name="pointsTo1Anchor">pointsTo</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3704 <tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
3705 </pre></td></tr>
3708 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('pointsTo0')"><a name="pointsTo0Anchor">pointsTo</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3709 <tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
3710 matches the specified matcher.
3712 Example matches y-&gt;x()
3713 (matcher = callExpr(on(hasType(pointsTo(recordDecl(hasName("Y")))))))
3714 class Y { public: void x(); };
3715 void z() { Y *y; y-&gt;x(); }
3716 </pre></td></tr>
3719 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('references1')"><a name="references1Anchor">references</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3720 <tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
3721 </pre></td></tr>
3724 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('references0')"><a name="references0Anchor">references</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3725 <tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
3726 type matches the specified matcher.
3728 Example matches X &amp;x and const X &amp;y
3729 (matcher = varDecl(hasType(references(recordDecl(hasName("X"))))))
3730 class X {
3731 void a(X b) {
3732 X &amp;x = b;
3733 const X &amp;y = b;
3736 </pre></td></tr>
3739 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration5')"><a name="hasDeclaration5Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3740 <tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
3741 matches the given matcher.
3743 The associated declaration is:
3744 - for type nodes, the declaration of the underlying type
3745 - for CallExpr, the declaration of the callee
3746 - for MemberExpr, the declaration of the referenced member
3747 - for CXXConstructExpr, the declaration of the constructor
3749 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3750 function. e.g. various subtypes of clang::Type and various expressions.
3752 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3753 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3754 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3755 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3756 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3757 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3758 </pre></td></tr>
3761 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceTypeLoc.html">ReferenceTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc3')"><a name="pointeeLoc3Anchor">pointeeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
3762 <tr><td colspan="4" class="doc" id="pointeeLoc3"><pre>Narrows PointerType (and similar) matchers to those where the
3763 pointee matches a given matcher.
3765 Given
3766 int *a;
3767 int const *b;
3768 float const *f;
3769 pointerType(pointee(isConstQualified(), isInteger()))
3770 matches "int const *b"
3772 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3773 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3774 </pre></td></tr>
3777 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;</td><td class="name" onclick="toggle('pointee3')"><a name="pointee3Anchor">pointee</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
3778 <tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
3779 pointee matches a given matcher.
3781 Given
3782 int *a;
3783 int const *b;
3784 float const *f;
3785 pointerType(pointee(isConstQualified(), isInteger()))
3786 matches "int const *b"
3788 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3789 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3790 </pre></td></tr>
3793 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('alignOfExpr0')"><a name="alignOfExpr0Anchor">alignOfExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt; InnerMatcher</td></tr>
3794 <tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
3795 alignof.
3796 </pre></td></tr>
3799 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('sizeOfExpr0')"><a name="sizeOfExpr0Anchor">sizeOfExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt; InnerMatcher</td></tr>
3800 <tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
3801 sizeof.
3802 </pre></td></tr>
3805 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1SwitchStmt.html">SwitchStmt</a>&gt;</td><td class="name" onclick="toggle('forEachSwitchCase0')"><a name="forEachSwitchCase0Anchor">forEachSwitchCase</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1SwitchCase.html">SwitchCase</a>&gt; InnerMatcher</td></tr>
3806 <tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
3807 statement. This matcher may produce multiple matches.
3809 Given
3810 switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
3811 switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
3812 matches four times, with "c" binding each of "case 1:", "case 2:",
3813 "case 3:" and "case 4:", and "s" respectively binding "switch (1)",
3814 "switch (1)", "switch (2)" and "switch (2)".
3815 </pre></td></tr>
3818 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration4')"><a name="hasDeclaration4Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3819 <tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
3820 matches the given matcher.
3822 The associated declaration is:
3823 - for type nodes, the declaration of the underlying type
3824 - for CallExpr, the declaration of the callee
3825 - for MemberExpr, the declaration of the referenced member
3826 - for CXXConstructExpr, the declaration of the constructor
3828 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3829 function. e.g. various subtypes of clang::Type and various expressions.
3831 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3832 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3833 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3834 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3835 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3836 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3837 </pre></td></tr>
3840 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;</td><td class="name" onclick="toggle('isExpr0')"><a name="isExpr0Anchor">isExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3841 <tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
3843 Given
3844 template&lt;typename T&gt; struct A {};
3845 struct B { B* next; };
3846 A&lt;&amp;B::next&gt; a;
3847 templateSpecializationType(hasAnyTemplateArgument(
3848 isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
3849 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
3850 B::next
3851 </pre></td></tr>
3854 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;</td><td class="name" onclick="toggle('refersToDeclaration0')"><a name="refersToDeclaration0Anchor">refersToDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3855 <tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
3856 declaration.
3858 Given
3859 template&lt;typename T&gt; struct A {};
3860 struct B { B* next; };
3861 A&lt;&amp;B::next&gt; a;
3862 classTemplateSpecializationDecl(hasAnyTemplateArgument(
3863 refersToDeclaration(fieldDecl(hasName("next"))))
3864 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
3865 B::next
3866 </pre></td></tr>
3869 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;</td><td class="name" onclick="toggle('refersToIntegralType0')"><a name="refersToIntegralType0Anchor">refersToIntegralType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3870 <tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that referes to an integral type.
3872 Given
3873 template&lt;int T&gt; struct A {};
3874 C&lt;42&gt; c;
3875 classTemplateSpecializationDecl(
3876 hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
3877 matches the implicit instantiation of C in C&lt;42&gt;.
3878 </pre></td></tr>
3881 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;</td><td class="name" onclick="toggle('refersToType0')"><a name="refersToType0Anchor">refersToType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3882 <tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
3884 Given
3885 struct X {};
3886 template&lt;typename T&gt; struct A {};
3887 A&lt;X&gt; a;
3888 classTemplateSpecializationDecl(hasAnyTemplateArgument(
3889 refersToType(class(hasName("X")))))
3890 matches the specialization A&lt;X&gt;
3891 </pre></td></tr>
3894 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgument1')"><a name="hasAnyTemplateArgument1Anchor">hasAnyTemplateArgument</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
3895 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations that have at least one
3896 TemplateArgument matching the given InnerMatcher.
3898 Given
3899 template&lt;typename T&gt; class A {};
3900 template&lt;&gt; class A&lt;double&gt; {};
3901 A&lt;int&gt; a;
3902 classTemplateSpecializationDecl(hasAnyTemplateArgument(
3903 refersToType(asString("int"))))
3904 matches the specialization A&lt;int&gt;
3905 </pre></td></tr>
3908 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration3')"><a name="hasDeclaration3Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3909 <tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
3910 matches the given matcher.
3912 The associated declaration is:
3913 - for type nodes, the declaration of the underlying type
3914 - for CallExpr, the declaration of the callee
3915 - for MemberExpr, the declaration of the referenced member
3916 - for CXXConstructExpr, the declaration of the constructor
3918 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3919 function. e.g. various subtypes of clang::Type and various expressions.
3921 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3922 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3923 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3924 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3925 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3926 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3927 </pre></td></tr>
3930 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgument1')"><a name="hasTemplateArgument1Anchor">hasTemplateArgument</a></td><td>unsigned N, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
3931 <tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations where the n'th TemplateArgument
3932 matches the given InnerMatcher.
3934 Given
3935 template&lt;typename T, typename U&gt; class A {};
3936 A&lt;bool, int&gt; b;
3937 A&lt;int, bool&gt; c;
3938 classTemplateSpecializationDecl(hasTemplateArgument(
3939 1, refersToType(asString("int"))))
3940 matches the specialization A&lt;bool, int&gt;
3941 </pre></td></tr>
3944 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration2')"><a name="hasDeclaration2Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3945 <tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
3946 matches the given matcher.
3948 The associated declaration is:
3949 - for type nodes, the declaration of the underlying type
3950 - for CallExpr, the declaration of the callee
3951 - for MemberExpr, the declaration of the referenced member
3952 - for CXXConstructExpr, the declaration of the constructor
3954 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3955 function. e.g. various subtypes of clang::Type and various expressions.
3957 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3958 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3959 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3960 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3961 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3962 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3963 </pre></td></tr>
3966 <tr><td>Matcher&lt;T&gt;</td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>Matcher&lt;T&gt; Matcher</td></tr>
3967 <tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
3969 Generates results for each match.
3971 For example, in:
3972 class A { class B {}; class C {}; };
3973 The matcher:
3974 recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("m")))
3975 will generate results for A, B and C.
3977 Usable as: Any Matcher
3978 </pre></td></tr>
3981 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration1')"><a name="hasDeclaration1Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3982 <tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
3983 matches the given matcher.
3985 The associated declaration is:
3986 - for type nodes, the declaration of the underlying type
3987 - for CallExpr, the declaration of the callee
3988 - for MemberExpr, the declaration of the referenced member
3989 - for CXXConstructExpr, the declaration of the constructor
3991 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3992 function. e.g. various subtypes of clang::Type and various expressions.
3994 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3995 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3996 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3997 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3998 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3999 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4000 </pre></td></tr>
4003 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;</td><td class="name" onclick="toggle('hasArgumentOfType0')"><a name="hasArgumentOfType0Anchor">hasArgumentOfType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
4004 <tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
4006 Given
4007 int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
4008 unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
4009 matches sizeof(a) and alignof(c)
4010 </pre></td></tr>
4013 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasUnaryOperand0')"><a name="hasUnaryOperand0Anchor">hasUnaryOperand</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4014 <tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
4016 Example matches true (matcher = hasUnaryOperand(boolLiteral(equals(true))))
4017 !true
4018 </pre></td></tr>
4021 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration0')"><a name="hasDeclaration0Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
4022 <tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
4023 matches the given matcher.
4025 The associated declaration is:
4026 - for type nodes, the declaration of the underlying type
4027 - for CallExpr, the declaration of the callee
4028 - for MemberExpr, the declaration of the referenced member
4029 - for CXXConstructExpr, the declaration of the constructor
4031 Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
4032 function. e.g. various subtypes of clang::Type and various expressions.
4034 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
4035 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
4036 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
4037 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
4038 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
4039 Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4040 </pre></td></tr>
4043 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingDecl.html">UsingDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyUsingShadowDecl0')"><a name="hasAnyUsingShadowDecl0Anchor">hasAnyUsingShadowDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>&gt; InnerMatcher</td></tr>
4044 <tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
4046 Given
4047 namespace X { void b(); }
4048 using X::b;
4049 usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
4050 matches using X::b </pre></td></tr>
4053 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>&gt;</td><td class="name" onclick="toggle('hasTargetDecl0')"><a name="hasTargetDecl0Anchor">hasTargetDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; InnerMatcher</td></tr>
4054 <tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
4055 matched by the given matcher.
4057 Given
4058 namespace X { int a; void b(); }
4059 using X::a;
4060 using X::b;
4061 usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
4062 matches using X::b but not using X::a </pre></td></tr>
4065 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;</td><td class="name" onclick="toggle('hasType3')"><a name="hasType3Anchor">hasType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
4066 <tr><td colspan="4" class="doc" id="hasType3"><pre>Overloaded to match the declaration of the expression's or value
4067 declaration's type.
4069 In case of a value declaration (for example a variable declaration),
4070 this resolves one layer of indirection. For example, in the value
4071 declaration "X x;", recordDecl(hasName("X")) matches the declaration of X,
4072 while varDecl(hasType(recordDecl(hasName("X")))) matches the declaration
4073 of x."
4075 Example matches x (matcher = expr(hasType(recordDecl(hasName("X")))))
4076 and z (matcher = varDecl(hasType(recordDecl(hasName("X")))))
4077 class X {};
4078 void y(X &amp;x) { x; X z; }
4080 Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;
4081 </pre></td></tr>
4084 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;</td><td class="name" onclick="toggle('hasType1')"><a name="hasType1Anchor">hasType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
4085 <tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
4086 matcher.
4088 Example matches x (matcher = expr(hasType(recordDecl(hasName("X")))))
4089 and z (matcher = varDecl(hasType(recordDecl(hasName("X")))))
4090 class X {};
4091 void y(X &amp;x) { x; X z; }
4092 </pre></td></tr>
4095 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('hasInitializer0')"><a name="hasInitializer0Anchor">hasInitializer</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4096 <tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
4097 that matches the given matcher.
4099 Example matches x (matcher = varDecl(hasInitializer(callExpr())))
4100 bool y() { return true; }
4101 bool x = y();
4102 </pre></td></tr>
4105 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VariableArrayType.html">VariableArrayType</a>&gt;</td><td class="name" onclick="toggle('hasSizeExpr0')"><a name="hasSizeExpr0Anchor">hasSizeExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4106 <tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
4107 expression.
4109 Given
4110 void f(int b) {
4111 int a[b];
4113 variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
4114 varDecl(hasName("b")))))))
4115 matches "int a[b]"
4116 </pre></td></tr>
4119 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1WhileStmt.html">WhileStmt</a>&gt;</td><td class="name" onclick="toggle('hasBody2')"><a name="hasBody2Anchor">hasBody</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
4120 <tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', or 'do while' statement that has
4121 a given body.
4123 Given
4124 for (;;) {}
4125 hasBody(compoundStmt())
4126 matches 'for (;;) {}'
4127 with compoundStmt()
4128 matching '{}'
4129 </pre></td></tr>
4132 <tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1WhileStmt.html">WhileStmt</a>&gt;</td><td class="name" onclick="toggle('hasCondition2')"><a name="hasCondition2Anchor">hasCondition</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4133 <tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
4134 or conditional operator.
4136 Example matches true (matcher = hasCondition(boolLiteral(equals(true))))
4137 if (true) {}
4138 </pre></td></tr>
4141 <tr><td>Matcher&lt;internal::BindableMatcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt;&gt;</td><td class="name" onclick="toggle('loc1')"><a name="loc1Anchor">loc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt; InnerMatcher</td></tr>
4142 <tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
4143 NestedNameSpecifier-matcher matches.
4144 </pre></td></tr>
4147 <tr><td>Matcher&lt;internal::BindableMatcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;&gt;</td><td class="name" onclick="toggle('loc0')"><a name="loc0Anchor">loc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
4148 <tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
4149 QualType-matcher matches.
4150 </pre></td></tr>
4152 <!--END_TRAVERSAL_MATCHERS -->
4153 </table>
4155 </div>
4156 </body>
4157 </html>