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">
9td {
10  padding: .33em;
11}
12td.doc {
13  display: none;
14  border-bottom: 1px solid black;
15}
16td.name:hover {
17  color: blue;
18  cursor: pointer;
19}
20</style>
21<script type="text/javascript">
22function toggle(id) {
23  if (!id) return;
24  row = document.getElementById(id);
25  if (row.style.display != 'table-cell')
26    row.style.display = 'table-cell';
27  else
28    row.style.display = 'none';
29}
30</script>
31</head>
32<body onLoad="toggle(location.hash.substring(1, location.hash.length - 6))">
33
34<!--#include virtual="../menu.html.incl"-->
35
36<div id="content">
37
38<h1>AST Matcher Reference</h1>
39
40<p>This document shows all currently implemented matchers. The matchers are grouped
41by category and node type they match. You can click on matcher names to show the
42matcher's source documentation.</p>
43
44<p>There are three different basic categories of matchers:
45<ul>
46<li><a href="#decl-matchers">Node Matchers:</a> Matchers that match a specific type of AST node.</li>
47<li><a href="#narrowing-matchers">Narrowing Matchers:</a> Matchers that match attributes on AST nodes.</li>
48<li><a href="#traversal-matchers">Traversal Matchers:</a> Matchers that allow traversal between AST nodes.</li>
49</ul>
50</p>
51
52<p>Within each category the matchers are ordered by node type they match on.
53Note that if a matcher can match multiple node types, it will it will appear
54multiple times. This means that by searching for Matcher&lt;Stmt&gt; you can
55find all matchers that can be used to match on Stmt nodes.</p>
56
57<p>The exception to that rule are matchers that can match on any node. Those
58are marked with a * and are listed in the beginning of each category.</p>
59
60<p>Note that the categorization of matchers is a great help when you combine
61them into matcher expressions. You will usually want to form matcher expressions
62that read like english sentences by alternating between node matchers and
63narrowing or traversal matchers, like this:
64<pre>
65recordDecl(hasDescendant(
66    ifStmt(hasTrueExpression(
67        expr(hasDescendant(
68            ifStmt()))))))
69</pre>
70</p>
71
72<!-- ======================================================================= -->
73<h2 id="decl-matchers">Node Matchers</h2>
74<!-- ======================================================================= -->
75
76<p>Node matchers are at the core of matcher expressions - they specify the type
77of node that is expected. Every match expression starts with a node matcher,
78which can then be further refined with a narrowing or traversal matcher. All
79traversal matchers take node matchers as their arguments.</p>
80
81<p>For convenience, all node matchers take an arbitrary number of arguments
82and implicitly act as allOf matchers.</p>
83
84<p>Node matchers are the only matchers that support the bind("id") call to
85bind the matched node to the given string, to be later retrieved from the
86match callback.</p>
87
88<p>It is important to remember that the arguments to node matchers are
89predicates on the same node, just with additional information about the type.
90This is often useful to make matcher expression more readable by inlining bind
91calls 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.
95recordDecl(decl().bind("id"), hasName("::MyClass"))
96</pre>
97</p>
98
99<table>
100<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
101<!-- START_DECL_MATCHERS -->
102
103<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;</td><td class="name" onclick="toggle('cxxCtorInitializer0')"><a name="cxxCtorInitializer0Anchor">cxxCtorInitializer</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="cxxCtorInitializer0"><pre>Matches constructor initializers.
105
106Examples matches i(42).
107  class C {
108    C() : i(42) {}
109    int i;
110  };
111</pre></td></tr>
112
113
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.
116
117Given
118  class C {
119  public:
120    int a;
121  };
122accessSpecDecl()
123  matches 'public:'
124</pre></td></tr>
125
126
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('blockDecl0')"><a name="blockDecl0Anchor">blockDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;...</td></tr>
128<tr><td colspan="4" class="doc" id="blockDecl0"><pre>Matches block declarations.
129
130Example matches the declaration of the nameless block printing an input
131integer.
132
133  myFunc(^(int p) {
134    printf("%d", p);
135  })
136</pre></td></tr>
137
138
139<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>
140<tr><td colspan="4" class="doc" id="classTemplateDecl0"><pre>Matches C++ class template declarations.
141
142Example matches Z
143  template&lt;class T&gt; class Z {};
144</pre></td></tr>
145
146
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('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>
148<tr><td colspan="4" class="doc" id="classTemplateSpecializationDecl0"><pre>Matches C++ class template specializations.
149
150Given
151  template&lt;typename T&gt; class A {};
152  template&lt;&gt; class A&lt;double&gt; {};
153  A&lt;int&gt; a;
154classTemplateSpecializationDecl()
155  matches the specializations A&lt;int&gt; and A&lt;double&gt;
156</pre></td></tr>
157
158
159<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('cxxConstructorDecl0')"><a name="cxxConstructorDecl0Anchor">cxxConstructorDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;...</td></tr>
160<tr><td colspan="4" class="doc" id="cxxConstructorDecl0"><pre>Matches C++ constructor declarations.
161
162Example matches Foo::Foo() and Foo::Foo(int)
163  class Foo {
164   public:
165    Foo();
166    Foo(int);
167    int DoSomething();
168  };
169</pre></td></tr>
170
171
172<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('cxxConversionDecl0')"><a name="cxxConversionDecl0Anchor">cxxConversionDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConversionDecl.html">CXXConversionDecl</a>&gt;...</td></tr>
173<tr><td colspan="4" class="doc" id="cxxConversionDecl0"><pre>Matches conversion operator declarations.
174
175Example matches the operator.
176  class X { operator int() const; };
177</pre></td></tr>
178
179
180<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('cxxDestructorDecl0')"><a name="cxxDestructorDecl0Anchor">cxxDestructorDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDestructorDecl.html">CXXDestructorDecl</a>&gt;...</td></tr>
181<tr><td colspan="4" class="doc" id="cxxDestructorDecl0"><pre>Matches explicit C++ destructor declarations.
182
183Example matches Foo::~Foo()
184  class Foo {
185   public:
186    virtual ~Foo();
187  };
188</pre></td></tr>
189
190
191<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('cxxMethodDecl0')"><a name="cxxMethodDecl0Anchor">cxxMethodDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;...</td></tr>
192<tr><td colspan="4" class="doc" id="cxxMethodDecl0"><pre>Matches method declarations.
193
194Example matches y
195  class X { void y(); };
196</pre></td></tr>
197
198
199<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('cxxRecordDecl0')"><a name="cxxRecordDecl0Anchor">cxxRecordDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;...</td></tr>
200<tr><td colspan="4" class="doc" id="cxxRecordDecl0"><pre>Matches C++ class declarations.
201
202Example matches X, Z
203  class X;
204  template&lt;class T&gt; class Z {};
205</pre></td></tr>
206
207
208<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>
209<tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations.
210
211Examples matches X, C, and the friend declaration inside C;
212  void X();
213  class C {
214    friend X;
215  };
216</pre></td></tr>
217
218
219<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>
220<tr><td colspan="4" class="doc" id="declaratorDecl0"><pre>Matches declarator declarations (field, variable, function
221and non-type template parameter declarations).
222
223Given
224  class X { int y; };
225declaratorDecl()
226  matches int y.
227</pre></td></tr>
228
229
230<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>
231<tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants.
232
233Example matches A, B, C
234  enum X {
235    A, B, C
236  };
237</pre></td></tr>
238
239
240<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>
241<tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations.
242
243Example matches X
244  enum X {
245    A, B, C
246  };
247</pre></td></tr>
248
249
250<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>
251<tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations.
252
253Given
254  class X { int m; };
255fieldDecl()
256  matches 'm'.
257</pre></td></tr>
258
259
260<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>
261<tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations.
262
263Given
264  class X { friend void foo(); };
265friendDecl()
266  matches 'friend void foo()'.
267</pre></td></tr>
268
269
270<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>
271<tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations.
272
273Example matches f
274  void f();
275</pre></td></tr>
276
277
278<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>
279<tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations.
280
281Example matches f
282  template&lt;class T&gt; void f(T t) {}
283</pre></td></tr>
284
285
286<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('labelDecl0')"><a name="labelDecl0Anchor">labelDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelDecl.html">LabelDecl</a>&gt;...</td></tr>
287<tr><td colspan="4" class="doc" id="labelDecl0"><pre>Matches a declaration of label.
288
289Given
290  goto FOO;
291  FOO: bar();
292labelDecl()
293  matches 'FOO:'
294</pre></td></tr>
295
296
297<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>
298<tr><td colspan="4" class="doc" id="linkageSpecDecl0"><pre>Matches a declaration of a linkage specification.
299
300Given
301  extern "C" {}
302linkageSpecDecl()
303  matches "extern "C" {}"
304</pre></td></tr>
305
306
307<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>
308<tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name.
309
310Example matches X, S, the anonymous union type, i, and U;
311  typedef int X;
312  struct S {
313    union {
314      int i;
315    } U;
316  };
317</pre></td></tr>
318
319
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('namespaceAliasDecl0')"><a name="namespaceAliasDecl0Anchor">namespaceAliasDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1NamespaceAliasDecl.html">NamespaceAliasDecl</a>&gt;...</td></tr>
321<tr><td colspan="4" class="doc" id="namespaceAliasDecl0"><pre>Matches a declaration of a namespace alias.
322
323Given
324  namespace test {}
325  namespace alias = ::test;
326namespaceAliasDecl()
327  matches "namespace alias" but not "namespace test"
328</pre></td></tr>
329
330
331<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>
332<tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace.
333
334Given
335  namespace {}
336  namespace test {}
337namespaceDecl()
338  matches "namespace {}" and "namespace test {}"
339</pre></td></tr>
340
341
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('nonTypeTemplateParmDecl0')"><a name="nonTypeTemplateParmDecl0Anchor">nonTypeTemplateParmDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1NonTypeTemplateParmDecl.html">NonTypeTemplateParmDecl</a>&gt;...</td></tr>
343<tr><td colspan="4" class="doc" id="nonTypeTemplateParmDecl0"><pre>Matches non-type template parameter declarations.
344
345Given
346  template &lt;typename T, int N&gt; struct C {};
347nonTypeTemplateParmDecl()
348  matches 'N', but not 'T'.
349</pre></td></tr>
350
351
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('objcCategoryDecl0')"><a name="objcCategoryDecl0Anchor">objcCategoryDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCCategoryDecl.html">ObjCCategoryDecl</a>&gt;...</td></tr>
353<tr><td colspan="4" class="doc" id="objcCategoryDecl0"><pre>Matches Objective-C category declarations.
354
355Example matches Foo (Additions)
356  @interface Foo (Additions)
357  @end
358</pre></td></tr>
359
360
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('objcCategoryImplDecl0')"><a name="objcCategoryImplDecl0Anchor">objcCategoryImplDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCCategoryImplDecl.html">ObjCCategoryImplDecl</a>&gt;...</td></tr>
362<tr><td colspan="4" class="doc" id="objcCategoryImplDecl0"><pre>Matches Objective-C category definitions.
363
364Example matches Foo (Additions)
365  @implementation Foo (Additions)
366  @end
367</pre></td></tr>
368
369
370<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcImplementationDecl0')"><a name="objcImplementationDecl0Anchor">objcImplementationDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCImplementationDecl.html">ObjCImplementationDecl</a>&gt;...</td></tr>
371<tr><td colspan="4" class="doc" id="objcImplementationDecl0"><pre>Matches Objective-C implementation declarations.
372
373Example matches Foo
374  @implementation Foo
375  @end
376</pre></td></tr>
377
378
379<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcInterfaceDecl0')"><a name="objcInterfaceDecl0Anchor">objcInterfaceDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;...</td></tr>
380<tr><td colspan="4" class="doc" id="objcInterfaceDecl0"><pre>Matches Objective-C interface declarations.
381
382Example matches Foo
383  @interface Foo
384  @end
385</pre></td></tr>
386
387
388<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcIvarDecl0')"><a name="objcIvarDecl0Anchor">objcIvarDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCIvarDecl.html">ObjCIvarDecl</a>&gt;...</td></tr>
389<tr><td colspan="4" class="doc" id="objcIvarDecl0"><pre>Matches Objective-C instance variable declarations.
390
391Example matches _enabled
392  @implementation Foo {
393    BOOL _enabled;
394  }
395  @end
396</pre></td></tr>
397
398
399<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcMethodDecl0')"><a name="objcMethodDecl0Anchor">objcMethodDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;...</td></tr>
400<tr><td colspan="4" class="doc" id="objcMethodDecl0"><pre>Matches Objective-C method declarations.
401
402Example matches both declaration and definition of -[Foo method]
403  @interface Foo
404  - (void)method;
405  @end
406
407  @implementation Foo
408  - (void)method {}
409  @end
410</pre></td></tr>
411
412
413<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcPropertyDecl0')"><a name="objcPropertyDecl0Anchor">objcPropertyDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;...</td></tr>
414<tr><td colspan="4" class="doc" id="objcPropertyDecl0"><pre>Matches Objective-C property declarations.
415
416Example matches enabled
417  @interface Foo
418  @property BOOL enabled;
419  @end
420</pre></td></tr>
421
422
423<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcProtocolDecl0')"><a name="objcProtocolDecl0Anchor">objcProtocolDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCProtocolDecl.html">ObjCProtocolDecl</a>&gt;...</td></tr>
424<tr><td colspan="4" class="doc" id="objcProtocolDecl0"><pre>Matches Objective-C protocol declarations.
425
426Example matches FooDelegate
427  @protocol FooDelegate
428  @end
429</pre></td></tr>
430
431
432<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>
433<tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations.
434
435Given
436  void f(int x);
437parmVarDecl()
438  matches int x.
439</pre></td></tr>
440
441
442<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_1RecordDecl.html">RecordDecl</a>&gt;...</td></tr>
443<tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches class, struct, and union declarations.
444
445Example matches X, Z, U, and S
446  class X;
447  template&lt;class T&gt; class Z {};
448  struct S {};
449  union U {};
450</pre></td></tr>
451
452
453<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('staticAssertDecl0')"><a name="staticAssertDecl0Anchor">staticAssertDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1StaticAssertDecl.html">StaticAssertDecl</a>&gt;...</td></tr>
454<tr><td colspan="4" class="doc" id="staticAssertDecl0"><pre>Matches a C++ static_assert declaration.
455
456Example:
457  staticAssertExpr()
458matches
459  static_assert(sizeof(S) == sizeof(int))
460in
461  struct S {
462    int x;
463  };
464  static_assert(sizeof(S) == sizeof(int));
465</pre></td></tr>
466
467
468<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('templateTypeParmDecl0')"><a name="templateTypeParmDecl0Anchor">templateTypeParmDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmDecl.html">TemplateTypeParmDecl</a>&gt;...</td></tr>
469<tr><td colspan="4" class="doc" id="templateTypeParmDecl0"><pre>Matches template type parameter declarations.
470
471Given
472  template &lt;typename T, int N&gt; struct C {};
473templateTypeParmDecl()
474  matches 'T', but not 'N'.
475</pre></td></tr>
476
477
478<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('translationUnitDecl0')"><a name="translationUnitDecl0Anchor">translationUnitDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TranslationUnitDecl.html">TranslationUnitDecl</a>&gt;...</td></tr>
479<tr><td colspan="4" class="doc" id="translationUnitDecl0"><pre>Matches the top declaration context.
480
481Given
482  int X;
483  namespace NS {
484  int Y;
485  }  namespace NS
486decl(hasDeclContext(translationUnitDecl()))
487  matches "int X", but not "int Y".
488</pre></td></tr>
489
490
491<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('typeAliasDecl0')"><a name="typeAliasDecl0Anchor">typeAliasDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeAliasDecl.html">TypeAliasDecl</a>&gt;...</td></tr>
492<tr><td colspan="4" class="doc" id="typeAliasDecl0"><pre>Matches type alias declarations.
493
494Given
495  typedef int X;
496  using Y = int;
497typeAliasDecl()
498  matches "using Y = int", but not "typedef int X"
499</pre></td></tr>
500
501
502<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('typeAliasTemplateDecl0')"><a name="typeAliasTemplateDecl0Anchor">typeAliasTemplateDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeAliasTemplateDecl.html">TypeAliasTemplateDecl</a>&gt;...</td></tr>
503<tr><td colspan="4" class="doc" id="typeAliasTemplateDecl0"><pre>Matches type alias template declarations.
504
505typeAliasTemplateDecl() matches
506  template &lt;typename T&gt;
507  using Y = X&lt;T&gt;;
508</pre></td></tr>
509
510
511<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>
512<tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef declarations.
513
514Given
515  typedef int X;
516  using Y = int;
517typedefDecl()
518  matches "typedef int X", but not "using Y = int"
519</pre></td></tr>
520
521
522<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('typedefNameDecl0')"><a name="typedefNameDecl0Anchor">typedefNameDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;...</td></tr>
523<tr><td colspan="4" class="doc" id="typedefNameDecl0"><pre>Matches typedef name declarations.
524
525Given
526  typedef int X;
527  using Y = int;
528typedefNameDecl()
529  matches "typedef int X" and "using Y = int"
530</pre></td></tr>
531
532
533<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('unresolvedUsingTypenameDecl0')"><a name="unresolvedUsingTypenameDecl0Anchor">unresolvedUsingTypenameDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingTypenameDecl.html">UnresolvedUsingTypenameDecl</a>&gt;...</td></tr>
534<tr><td colspan="4" class="doc" id="unresolvedUsingTypenameDecl0"><pre>Matches unresolved using value declarations that involve the
535typename.
536
537Given
538  template &lt;typename T&gt;
539  struct Base { typedef T Foo; };
540
541  template&lt;typename T&gt;
542  struct S : private Base&lt;T&gt; {
543    using typename Base&lt;T&gt;::Foo;
544  };
545unresolvedUsingTypenameDecl()
546  matches using Base&lt;T&gt;::Foo </pre></td></tr>
547
548
549<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>
550<tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations.
551
552Given
553  template&lt;typename X&gt;
554  class C : private X {
555    using X::x;
556  };
557unresolvedUsingValueDecl()
558  matches using X::x </pre></td></tr>
559
560
561<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>
562<tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations.
563
564Given
565  namespace X { int x; }
566  using X::x;
567usingDecl()
568  matches using X::x </pre></td></tr>
569
570
571<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>
572<tr><td colspan="4" class="doc" id="usingDirectiveDecl0"><pre>Matches using namespace declarations.
573
574Given
575  namespace X { int x; }
576  using namespace X;
577usingDirectiveDecl()
578  matches using namespace X </pre></td></tr>
579
580
581<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>
582<tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value declaration.
583
584Example matches A, B, C and F
585  enum X { A, B, C };
586  void F();
587</pre></td></tr>
588
589
590<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>
591<tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations.
592
593Note: this does not match declarations of member variables, which are
594"field" declarations in Clang parlance.
595
596Example matches a
597  int a;
598</pre></td></tr>
599
600
601<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>
602<tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
603</pre></td></tr>
604
605
606<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>
607<tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers.
608
609Given
610  namespace ns {
611    struct A { static void f(); };
612    void A::f() {}
613    void g() { A::f(); }
614  }
615  ns::A a;
616nestedNameSpecifier()
617  matches "ns::" and both "A::"
618</pre></td></tr>
619
620
621<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>
622<tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST.
623</pre></td></tr>
624
625
626<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('addrLabelExpr0')"><a name="addrLabelExpr0Anchor">addrLabelExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;...</td></tr>
627<tr><td colspan="4" class="doc" id="addrLabelExpr0"><pre>Matches address of label statements (GNU extension).
628
629Given
630  FOO: bar();
631  void *ptr = &amp;&amp;FOO;
632  goto *bar;
633addrLabelExpr()
634  matches '&amp;&amp;FOO'
635</pre></td></tr>
636
637
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('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>
639<tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions.
640
641Given
642  int i = a[1];
643arraySubscriptExpr()
644  matches "a[1]"
645</pre></td></tr>
646
647
648<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>
649<tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements.
650
651 int i = 100;
652  __asm("mov al, 2");
653asmStmt()
654  matches '__asm("mov al, 2")'
655</pre></td></tr>
656
657
658<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('atomicExpr0')"><a name="atomicExpr0Anchor">atomicExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicExpr.html">AtomicExpr</a>&gt;...</td></tr>
659<tr><td colspan="4" class="doc" id="atomicExpr0"><pre>Matches atomic builtins.
660Example matches __atomic_load_n(ptr, 1)
661  void foo() { int *ptr; __atomic_load_n(ptr, 1); }
662</pre></td></tr>
663
664
665<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('autoreleasePoolStmt0')"><a name="autoreleasePoolStmt0Anchor">autoreleasePoolStmt</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCAutoreleasePoolStmt.html">ObjCAutoreleasePoolStmt</a>&gt;...</td></tr>
666<tr><td colspan="4" class="doc" id="autoreleasePoolStmt0"><pre>Matches an Objective-C autorelease pool statement.
667
668Given
669  @autoreleasepool {
670    int x = 0;
671  }
672autoreleasePoolStmt(stmt()) matches the declaration of "x"
673inside the autorelease pool.
674</pre></td></tr>
675
676
677<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('binaryConditionalOperator0')"><a name="binaryConditionalOperator0Anchor">binaryConditionalOperator</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryConditionalOperator.html">BinaryConditionalOperator</a>&gt;...</td></tr>
678<tr><td colspan="4" class="doc" id="binaryConditionalOperator0"><pre>Matches binary conditional operator expressions (GNU extension).
679
680Example matches a ?: b
681  (a ?: b) + 42;
682</pre></td></tr>
683
684
685<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>
686<tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions.
687
688Example matches a || b
689  !(a || b)
690</pre></td></tr>
691
692
693<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>
694<tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements.
695
696Given
697  while (true) { break; }
698breakStmt()
699  matches 'break'
700</pre></td></tr>
701
702
703<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>
704<tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression.
705
706Example: Matches (int) 2.2f in
707  int i = (int) 2.2f;
708</pre></td></tr>
709
710
711<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>
712<tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions.
713
714Example matches x.y() and y()
715  X x;
716  x.y();
717  y();
718</pre></td></tr>
719
720
721<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>
722<tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements.
723
724Given
725  switch(a) { case 42: break; default: break; }
726caseStmt()
727  matches 'case 42:'.
728</pre></td></tr>
729
730
731<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>
732<tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST.
733
734Example: castExpr() matches each of the following:
735  (int) 3;
736  const_cast&lt;Expr *&gt;(SubExpr);
737  char c = 0;
738but does not match
739  int i = (0);
740  int k = 0;
741</pre></td></tr>
742
743
744<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>
745<tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t).
746
747Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
748though.
749
750Example matches 'a', L'a'
751  char ch = 'a';
752  wchar_t chw = L'a';
753</pre></td></tr>
754
755
756<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>
757<tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
758
759Example match: {1}, (1, 2)
760  int array[4] = {1};
761  vector int myvec = (vector int)(1, 2);
762</pre></td></tr>
763
764
765<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>
766<tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements.
767
768Example matches '{}' and '{{}}' in 'for (;;) {{}}'
769  for (;;) {{}}
770</pre></td></tr>
771
772
773<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>
774<tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions.
775
776Example matches a ? b : c
777  (a ? b : c) + 42
778</pre></td></tr>
779
780
781<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>
782<tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements.
783
784Given
785  while (true) { continue; }
786continueStmt()
787  matches 'continue'
788</pre></td></tr>
789
790
791<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>
792<tr><td colspan="4" class="doc" id="cudaKernelCallExpr0"><pre>Matches CUDA kernel call expression.
793
794Example matches,
795  kernel&lt;&lt;&lt;i,j&gt;&gt;&gt;();
796</pre></td></tr>
797
798
799<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxBindTemporaryExpr0')"><a name="cxxBindTemporaryExpr0Anchor">cxxBindTemporaryExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBindTemporaryExpr.html">CXXBindTemporaryExpr</a>&gt;...</td></tr>
800<tr><td colspan="4" class="doc" id="cxxBindTemporaryExpr0"><pre>Matches nodes where temporaries are created.
801
802Example matches FunctionTakesString(GetStringByValue())
803    (matcher = cxxBindTemporaryExpr())
804  FunctionTakesString(GetStringByValue());
805  FunctionTakesStringByPointer(GetStringPointer());
806</pre></td></tr>
807
808
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('cxxBoolLiteral0')"><a name="cxxBoolLiteral0Anchor">cxxBoolLiteral</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;...</td></tr>
810<tr><td colspan="4" class="doc" id="cxxBoolLiteral0"><pre>Matches bool literals.
811
812Example matches true
813  true
814</pre></td></tr>
815
816
817<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxCatchStmt0')"><a name="cxxCatchStmt0Anchor">cxxCatchStmt</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCatchStmt.html">CXXCatchStmt</a>&gt;...</td></tr>
818<tr><td colspan="4" class="doc" id="cxxCatchStmt0"><pre>Matches catch statements.
819
820  try {} catch(int i) {}
821cxxCatchStmt()
822  matches 'catch(int i)'
823</pre></td></tr>
824
825
826<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxConstCastExpr0')"><a name="cxxConstCastExpr0Anchor">cxxConstCastExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstCastExpr.html">CXXConstCastExpr</a>&gt;...</td></tr>
827<tr><td colspan="4" class="doc" id="cxxConstCastExpr0"><pre>Matches a const_cast expression.
828
829Example: Matches const_cast&lt;int*&gt;(&amp;r) in
830  int n = 42;
831  const int &amp;r(n);
832  int* p = const_cast&lt;int*&gt;(&amp;r);
833</pre></td></tr>
834
835
836<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxConstructExpr0')"><a name="cxxConstructExpr0Anchor">cxxConstructExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;...</td></tr>
837<tr><td colspan="4" class="doc" id="cxxConstructExpr0"><pre>Matches constructor call expressions (including implicit ones).
838
839Example matches string(ptr, n) and ptr within arguments of f
840    (matcher = cxxConstructExpr())
841  void f(const string &amp;a, const string &amp;b);
842  char *ptr;
843  int n;
844  f(string(ptr, n), ptr);
845</pre></td></tr>
846
847
848<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxDefaultArgExpr0')"><a name="cxxDefaultArgExpr0Anchor">cxxDefaultArgExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDefaultArgExpr.html">CXXDefaultArgExpr</a>&gt;...</td></tr>
849<tr><td colspan="4" class="doc" id="cxxDefaultArgExpr0"><pre>Matches the value of a default argument at the call site.
850
851Example matches the CXXDefaultArgExpr placeholder inserted for the
852    default value of the second parameter in the call expression f(42)
853    (matcher = cxxDefaultArgExpr())
854  void f(int x, int y = 0);
855  f(42);
856</pre></td></tr>
857
858
859<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxDeleteExpr0')"><a name="cxxDeleteExpr0Anchor">cxxDeleteExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDeleteExpr.html">CXXDeleteExpr</a>&gt;...</td></tr>
860<tr><td colspan="4" class="doc" id="cxxDeleteExpr0"><pre>Matches delete expressions.
861
862Given
863  delete X;
864cxxDeleteExpr()
865  matches 'delete X'.
866</pre></td></tr>
867
868
869<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxDependentScopeMemberExpr0')"><a name="cxxDependentScopeMemberExpr0Anchor">cxxDependentScopeMemberExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;...</td></tr>
870<tr><td colspan="4" class="doc" id="cxxDependentScopeMemberExpr0"><pre>Matches member expressions where the actual member referenced could not be
871resolved because the base expression or the member name was dependent.
872
873Given
874  template &lt;class T&gt; void f() { T t; t.g(); }
875cxxDependentScopeMemberExpr()
876  matches t.g
877</pre></td></tr>
878
879
880<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxDynamicCastExpr0')"><a name="cxxDynamicCastExpr0Anchor">cxxDynamicCastExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDynamicCastExpr.html">CXXDynamicCastExpr</a>&gt;...</td></tr>
881<tr><td colspan="4" class="doc" id="cxxDynamicCastExpr0"><pre>Matches a dynamic_cast expression.
882
883Example:
884  cxxDynamicCastExpr()
885matches
886  dynamic_cast&lt;D*&gt;(&amp;b);
887in
888  struct B { virtual ~B() {} }; struct D : B {};
889  B b;
890  D* p = dynamic_cast&lt;D*&gt;(&amp;b);
891</pre></td></tr>
892
893
894<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxForRangeStmt0')"><a name="cxxForRangeStmt0Anchor">cxxForRangeStmt</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>&gt;...</td></tr>
895<tr><td colspan="4" class="doc" id="cxxForRangeStmt0"><pre>Matches range-based for statements.
896
897cxxForRangeStmt() matches 'for (auto a : i)'
898  int i[] =  {1, 2, 3}; for (auto a : i);
899  for(int j = 0; j &lt; 5; ++j);
900</pre></td></tr>
901
902
903<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxFunctionalCastExpr0')"><a name="cxxFunctionalCastExpr0Anchor">cxxFunctionalCastExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;...</td></tr>
904<tr><td colspan="4" class="doc" id="cxxFunctionalCastExpr0"><pre>Matches functional cast expressions
905
906Example: Matches Foo(bar);
907  Foo f = bar;
908  Foo g = (Foo) bar;
909  Foo h = Foo(bar);
910</pre></td></tr>
911
912
913<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxMemberCallExpr0')"><a name="cxxMemberCallExpr0Anchor">cxxMemberCallExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>&gt;...</td></tr>
914<tr><td colspan="4" class="doc" id="cxxMemberCallExpr0"><pre>Matches member call expressions.
915
916Example matches x.y()
917  X x;
918  x.y();
919</pre></td></tr>
920
921
922<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxNewExpr0')"><a name="cxxNewExpr0Anchor">cxxNewExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;...</td></tr>
923<tr><td colspan="4" class="doc" id="cxxNewExpr0"><pre>Matches new expressions.
924
925Given
926  new X;
927cxxNewExpr()
928  matches 'new X'.
929</pre></td></tr>
930
931
932<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxNullPtrLiteralExpr0')"><a name="cxxNullPtrLiteralExpr0Anchor">cxxNullPtrLiteralExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNullPtrLiteralExpr.html">CXXNullPtrLiteralExpr</a>&gt;...</td></tr>
933<tr><td colspan="4" class="doc" id="cxxNullPtrLiteralExpr0"><pre>Matches nullptr literal.
934</pre></td></tr>
935
936
937<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxOperatorCallExpr0')"><a name="cxxOperatorCallExpr0Anchor">cxxOperatorCallExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;...</td></tr>
938<tr><td colspan="4" class="doc" id="cxxOperatorCallExpr0"><pre>Matches overloaded operator calls.
939
940Note that if an operator isn't overloaded, it won't match. Instead, use
941binaryOperator matcher.
942Currently it does not match operators such as new delete.
943FIXME: figure out why these do not match?
944
945Example matches both operator&lt;&lt;((o &lt;&lt; b), c) and operator&lt;&lt;(o, b)
946    (matcher = cxxOperatorCallExpr())
947  ostream &amp;operator&lt;&lt; (ostream &amp;out, int i) { };
948  ostream &amp;o; int b = 1, c = 1;
949  o &lt;&lt; b &lt;&lt; c;
950</pre></td></tr>
951
952
953<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxReinterpretCastExpr0')"><a name="cxxReinterpretCastExpr0Anchor">cxxReinterpretCastExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXReinterpretCastExpr.html">CXXReinterpretCastExpr</a>&gt;...</td></tr>
954<tr><td colspan="4" class="doc" id="cxxReinterpretCastExpr0"><pre>Matches a reinterpret_cast expression.
955
956Either the source expression or the destination type can be matched
957using has(), but hasDestinationType() is more specific and can be
958more readable.
959
960Example matches reinterpret_cast&lt;char*&gt;(&amp;p) in
961  void* p = reinterpret_cast&lt;char*&gt;(&amp;p);
962</pre></td></tr>
963
964
965<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxStaticCastExpr0')"><a name="cxxStaticCastExpr0Anchor">cxxStaticCastExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXStaticCastExpr.html">CXXStaticCastExpr</a>&gt;...</td></tr>
966<tr><td colspan="4" class="doc" id="cxxStaticCastExpr0"><pre>Matches a C++ static_cast expression.
967
968See also: hasDestinationType
969See also: reinterpretCast
970
971Example:
972  cxxStaticCastExpr()
973matches
974  static_cast&lt;long&gt;(8)
975in
976  long eight(static_cast&lt;long&gt;(8));
977</pre></td></tr>
978
979
980<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxStdInitializerListExpr0')"><a name="cxxStdInitializerListExpr0Anchor">cxxStdInitializerListExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXStdInitializerListExpr.html">CXXStdInitializerListExpr</a>&gt;...</td></tr>
981<tr><td colspan="4" class="doc" id="cxxStdInitializerListExpr0"><pre>Matches C++ initializer list expressions.
982
983Given
984  std::vector&lt;int&gt; a({ 1, 2, 3 });
985  std::vector&lt;int&gt; b = { 4, 5 };
986  int c[] = { 6, 7 };
987  std::pair&lt;int, int&gt; d = { 8, 9 };
988cxxStdInitializerListExpr()
989  matches "{ 1, 2, 3 }" and "{ 4, 5 }"
990</pre></td></tr>
991
992
993<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxTemporaryObjectExpr0')"><a name="cxxTemporaryObjectExpr0Anchor">cxxTemporaryObjectExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;...</td></tr>
994<tr><td colspan="4" class="doc" id="cxxTemporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments
995
996Example: Matches Foo(bar, bar)
997  Foo h = Foo(bar, bar);
998</pre></td></tr>
999
1000
1001<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxThisExpr0')"><a name="cxxThisExpr0Anchor">cxxThisExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXThisExpr.html">CXXThisExpr</a>&gt;...</td></tr>
1002<tr><td colspan="4" class="doc" id="cxxThisExpr0"><pre>Matches implicit and explicit this expressions.
1003
1004Example matches the implicit this expression in "return i".
1005    (matcher = cxxThisExpr())
1006struct foo {
1007  int i;
1008  int f() { return i; }
1009};
1010</pre></td></tr>
1011
1012
1013<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxThrowExpr0')"><a name="cxxThrowExpr0Anchor">cxxThrowExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXThrowExpr.html">CXXThrowExpr</a>&gt;...</td></tr>
1014<tr><td colspan="4" class="doc" id="cxxThrowExpr0"><pre>Matches throw expressions.
1015
1016  try { throw 5; } catch(int i) {}
1017cxxThrowExpr()
1018  matches 'throw 5'
1019</pre></td></tr>
1020
1021
1022<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxTryStmt0')"><a name="cxxTryStmt0Anchor">cxxTryStmt</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXTryStmt.html">CXXTryStmt</a>&gt;...</td></tr>
1023<tr><td colspan="4" class="doc" id="cxxTryStmt0"><pre>Matches try statements.
1024
1025  try {} catch(int i) {}
1026cxxTryStmt()
1027  matches 'try {}'
1028</pre></td></tr>
1029
1030
1031<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxUnresolvedConstructExpr0')"><a name="cxxUnresolvedConstructExpr0Anchor">cxxUnresolvedConstructExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;...</td></tr>
1032<tr><td colspan="4" class="doc" id="cxxUnresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions.
1033
1034Example matches T(t) in return statement of f
1035    (matcher = cxxUnresolvedConstructExpr())
1036  template &lt;typename T&gt;
1037  void f(const T&amp; t) { return T(t); }
1038</pre></td></tr>
1039
1040
1041<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>
1042<tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations.
1043
1044Example matches x in if (x)
1045  bool x;
1046  if (x) {}
1047</pre></td></tr>
1048
1049
1050<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>
1051<tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements.
1052
1053Given
1054  int a;
1055declStmt()
1056  matches 'int a'.
1057</pre></td></tr>
1058
1059
1060<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>
1061<tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements.
1062
1063Given
1064  switch(a) { case 42: break; default: break; }
1065defaultStmt()
1066  matches 'default:'.
1067</pre></td></tr>
1068
1069
1070<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('designatedInitExpr0')"><a name="designatedInitExpr0Anchor">designatedInitExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DesignatedInitExpr.html">DesignatedInitExpr</a>&gt;...</td></tr>
1071<tr><td colspan="4" class="doc" id="designatedInitExpr0"><pre>Matches C99 designated initializer expressions [C99 6.7.8].
1072
1073Example: Matches { [2].y = 1.0, [0].x = 1.0 }
1074  point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
1075</pre></td></tr>
1076
1077
1078<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>
1079<tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements.
1080
1081Given
1082  do {} while (true);
1083doStmt()
1084  matches 'do {} while(true)'
1085</pre></td></tr>
1086
1087
1088<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>
1089<tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions.
1090
1091Matches any cast expression written in user code, whether it be a
1092C-style cast, a functional-style cast, or a keyword cast.
1093
1094Does not match implicit conversions.
1095
1096Note: the name "explicitCast" is chosen to match Clang's terminology, as
1097Clang uses the term "cast" to apply to implicit conversions as well as to
1098actual cast expressions.
1099
1100See also: hasDestinationType.
1101
1102Example: matches all five of the casts in
1103  int((int)(reinterpret_cast&lt;int&gt;(static_cast&lt;int&gt;(const_cast&lt;int&gt;(42)))))
1104but does not match the implicit conversion in
1105  long ell = 42;
1106</pre></td></tr>
1107
1108
1109<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>
1110<tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions.
1111
1112Example matches x()
1113  void f() { x(); }
1114</pre></td></tr>
1115
1116
1117<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>
1118<tr><td colspan="4" class="doc" id="exprWithCleanups0"><pre>Matches expressions that introduce cleanups to be run at the end
1119of the sub-expression's evaluation.
1120
1121Example matches std::string()
1122  const std::string str = std::string();
1123</pre></td></tr>
1124
1125
1126<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>
1127<tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes encodings, e.g.
11281.0, 1.0f, 1.0L and 1e10.
1129
1130Does not match implicit conversions such as
1131  float a = 10;
1132</pre></td></tr>
1133
1134
1135<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>
1136<tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements.
1137
1138Example matches 'for (;;) {}'
1139  for (;;) {}
1140  int i[] =  {1, 2, 3}; for (auto a : i);
1141</pre></td></tr>
1142
1143
1144<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('gnuNullExpr0')"><a name="gnuNullExpr0Anchor">gnuNullExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1GNUNullExpr.html">GNUNullExpr</a>&gt;...</td></tr>
1145<tr><td colspan="4" class="doc" id="gnuNullExpr0"><pre>Matches GNU __null expression.
1146</pre></td></tr>
1147
1148
1149<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>
1150<tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements.
1151
1152Given
1153  goto FOO;
1154  FOO: bar();
1155gotoStmt()
1156  matches 'goto FOO'
1157</pre></td></tr>
1158
1159
1160<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>
1161<tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements.
1162
1163Example matches 'if (x) {}'
1164  if (x) {}
1165</pre></td></tr>
1166
1167
1168<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>
1169<tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST.
1170
1171This matches many different places, including function call return value
1172eliding, as well as any type conversions.
1173</pre></td></tr>
1174
1175
1176<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('implicitValueInitExpr0')"><a name="implicitValueInitExpr0Anchor">implicitValueInitExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ImplicitValueInitExpr.html">ImplicitValueInitExpr</a>&gt;...</td></tr>
1177<tr><td colspan="4" class="doc" id="implicitValueInitExpr0"><pre>Matches implicit initializers of init list expressions.
1178
1179Given
1180  point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
1181implicitValueInitExpr()
1182  matches "[0].y" (implicitly)
1183</pre></td></tr>
1184
1185
1186<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>
1187<tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions.
1188
1189Given
1190  int a[] = { 1, 2 };
1191  struct B { int x, y; };
1192  B b = { 5, 6 };
1193initListExpr()
1194  matches "{ 1, 2 }" and "{ 5, 6 }"
1195</pre></td></tr>
1196
1197
1198<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>
1199<tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes encodings, e.g.
12001, 1L, 0x1 and 1U.
1201
1202Does not match character-encoded integers such as L'a'.
1203</pre></td></tr>
1204
1205
1206<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>
1207<tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements.
1208
1209Given
1210  goto FOO;
1211  FOO: bar();
1212labelStmt()
1213  matches 'FOO:'
1214</pre></td></tr>
1215
1216
1217<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>
1218<tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions.
1219
1220Example matches [&amp;](){return 5;}
1221  [&amp;](){return 5;}
1222</pre></td></tr>
1223
1224
1225<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>
1226<tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized.
1227
1228Example: Given
1229  struct T {void func();};
1230  T f();
1231  void g(T);
1232materializeTemporaryExpr() matches 'f()' in these statements
1233  T u(f());
1234  g(f());
1235  f().func();
1236but does not match
1237  f();
1238</pre></td></tr>
1239
1240
1241<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>
1242<tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions.
1243
1244Given
1245  class Y {
1246    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
1247    int a; static int b;
1248  };
1249memberExpr()
1250  matches this-&gt;x, x, y.x, a, this-&gt;b
1251</pre></td></tr>
1252
1253
1254<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>
1255<tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements.
1256
1257  foo();;
1258nullStmt()
1259  matches the second ';'
1260</pre></td></tr>
1261
1262
1263<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcCatchStmt0')"><a name="objcCatchStmt0Anchor">objcCatchStmt</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCAtCatchStmt.html">ObjCAtCatchStmt</a>&gt;...</td></tr>
1264<tr><td colspan="4" class="doc" id="objcCatchStmt0"><pre>Matches Objective-C @catch statements.
1265
1266Example matches @catch
1267  @try {}
1268  @catch (...) {}
1269</pre></td></tr>
1270
1271
1272<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcFinallyStmt0')"><a name="objcFinallyStmt0Anchor">objcFinallyStmt</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCAtFinallyStmt.html">ObjCAtFinallyStmt</a>&gt;...</td></tr>
1273<tr><td colspan="4" class="doc" id="objcFinallyStmt0"><pre>Matches Objective-C @finally statements.
1274
1275Example matches @finally
1276  @try {}
1277  @finally {}
1278</pre></td></tr>
1279
1280
1281<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcIvarRefExpr0')"><a name="objcIvarRefExpr0Anchor">objcIvarRefExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCIvarRefExpr.html">ObjCIvarRefExpr</a>&gt;...</td></tr>
1282<tr><td colspan="4" class="doc" id="objcIvarRefExpr0"><pre>Matches a reference to an ObjCIvar.
1283
1284Example: matches "a" in "init" method:
1285@implementation A {
1286  NSString *a;
1287}
1288- (void) init {
1289  a = @"hello";
1290}
1291}
1292</pre></td></tr>
1293
1294
1295<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcMessageExpr0')"><a name="objcMessageExpr0Anchor">objcMessageExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;...</td></tr>
1296<tr><td colspan="4" class="doc" id="objcMessageExpr0"><pre>Matches ObjectiveC Message invocation expressions.
1297
1298The innermost message send invokes the "alloc" class method on the
1299NSString class, while the outermost message send invokes the
1300"initWithString" instance method on the object returned from
1301NSString's "alloc". This matcher should match both message sends.
1302  [[NSString alloc] initWithString:@"Hello"]
1303</pre></td></tr>
1304
1305
1306<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcThrowStmt0')"><a name="objcThrowStmt0Anchor">objcThrowStmt</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCAtThrowStmt.html">ObjCAtThrowStmt</a>&gt;...</td></tr>
1307<tr><td colspan="4" class="doc" id="objcThrowStmt0"><pre>Matches Objective-C statements.
1308
1309Example matches @throw obj;
1310</pre></td></tr>
1311
1312
1313<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcTryStmt0')"><a name="objcTryStmt0Anchor">objcTryStmt</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCAtTryStmt.html">ObjCAtTryStmt</a>&gt;...</td></tr>
1314<tr><td colspan="4" class="doc" id="objcTryStmt0"><pre>Matches Objective-C @try statements.
1315
1316Example matches @try
1317  @try {}
1318  @catch (...) {}
1319</pre></td></tr>
1320
1321
1322<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('opaqueValueExpr0')"><a name="opaqueValueExpr0Anchor">opaqueValueExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1OpaqueValueExpr.html">OpaqueValueExpr</a>&gt;...</td></tr>
1323<tr><td colspan="4" class="doc" id="opaqueValueExpr0"><pre>Matches opaque value expressions. They are used as helpers
1324to reference another expressions and can be met
1325in BinaryConditionalOperators, for example.
1326
1327Example matches 'a'
1328  (a ?: c) + 42;
1329</pre></td></tr>
1330
1331
1332<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('parenExpr0')"><a name="parenExpr0Anchor">parenExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenExpr.html">ParenExpr</a>&gt;...</td></tr>
1333<tr><td colspan="4" class="doc" id="parenExpr0"><pre>Matches parentheses used in expressions.
1334
1335Example matches (foo() + 1)
1336  int foo() { return 1; }
1337  int a = (foo() + 1);
1338</pre></td></tr>
1339
1340
1341<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('parenListExpr0')"><a name="parenListExpr0Anchor">parenListExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenListExpr.html">ParenListExpr</a>&gt;...</td></tr>
1342<tr><td colspan="4" class="doc" id="parenListExpr0"><pre>Matches paren list expressions.
1343ParenListExprs don't have a predefined type and are used for late parsing.
1344In the final AST, they can be met in template declarations.
1345
1346Given
1347  template&lt;typename T&gt; class X {
1348    void f() {
1349      X x(*this);
1350      int a = 0, b = 1; int i = (a, b);
1351    }
1352  };
1353parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
1354has a predefined type and is a ParenExpr, not a ParenListExpr.
1355</pre></td></tr>
1356
1357
1358<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('predefinedExpr0')"><a name="predefinedExpr0Anchor">predefinedExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1PredefinedExpr.html">PredefinedExpr</a>&gt;...</td></tr>
1359<tr><td colspan="4" class="doc" id="predefinedExpr0"><pre>Matches predefined identifier expressions [C99 6.4.2.2].
1360
1361Example: Matches __func__
1362  printf("%s", __func__);
1363</pre></td></tr>
1364
1365
1366<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>
1367<tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements.
1368
1369Given
1370  return 1;
1371returnStmt()
1372  matches 'return 1'
1373</pre></td></tr>
1374
1375
1376<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>
1377<tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements.
1378
1379Given
1380  { ++a; }
1381stmt()
1382  matches both the compound statement '{ ++a; }' and '++a'.
1383</pre></td></tr>
1384
1385
1386<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('stmtExpr0')"><a name="stmtExpr0Anchor">stmtExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1StmtExpr.html">StmtExpr</a>&gt;...</td></tr>
1387<tr><td colspan="4" class="doc" id="stmtExpr0"><pre>Matches statement expression (GNU extension).
1388
1389Example match: ({ int X = 4; X; })
1390  int C = ({ int X = 4; X; });
1391</pre></td></tr>
1392
1393
1394<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>
1395<tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
1396
1397Example matches "abcd", L"abcd"
1398  char *s = "abcd";
1399  wchar_t *ws = L"abcd";
1400</pre></td></tr>
1401
1402
1403<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>
1404<tr><td colspan="4" class="doc" id="substNonTypeTemplateParmExpr0"><pre>Matches substitutions of non-type template parameters.
1405
1406Given
1407  template &lt;int N&gt;
1408  struct A { static const int n = N; };
1409  struct B : public A&lt;42&gt; {};
1410substNonTypeTemplateParmExpr()
1411  matches "N" in the right-hand side of "static const int n = N;"
1412</pre></td></tr>
1413
1414
1415<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>
1416<tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements.
1417
1418Given
1419  switch(a) { case 42: break; default: break; }
1420switchCase()
1421  matches 'case 42:' and 'default:'.
1422</pre></td></tr>
1423
1424
1425<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>
1426<tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements.
1427
1428Given
1429  switch(a) { case 42: break; default: break; }
1430switchStmt()
1431  matches 'switch(a)'.
1432</pre></td></tr>
1433
1434
1435<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>
1436<tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
1437
1438Given
1439  Foo x = bar;
1440  int y = sizeof(x) + alignof(x);
1441unaryExprOrTypeTraitExpr()
1442  matches sizeof(x) and alignof(x)
1443</pre></td></tr>
1444
1445
1446<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>
1447<tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions.
1448
1449Example matches !a
1450  !a || b
1451</pre></td></tr>
1452
1453
1454<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('unresolvedLookupExpr0')"><a name="unresolvedLookupExpr0Anchor">unresolvedLookupExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedLookupExpr.html">UnresolvedLookupExpr</a>&gt;...</td></tr>
1455<tr><td colspan="4" class="doc" id="unresolvedLookupExpr0"><pre>Matches reference to a name that can be looked up during parsing
1456but could not be resolved to a specific declaration.
1457
1458Given
1459  template&lt;typename T&gt;
1460  T foo() { T a; return a; }
1461  template&lt;typename T&gt;
1462  void bar() {
1463    foo&lt;T&gt;();
1464  }
1465unresolvedLookupExpr()
1466  matches foo&lt;T&gt;() </pre></td></tr>
1467
1468
1469<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('unresolvedMemberExpr0')"><a name="unresolvedMemberExpr0Anchor">unresolvedMemberExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedMemberExpr.html">UnresolvedMemberExpr</a>&gt;...</td></tr>
1470<tr><td colspan="4" class="doc" id="unresolvedMemberExpr0"><pre>Matches unresolved member expressions.
1471
1472Given
1473  struct X {
1474    template &lt;class T&gt; void f();
1475    void g();
1476  };
1477  template &lt;class T&gt; void h() { X x; x.f&lt;T&gt;(); x.g(); }
1478unresolvedMemberExpr()
1479  matches x.f&lt;T&gt;
1480</pre></td></tr>
1481
1482
1483<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>
1484<tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call.
1485
1486Example match: "foo"_suffix
1487</pre></td></tr>
1488
1489
1490<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>
1491<tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements.
1492
1493Given
1494  while (true) {}
1495whileStmt()
1496  matches 'while (true) {}'.
1497</pre></td></tr>
1498
1499
1500<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>
1501<tr><td colspan="4" class="doc" id="templateArgument0"><pre>Matches template arguments.
1502
1503Given
1504  template &lt;typename T&gt; struct C {};
1505  C&lt;int&gt; c;
1506templateArgument()
1507  matches 'int' in C&lt;int&gt;.
1508</pre></td></tr>
1509
1510
1511<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateName.html">TemplateName</a>&gt;</td><td class="name" onclick="toggle('templateName0')"><a name="templateName0Anchor">templateName</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateName.html">TemplateName</a>&gt;...</td></tr>
1512<tr><td colspan="4" class="doc" id="templateName0"><pre>Matches template name.
1513
1514Given
1515  template &lt;typename T&gt; class X { };
1516  X&lt;int&gt; xi;
1517templateName()
1518  matches 'X' in X&lt;int&gt;.
1519</pre></td></tr>
1520
1521
1522<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>
1523<tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST.
1524</pre></td></tr>
1525
1526
1527<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>
1528<tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays.
1529
1530Given
1531  int a[] = { 2, 3 };
1532  int b[4];
1533  void f() { int c[a[0]]; }
1534arrayType()
1535  matches "int a[]", "int b[4]" and "int c[a[0]]";
1536</pre></td></tr>
1537
1538
1539<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>
1540<tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types.
1541
1542Given
1543  _Atomic(int) i;
1544atomicType()
1545  matches "_Atomic(int) i"
1546</pre></td></tr>
1547
1548
1549<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>
1550<tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types.
1551
1552Given:
1553  auto n = 4;
1554  int v[] = { 2, 3 }
1555  for (auto i : v) { }
1556autoType()
1557  matches "auto n" and "auto i"
1558</pre></td></tr>
1559
1560
1561<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>
1562<tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as
1563"void (^)(int)".
1564
1565The pointee is always required to be a FunctionType.
1566</pre></td></tr>
1567
1568
1569<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>
1570<tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types.
1571
1572Given
1573  struct A {};
1574  A a;
1575  int b;
1576  float c;
1577  bool d;
1578builtinType()
1579  matches "int b", "float c" and "bool d"
1580</pre></td></tr>
1581
1582
1583<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>
1584<tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types.
1585
1586Given
1587  _Complex float f;
1588complexType()
1589  matches "_Complex float f"
1590</pre></td></tr>
1591
1592
1593<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>
1594<tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size.
1595
1596Given
1597  void() {
1598    int a[2];
1599    int b[] = { 2, 3 };
1600    int c[b[0]];
1601  }
1602constantArrayType()
1603  matches "int a[2]"
1604</pre></td></tr>
1605
1606
1607<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('decayedType0')"><a name="decayedType0Anchor">decayedType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DecayedType.html">DecayedType</a>&gt;...</td></tr>
1608<tr><td colspan="4" class="doc" id="decayedType0"><pre>Matches decayed type
1609Example matches i[] in declaration of f.
1610    (matcher = valueDecl(hasType(decayedType(hasDecayedType(pointerType())))))
1611Example matches i[1].
1612    (matcher = expr(hasType(decayedType(hasDecayedType(pointerType())))))
1613  void f(int i[]) {
1614    i[1] = 0;
1615  }
1616</pre></td></tr>
1617
1618
1619<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('decltypeType0')"><a name="decltypeType0Anchor">decltypeType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;...</td></tr>
1620<tr><td colspan="4" class="doc" id="decltypeType0"><pre>Matches types nodes representing C++11 decltype(&lt;expr&gt;) types.
1621
1622Given:
1623  short i = 1;
1624  int j = 42;
1625  decltype(i + j) result = i + j;
1626decltypeType()
1627  matches "decltype(i + j)"
1628</pre></td></tr>
1629
1630
1631<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>
1632<tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression.
1633
1634Given
1635  template&lt;typename T, int Size&gt;
1636  class array {
1637    T data[Size];
1638  };
1639dependentSizedArrayType
1640  matches "T data[Size]"
1641</pre></td></tr>
1642
1643
1644<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>
1645<tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a
1646qualified name.
1647
1648Given
1649  namespace N {
1650    namespace M {
1651      class D {};
1652    }
1653  }
1654  class C {};
1655
1656  class C c;
1657  N::M::D d;
1658
1659elaboratedType() matches the type of the variable declarations of both
1660c and d.
1661</pre></td></tr>
1662
1663
1664<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('enumType0')"><a name="enumType0Anchor">enumType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;...</td></tr>
1665<tr><td colspan="4" class="doc" id="enumType0"><pre>Matches enum types.
1666
1667Given
1668  enum C { Green };
1669  enum class S { Red };
1670
1671  C c;
1672  S s;
1673
1674enumType() matches the type of the variable declarations of both c and
1675s.
1676</pre></td></tr>
1677
1678
1679<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('functionProtoType0')"><a name="functionProtoType0Anchor">functionProtoType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionProtoType.html">FunctionProtoType</a>&gt;...</td></tr>
1680<tr><td colspan="4" class="doc" id="functionProtoType0"><pre>Matches FunctionProtoType nodes.
1681
1682Given
1683  int (*f)(int);
1684  void g();
1685functionProtoType()
1686  matches "int (*f)(int)" and the type of "g" in C++ mode.
1687  In C mode, "g" is not matched because it does not contain a prototype.
1688</pre></td></tr>
1689
1690
1691<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>
1692<tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes.
1693
1694Given
1695  int (*f)(int);
1696  void g();
1697functionType()
1698  matches "int (*f)(int)" and the type of "g".
1699</pre></td></tr>
1700
1701
1702<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>
1703<tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size.
1704
1705Given
1706  int a[] = { 2, 3 };
1707  int b[42];
1708  void f(int c[]) { int d[a[0]]; };
1709incompleteArrayType()
1710  matches "int a[]" and "int c[]"
1711</pre></td></tr>
1712
1713
1714<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('injectedClassNameType0')"><a name="injectedClassNameType0Anchor">injectedClassNameType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;...</td></tr>
1715<tr><td colspan="4" class="doc" id="injectedClassNameType0"><pre>Matches injected class name types.
1716
1717Example matches S s, but not S&lt;T&gt; s.
1718    (matcher = parmVarDecl(hasType(injectedClassNameType())))
1719  template &lt;typename T&gt; struct S {
1720    void f(S s);
1721    void g(S&lt;T&gt; s);
1722  };
1723</pre></td></tr>
1724
1725
1726<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>
1727<tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types.
1728
1729Given:
1730  int *a;
1731  int &amp;b = *a;
1732  int &amp;&amp;c = 1;
1733  auto &amp;d = b;
1734  auto &amp;&amp;e = c;
1735  auto &amp;&amp;f = 2;
1736  int g = 5;
1737
1738lValueReferenceType() matches the types of b, d, and e. e is
1739matched since the type is deduced as int&amp; by reference collapsing rules.
1740</pre></td></tr>
1741
1742
1743<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>
1744<tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types.
1745Given
1746  struct A { int i; }
1747  A::* ptr = A::i;
1748memberPointerType()
1749  matches "A::* ptr"
1750</pre></td></tr>
1751
1752
1753<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('objcObjectPointerType0')"><a name="objcObjectPointerType0Anchor">objcObjectPointerType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCObjectPointerType.html">ObjCObjectPointerType</a>&gt;...</td></tr>
1754<tr><td colspan="4" class="doc" id="objcObjectPointerType0"><pre>Matches an Objective-C object pointer type, which is different from
1755a pointer type, despite being syntactically similar.
1756
1757Given
1758  int *a;
1759
1760  @interface Foo
1761  @end
1762  Foo *f;
1763pointerType()
1764  matches "Foo *f", but does not match "int *a".
1765</pre></td></tr>
1766
1767
1768<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>
1769<tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes.
1770
1771Given
1772  int (*ptr_to_array)[4];
1773  int *array_of_ptrs[4];
1774
1775varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
1776array_of_ptrs.
1777</pre></td></tr>
1778
1779
1780<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>
1781<tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types, but does not match Objective-C object pointer
1782types.
1783
1784Given
1785  int *a;
1786  int &amp;b = *a;
1787  int c = 5;
1788
1789  @interface Foo
1790  @end
1791  Foo *f;
1792pointerType()
1793  matches "int *a", but does not match "Foo *f".
1794</pre></td></tr>
1795
1796
1797<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>
1798<tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types.
1799
1800Given:
1801  int *a;
1802  int &amp;b = *a;
1803  int &amp;&amp;c = 1;
1804  auto &amp;d = b;
1805  auto &amp;&amp;e = c;
1806  auto &amp;&amp;f = 2;
1807  int g = 5;
1808
1809rValueReferenceType() matches the types of c and f. e is not
1810matched as it is deduced to int&amp; by reference collapsing rules.
1811</pre></td></tr>
1812
1813
1814<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>
1815<tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes).
1816
1817Given
1818  class C {};
1819  struct S {};
1820
1821  C c;
1822  S s;
1823
1824recordType() matches the type of the variable declarations of both c
1825and s.
1826</pre></td></tr>
1827
1828
1829<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>
1830<tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types.
1831
1832Given
1833  int *a;
1834  int &amp;b = *a;
1835  int &amp;&amp;c = 1;
1836  auto &amp;d = b;
1837  auto &amp;&amp;e = c;
1838  auto &amp;&amp;f = 2;
1839  int g = 5;
1840
1841referenceType() matches the types of b, c, d, e, and f.
1842</pre></td></tr>
1843
1844
1845<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('substTemplateTypeParmType0')"><a name="substTemplateTypeParmType0Anchor">substTemplateTypeParmType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1SubstTemplateTypeParmType.html">SubstTemplateTypeParmType</a>&gt;...</td></tr>
1846<tr><td colspan="4" class="doc" id="substTemplateTypeParmType0"><pre>Matches types that represent the result of substituting a type for a
1847template type parameter.
1848
1849Given
1850  template &lt;typename T&gt;
1851  void F(T t) {
1852    int i = 1 + t;
1853  }
1854
1855substTemplateTypeParmType() matches the type of 't' but not '1'
1856</pre></td></tr>
1857
1858
1859<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('tagType0')"><a name="tagType0Anchor">tagType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;...</td></tr>
1860<tr><td colspan="4" class="doc" id="tagType0"><pre>Matches tag types (record and enum types).
1861
1862Given
1863  enum E {};
1864  class C {};
1865
1866  E e;
1867  C c;
1868
1869tagType() matches the type of the variable declarations of both e
1870and c.
1871</pre></td></tr>
1872
1873
1874<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>
1875<tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types.
1876
1877Given
1878  template &lt;typename T&gt;
1879  class C { };
1880
1881  template class C&lt;int&gt;;  A
1882  C&lt;char&gt; var;            B
1883
1884templateSpecializationType() matches the type of the explicit
1885instantiation in A and the type of the variable declaration in B.
1886</pre></td></tr>
1887
1888
1889<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('templateTypeParmType0')"><a name="templateTypeParmType0Anchor">templateTypeParmType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;...</td></tr>
1890<tr><td colspan="4" class="doc" id="templateTypeParmType0"><pre>Matches template type parameter types.
1891
1892Example matches T, but not int.
1893    (matcher = templateTypeParmType())
1894  template &lt;typename T&gt; void f(int i);
1895</pre></td></tr>
1896
1897
1898<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>
1899<tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST.
1900</pre></td></tr>
1901
1902
1903<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>
1904<tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types.
1905
1906Given
1907  typedef int X;
1908typedefType()
1909  matches "typedef int X"
1910</pre></td></tr>
1911
1912
1913<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>
1914<tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations.
1915
1916Given:
1917  typedef __underlying_type(T) type;
1918unaryTransformType()
1919  matches "__underlying_type(T)"
1920</pre></td></tr>
1921
1922
1923<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>
1924<tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an
1925integer-constant-expression.
1926
1927Given
1928  void f() {
1929    int a[] = { 2, 3 }
1930    int b[42];
1931    int c[a[0]];
1932  }
1933variableArrayType()
1934  matches "int c[a[0]]"
1935</pre></td></tr>
1936
1937<!--END_DECL_MATCHERS -->
1938</table>
1939
1940<!-- ======================================================================= -->
1941<h2 id="narrowing-matchers">Narrowing Matchers</h2>
1942<!-- ======================================================================= -->
1943
1944<p>Narrowing matchers match certain attributes on the current node, thus
1945narrowing down the set of nodes of the current type to match on.</p>
1946
1947<p>There are special logical narrowing matchers (allOf, anyOf, anything and unless)
1948which allow users to create more powerful match expressions.</p>
1949
1950<table>
1951<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
1952<!-- START_NARROWING_MATCHERS -->
1953
1954<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>
1955<tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match.
1956
1957Usable as: Any Matcher
1958</pre></td></tr>
1959
1960
1961<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>
1962<tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches.
1963
1964Usable as: Any Matcher
1965</pre></td></tr>
1966
1967
1968<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr>
1969<tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node.
1970
1971Useful when another matcher requires a child matcher, but there's no
1972additional constraint. This will often be used with an explicit conversion
1973to an internal::Matcher&lt;&gt; type such as TypeMatcher.
1974
1975Example: DeclarationMatcher(anything()) matches all declarations, e.g.,
1976"int* p" and "void f()" in
1977  int* p;
1978  void f();
1979
1980Usable as: Any Matcher
1981</pre></td></tr>
1982
1983
1984<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher&lt;*&gt;</td></tr>
1985<tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match.
1986
1987Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
1988  class X {};
1989  class Y {};
1990
1991Usable as: Any Matcher
1992</pre></td></tr>
1993
1994
1995<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>
1996<tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions (binary or
1997unary).
1998
1999Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
2000  !(a || b)
2001</pre></td></tr>
2002
2003
2004<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('isAssignmentOperator0')"><a name="isAssignmentOperator0Anchor">isAssignmentOperator</a></td><td></td></tr>
2005<tr><td colspan="4" class="doc" id="isAssignmentOperator0"><pre>Matches all kinds of assignment operators.
2006
2007Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2008  if (a == b)
2009    a += b;
2010
2011Example 2: matches s1 = s2
2012           (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
2013  struct S { S&amp; operator=(const S&amp;); };
2014  void x() { S s1, s2; s1 = s2; })
2015</pre></td></tr>
2016
2017
2018<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;</td><td class="name" onclick="toggle('equals5')"><a name="equals5Anchor">equals</a></td><td>bool Value</td></tr>
2019<tr><td colspan="4" class="doc" id="equals5"><pre></pre></td></tr>
2020
2021
2022<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;</td><td class="name" onclick="toggle('equals2')"><a name="equals2Anchor">equals</a></td><td>const ValueT  Value</td></tr>
2023<tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value of type ValueT.
2024
2025Given
2026  f('false, 3.14, 42);
2027characterLiteral(equals(0))
2028  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2029  match false
2030floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2031  match 3.14
2032integerLiteral(equals(42))
2033  matches 42
2034
2035Note that you cannot directly match a negative numeric literal because the
2036minus sign is not part of the literal: It is a unary operator whose operand
2037is the positive numeric literal. Instead, you must use a unaryOperator()
2038matcher to match the minus sign:
2039
2040unaryOperator(hasOperatorName("-"),
2041              hasUnaryOperand(integerLiteral(equals(13))))
2042
2043Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;,
2044           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;
2045</pre></td></tr>
2046
2047
2048<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;</td><td class="name" onclick="toggle('equals11')"><a name="equals11Anchor">equals</a></td><td>double Value</td></tr>
2049<tr><td colspan="4" class="doc" id="equals11"><pre></pre></td></tr>
2050
2051
2052<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;</td><td class="name" onclick="toggle('equals8')"><a name="equals8Anchor">equals</a></td><td>unsigned Value</td></tr>
2053<tr><td colspan="4" class="doc" id="equals8"><pre></pre></td></tr>
2054
2055
2056<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCatchStmt.html">CXXCatchStmt</a>&gt;</td><td class="name" onclick="toggle('isCatchAll0')"><a name="isCatchAll0Anchor">isCatchAll</a></td><td></td></tr>
2057<tr><td colspan="4" class="doc" id="isCatchAll0"><pre>Matches a C++ catch statement that has a catch-all handler.
2058
2059Given
2060  try {
2061    ...
2062  } catch (int) {
2063    ...
2064  } catch (...) {
2065    ...
2066  }
2067endcode
2068cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
2069</pre></td></tr>
2070
2071
2072<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>
2073<tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has
2074a specific number of arguments (including absent default arguments).
2075
2076Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2077  void f(int x, int y);
2078  f(0, 0);
2079</pre></td></tr>
2080
2081
2082<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>
2083<tr><td colspan="4" class="doc" id="isListInitialization0"><pre>Matches a constructor call expression which uses list initialization.
2084</pre></td></tr>
2085
2086
2087<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('requiresZeroInitialization0')"><a name="requiresZeroInitialization0Anchor">requiresZeroInitialization</a></td><td></td></tr>
2088<tr><td colspan="4" class="doc" id="requiresZeroInitialization0"><pre>Matches a constructor call expression which requires
2089zero initialization.
2090
2091Given
2092void foo() {
2093  struct point { double x; double y; };
2094  point pt[2] = { { 1.0, 2.0 } };
2095}
2096initListExpr(has(cxxConstructExpr(requiresZeroInitialization()))
2097will match the implicit array filler for pt[1].
2098</pre></td></tr>
2099
2100
2101<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;</td><td class="name" onclick="toggle('isCopyConstructor0')"><a name="isCopyConstructor0Anchor">isCopyConstructor</a></td><td></td></tr>
2102<tr><td colspan="4" class="doc" id="isCopyConstructor0"><pre>Matches constructor declarations that are copy constructors.
2103
2104Given
2105  struct S {
2106    S(); #1
2107    S(const S &amp;); #2
2108    S(S &amp;&amp;); #3
2109  };
2110cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3.
2111</pre></td></tr>
2112
2113
2114<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;</td><td class="name" onclick="toggle('isDefaultConstructor0')"><a name="isDefaultConstructor0Anchor">isDefaultConstructor</a></td><td></td></tr>
2115<tr><td colspan="4" class="doc" id="isDefaultConstructor0"><pre>Matches constructor declarations that are default constructors.
2116
2117Given
2118  struct S {
2119    S(); #1
2120    S(const S &amp;); #2
2121    S(S &amp;&amp;); #3
2122  };
2123cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3.
2124</pre></td></tr>
2125
2126
2127<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;</td><td class="name" onclick="toggle('isDelegatingConstructor0')"><a name="isDelegatingConstructor0Anchor">isDelegatingConstructor</a></td><td></td></tr>
2128<tr><td colspan="4" class="doc" id="isDelegatingConstructor0"><pre>Matches constructors that delegate to another constructor.
2129
2130Given
2131  struct S {
2132    S(); #1
2133    S(int) {} #2
2134    S(S &amp;&amp;) : S() {} #3
2135  };
2136  S::S() : S(0) {} #4
2137cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not
2138#1 or #2.
2139</pre></td></tr>
2140
2141
2142<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;</td><td class="name" onclick="toggle('isExplicit0')"><a name="isExplicit0Anchor">isExplicit</a></td><td></td></tr>
2143<tr><td colspan="4" class="doc" id="isExplicit0"><pre>Matches constructor and conversion declarations that are marked with
2144the explicit keyword.
2145
2146Given
2147  struct S {
2148    S(int); #1
2149    explicit S(double); #2
2150    operator int(); #3
2151    explicit operator bool(); #4
2152  };
2153cxxConstructorDecl(isExplicit()) will match #2, but not #1.
2154cxxConversionDecl(isExplicit()) will match #4, but not #3.
2155</pre></td></tr>
2156
2157
2158<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;</td><td class="name" onclick="toggle('isMoveConstructor0')"><a name="isMoveConstructor0Anchor">isMoveConstructor</a></td><td></td></tr>
2159<tr><td colspan="4" class="doc" id="isMoveConstructor0"><pre>Matches constructor declarations that are move constructors.
2160
2161Given
2162  struct S {
2163    S(); #1
2164    S(const S &amp;); #2
2165    S(S &amp;&amp;); #3
2166  };
2167cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2.
2168</pre></td></tr>
2169
2170
2171<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConversionDecl.html">CXXConversionDecl</a>&gt;</td><td class="name" onclick="toggle('isExplicit1')"><a name="isExplicit1Anchor">isExplicit</a></td><td></td></tr>
2172<tr><td colspan="4" class="doc" id="isExplicit1"><pre>Matches constructor and conversion declarations that are marked with
2173the explicit keyword.
2174
2175Given
2176  struct S {
2177    S(int); #1
2178    explicit S(double); #2
2179    operator int(); #3
2180    explicit operator bool(); #4
2181  };
2182cxxConstructorDecl(isExplicit()) will match #2, but not #1.
2183cxxConversionDecl(isExplicit()) will match #4, but not #3.
2184</pre></td></tr>
2185
2186
2187<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;</td><td class="name" onclick="toggle('isBaseInitializer0')"><a name="isBaseInitializer0Anchor">isBaseInitializer</a></td><td></td></tr>
2188<tr><td colspan="4" class="doc" id="isBaseInitializer0"><pre>Matches a constructor initializer if it is initializing a base, as
2189opposed to a member.
2190
2191Given
2192  struct B {};
2193  struct D : B {
2194    int I;
2195    D(int i) : I(i) {}
2196  };
2197  struct E : B {
2198    E() : B() {}
2199  };
2200cxxConstructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
2201  will match E(), but not match D(int).
2202</pre></td></tr>
2203
2204
2205<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;</td><td class="name" onclick="toggle('isMemberInitializer0')"><a name="isMemberInitializer0Anchor">isMemberInitializer</a></td><td></td></tr>
2206<tr><td colspan="4" class="doc" id="isMemberInitializer0"><pre>Matches a constructor initializer if it is initializing a member, as
2207opposed to a base.
2208
2209Given
2210  struct B {};
2211  struct D : B {
2212    int I;
2213    D(int i) : I(i) {}
2214  };
2215  struct E : B {
2216    E() : B() {}
2217  };
2218cxxConstructorDecl(hasAnyConstructorInitializer(isMemberInitializer()))
2219  will match D(int), but not match E().
2220</pre></td></tr>
2221
2222
2223<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>
2224<tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in
2225code (as opposed to implicitly added by the compiler).
2226
2227Given
2228  struct Foo {
2229    Foo() { }
2230    Foo(int) : foo_("A") { }
2231    string foo_;
2232  };
2233cxxConstructorDecl(hasAnyConstructorInitializer(isWritten()))
2234  will match Foo(int), but not Foo()
2235</pre></td></tr>
2236
2237
2238<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>
2239<tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
2240
2241Given
2242struct A {
2243  void foo() const;
2244  void bar();
2245};
2246
2247cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
2248</pre></td></tr>
2249
2250
2251<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isCopyAssignmentOperator0')"><a name="isCopyAssignmentOperator0Anchor">isCopyAssignmentOperator</a></td><td></td></tr>
2252<tr><td colspan="4" class="doc" id="isCopyAssignmentOperator0"><pre>Matches if the given method declaration declares a copy assignment
2253operator.
2254
2255Given
2256struct A {
2257  A &amp;operator=(const A &amp;);
2258  A &amp;operator=(A &amp;&amp;);
2259};
2260
2261cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
2262the second one.
2263</pre></td></tr>
2264
2265
2266<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isFinal1')"><a name="isFinal1Anchor">isFinal</a></td><td></td></tr>
2267<tr><td colspan="4" class="doc" id="isFinal1"><pre>Matches if the given method or class declaration is final.
2268
2269Given:
2270  class A final {};
2271
2272  struct B {
2273    virtual void f();
2274  };
2275
2276  struct C : B {
2277    void f() final;
2278  };
2279matches A and C::f, but not B, C, or B::f
2280</pre></td></tr>
2281
2282
2283<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isMoveAssignmentOperator0')"><a name="isMoveAssignmentOperator0Anchor">isMoveAssignmentOperator</a></td><td></td></tr>
2284<tr><td colspan="4" class="doc" id="isMoveAssignmentOperator0"><pre>Matches if the given method declaration declares a move assignment
2285operator.
2286
2287Given
2288struct A {
2289  A &amp;operator=(const A &amp;);
2290  A &amp;operator=(A &amp;&amp;);
2291};
2292
2293cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
2294the first one.
2295</pre></td></tr>
2296
2297
2298<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>
2299<tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
2300
2301Given
2302  class A {
2303   public:
2304    virtual void x();
2305  };
2306  class B : public A {
2307   public:
2308    virtual void x();
2309  };
2310  matches B::x
2311</pre></td></tr>
2312
2313
2314<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>
2315<tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure.
2316
2317Given
2318  class A {
2319   public:
2320    virtual void x() = 0;
2321  };
2322  matches A::x
2323</pre></td></tr>
2324
2325
2326<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isUserProvided0')"><a name="isUserProvided0Anchor">isUserProvided</a></td><td></td></tr>
2327<tr><td colspan="4" class="doc" id="isUserProvided0"><pre>Matches method declarations that are user-provided.
2328
2329Given
2330  struct S {
2331    S(); #1
2332    S(const S &amp;) = default; #2
2333    S(S &amp;&amp;) = delete; #3
2334  };
2335cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3.
2336</pre></td></tr>
2337
2338
2339<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>
2340<tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches if the given method declaration is virtual.
2341
2342Given
2343  class A {
2344   public:
2345    virtual void x();
2346  };
2347  matches A::x
2348</pre></td></tr>
2349
2350
2351<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isVirtualAsWritten0')"><a name="isVirtualAsWritten0Anchor">isVirtualAsWritten</a></td><td></td></tr>
2352<tr><td colspan="4" class="doc" id="isVirtualAsWritten0"><pre>Matches if the given method declaration has an explicit "virtual".
2353
2354Given
2355  class A {
2356   public:
2357    virtual void x();
2358  };
2359  class B : public A {
2360   public:
2361    void x();
2362  };
2363  matches A::x but not B::x
2364</pre></td></tr>
2365
2366
2367<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('isArray0')"><a name="isArray0Anchor">isArray</a></td><td></td></tr>
2368<tr><td colspan="4" class="doc" id="isArray0"><pre>Matches array new expressions.
2369
2370Given:
2371  MyClass *p1 = new MyClass[10];
2372cxxNewExpr(isArray())
2373  matches the expression 'new MyClass[10]'.
2374</pre></td></tr>
2375
2376
2377<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>
2378<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
2379
2380Matches overloaded operator names specified in strings without the
2381"operator" prefix: e.g. "&lt;&lt;".
2382
2383Given:
2384  class A { int operator*(); };
2385  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
2386  A a;
2387  a &lt;&lt; a;   &lt;-- This matches
2388
2389cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
2390specified line and
2391cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
2392matches the declaration of A.
2393
2394Usable 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;
2395</pre></td></tr>
2396
2397
2398<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('isAssignmentOperator1')"><a name="isAssignmentOperator1Anchor">isAssignmentOperator</a></td><td></td></tr>
2399<tr><td colspan="4" class="doc" id="isAssignmentOperator1"><pre>Matches all kinds of assignment operators.
2400
2401Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2402  if (a == b)
2403    a += b;
2404
2405Example 2: matches s1 = s2
2406           (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
2407  struct S { S&amp; operator=(const S&amp;); };
2408  void x() { S s1, s2; s1 = s2; })
2409</pre></td></tr>
2410
2411
2412<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('hasDefinition0')"><a name="hasDefinition0Anchor">hasDefinition</a></td><td></td></tr>
2413<tr><td colspan="4" class="doc" id="hasDefinition0"><pre>Matches a class declaration that is defined.
2414
2415Example matches x (matcher = cxxRecordDecl(hasDefinition()))
2416class x {};
2417class y;
2418</pre></td></tr>
2419
2420
2421<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>std::string BaseName</td></tr>
2422<tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
2423</pre></td></tr>
2424
2425
2426<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>
2427<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
2428static member variable template instantiations.
2429
2430Given
2431  template&lt;typename T&gt; void A(T t) { }
2432  template&lt;&gt; void A(int N) { }
2433functionDecl(isExplicitTemplateSpecialization())
2434  matches the specialization A&lt;int&gt;().
2435
2436Usable 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;
2437</pre></td></tr>
2438
2439
2440<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isFinal0')"><a name="isFinal0Anchor">isFinal</a></td><td></td></tr>
2441<tr><td colspan="4" class="doc" id="isFinal0"><pre>Matches if the given method or class declaration is final.
2442
2443Given:
2444  class A final {};
2445
2446  struct B {
2447    virtual void f();
2448  };
2449
2450  struct C : B {
2451    void f() final;
2452  };
2453matches A and C::f, but not B, C, or B::f
2454</pre></td></tr>
2455
2456
2457<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isLambda0')"><a name="isLambda0Anchor">isLambda</a></td><td></td></tr>
2458<tr><td colspan="4" class="doc" id="isLambda0"><pre>Matches the generated class of lambda expressions.
2459
2460Given:
2461  auto x = []{};
2462
2463cxxRecordDecl(isLambda()) matches the implicit class declaration of
2464decltype(x)
2465</pre></td></tr>
2466
2467
2468<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>std::string BaseName</td></tr>
2469<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Overloaded method as shortcut for
2470isSameOrDerivedFrom(hasName(...)).
2471</pre></td></tr>
2472
2473
2474<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>
2475<tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
2476member variable template instantiations.
2477
2478Given
2479  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
2480or
2481  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
2482or
2483  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
2484cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2485  matches the template instantiation of X&lt;A&gt;.
2486
2487But given
2488  template &lt;typename T&gt;  class X {}; class A {};
2489  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
2490cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2491  does not match, as X&lt;A&gt; is an explicit template specialization.
2492
2493Usable 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;
2494</pre></td></tr>
2495
2496
2497<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>
2498<tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
2499a specific number of arguments (including absent default arguments).
2500
2501Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2502  void f(int x, int y);
2503  f(0, 0);
2504</pre></td></tr>
2505
2506
2507<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html">CastExpr</a>&gt;</td><td class="name" onclick="toggle('hasCastKind0')"><a name="hasCastKind0Anchor">hasCastKind</a></td><td>CastKind Kind</td></tr>
2508<tr><td colspan="4" class="doc" id="hasCastKind0"><pre>Matches casts that has a given cast kind.
2509
2510Example: matches the implicit cast around 0
2511(matcher = castExpr(hasCastKind(CK_NullToPointer)))
2512  int *p = 0;
2513</pre></td></tr>
2514
2515
2516<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;</td><td class="name" onclick="toggle('equals4')"><a name="equals4Anchor">equals</a></td><td>bool Value</td></tr>
2517<tr><td colspan="4" class="doc" id="equals4"><pre></pre></td></tr>
2518
2519
2520<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>const ValueT  Value</td></tr>
2521<tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value of type ValueT.
2522
2523Given
2524  f('false, 3.14, 42);
2525characterLiteral(equals(0))
2526  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2527  match false
2528floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2529  match 3.14
2530integerLiteral(equals(42))
2531  matches 42
2532
2533Note that you cannot directly match a negative numeric literal because the
2534minus sign is not part of the literal: It is a unary operator whose operand
2535is the positive numeric literal. Instead, you must use a unaryOperator()
2536matcher to match the minus sign:
2537
2538unaryOperator(hasOperatorName("-"),
2539              hasUnaryOperand(integerLiteral(equals(13))))
2540
2541Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;,
2542           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;
2543</pre></td></tr>
2544
2545
2546<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;</td><td class="name" onclick="toggle('equals10')"><a name="equals10Anchor">equals</a></td><td>double Value</td></tr>
2547<tr><td colspan="4" class="doc" id="equals10"><pre></pre></td></tr>
2548
2549
2550<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;</td><td class="name" onclick="toggle('equals7')"><a name="equals7Anchor">equals</a></td><td>unsigned Value</td></tr>
2551<tr><td colspan="4" class="doc" id="equals7"><pre></pre></td></tr>
2552
2553
2554<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>
2555<tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N.
2556
2557Given
2558  template&lt;typename T&gt; struct C {};
2559  C&lt;int&gt; c;
2560classTemplateSpecializationDecl(templateArgumentCountIs(1))
2561  matches C&lt;int&gt;.
2562</pre></td></tr>
2563
2564
2565<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>
2566<tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
2567child statements.
2568
2569Example: Given
2570  { for (;;) {} }
2571compoundStmt(statementCountIs(0)))
2572  matches '{}'
2573  but does not match the outer compound statement.
2574</pre></td></tr>
2575
2576
2577<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>
2578<tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches nodes that have the specified size.
2579
2580Given
2581  int a[42];
2582  int b[2 * 21];
2583  int c[41], d[43];
2584  char *s = "abcd";
2585  wchar_t *ws = L"abcd";
2586  char *w = "a";
2587constantArrayType(hasSize(42))
2588  matches "int a[42]" and "int b[2 * 21]"
2589stringLiteral(hasSize(4))
2590  matches "abcd", L"abcd"
2591</pre></td></tr>
2592
2593
2594<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>
2595<tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
2596declarations.
2597
2598Example: Given
2599  int a, b;
2600  int c;
2601  int d = 2, e;
2602declCountIs(2)
2603  matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
2604</pre></td></tr>
2605
2606
2607<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>
2608<tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
2609
2610Matches a node if it equals the node previously bound to ID.
2611
2612Given
2613  class X { int a; int b; };
2614cxxRecordDecl(
2615    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
2616    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
2617  matches the class X, as a and b have the same type.
2618
2619Note that when multiple matches are involved via forEach* matchers,
2620equalsBoundNodes acts as a filter.
2621For example:
2622compoundStmt(
2623    forEachDescendant(varDecl().bind("d")),
2624    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
2625will trigger a match for each combination of variable declaration
2626and reference to that variable declaration within a compound statement.
2627</pre></td></tr>
2628
2629
2630<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('equalsNode0')"><a name="equalsNode0Anchor">equalsNode</a></td><td>const Decl* Other</td></tr>
2631<tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node.
2632
2633Decl has pointer identity in the AST.
2634</pre></td></tr>
2635
2636
2637<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>
2638<tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute.
2639
2640Given
2641  __attribute__((device)) void f() { ... }
2642decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
2643f. If the matcher is use from clang-query, attr::Kind parameter should be
2644passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
2645</pre></td></tr>
2646
2647
2648<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>
2649<tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is
2650partially matching a given regex.
2651
2652Example matches Y but not X
2653    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
2654  #include "ASTMatcher.h"
2655  class X {};
2656ASTMatcher.h:
2657  class Y {};
2658
2659Usable 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;
2660</pre></td></tr>
2661
2662
2663<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>
2664<tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file.
2665
2666Example matches X but not Y
2667  (matcher = cxxRecordDecl(isExpansionInMainFile())
2668  #include &lt;Y.h&gt;
2669  class X {};
2670Y.h:
2671  class Y {};
2672
2673Usable 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;
2674</pre></td></tr>
2675
2676
2677<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>
2678<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files.
2679
2680Example matches Y but not X
2681    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
2682  #include &lt;SystemHeader.h&gt;
2683  class X {};
2684SystemHeader.h:
2685  class Y {};
2686
2687Usable 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;
2688</pre></td></tr>
2689
2690
2691<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>
2692<tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a declaration that has been implicitly added
2693by the compiler (eg. implicit defaultcopy constructors).
2694</pre></td></tr>
2695
2696
2697<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>
2698<tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations.
2699
2700Given
2701  class C {
2702  public:    int a;
2703  protected: int b;
2704  private:   int c;
2705  };
2706fieldDecl(isPrivate())
2707  matches 'int c;'
2708</pre></td></tr>
2709
2710
2711<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>
2712<tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations.
2713
2714Given
2715  class C {
2716  public:    int a;
2717  protected: int b;
2718  private:   int c;
2719  };
2720fieldDecl(isProtected())
2721  matches 'int b;'
2722</pre></td></tr>
2723
2724
2725<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>
2726<tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations.
2727
2728Given
2729  class C {
2730  public:    int a;
2731  protected: int b;
2732  private:   int c;
2733  };
2734fieldDecl(isPublic())
2735  matches 'int a;'
2736</pre></td></tr>
2737
2738
2739<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DesignatedInitExpr.html">DesignatedInitExpr</a>&gt;</td><td class="name" onclick="toggle('designatorCountIs0')"><a name="designatorCountIs0Anchor">designatorCountIs</a></td><td>unsigned N</td></tr>
2740<tr><td colspan="4" class="doc" id="designatorCountIs0"><pre>Matches designated initializer expressions that contain
2741a specific number of designators.
2742
2743Example: Given
2744  point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
2745  point ptarray2[10] = { [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 };
2746designatorCountIs(2)
2747  matches '{ [2].y = 1.0, [0].x = 1.0 }',
2748  but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'.
2749</pre></td></tr>
2750
2751
2752<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumDecl.html">EnumDecl</a>&gt;</td><td class="name" onclick="toggle('isScoped0')"><a name="isScoped0Anchor">isScoped</a></td><td></td></tr>
2753<tr><td colspan="4" class="doc" id="isScoped0"><pre>Matches C++11 scoped enum declaration.
2754
2755Example matches Y (matcher = enumDecl(isScoped()))
2756enum X {};
2757enum class Y {};
2758</pre></td></tr>
2759
2760
2761<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt;</td><td class="name" onclick="toggle('hasBitWidth0')"><a name="hasBitWidth0Anchor">hasBitWidth</a></td><td>unsigned Width</td></tr>
2762<tr><td colspan="4" class="doc" id="hasBitWidth0"><pre>Matches non-static data members that are bit-fields of the specified
2763bit width.
2764
2765Given
2766  class C {
2767    int a : 2;
2768    int b : 4;
2769    int c : 2;
2770  };
2771fieldDecl(hasBitWidth(2))
2772  matches 'int a;' and 'int c;' but not 'int b;'.
2773</pre></td></tr>
2774
2775
2776<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt;</td><td class="name" onclick="toggle('isBitField0')"><a name="isBitField0Anchor">isBitField</a></td><td></td></tr>
2777<tr><td colspan="4" class="doc" id="isBitField0"><pre>Matches non-static data members that are bit-fields.
2778
2779Given
2780  class C {
2781    int a : 2;
2782    int b;
2783  };
2784fieldDecl(isBitField())
2785  matches 'int a;' but not 'int b;'.
2786</pre></td></tr>
2787
2788
2789<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>const ValueT  Value</td></tr>
2790<tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value of type ValueT.
2791
2792Given
2793  f('false, 3.14, 42);
2794characterLiteral(equals(0))
2795  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2796  match false
2797floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2798  match 3.14
2799integerLiteral(equals(42))
2800  matches 42
2801
2802Note that you cannot directly match a negative numeric literal because the
2803minus sign is not part of the literal: It is a unary operator whose operand
2804is the positive numeric literal. Instead, you must use a unaryOperator()
2805matcher to match the minus sign:
2806
2807unaryOperator(hasOperatorName("-"),
2808              hasUnaryOperand(integerLiteral(equals(13))))
2809
2810Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;,
2811           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;
2812</pre></td></tr>
2813
2814
2815<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;</td><td class="name" onclick="toggle('equals12')"><a name="equals12Anchor">equals</a></td><td>double Value</td></tr>
2816<tr><td colspan="4" class="doc" id="equals12"><pre></pre></td></tr>
2817
2818
2819<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasDynamicExceptionSpec0')"><a name="hasDynamicExceptionSpec0Anchor">hasDynamicExceptionSpec</a></td><td></td></tr>
2820<tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec0"><pre>Matches functions that have a dynamic exception specification.
2821
2822Given:
2823  void f();
2824  void g() noexcept;
2825  void h() noexcept(true);
2826  void i() noexcept(false);
2827  void j() throw();
2828  void k() throw(int);
2829  void l() throw(...);
2830functionDecl(hasDynamicExceptionSpec()) and
2831  functionProtoType(hasDynamicExceptionSpec())
2832  match the declarations of j, k, and l, but not f, g, h, or i.
2833</pre></td></tr>
2834
2835
2836<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>
2837<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names.
2838
2839Matches overloaded operator names specified in strings without the
2840"operator" prefix: e.g. "&lt;&lt;".
2841
2842Given:
2843  class A { int operator*(); };
2844  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
2845  A a;
2846  a &lt;&lt; a;   &lt;-- This matches
2847
2848cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
2849specified line and
2850cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
2851matches the declaration of A.
2852
2853Usable 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;
2854</pre></td></tr>
2855
2856
2857<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasTrailingReturn0')"><a name="hasTrailingReturn0Anchor">hasTrailingReturn</a></td><td></td></tr>
2858<tr><td colspan="4" class="doc" id="hasTrailingReturn0"><pre>Matches a function declared with a trailing return type.
2859
2860Example matches Y (matcher = functionDecl(hasTrailingReturn()))
2861int X() {}
2862auto Y() -&gt; int {}
2863</pre></td></tr>
2864
2865
2866<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isConstexpr1')"><a name="isConstexpr1Anchor">isConstexpr</a></td><td></td></tr>
2867<tr><td colspan="4" class="doc" id="isConstexpr1"><pre>Matches constexpr variable and function declarations,
2868       and if constexpr.
2869
2870Given:
2871  constexpr int foo = 42;
2872  constexpr int bar();
2873  void baz() { if constexpr(1 &gt; 0) {} }
2874varDecl(isConstexpr())
2875  matches the declaration of foo.
2876functionDecl(isConstexpr())
2877  matches the declaration of bar.
2878ifStmt(isConstexpr())
2879  matches the if statement in baz.
2880</pre></td></tr>
2881
2882
2883<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isDefaulted0')"><a name="isDefaulted0Anchor">isDefaulted</a></td><td></td></tr>
2884<tr><td colspan="4" class="doc" id="isDefaulted0"><pre>Matches defaulted function declarations.
2885
2886Given:
2887  class A { ~A(); };
2888  class B { ~B() = default; };
2889functionDecl(isDefaulted())
2890  matches the declaration of ~B, but not ~A.
2891</pre></td></tr>
2892
2893
2894<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isDefinition3')"><a name="isDefinition3Anchor">isDefinition</a></td><td></td></tr>
2895<tr><td colspan="4" class="doc" id="isDefinition3"><pre>Matches if a declaration has a body attached.
2896
2897Example matches A, va, fa
2898  class A {};
2899  class B;  Doesn't match, as it has no body.
2900  int va;
2901  extern int vb;  Doesn't match, as it doesn't define the variable.
2902  void fa() {}
2903  void fb();  Doesn't match, as it has no body.
2904  @interface X
2905  - (void)ma; Doesn't match, interface is declaration.
2906  @end
2907  @implementation X
2908  - (void)ma {}
2909  @end
2910
2911Usable 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;,
2912  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
2913</pre></td></tr>
2914
2915
2916<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>
2917<tr><td colspan="4" class="doc" id="isDeleted0"><pre>Matches deleted function declarations.
2918
2919Given:
2920  void Func();
2921  void DeletedFunc() = delete;
2922functionDecl(isDeleted())
2923  matches the declaration of DeletedFunc, but not Func.
2924</pre></td></tr>
2925
2926
2927<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>
2928<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or
2929static member variable template instantiations.
2930
2931Given
2932  template&lt;typename T&gt; void A(T t) { }
2933  template&lt;&gt; void A(int N) { }
2934functionDecl(isExplicitTemplateSpecialization())
2935  matches the specialization A&lt;int&gt;().
2936
2937Usable 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;
2938</pre></td></tr>
2939
2940
2941<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>
2942<tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function or variable declarations.
2943
2944Given:
2945  extern "C" void f() {}
2946  extern "C" { void g() {} }
2947  void h() {}
2948  extern "C" int x = 1;
2949  extern "C" int y = 2;
2950  int z = 3;
2951functionDecl(isExternC())
2952  matches the declaration of f and g, but not the declaration of h.
2953varDecl(isExternC())
2954  matches the declaration of x and y, but not the declaration of z.
2955</pre></td></tr>
2956
2957
2958<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isInline1')"><a name="isInline1Anchor">isInline</a></td><td></td></tr>
2959<tr><td colspan="4" class="doc" id="isInline1"><pre>Matches function and namespace declarations that are marked with
2960the inline keyword.
2961
2962Given
2963  inline void f();
2964  void g();
2965  namespace n {
2966  inline namespace m {}
2967  }
2968functionDecl(isInline()) will match ::f().
2969namespaceDecl(isInline()) will match n::m.
2970</pre></td></tr>
2971
2972
2973<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isMain0')"><a name="isMain0Anchor">isMain</a></td><td></td></tr>
2974<tr><td colspan="4" class="doc" id="isMain0"><pre>Determines whether the function is "main", which is the entry point
2975into an executable program.
2976</pre></td></tr>
2977
2978
2979<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isNoReturn0')"><a name="isNoReturn0Anchor">isNoReturn</a></td><td></td></tr>
2980<tr><td colspan="4" class="doc" id="isNoReturn0"><pre>Matches FunctionDecls that have a noreturn attribute.
2981
2982Given
2983  void nope();
2984  [[noreturn]] void a();
2985  __attribute__((noreturn)) void b();
2986  struct c { [[noreturn]] c(); };
2987functionDecl(isNoReturn())
2988  matches all of those except
2989  void nope();
2990</pre></td></tr>
2991
2992
2993<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isNoThrow0')"><a name="isNoThrow0Anchor">isNoThrow</a></td><td></td></tr>
2994<tr><td colspan="4" class="doc" id="isNoThrow0"><pre>Matches functions that have a non-throwing exception specification.
2995
2996Given:
2997  void f();
2998  void g() noexcept;
2999  void h() throw();
3000  void i() throw(int);
3001  void j() noexcept(false);
3002functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
3003  match the declarations of g, and h, but not f, i or j.
3004</pre></td></tr>
3005
3006
3007<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isStaticStorageClass0')"><a name="isStaticStorageClass0Anchor">isStaticStorageClass</a></td><td></td></tr>
3008<tr><td colspan="4" class="doc" id="isStaticStorageClass0"><pre>Matches variablefunction declarations that have "static" storage
3009class specifier ("static" keyword) written in the source.
3010
3011Given:
3012  static void f() {}
3013  static int i = 0;
3014  extern int j;
3015  int k;
3016functionDecl(isStaticStorageClass())
3017  matches the function declaration f.
3018varDecl(isStaticStorageClass())
3019  matches the variable declaration i.
3020</pre></td></tr>
3021
3022
3023<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>
3024<tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static
3025member variable template instantiations.
3026
3027Given
3028  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
3029or
3030  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
3031or
3032  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
3033cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3034  matches the template instantiation of X&lt;A&gt;.
3035
3036But given
3037  template &lt;typename T&gt;  class X {}; class A {};
3038  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
3039cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3040  does not match, as X&lt;A&gt; is an explicit template specialization.
3041
3042Usable 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;
3043</pre></td></tr>
3044
3045
3046<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isVariadic0')"><a name="isVariadic0Anchor">isVariadic</a></td><td></td></tr>
3047<tr><td colspan="4" class="doc" id="isVariadic0"><pre>Matches if a function declaration is variadic.
3048
3049Example matches f, but not g or h. The function i will not match, even when
3050compiled in C mode.
3051  void f(...);
3052  void g(int);
3053  template &lt;typename... Ts&gt; void h(Ts...);
3054  void i();
3055</pre></td></tr>
3056
3057
3058<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>
3059<tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
3060specific parameter count.
3061
3062Given
3063  void f(int i) {}
3064  void g(int i, int j) {}
3065  void h(int i, int j);
3066  void j(int i);
3067  void k(int x, int y, int z, ...);
3068functionDecl(parameterCountIs(2))
3069  matches g and h
3070functionProtoType(parameterCountIs(2))
3071  matches g and h
3072functionProtoType(parameterCountIs(3))
3073  matches k
3074</pre></td></tr>
3075
3076
3077<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionProtoType.html">FunctionProtoType</a>&gt;</td><td class="name" onclick="toggle('hasDynamicExceptionSpec1')"><a name="hasDynamicExceptionSpec1Anchor">hasDynamicExceptionSpec</a></td><td></td></tr>
3078<tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec1"><pre>Matches functions that have a dynamic exception specification.
3079
3080Given:
3081  void f();
3082  void g() noexcept;
3083  void h() noexcept(true);
3084  void i() noexcept(false);
3085  void j() throw();
3086  void k() throw(int);
3087  void l() throw(...);
3088functionDecl(hasDynamicExceptionSpec()) and
3089  functionProtoType(hasDynamicExceptionSpec())
3090  match the declarations of j, k, and l, but not f, g, h, or i.
3091</pre></td></tr>
3092
3093
3094<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionProtoType.html">FunctionProtoType</a>&gt;</td><td class="name" onclick="toggle('isNoThrow1')"><a name="isNoThrow1Anchor">isNoThrow</a></td><td></td></tr>
3095<tr><td colspan="4" class="doc" id="isNoThrow1"><pre>Matches functions that have a non-throwing exception specification.
3096
3097Given:
3098  void f();
3099  void g() noexcept;
3100  void h() throw();
3101  void i() throw(int);
3102  void j() noexcept(false);
3103functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
3104  match the declarations of g, and h, but not f, i or j.
3105</pre></td></tr>
3106
3107
3108<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionProtoType.html">FunctionProtoType</a>&gt;</td><td class="name" onclick="toggle('parameterCountIs1')"><a name="parameterCountIs1Anchor">parameterCountIs</a></td><td>unsigned N</td></tr>
3109<tr><td colspan="4" class="doc" id="parameterCountIs1"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
3110specific parameter count.
3111
3112Given
3113  void f(int i) {}
3114  void g(int i, int j) {}
3115  void h(int i, int j);
3116  void j(int i);
3117  void k(int x, int y, int z, ...);
3118functionDecl(parameterCountIs(2))
3119  matches g and h
3120functionProtoType(parameterCountIs(2))
3121  matches g and h
3122functionProtoType(parameterCountIs(3))
3123  matches k
3124</pre></td></tr>
3125
3126
3127<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;</td><td class="name" onclick="toggle('isConstexpr2')"><a name="isConstexpr2Anchor">isConstexpr</a></td><td></td></tr>
3128<tr><td colspan="4" class="doc" id="isConstexpr2"><pre>Matches constexpr variable and function declarations,
3129       and if constexpr.
3130
3131Given:
3132  constexpr int foo = 42;
3133  constexpr int bar();
3134  void baz() { if constexpr(1 &gt; 0) {} }
3135varDecl(isConstexpr())
3136  matches the declaration of foo.
3137functionDecl(isConstexpr())
3138  matches the declaration of bar.
3139ifStmt(isConstexpr())
3140  matches the if statement in baz.
3141</pre></td></tr>
3142
3143
3144<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;</td><td class="name" onclick="toggle('equals6')"><a name="equals6Anchor">equals</a></td><td>bool Value</td></tr>
3145<tr><td colspan="4" class="doc" id="equals6"><pre></pre></td></tr>
3146
3147
3148<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>const ValueT  Value</td></tr>
3149<tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value of type ValueT.
3150
3151Given
3152  f('false, 3.14, 42);
3153characterLiteral(equals(0))
3154  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
3155  match false
3156floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
3157  match 3.14
3158integerLiteral(equals(42))
3159  matches 42
3160
3161Note that you cannot directly match a negative numeric literal because the
3162minus sign is not part of the literal: It is a unary operator whose operand
3163is the positive numeric literal. Instead, you must use a unaryOperator()
3164matcher to match the minus sign:
3165
3166unaryOperator(hasOperatorName("-"),
3167              hasUnaryOperand(integerLiteral(equals(13))))
3168
3169Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;,
3170           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;
3171</pre></td></tr>
3172
3173
3174<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;</td><td class="name" onclick="toggle('equals13')"><a name="equals13Anchor">equals</a></td><td>double Value</td></tr>
3175<tr><td colspan="4" class="doc" id="equals13"><pre></pre></td></tr>
3176
3177
3178<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;</td><td class="name" onclick="toggle('equals9')"><a name="equals9Anchor">equals</a></td><td>unsigned Value</td></tr>
3179<tr><td colspan="4" class="doc" id="equals9"><pre></pre></td></tr>
3180
3181
3182<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>
3183<tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '-&gt;' as opposed
3184to '.'.
3185
3186Member calls on the implicit this pointer match as called with '-&gt;'.
3187
3188Given
3189  class Y {
3190    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
3191    int a;
3192    static int b;
3193  };
3194memberExpr(isArrow())
3195  matches this-&gt;x, x, y.x, a, this-&gt;b
3196</pre></td></tr>
3197
3198
3199<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</td><td class="name" onclick="toggle('hasExternalFormalLinkage0')"><a name="hasExternalFormalLinkage0Anchor">hasExternalFormalLinkage</a></td><td></td></tr>
3200<tr><td colspan="4" class="doc" id="hasExternalFormalLinkage0"><pre>Matches a declaration that has external formal linkage.
3201
3202Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
3203void f() {
3204  int x;
3205  static int y;
3206}
3207int z;
3208
3209Example matches f() because it has external formal linkage despite being
3210unique to the translation unit as though it has internal likage
3211(matcher = functionDecl(hasExternalFormalLinkage()))
3212
3213namespace {
3214void f() {}
3215}
3216</pre></td></tr>
3217
3218
3219<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>const std::string  Name</td></tr>
3220<tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name.
3221
3222Supports specifying enclosing namespaces or classes by prefixing the name
3223with '&lt;enclosing&gt;::'.
3224Does not match typedefs of an underlying type with the given name.
3225
3226Example matches X (Name == "X")
3227  class X;
3228
3229Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
3230  namespace a { namespace b { class X; } }
3231</pre></td></tr>
3232
3233
3234<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>
3235<tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain
3236a substring matched by the given RegExp.
3237
3238Supports specifying enclosing namespaces or classes by
3239prefixing the name with '&lt;enclosing&gt;::'.  Does not match typedefs
3240of an underlying type with the given name.
3241
3242Example matches X (regexp == "::X")
3243  class X;
3244
3245Example matches X (regexp is one of "::X", "^foo::.*X", among others)
3246  namespace foo { namespace bar { class X; } }
3247</pre></td></tr>
3248
3249
3250<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>&gt;</td><td class="name" onclick="toggle('isAnonymous0')"><a name="isAnonymous0Anchor">isAnonymous</a></td><td></td></tr>
3251<tr><td colspan="4" class="doc" id="isAnonymous0"><pre>Matches anonymous namespace declarations.
3252
3253Given
3254  namespace n {
3255  namespace {} #1
3256  }
3257namespaceDecl(isAnonymous()) will match #1 but not ::n.
3258</pre></td></tr>
3259
3260
3261<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>&gt;</td><td class="name" onclick="toggle('isInline0')"><a name="isInline0Anchor">isInline</a></td><td></td></tr>
3262<tr><td colspan="4" class="doc" id="isInline0"><pre>Matches function and namespace declarations that are marked with
3263the inline keyword.
3264
3265Given
3266  inline void f();
3267  void g();
3268  namespace n {
3269  inline namespace m {}
3270  }
3271functionDecl(isInline()) will match ::f().
3272namespaceDecl(isInline()) will match n::m.
3273</pre></td></tr>
3274
3275
3276<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountIs2')"><a name="argumentCountIs2Anchor">argumentCountIs</a></td><td>unsigned N</td></tr>
3277<tr><td colspan="4" class="doc" id="argumentCountIs2"><pre>Checks that a call expression or a constructor call expression has
3278a specific number of arguments (including absent default arguments).
3279
3280Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3281  void f(int x, int y);
3282  f(0, 0);
3283</pre></td></tr>
3284
3285
3286<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasKeywordSelector0')"><a name="hasKeywordSelector0Anchor">hasKeywordSelector</a></td><td></td></tr>
3287<tr><td colspan="4" class="doc" id="hasKeywordSelector0"><pre>Matches when the selector is a keyword selector
3288
3289objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
3290message expression in
3291
3292  UIWebView *webView = ...;
3293  CGRect bodyFrame = webView.frame;
3294  bodyFrame.size.height = self.bodyContentHeight;
3295  webView.frame = bodyFrame;
3296      ^---- matches here
3297</pre></td></tr>
3298
3299
3300<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasNullSelector0')"><a name="hasNullSelector0Anchor">hasNullSelector</a></td><td></td></tr>
3301<tr><td colspan="4" class="doc" id="hasNullSelector0"><pre>Matches when the selector is the empty selector
3302
3303Matches only when the selector of the objCMessageExpr is NULL. This may
3304represent an error condition in the tree!
3305</pre></td></tr>
3306
3307
3308<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasSelector0')"><a name="hasSelector0Anchor">hasSelector</a></td><td>std::string BaseName</td></tr>
3309<tr><td colspan="4" class="doc" id="hasSelector0"><pre>Matches when BaseName == Selector.getAsString()
3310
3311 matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:"));
3312 matches the outer message expr in the code below, but NOT the message
3313 invocation for self.bodyView.
3314    [self.bodyView loadHTMLString:html baseURL:NULL];
3315</pre></td></tr>
3316
3317
3318<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasUnarySelector0')"><a name="hasUnarySelector0Anchor">hasUnarySelector</a></td><td></td></tr>
3319<tr><td colspan="4" class="doc" id="hasUnarySelector0"><pre>Matches when the selector is a Unary Selector
3320
3321 matcher = objCMessageExpr(matchesSelector(hasUnarySelector());
3322 matches self.bodyView in the code below, but NOT the outer message
3323 invocation of "loadHTMLString:baseURL:".
3324    [self.bodyView loadHTMLString:html baseURL:NULL];
3325</pre></td></tr>
3326
3327
3328<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('isInstanceMessage0')"><a name="isInstanceMessage0Anchor">isInstanceMessage</a></td><td></td></tr>
3329<tr><td colspan="4" class="doc" id="isInstanceMessage0"><pre>Returns true when the Objective-C message is sent to an instance.
3330
3331Example
3332matcher = objcMessagaeExpr(isInstanceMessage())
3333matches
3334  NSString *x = @"hello";
3335  [x containsString:@"h"];
3336but not
3337  [NSString stringWithFormat:@"format"];
3338</pre></td></tr>
3339
3340
3341<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('matchesSelector0')"><a name="matchesSelector0Anchor">matchesSelector</a></td><td>std::string RegExp</td></tr>
3342<tr><td colspan="4" class="doc" id="matchesSelector0"><pre>Matches ObjC selectors whose name contains
3343a substring matched by the given RegExp.
3344 matcher = objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
3345 invocation for self.bodyView.
3346    [self.bodyView loadHTMLString:html baseURL:NULL];
3347</pre></td></tr>
3348
3349
3350<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('numSelectorArgs0')"><a name="numSelectorArgs0Anchor">numSelectorArgs</a></td><td>unsigned N</td></tr>
3351<tr><td colspan="4" class="doc" id="numSelectorArgs0"><pre>Matches when the selector has the specified number of arguments
3352
3353 matcher = objCMessageExpr(numSelectorArgs(0));
3354 matches self.bodyView in the code below
3355
3356 matcher = objCMessageExpr(numSelectorArgs(2));
3357 matches the invocation of "loadHTMLString:baseURL:" but not that
3358 of self.bodyView
3359    [self.bodyView loadHTMLString:html baseURL:NULL];
3360</pre></td></tr>
3361
3362
3363<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isDefinition2')"><a name="isDefinition2Anchor">isDefinition</a></td><td></td></tr>
3364<tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached.
3365
3366Example matches A, va, fa
3367  class A {};
3368  class B;  Doesn't match, as it has no body.
3369  int va;
3370  extern int vb;  Doesn't match, as it doesn't define the variable.
3371  void fa() {}
3372  void fb();  Doesn't match, as it has no body.
3373  @interface X
3374  - (void)ma; Doesn't match, interface is declaration.
3375  @end
3376  @implementation X
3377  - (void)ma {}
3378  @end
3379
3380Usable 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;,
3381  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3382</pre></td></tr>
3383
3384
3385<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt;</td><td class="name" onclick="toggle('hasDefaultArgument0')"><a name="hasDefaultArgument0Anchor">hasDefaultArgument</a></td><td></td></tr>
3386<tr><td colspan="4" class="doc" id="hasDefaultArgument0"><pre>Matches a declaration that has default arguments.
3387
3388Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
3389void x(int val) {}
3390void y(int val = 0) {}
3391</pre></td></tr>
3392
3393
3394<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>
3395<tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string.
3396
3397Given
3398  class Y { public: void x(); };
3399  void z() { Y* y; y-&gt;x(); }
3400cxxMemberCallExpr(on(hasType(asString("class Y *"))))
3401  matches y-&gt;x()
3402</pre></td></tr>
3403
3404
3405<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>
3406<tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node.
3407
3408Matches a node if it equals the node previously bound to ID.
3409
3410Given
3411  class X { int a; int b; };
3412cxxRecordDecl(
3413    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3414    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3415  matches the class X, as a and b have the same type.
3416
3417Note that when multiple matches are involved via forEach* matchers,
3418equalsBoundNodes acts as a filter.
3419For example:
3420compoundStmt(
3421    forEachDescendant(varDecl().bind("d")),
3422    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3423will trigger a match for each combination of variable declaration
3424and reference to that variable declaration within a compound statement.
3425</pre></td></tr>
3426
3427
3428<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>
3429<tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to
3430the node, not hidden within a typedef.
3431
3432Given
3433  typedef const int const_int;
3434  const_int i;
3435  int *const j;
3436  int *volatile k;
3437  int m;
3438varDecl(hasType(hasLocalQualifiers())) matches only j and k.
3439i is const-qualified but the qualifier is not local.
3440</pre></td></tr>
3441
3442
3443<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('isAnyCharacter0')"><a name="isAnyCharacter0Anchor">isAnyCharacter</a></td><td></td></tr>
3444<tr><td colspan="4" class="doc" id="isAnyCharacter0"><pre>Matches QualType nodes that are of character type.
3445
3446Given
3447  void a(char);
3448  void b(wchar_t);
3449  void c(double);
3450functionDecl(hasAnyParameter(hasType(isAnyCharacter())))
3451matches "a(char)", "b(wchar_t)", but not "c(double)".
3452</pre></td></tr>
3453
3454
3455<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('isAnyPointer0')"><a name="isAnyPointer0Anchor">isAnyPointer</a></td><td></td></tr>
3456<tr><td colspan="4" class="doc" id="isAnyPointer0"><pre>Matches QualType nodes that are of any pointer type; this includes
3457the Objective-C object pointer type, which is different despite being
3458syntactically similar.
3459
3460Given
3461  int *i = nullptr;
3462
3463  @interface Foo
3464  @end
3465  Foo *f;
3466
3467  int j;
3468varDecl(hasType(isAnyPointer()))
3469  matches "int *i" and "Foo *f", but not "int j".
3470</pre></td></tr>
3471
3472
3473<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>
3474<tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that
3475include "top-level" const.
3476
3477Given
3478  void a(int);
3479  void b(int const);
3480  void c(const int);
3481  void d(const int*);
3482  void e(int const) {};
3483functionDecl(hasAnyParameter(hasType(isConstQualified())))
3484  matches "void b(int const)", "void c(const int)" and
3485  "void e(int const) {}". It does not match d as there
3486  is no top-level const on the parameter type "const int *".
3487</pre></td></tr>
3488
3489
3490<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>
3491<tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type.
3492
3493Given
3494  void a(int);
3495  void b(long);
3496  void c(double);
3497functionDecl(hasAnyParameter(hasType(isInteger())))
3498matches "a(int)", "b(long)", but not "c(double)".
3499</pre></td></tr>
3500
3501
3502<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('isSignedInteger0')"><a name="isSignedInteger0Anchor">isSignedInteger</a></td><td></td></tr>
3503<tr><td colspan="4" class="doc" id="isSignedInteger0"><pre>Matches QualType nodes that are of signed integer type.
3504
3505Given
3506  void a(int);
3507  void b(unsigned long);
3508  void c(double);
3509functionDecl(hasAnyParameter(hasType(isSignedInteger())))
3510matches "a(int)", but not "b(unsigned long)" and "c(double)".
3511</pre></td></tr>
3512
3513
3514<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('isUnsignedInteger0')"><a name="isUnsignedInteger0Anchor">isUnsignedInteger</a></td><td></td></tr>
3515<tr><td colspan="4" class="doc" id="isUnsignedInteger0"><pre>Matches QualType nodes that are of unsigned integer type.
3516
3517Given
3518  void a(int);
3519  void b(unsigned long);
3520  void c(double);
3521functionDecl(hasAnyParameter(hasType(isUnsignedInteger())))
3522matches "b(unsigned long)", but not "a(int)" and "c(double)".
3523</pre></td></tr>
3524
3525
3526<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('isVolatileQualified0')"><a name="isVolatileQualified0Anchor">isVolatileQualified</a></td><td></td></tr>
3527<tr><td colspan="4" class="doc" id="isVolatileQualified0"><pre>Matches QualType nodes that are volatile-qualified, i.e., that
3528include "top-level" volatile.
3529
3530Given
3531  void a(int);
3532  void b(int volatile);
3533  void c(volatile int);
3534  void d(volatile int*);
3535  void e(int volatile) {};
3536functionDecl(hasAnyParameter(hasType(isVolatileQualified())))
3537  matches "void b(int volatile)", "void c(volatile int)" and
3538  "void e(int volatile) {}". It does not match d as there
3539  is no top-level volatile on the parameter type "volatile int *".
3540</pre></td></tr>
3541
3542
3543<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordDecl.html">RecordDecl</a>&gt;</td><td class="name" onclick="toggle('isClass0')"><a name="isClass0Anchor">isClass</a></td><td></td></tr>
3544<tr><td colspan="4" class="doc" id="isClass0"><pre>Matches RecordDecl object that are spelled with "class."
3545
3546Example matches C, but not S or U.
3547  struct S {};
3548  class C {};
3549  union U {};
3550</pre></td></tr>
3551
3552
3553<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordDecl.html">RecordDecl</a>&gt;</td><td class="name" onclick="toggle('isStruct0')"><a name="isStruct0Anchor">isStruct</a></td><td></td></tr>
3554<tr><td colspan="4" class="doc" id="isStruct0"><pre>Matches RecordDecl object that are spelled with "struct."
3555
3556Example matches S, but not C or U.
3557  struct S {};
3558  class C {};
3559  union U {};
3560</pre></td></tr>
3561
3562
3563<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordDecl.html">RecordDecl</a>&gt;</td><td class="name" onclick="toggle('isUnion0')"><a name="isUnion0Anchor">isUnion</a></td><td></td></tr>
3564<tr><td colspan="4" class="doc" id="isUnion0"><pre>Matches RecordDecl object that are spelled with "union."
3565
3566Example matches U, but not C or S.
3567  struct S {};
3568  class C {};
3569  union U {};
3570</pre></td></tr>
3571
3572
3573<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>
3574<tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node.
3575
3576Matches a node if it equals the node previously bound to ID.
3577
3578Given
3579  class X { int a; int b; };
3580cxxRecordDecl(
3581    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3582    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3583  matches the class X, as a and b have the same type.
3584
3585Note that when multiple matches are involved via forEach* matchers,
3586equalsBoundNodes acts as a filter.
3587For example:
3588compoundStmt(
3589    forEachDescendant(varDecl().bind("d")),
3590    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3591will trigger a match for each combination of variable declaration
3592and reference to that variable declaration within a compound statement.
3593</pre></td></tr>
3594
3595
3596<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('equalsNode1')"><a name="equalsNode1Anchor">equalsNode</a></td><td>const Stmt* Other</td></tr>
3597<tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node.
3598
3599Stmt has pointer identity in the AST.
3600</pre></td></tr>
3601
3602
3603<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>
3604<tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches AST nodes that were expanded within files whose name is
3605partially matching a given regex.
3606
3607Example matches Y but not X
3608    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3609  #include "ASTMatcher.h"
3610  class X {};
3611ASTMatcher.h:
3612  class Y {};
3613
3614Usable 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;
3615</pre></td></tr>
3616
3617
3618<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>
3619<tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches AST nodes that were expanded within the main-file.
3620
3621Example matches X but not Y
3622  (matcher = cxxRecordDecl(isExpansionInMainFile())
3623  #include &lt;Y.h&gt;
3624  class X {};
3625Y.h:
3626  class Y {};
3627
3628Usable 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;
3629</pre></td></tr>
3630
3631
3632<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>
3633<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches AST nodes that were expanded within system-header-files.
3634
3635Example matches Y but not X
3636    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3637  #include &lt;SystemHeader.h&gt;
3638  class X {};
3639SystemHeader.h:
3640  class Y {};
3641
3642Usable 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;
3643</pre></td></tr>
3644
3645
3646<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1StringLiteral.html">StringLiteral</a>&gt;</td><td class="name" onclick="toggle('hasSize1')"><a name="hasSize1Anchor">hasSize</a></td><td>unsigned N</td></tr>
3647<tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
3648
3649Given
3650  int a[42];
3651  int b[2 * 21];
3652  int c[41], d[43];
3653  char *s = "abcd";
3654  wchar_t *ws = L"abcd";
3655  char *w = "a";
3656constantArrayType(hasSize(42))
3657  matches "int a[42]" and "int b[2 * 21]"
3658stringLiteral(hasSize(4))
3659  matches "abcd", L"abcd"
3660</pre></td></tr>
3661
3662
3663<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>
3664<tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
3665
3666Example matches A, va, fa
3667  class A {};
3668  class B;  Doesn't match, as it has no body.
3669  int va;
3670  extern int vb;  Doesn't match, as it doesn't define the variable.
3671  void fa() {}
3672  void fb();  Doesn't match, as it has no body.
3673  @interface X
3674  - (void)ma; Doesn't match, interface is declaration.
3675  @end
3676  @implementation X
3677  - (void)ma {}
3678  @end
3679
3680Usable 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;,
3681  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3682</pre></td></tr>
3683
3684
3685<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>
3686<tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value.
3687
3688Note that 'Value' is a string as the template argument's value is
3689an arbitrary precision integer. 'Value' must be euqal to the canonical
3690representation of that integral value in base 10.
3691
3692Given
3693  template&lt;int T&gt; struct C {};
3694  C&lt;42&gt; c;
3695classTemplateSpecializationDecl(
3696  hasAnyTemplateArgument(equalsIntegralValue("42")))
3697  matches the implicit instantiation of C in C&lt;42&gt;.
3698</pre></td></tr>
3699
3700
3701<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>
3702<tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value.
3703
3704Given
3705  template&lt;int T&gt; struct C {};
3706  C&lt;42&gt; c;
3707classTemplateSpecializationDecl(
3708  hasAnyTemplateArgument(isIntegral()))
3709  matches the implicit instantiation of C in C&lt;42&gt;
3710  with isIntegral() matching 42.
3711</pre></td></tr>
3712
3713
3714<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>
3715<tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N.
3716
3717Given
3718  template&lt;typename T&gt; struct C {};
3719  C&lt;int&gt; c;
3720classTemplateSpecializationDecl(templateArgumentCountIs(1))
3721  matches C&lt;int&gt;.
3722</pre></td></tr>
3723
3724
3725<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>
3726<tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is
3727partially matching a given regex.
3728
3729Example matches Y but not X
3730    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3731  #include "ASTMatcher.h"
3732  class X {};
3733ASTMatcher.h:
3734  class Y {};
3735
3736Usable 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;
3737</pre></td></tr>
3738
3739
3740<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>
3741<tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file.
3742
3743Example matches X but not Y
3744  (matcher = cxxRecordDecl(isExpansionInMainFile())
3745  #include &lt;Y.h&gt;
3746  class X {};
3747Y.h:
3748  class Y {};
3749
3750Usable 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;
3751</pre></td></tr>
3752
3753
3754<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>
3755<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files.
3756
3757Example matches Y but not X
3758    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3759  #include &lt;SystemHeader.h&gt;
3760  class X {};
3761SystemHeader.h:
3762  class Y {};
3763
3764Usable 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;
3765</pre></td></tr>
3766
3767
3768<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('booleanType0')"><a name="booleanType0Anchor">booleanType</a></td><td></td></tr>
3769<tr><td colspan="4" class="doc" id="booleanType0"><pre>Matches type bool.
3770
3771Given
3772 struct S { bool func(); };
3773functionDecl(returns(booleanType()))
3774  matches "bool func();"
3775</pre></td></tr>
3776
3777
3778<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>
3779<tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
3780
3781Matches a node if it equals the node previously bound to ID.
3782
3783Given
3784  class X { int a; int b; };
3785cxxRecordDecl(
3786    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3787    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3788  matches the class X, as a and b have the same type.
3789
3790Note that when multiple matches are involved via forEach* matchers,
3791equalsBoundNodes acts as a filter.
3792For example:
3793compoundStmt(
3794    forEachDescendant(varDecl().bind("d")),
3795    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3796will trigger a match for each combination of variable declaration
3797and reference to that variable declaration within a compound statement.
3798</pre></td></tr>
3799
3800
3801<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('equalsNode2')"><a name="equalsNode2Anchor">equalsNode</a></td><td>const Type* Other</td></tr>
3802<tr><td colspan="4" class="doc" id="equalsNode2"><pre>Matches if a node equals another node.
3803
3804Type has pointer identity in the AST.
3805</pre></td></tr>
3806
3807
3808<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('realFloatingPointType0')"><a name="realFloatingPointType0Anchor">realFloatingPointType</a></td><td></td></tr>
3809<tr><td colspan="4" class="doc" id="realFloatingPointType0"><pre>Matches any real floating-point type (float, double, long double).
3810
3811Given
3812  int i;
3813  float f;
3814realFloatingPointType()
3815  matches "float f" but not "int i"
3816</pre></td></tr>
3817
3818
3819<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('voidType0')"><a name="voidType0Anchor">voidType</a></td><td></td></tr>
3820<tr><td colspan="4" class="doc" id="voidType0"><pre>Matches type void.
3821
3822Given
3823 struct S { void func(); };
3824functionDecl(returns(voidType()))
3825  matches "void func();"
3826</pre></td></tr>
3827
3828
3829<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>
3830<tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
3831
3832Given
3833  int x;
3834  int s = sizeof(x) + alignof(x)
3835unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
3836  matches sizeof(x)
3837</pre></td></tr>
3838
3839
3840<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>
3841<tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or
3842unary).
3843
3844Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3845  !(a || b)
3846</pre></td></tr>
3847
3848
3849<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('hasAutomaticStorageDuration0')"><a name="hasAutomaticStorageDuration0Anchor">hasAutomaticStorageDuration</a></td><td></td></tr>
3850<tr><td colspan="4" class="doc" id="hasAutomaticStorageDuration0"><pre>Matches a variable declaration that has automatic storage duration.
3851
3852Example matches x, but not y, z, or a.
3853(matcher = varDecl(hasAutomaticStorageDuration())
3854void f() {
3855  int x;
3856  static int y;
3857  thread_local int z;
3858}
3859int a;
3860</pre></td></tr>
3861
3862
3863<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>
3864<tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
3865
3866Example matches y and z (matcher = varDecl(hasGlobalStorage())
3867void f() {
3868  int x;
3869  static int y;
3870}
3871int z;
3872</pre></td></tr>
3873
3874
3875<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>
3876<tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a
3877non-static local variable.
3878
3879Example matches x (matcher = varDecl(hasLocalStorage())
3880void f() {
3881  int x;
3882  static int y;
3883}
3884int z;
3885</pre></td></tr>
3886
3887
3888<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('hasStaticStorageDuration0')"><a name="hasStaticStorageDuration0Anchor">hasStaticStorageDuration</a></td><td></td></tr>
3889<tr><td colspan="4" class="doc" id="hasStaticStorageDuration0"><pre>Matches a variable declaration that has static storage duration.
3890It includes the variable declared at namespace scope and those declared
3891with "static" and "extern" storage class specifiers.
3892
3893void f() {
3894  int x;
3895  static int y;
3896  thread_local int z;
3897}
3898int a;
3899static int b;
3900extern int c;
3901varDecl(hasStaticStorageDuration())
3902  matches the function declaration y, a, b and c.
3903</pre></td></tr>
3904
3905
3906<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('hasThreadStorageDuration0')"><a name="hasThreadStorageDuration0Anchor">hasThreadStorageDuration</a></td><td></td></tr>
3907<tr><td colspan="4" class="doc" id="hasThreadStorageDuration0"><pre>Matches a variable declaration that has thread storage duration.
3908
3909Example matches z, but not x, z, or a.
3910(matcher = varDecl(hasThreadStorageDuration())
3911void f() {
3912  int x;
3913  static int y;
3914  thread_local int z;
3915}
3916int a;
3917</pre></td></tr>
3918
3919
3920<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isConstexpr0')"><a name="isConstexpr0Anchor">isConstexpr</a></td><td></td></tr>
3921<tr><td colspan="4" class="doc" id="isConstexpr0"><pre>Matches constexpr variable and function declarations,
3922       and if constexpr.
3923
3924Given:
3925  constexpr int foo = 42;
3926  constexpr int bar();
3927  void baz() { if constexpr(1 &gt; 0) {} }
3928varDecl(isConstexpr())
3929  matches the declaration of foo.
3930functionDecl(isConstexpr())
3931  matches the declaration of bar.
3932ifStmt(isConstexpr())
3933  matches the if statement in baz.
3934</pre></td></tr>
3935
3936
3937<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>
3938<tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
3939
3940Example matches A, va, fa
3941  class A {};
3942  class B;  Doesn't match, as it has no body.
3943  int va;
3944  extern int vb;  Doesn't match, as it doesn't define the variable.
3945  void fa() {}
3946  void fb();  Doesn't match, as it has no body.
3947  @interface X
3948  - (void)ma; Doesn't match, interface is declaration.
3949  @end
3950  @implementation X
3951  - (void)ma {}
3952  @end
3953
3954Usable 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;,
3955  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3956</pre></td></tr>
3957
3958
3959<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isExceptionVariable0')"><a name="isExceptionVariable0Anchor">isExceptionVariable</a></td><td></td></tr>
3960<tr><td colspan="4" class="doc" id="isExceptionVariable0"><pre>Matches a variable declaration that is an exception variable from
3961a C++ catch block, or an Objective-C statement.
3962
3963Example matches x (matcher = varDecl(isExceptionVariable())
3964void f(int y) {
3965  try {
3966  } catch (int x) {
3967  }
3968}
3969</pre></td></tr>
3970
3971
3972<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>
3973<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
3974static member variable template instantiations.
3975
3976Given
3977  template&lt;typename T&gt; void A(T t) { }
3978  template&lt;&gt; void A(int N) { }
3979functionDecl(isExplicitTemplateSpecialization())
3980  matches the specialization A&lt;int&gt;().
3981
3982Usable 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;
3983</pre></td></tr>
3984
3985
3986<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isExternC1')"><a name="isExternC1Anchor">isExternC</a></td><td></td></tr>
3987<tr><td colspan="4" class="doc" id="isExternC1"><pre>Matches extern "C" function or variable declarations.
3988
3989Given:
3990  extern "C" void f() {}
3991  extern "C" { void g() {} }
3992  void h() {}
3993  extern "C" int x = 1;
3994  extern "C" int y = 2;
3995  int z = 3;
3996functionDecl(isExternC())
3997  matches the declaration of f and g, but not the declaration of h.
3998varDecl(isExternC())
3999  matches the declaration of x and y, but not the declaration of z.
4000</pre></td></tr>
4001
4002
4003<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isStaticStorageClass1')"><a name="isStaticStorageClass1Anchor">isStaticStorageClass</a></td><td></td></tr>
4004<tr><td colspan="4" class="doc" id="isStaticStorageClass1"><pre>Matches variablefunction declarations that have "static" storage
4005class specifier ("static" keyword) written in the source.
4006
4007Given:
4008  static void f() {}
4009  static int i = 0;
4010  extern int j;
4011  int k;
4012functionDecl(isStaticStorageClass())
4013  matches the function declaration f.
4014varDecl(isStaticStorageClass())
4015  matches the variable declaration i.
4016</pre></td></tr>
4017
4018
4019<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>
4020<tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
4021member variable template instantiations.
4022
4023Given
4024  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
4025or
4026  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
4027or
4028  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
4029cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4030  matches the template instantiation of X&lt;A&gt;.
4031
4032But given
4033  template &lt;typename T&gt;  class X {}; class A {};
4034  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
4035cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4036  does not match, as X&lt;A&gt; is an explicit template specialization.
4037
4038Usable 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;
4039</pre></td></tr>
4040
4041
4042<tr><td>Matcher&lt;internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;&gt;</td><td class="name" onclick="toggle('isInstantiated0')"><a name="isInstantiated0Anchor">isInstantiated</a></td><td></td></tr>
4043<tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
4044template instantiations.
4045
4046Given
4047  template&lt;typename T&gt; void A(T t) { T i; }
4048  A(0);
4049  A(0U);
4050functionDecl(isInstantiated())
4051  matches 'A(int) {...};' and 'A(unsigned) {...}'.
4052</pre></td></tr>
4053
4054
4055<tr><td>Matcher&lt;internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;&gt;</td><td class="name" onclick="toggle('nullPointerConstant0')"><a name="nullPointerConstant0Anchor">nullPointerConstant</a></td><td></td></tr>
4056<tr><td colspan="4" class="doc" id="nullPointerConstant0"><pre>Matches expressions that resolve to a null pointer constant, such as
4057GNU's __null, C++11's nullptr, or C's NULL macro.
4058
4059Given:
4060  void *v1 = NULL;
4061  void *v2 = nullptr;
4062  void *v3 = __null; GNU extension
4063  char *cp = (char *)0;
4064  int *ip = 0;
4065  int i = 0;
4066expr(nullPointerConstant())
4067  matches the initializer for v1, v2, v3, cp, and ip. Does not match the
4068  initializer for i.
4069</pre></td></tr>
4070
4071
4072<tr><td>Matcher&lt;internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;&gt;</td><td class="name" onclick="toggle('hasAnyName0')"><a name="hasAnyName0Anchor">hasAnyName</a></td><td>StringRef, ..., StringRef</td></tr>
4073<tr><td colspan="4" class="doc" id="hasAnyName0"><pre>Matches NamedDecl nodes that have any of the specified names.
4074
4075This matcher is only provided as a performance optimization of hasName.
4076    hasAnyName(a, b, c)
4077 is equivalent to, but faster than
4078    anyOf(hasName(a), hasName(b), hasName(c))
4079</pre></td></tr>
4080
4081
4082<tr><td>Matcher&lt;internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;&gt;</td><td class="name" onclick="toggle('hasAnySelector0')"><a name="hasAnySelector0Anchor">hasAnySelector</a></td><td>StringRef, ..., StringRef</td></tr>
4083<tr><td colspan="4" class="doc" id="hasAnySelector0"><pre>Matches when at least one of the supplied string equals to the
4084Selector.getAsString()
4085
4086 matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
4087 matches both of the expressions below:
4088    [myObj methodA:argA];
4089    [myObj methodB:argB];
4090</pre></td></tr>
4091
4092
4093<tr><td>Matcher&lt;internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;&gt;</td><td class="name" onclick="toggle('isInTemplateInstantiation0')"><a name="isInTemplateInstantiation0Anchor">isInTemplateInstantiation</a></td><td></td></tr>
4094<tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
4095
4096Given
4097  int j;
4098  template&lt;typename T&gt; void A(T t) { T i; j += 42;}
4099  A(0);
4100  A(0U);
4101declStmt(isInTemplateInstantiation())
4102  matches 'int i;' and 'unsigned i'.
4103unless(stmt(isInTemplateInstantiation()))
4104  will NOT match j += 42; as it's shared between the template definition and
4105  instantiation.
4106</pre></td></tr>
4107
4108<!--END_NARROWING_MATCHERS -->
4109</table>
4110
4111<!-- ======================================================================= -->
4112<h2 id="traversal-matchers">AST Traversal Matchers</h2>
4113<!-- ======================================================================= -->
4114
4115<p>Traversal matchers specify the relationship to other nodes that are
4116reachable from the current node.</p>
4117
4118<p>Note that there are special traversal matchers (has, hasDescendant, forEach and
4119forEachDescendant) which work on all nodes and allow users to write more generic
4120match expressions.</p>
4121
4122<table>
4123<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
4124<!-- START_TRAVERSAL_MATCHERS -->
4125
4126<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>
4127<tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
4128
4129Unlike anyOf, eachOf will generate a match result for each
4130matching submatcher.
4131
4132For example, in:
4133  class A { int a; int b; };
4134The matcher:
4135  cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
4136                       has(fieldDecl(hasName("b")).bind("v"))))
4137will generate two results binding "v", the first of which binds
4138the field declaration of a, the second the field declaration of
4139b.
4140
4141Usable as: Any Matcher
4142</pre></td></tr>
4143
4144
4145<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4146<tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4147provided matcher.
4148
4149Example matches X, A, A::X, B, B::C, B::C::X
4150  (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
4151  class X {};
4152  class A { class X {}; };  Matches A, because A::X is a class of name
4153                            X inside A.
4154  class B { class C { class X {}; }; };
4155
4156DescendantT must be an AST base type.
4157
4158As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
4159each result that matches instead of only on the first one.
4160
4161Note: Recursively combined ForEachDescendant can cause many matches:
4162  cxxRecordDecl(forEachDescendant(cxxRecordDecl(
4163    forEachDescendant(cxxRecordDecl())
4164  )))
4165will match 10 times (plus injected class name matches) on:
4166  class A { class B { class C { class D { class E {}; }; }; }; };
4167
4168Usable as: Any Matcher
4169</pre></td></tr>
4170
4171
4172<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
4173<tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
4174provided matcher.
4175
4176Example matches X, Y, Y::X, Z::Y, Z::Y::X
4177  (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
4178  class X {};
4179  class Y { class X {}; };  Matches Y, because Y::X is a class of name X
4180                            inside Y.
4181  class Z { class Y { class X {}; }; };  Does not match Z.
4182
4183ChildT must be an AST base type.
4184
4185As opposed to 'has', 'forEach' will cause a match for each result that
4186matches instead of only on the first one.
4187
4188Usable as: Any Matcher
4189</pre></td></tr>
4190
4191
4192<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
4193<tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
4194matcher.
4195
4196Given
4197void f() { if (true) { int x = 42; } }
4198void g() { for (;;) { int x = 43; } }
4199expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
4200
4201Usable as: Any Matcher
4202</pre></td></tr>
4203
4204
4205<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4206<tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4207provided matcher.
4208
4209Example matches X, Y, Z
4210    (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
4211  class X {};  Matches X, because X::X is a class of name X inside X.
4212  class Y { class X {}; };
4213  class Z { class Y { class X {}; }; };
4214
4215DescendantT must be an AST base type.
4216
4217Usable as: Any Matcher
4218</pre></td></tr>
4219
4220
4221<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
4222<tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
4223provided matcher.
4224
4225Example matches X, Y
4226  (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
4227  class X {};  Matches X, because X::X is a class of name X inside X.
4228  class Y { class X {}; };
4229  class Z { class Y { class X {}; }; };  Does not match Z.
4230
4231ChildT must be an AST base type.
4232
4233Usable as: Any Matcher
4234Note that has is direct matcher, so it also matches things like implicit
4235casts and paren casts. If you are matching with expr then you should
4236probably consider using ignoringParenImpCasts like:
4237has(ignoringParenImpCasts(expr())).
4238</pre></td></tr>
4239
4240
4241<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
4242<tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
4243matcher.
4244
4245Given
4246void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
4247compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
4248
4249Usable as: Any Matcher
4250</pre></td></tr>
4251
4252
4253<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AbstractConditionalOperator.html">AbstractConditionalOperator</a>&gt;</td><td class="name" onclick="toggle('hasCondition5')"><a name="hasCondition5Anchor">hasCondition</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4254<tr><td colspan="4" class="doc" id="hasCondition5"><pre>Matches the condition expression of an if statement, for loop,
4255switch statement or conditional operator.
4256
4257Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
4258  if (true) {}
4259</pre></td></tr>
4260
4261
4262<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AbstractConditionalOperator.html">AbstractConditionalOperator</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>
4263<tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator
4264(binary or ternary).
4265
4266Example matches b
4267  condition ? a : b
4268  condition ?: b
4269</pre></td></tr>
4270
4271
4272<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AbstractConditionalOperator.html">AbstractConditionalOperator</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>
4273<tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
4274
4275Example 1 (conditional ternary operator): matches a
4276  condition ? a : b
4277
4278Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
4279  condition ?: b
4280</pre></td></tr>
4281
4282
4283<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration15')"><a name="hasDeclaration15Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4284<tr><td colspan="4" class="doc" id="hasDeclaration15"><pre>Matches a node if the declaration associated with that node
4285matches the given matcher.
4286
4287The associated declaration is:
4288- for type nodes, the declaration of the underlying type
4289- for CallExpr, the declaration of the callee
4290- for MemberExpr, the declaration of the referenced member
4291- for CXXConstructExpr, the declaration of the constructor
4292- for CXXNewExpr, the declaration of the operator new
4293- for ObjCIvarExpr, the declaration of the ivar
4294
4295For type nodes, hasDeclaration will generally match the declaration of the
4296sugared type. Given
4297  class X {};
4298  typedef X Y;
4299  Y y;
4300in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4301typedefDecl. A common use case is to match the underlying, desugared type.
4302This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4303  varDecl(hasType(hasUnqualifiedDesugaredType(
4304      recordType(hasDeclaration(decl())))))
4305In this matcher, the decl will match the CXXRecordDecl of class X.
4306
4307Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
4308  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
4309  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
4310  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
4311  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
4312  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
4313  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4314</pre></td></tr>
4315
4316
4317<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>
4318<tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
4319
4320Given
4321  int i[5];
4322  void f() { i[1] = 42; }
4323arraySubscriptExpression(hasBase(implicitCastExpr(
4324    hasSourceExpression(declRefExpr()))))
4325  matches i[1] with the declRefExpr() matching i
4326</pre></td></tr>
4327
4328
4329<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>
4330<tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
4331
4332Given
4333  int i[5];
4334  void f() { i[1] = 42; }
4335arraySubscriptExpression(hasIndex(integerLiteral()))
4336  matches i[1] with the integerLiteral() matching 1
4337</pre></td></tr>
4338
4339
4340<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>&gt;</td><td class="name" onclick="toggle('hasLHS1')"><a name="hasLHS1Anchor">hasLHS</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4341<tr><td colspan="4" class="doc" id="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
4342
4343Example matches a (matcher = binaryOperator(hasLHS()))
4344  a || b
4345</pre></td></tr>
4346
4347
4348<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>&gt;</td><td class="name" onclick="toggle('hasRHS1')"><a name="hasRHS1Anchor">hasRHS</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4349<tr><td colspan="4" class="doc" id="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
4350
4351Example matches b (matcher = binaryOperator(hasRHS()))
4352  a || b
4353</pre></td></tr>
4354
4355
4356<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>
4357<tr><td colspan="4" class="doc" id="hasElementTypeLoc0"><pre>Matches arrays and C99 complex types that have a specific element
4358type.
4359
4360Given
4361  struct A {};
4362  A a[7];
4363  int b[7];
4364arrayType(hasElementType(builtinType()))
4365  matches "int b[7]"
4366
4367Usable 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;
4368</pre></td></tr>
4369
4370
4371<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>
4372<tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
4373type.
4374
4375Given
4376  struct A {};
4377  A a[7];
4378  int b[7];
4379arrayType(hasElementType(builtinType()))
4380  matches "int b[7]"
4381
4382Usable 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;
4383</pre></td></tr>
4384
4385
4386<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>
4387<tr><td colspan="4" class="doc" id="hasValueTypeLoc0"><pre>Matches atomic types with a specific value type.
4388
4389Given
4390  _Atomic(int) i;
4391  _Atomic(float) f;
4392atomicType(hasValueType(isInteger()))
4393 matches "_Atomic(int) i"
4394
4395Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
4396</pre></td></tr>
4397
4398
4399<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>
4400<tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
4401
4402Given
4403  _Atomic(int) i;
4404  _Atomic(float) f;
4405atomicType(hasValueType(isInteger()))
4406 matches "_Atomic(int) i"
4407
4408Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
4409</pre></td></tr>
4410
4411
4412<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>
4413<tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
4414
4415Note: There is no TypeLoc for the deduced type and thus no
4416getDeducedLoc() matcher.
4417
4418Given
4419  auto a = 1;
4420  auto b = 2.0;
4421autoType(hasDeducedType(isInteger()))
4422  matches "auto a"
4423
4424Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
4425</pre></td></tr>
4426
4427
4428<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;  InnerMatcher</td></tr>
4429<tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
4430binary operator matches.
4431</pre></td></tr>
4432
4433
4434<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>
4435<tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
4436
4437Example matches a (matcher = binaryOperator(hasLHS()))
4438  a || b
4439</pre></td></tr>
4440
4441
4442<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>
4443<tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
4444
4445Example matches b (matcher = binaryOperator(hasRHS()))
4446  a || b
4447</pre></td></tr>
4448
4449
4450<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyParameter2')"><a name="hasAnyParameter2Anchor">hasAnyParameter</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
4451<tr><td colspan="4" class="doc" id="hasAnyParameter2"><pre>Matches any parameter of a function or an ObjC method declaration or a
4452block.
4453
4454Does not match the 'this' parameter of a method.
4455
4456Given
4457  class X { void f(int x, int y, int z) {} };
4458cxxMethodDecl(hasAnyParameter(hasName("y")))
4459  matches f(int x, int y, int z) {}
4460with hasAnyParameter(...)
4461  matching int y
4462
4463For ObjectiveC, given
4464  @interface I - (void) f:(int) y; @end
4465
4466the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
4467matches the declaration of method f with hasParameter
4468matching y.
4469
4470For blocks, given
4471  b = ^(int y) { printf("%d", y) };
4472
4473the matcher blockDecl(hasAnyParameter(hasName("y")))
4474matches the declaration of the block b with hasParameter
4475matching y.
4476</pre></td></tr>
4477
4478
4479<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;</td><td class="name" onclick="toggle('hasParameter2')"><a name="hasParameter2Anchor">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>
4480<tr><td colspan="4" class="doc" id="hasParameter2"><pre>Matches the n'th parameter of a function or an ObjC method
4481declaration or a block.
4482
4483Given
4484  class X { void f(int x) {} };
4485cxxMethodDecl(hasParameter(0, hasType(varDecl())))
4486  matches f(int x) {}
4487with hasParameter(...)
4488  matching int x
4489
4490For ObjectiveC, given
4491  @interface I - (void) f:(int) y; @end
4492
4493the matcher objcMethodDecl(hasParameter(0, hasName("y")))
4494matches the declaration of method f with hasParameter
4495matching y.
4496</pre></td></tr>
4497
4498
4499<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>
4500<tr><td colspan="4" class="doc" id="pointeeLoc0"><pre>Narrows PointerType (and similar) matchers to those where the
4501pointee matches a given matcher.
4502
4503Given
4504  int *a;
4505  int const *b;
4506  float const *f;
4507pointerType(pointee(isConstQualified(), isInteger()))
4508  matches "int const *b"
4509
4510Usable 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;,
4511  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;
4512</pre></td></tr>
4513
4514
4515<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>
4516<tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
4517pointee matches a given matcher.
4518
4519Given
4520  int *a;
4521  int const *b;
4522  float const *f;
4523pointerType(pointee(isConstQualified(), isInteger()))
4524  matches "int const *b"
4525
4526Usable 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;,
4527  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;
4528</pre></td></tr>
4529
4530
4531<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('forEachArgumentWithParam1')"><a name="forEachArgumentWithParam1Anchor">forEachArgumentWithParam</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; ArgMatcher, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; ParamMatcher</td></tr>
4532<tr><td colspan="4" class="doc" id="forEachArgumentWithParam1"><pre>Matches all arguments and their respective ParmVarDecl.
4533
4534Given
4535  void f(int i);
4536  int y;
4537  f(y);
4538callExpr(
4539  forEachArgumentWithParam(
4540    declRefExpr(to(varDecl(hasName("y")))),
4541    parmVarDecl(hasType(isInteger()))
4542))
4543  matches f(y);
4544with declRefExpr(...)
4545  matching int y
4546and parmVarDecl(...)
4547  matching int i
4548</pre></td></tr>
4549
4550
4551<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>
4552<tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
4553expression, or an ObjC-message-send expression.
4554
4555Given
4556  void x(int, int, int) { int y; x(1, y, 42); }
4557callExpr(hasAnyArgument(declRefExpr()))
4558  matches x(1, y, 42)
4559with hasAnyArgument(...)
4560  matching y
4561
4562For ObjectiveC, given
4563  @interface I - (void) f:(int) y; @end
4564  void foo(I *i) { [i f:12]; }
4565objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
4566  matches [i f:12]
4567</pre></td></tr>
4568
4569
4570<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>
4571<tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
4572call expression.
4573
4574Example matches y in x(y)
4575    (matcher = callExpr(hasArgument(0, declRefExpr())))
4576  void x(int) { int y; x(y); }
4577</pre></td></tr>
4578
4579
4580<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration13')"><a name="hasDeclaration13Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4581<tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
4582matches the given matcher.
4583
4584The associated declaration is:
4585- for type nodes, the declaration of the underlying type
4586- for CallExpr, the declaration of the callee
4587- for MemberExpr, the declaration of the referenced member
4588- for CXXConstructExpr, the declaration of the constructor
4589- for CXXNewExpr, the declaration of the operator new
4590- for ObjCIvarExpr, the declaration of the ivar
4591
4592For type nodes, hasDeclaration will generally match the declaration of the
4593sugared type. Given
4594  class X {};
4595  typedef X Y;
4596  Y y;
4597in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4598typedefDecl. A common use case is to match the underlying, desugared type.
4599This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4600  varDecl(hasType(hasUnqualifiedDesugaredType(
4601      recordType(hasDeclaration(decl())))))
4602In this matcher, the decl will match the CXXRecordDecl of class X.
4603
4604Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
4605  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
4606  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
4607  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
4608  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
4609  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
4610  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4611</pre></td></tr>
4612
4613
4614<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>
4615<tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
4616
4617Given
4618  class A { A() : i(42), j(42) {} int i; int j; };
4619cxxConstructorDecl(forEachConstructorInitializer(
4620  forField(decl().bind("x"))
4621))
4622  will trigger two matches, binding for 'i' and 'j' respectively.
4623</pre></td></tr>
4624
4625
4626<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>
4627<tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
4628
4629Given
4630  struct Foo {
4631    Foo() : foo_(1) { }
4632    int foo_;
4633  };
4634cxxRecordDecl(has(cxxConstructorDecl(
4635  hasAnyConstructorInitializer(anything())
4636)))
4637  record matches Foo, hasAnyConstructorInitializer matches foo_(1)
4638</pre></td></tr>
4639
4640
4641<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>
4642<tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
4643
4644Given
4645  struct Foo {
4646    Foo() : foo_(1) { }
4647    int foo_;
4648  };
4649cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
4650    forField(hasName("foo_"))))))
4651  matches Foo
4652with forField matching foo_
4653</pre></td></tr>
4654
4655
4656<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>
4657<tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
4658
4659Given
4660  struct Foo {
4661    Foo() : foo_(1) { }
4662    int foo_;
4663  };
4664cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
4665    withInitializer(integerLiteral(equals(1)))))))
4666  matches Foo
4667with withInitializer matching (1)
4668</pre></td></tr>
4669
4670
4671<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;</td><td class="name" onclick="toggle('hasObjectExpression2')"><a name="hasObjectExpression2Anchor">hasObjectExpression</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4672<tr><td colspan="4" class="doc" id="hasObjectExpression2"><pre>Matches a member expression where the object expression is
4673matched by a given matcher.
4674
4675Given
4676  struct X { int m; };
4677  void f(X x) { x.m; m; }
4678memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
4679  matches "x.m" and "m"
4680with hasObjectExpression(...)
4681  matching "x" and the implicit object expression of "m" which has type X*.
4682</pre></td></tr>
4683
4684
4685<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>
4686<tr><td colspan="4" class="doc" id="hasBody3"><pre>Matches a 'for', 'while', 'do while' statement or a function
4687definition that has a given body.
4688
4689Given
4690  for (;;) {}
4691hasBody(compoundStmt())
4692  matches 'for (;;) {}'
4693with compoundStmt()
4694  matching '{}'
4695</pre></td></tr>
4696
4697
4698<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>
4699<tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
4700
4701Example:
4702    forStmt(hasLoopVariable(anything()))
4703matches 'int x' in
4704    for (int x : a) { }
4705</pre></td></tr>
4706
4707
4708<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>
4709<tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
4710
4711Example:
4712    forStmt(hasRangeInit(anything()))
4713matches 'a' in
4714    for (int x : a) { }
4715</pre></td></tr>
4716
4717
4718<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>
4719<tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre></pre></td></tr>
4720
4721
4722<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>
4723<tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression.
4724
4725Example matches y.x()
4726  (matcher = cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y"))))))
4727  class Y { public: void x(); };
4728  void z() { Y y; y.x(); }
4729
4730FIXME: Overload to allow directly matching types?
4731</pre></td></tr>
4732
4733
4734<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>
4735<tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
4736</pre></td></tr>
4737
4738
4739<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>
4740<tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the expression's type either matches the specified
4741matcher, or is a pointer to a type that matches the InnerMatcher.
4742</pre></td></tr>
4743
4744
4745<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('forEachOverridden0')"><a name="forEachOverridden0Anchor">forEachOverridden</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt; InnerMatcher</td></tr>
4746<tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overridden by the given method. This matcher may
4747produce multiple matches.
4748
4749Given
4750  class A { virtual void f(); };
4751  class B : public A { void f(); };
4752  class C : public B { void f(); };
4753cxxMethodDecl(ofClass(hasName("C")),
4754              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4755  matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
4756  that B::f is not overridden by C::f).
4757
4758The check can produce multiple matches in case of multiple inheritance, e.g.
4759  class A1 { virtual void f(); };
4760  class A2 { virtual void f(); };
4761  class C : public A1, public A2 { void f(); };
4762cxxMethodDecl(ofClass(hasName("C")),
4763              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4764  matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
4765  once with "b" binding "A2::f" and "d" binding "C::f".
4766</pre></td></tr>
4767
4768
4769<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>
4770<tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
4771belongs to.
4772
4773FIXME: Generalize this for other kinds of declarations.
4774FIXME: What other kind of declarations would we need to generalize
4775this to?
4776
4777Example matches A() in the last line
4778    (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
4779        ofClass(hasName("A"))))))
4780  class A {
4781   public:
4782    A();
4783  };
4784  A a = A();
4785</pre></td></tr>
4786
4787
4788<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('hasArraySize0')"><a name="hasArraySize0Anchor">hasArraySize</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4789<tr><td colspan="4" class="doc" id="hasArraySize0"><pre>Matches array new expressions with a given array size.
4790
4791Given:
4792  MyClass *p1 = new MyClass[10];
4793cxxNewExpr(hasArraySize(intgerLiteral(equals(10))))
4794  matches the expression 'new MyClass[10]'.
4795</pre></td></tr>
4796
4797
4798<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration12')"><a name="hasDeclaration12Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4799<tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
4800matches the given matcher.
4801
4802The associated declaration is:
4803- for type nodes, the declaration of the underlying type
4804- for CallExpr, the declaration of the callee
4805- for MemberExpr, the declaration of the referenced member
4806- for CXXConstructExpr, the declaration of the constructor
4807- for CXXNewExpr, the declaration of the operator new
4808- for ObjCIvarExpr, the declaration of the ivar
4809
4810For type nodes, hasDeclaration will generally match the declaration of the
4811sugared type. Given
4812  class X {};
4813  typedef X Y;
4814  Y y;
4815in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4816typedefDecl. A common use case is to match the underlying, desugared type.
4817This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4818  varDecl(hasType(hasUnqualifiedDesugaredType(
4819      recordType(hasDeclaration(decl())))))
4820In this matcher, the decl will match the CXXRecordDecl of class X.
4821
4822Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
4823  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
4824  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
4825  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
4826  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
4827  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
4828  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4829</pre></td></tr>
4830
4831
4832<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>
4833<tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
4834
4835Given:
4836  class A { void func(); };
4837  class B { void member(); };
4838
4839cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
4840A but not B.
4841</pre></td></tr>
4842
4843
4844<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>
4845<tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from
4846a class matching Base.
4847
4848Note that a class is not considered to be derived from itself.
4849
4850Example matches Y, Z, C (Base == hasName("X"))
4851  class X;
4852  class Y : public X {};  directly derived
4853  class Z : public Y {};  indirectly derived
4854  typedef X A;
4855  typedef A B;
4856  class C : public B {};  derived from a typedef of X
4857
4858In the following example, Bar matches isDerivedFrom(hasName("X")):
4859  class Foo;
4860  typedef Foo X;
4861  class Bar : public Foo {};  derived from a type that X is a typedef of
4862</pre></td></tr>
4863
4864
4865<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>
4866<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
4867match Base.
4868</pre></td></tr>
4869
4870
4871<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyArgument2')"><a name="hasAnyArgument2Anchor">hasAnyArgument</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4872<tr><td colspan="4" class="doc" id="hasAnyArgument2"><pre>Matches any argument of a call expression or a constructor call
4873expression, or an ObjC-message-send expression.
4874
4875Given
4876  void x(int, int, int) { int y; x(1, y, 42); }
4877callExpr(hasAnyArgument(declRefExpr()))
4878  matches x(1, y, 42)
4879with hasAnyArgument(...)
4880  matching y
4881
4882For ObjectiveC, given
4883  @interface I - (void) f:(int) y; @end
4884  void foo(I *i) { [i f:12]; }
4885objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
4886  matches [i f:12]
4887</pre></td></tr>
4888
4889
4890<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>
4891<tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
4892given matcher.
4893
4894Example matches y.x() (matcher = callExpr(callee(
4895                                   cxxMethodDecl(hasName("x")))))
4896  class Y { public: void x(); };
4897  void z() { Y y; y.x(); }
4898</pre></td></tr>
4899
4900
4901<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>
4902<tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches.
4903
4904Given
4905  class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
4906  void f() { f(); }
4907callExpr(callee(expr()))
4908  matches this-&gt;x(), x(), y.x(), f()
4909with callee(...)
4910  matching this-&gt;x, x, y.x, f respectively
4911
4912Note: Callee cannot take the more general internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
4913because this introduces ambiguous overloads with calls to Callee taking a
4914internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
4915implemented in terms of implicit casts.
4916</pre></td></tr>
4917
4918
4919<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('forEachArgumentWithParam0')"><a name="forEachArgumentWithParam0Anchor">forEachArgumentWithParam</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; ArgMatcher, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; ParamMatcher</td></tr>
4920<tr><td colspan="4" class="doc" id="forEachArgumentWithParam0"><pre>Matches all arguments and their respective ParmVarDecl.
4921
4922Given
4923  void f(int i);
4924  int y;
4925  f(y);
4926callExpr(
4927  forEachArgumentWithParam(
4928    declRefExpr(to(varDecl(hasName("y")))),
4929    parmVarDecl(hasType(isInteger()))
4930))
4931  matches f(y);
4932with declRefExpr(...)
4933  matching int y
4934and parmVarDecl(...)
4935  matching int i
4936</pre></td></tr>
4937
4938
4939<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>
4940<tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
4941expression, or an ObjC-message-send expression.
4942
4943Given
4944  void x(int, int, int) { int y; x(1, y, 42); }
4945callExpr(hasAnyArgument(declRefExpr()))
4946  matches x(1, y, 42)
4947with hasAnyArgument(...)
4948  matching y
4949
4950For ObjectiveC, given
4951  @interface I - (void) f:(int) y; @end
4952  void foo(I *i) { [i f:12]; }
4953objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
4954  matches [i f:12]
4955</pre></td></tr>
4956
4957
4958<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>
4959<tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
4960call expression.
4961
4962Example matches y in x(y)
4963    (matcher = callExpr(hasArgument(0, declRefExpr())))
4964  void x(int) { int y; x(y); }
4965</pre></td></tr>
4966
4967
4968<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration14')"><a name="hasDeclaration14Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4969<tr><td colspan="4" class="doc" id="hasDeclaration14"><pre>Matches a node if the declaration associated with that node
4970matches the given matcher.
4971
4972The associated declaration is:
4973- for type nodes, the declaration of the underlying type
4974- for CallExpr, the declaration of the callee
4975- for MemberExpr, the declaration of the referenced member
4976- for CXXConstructExpr, the declaration of the constructor
4977- for CXXNewExpr, the declaration of the operator new
4978- for ObjCIvarExpr, the declaration of the ivar
4979
4980For type nodes, hasDeclaration will generally match the declaration of the
4981sugared type. Given
4982  class X {};
4983  typedef X Y;
4984  Y y;
4985in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4986typedefDecl. A common use case is to match the underlying, desugared type.
4987This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4988  varDecl(hasType(hasUnqualifiedDesugaredType(
4989      recordType(hasDeclaration(decl())))))
4990In this matcher, the decl will match the CXXRecordDecl of class X.
4991
4992Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
4993  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
4994  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
4995  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
4996  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
4997  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
4998  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4999</pre></td></tr>
5000
5001
5002<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>
5003<tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
5004extension, matches the constant given in the statement.
5005
5006Given
5007  switch (1) { case 1: case 1+1: case 3 ... 4: ; }
5008caseStmt(hasCaseConstant(integerLiteral()))
5009  matches "case 1:"
5010</pre></td></tr>
5011
5012
5013<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>
5014<tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression
5015or opaque value's source expression matches the given matcher.
5016
5017Example 1: matches "a string"
5018(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
5019class URL { URL(string); };
5020URL url = "a string";
5021
5022Example 2: matches 'b' (matcher =
5023opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
5024int a = b ?: 1;
5025</pre></td></tr>
5026
5027
5028<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>
5029<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5030functionDecl that have at least one TemplateArgument matching the given
5031InnerMatcher.
5032
5033Given
5034  template&lt;typename T&gt; class A {};
5035  template&lt;&gt; class A&lt;double&gt; {};
5036  A&lt;int&gt; a;
5037
5038  template&lt;typename T&gt; f() {};
5039  void func() { f&lt;int&gt;(); };
5040
5041classTemplateSpecializationDecl(hasAnyTemplateArgument(
5042    refersToType(asString("int"))))
5043  matches the specialization A&lt;int&gt;
5044
5045functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
5046  matches the specialization f&lt;int&gt;
5047</pre></td></tr>
5048
5049
5050<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('hasSpecializedTemplate0')"><a name="hasSpecializedTemplate0Anchor">hasSpecializedTemplate</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateDecl.html">ClassTemplateDecl</a>&gt; InnerMatcher</td></tr>
5051<tr><td colspan="4" class="doc" id="hasSpecializedTemplate0"><pre>Matches the specialized template of a specialization declaration.
5052
5053Given
5054  tempalate&lt;typename T&gt; class A {};
5055  typedef A&lt;int&gt; B;
5056classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl()))
5057  matches 'B' with classTemplateDecl() matching the class template
5058  declaration of 'A'.
5059</pre></td></tr>
5060
5061
5062<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>
5063<tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5064functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
5065
5066Given
5067  template&lt;typename T, typename U&gt; class A {};
5068  A&lt;bool, int&gt; b;
5069  A&lt;int, bool&gt; c;
5070
5071  template&lt;typename T&gt; void f() {}
5072  void func() { f&lt;int&gt;(); };
5073classTemplateSpecializationDecl(hasTemplateArgument(
5074    1, refersToType(asString("int"))))
5075  matches the specialization A&lt;bool, int&gt;
5076
5077functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
5078  matches the specialization f&lt;int&gt;
5079</pre></td></tr>
5080
5081
5082<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>
5083<tr><td colspan="4" class="doc" id="hasElementTypeLoc1"><pre>Matches arrays and C99 complex types that have a specific element
5084type.
5085
5086Given
5087  struct A {};
5088  A a[7];
5089  int b[7];
5090arrayType(hasElementType(builtinType()))
5091  matches "int b[7]"
5092
5093Usable 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;
5094</pre></td></tr>
5095
5096
5097<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>
5098<tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
5099type.
5100
5101Given
5102  struct A {};
5103  A a[7];
5104  int b[7];
5105arrayType(hasElementType(builtinType()))
5106  matches "int b[7]"
5107
5108Usable 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;
5109</pre></td></tr>
5110
5111
5112<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>
5113<tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
5114a given matcher. Also matches StmtExprs that have CompoundStmt as children.
5115
5116Given
5117  { {}; 1+2; }
5118hasAnySubstatement(compoundStmt())
5119  matches '{ {}; 1+2; }'
5120with compoundStmt()
5121  matching '{}'
5122</pre></td></tr>
5123
5124
5125<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DecayedType.html">DecayedType</a>&gt;</td><td class="name" onclick="toggle('hasDecayedType0')"><a name="hasDecayedType0Anchor">hasDecayedType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerType</td></tr>
5126<tr><td colspan="4" class="doc" id="hasDecayedType0"><pre>Matches the decayed type, whos decayed type matches InnerMatcher
5127</pre></td></tr>
5128
5129
5130<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5131<tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
5132matches the given matcher.
5133
5134The associated declaration is:
5135- for type nodes, the declaration of the underlying type
5136- for CallExpr, the declaration of the callee
5137- for MemberExpr, the declaration of the referenced member
5138- for CXXConstructExpr, the declaration of the constructor
5139- for CXXNewExpr, the declaration of the operator new
5140- for ObjCIvarExpr, the declaration of the ivar
5141
5142For type nodes, hasDeclaration will generally match the declaration of the
5143sugared type. Given
5144  class X {};
5145  typedef X Y;
5146  Y y;
5147in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5148typedefDecl. A common use case is to match the underlying, desugared type.
5149This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5150  varDecl(hasType(hasUnqualifiedDesugaredType(
5151      recordType(hasDeclaration(decl())))))
5152In this matcher, the decl will match the CXXRecordDecl of class X.
5153
5154Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5155  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5156  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5157  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5158  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5159  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5160  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5161</pre></td></tr>
5162
5163
5164<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>
5165<tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a
5166specific using shadow declaration.
5167
5168Given
5169  namespace a { void f() {} }
5170  using a::f;
5171  void g() {
5172    f();     Matches this ..
5173    a::f();  .. but not this.
5174  }
5175declRefExpr(throughUsingDecl(anything()))
5176  matches f()
5177</pre></td></tr>
5178
5179
5180<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>
5181<tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
5182specified matcher.
5183
5184Example matches x in if(x)
5185    (matcher = declRefExpr(to(varDecl(hasName("x")))))
5186  bool x;
5187  if (x) {}
5188</pre></td></tr>
5189
5190
5191<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>
5192<tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
5193
5194Note that this does not work for global declarations because the AST
5195breaks up multiple-declaration DeclStmt's into multiple single-declaration
5196DeclStmt's.
5197Example: Given non-global declarations
5198  int a, b = 0;
5199  int c;
5200  int d = 2, e;
5201declStmt(containsDeclaration(
5202      0, varDecl(hasInitializer(anything()))))
5203  matches only 'int d = 2, e;', and
5204declStmt(containsDeclaration(1, varDecl()))
5205  matches 'int a, b = 0' as well as 'int d = 2, e;'
5206  but 'int c;' is not matched.
5207</pre></td></tr>
5208
5209
5210<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>
5211<tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
5212
5213Given
5214  int a, b;
5215  int c;
5216declStmt(hasSingleDecl(anything()))
5217  matches 'int c;' but not 'int a, b;'.
5218</pre></td></tr>
5219
5220
5221<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>
5222<tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches
5223the inner matcher.
5224
5225Given
5226  int x;
5227declaratorDecl(hasTypeLoc(loc(asString("int"))))
5228  matches int x
5229</pre></td></tr>
5230
5231
5232<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>
5233<tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
5234Decl, matches InnerMatcher.
5235
5236Given
5237  namespace N {
5238    namespace M {
5239      class D {};
5240    }
5241  }
5242
5243cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
5244declaration of class D.
5245</pre></td></tr>
5246
5247
5248<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;</td><td class="name" onclick="toggle('hasUnderlyingType0')"><a name="hasUnderlyingType0Anchor">hasUnderlyingType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
5249<tr><td colspan="4" class="doc" id="hasUnderlyingType0"><pre>Matches DecltypeType nodes to find out the underlying type.
5250
5251Given
5252  decltype(1) a = 1;
5253  decltype(2.0) b = 2.0;
5254decltypeType(hasUnderlyingType(isInteger()))
5255  matches "auto a"
5256
5257Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;
5258</pre></td></tr>
5259
5260
5261<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>
5262<tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', 'do while' statement or a function
5263definition that has a given body.
5264
5265Given
5266  for (;;) {}
5267hasBody(compoundStmt())
5268  matches 'for (;;) {}'
5269with compoundStmt()
5270  matching '{}'
5271</pre></td></tr>
5272
5273
5274<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>
5275<tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
5276switch statement or conditional operator.
5277
5278Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5279  if (true) {}
5280</pre></td></tr>
5281
5282
5283<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>
5284<tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
5285matches InnerMatcher if the qualifier exists.
5286
5287Given
5288  namespace N {
5289    namespace M {
5290      class D {};
5291    }
5292  }
5293  N::M::D d;
5294
5295elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
5296matches the type of the variable declaration of d.
5297</pre></td></tr>
5298
5299
5300<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>
5301<tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
5302
5303Given
5304  namespace N {
5305    namespace M {
5306      class D {};
5307    }
5308  }
5309  N::M::D d;
5310
5311elaboratedType(namesType(recordType(
5312hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
5313declaration of d.
5314</pre></td></tr>
5315
5316
5317<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5318<tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
5319matches the given matcher.
5320
5321The associated declaration is:
5322- for type nodes, the declaration of the underlying type
5323- for CallExpr, the declaration of the callee
5324- for MemberExpr, the declaration of the referenced member
5325- for CXXConstructExpr, the declaration of the constructor
5326- for CXXNewExpr, the declaration of the operator new
5327- for ObjCIvarExpr, the declaration of the ivar
5328
5329For type nodes, hasDeclaration will generally match the declaration of the
5330sugared type. Given
5331  class X {};
5332  typedef X Y;
5333  Y y;
5334in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5335typedefDecl. A common use case is to match the underlying, desugared type.
5336This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5337  varDecl(hasType(hasUnqualifiedDesugaredType(
5338      recordType(hasDeclaration(decl())))))
5339In this matcher, the decl will match the CXXRecordDecl of class X.
5340
5341Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5342  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5343  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5344  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5345  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5346  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5347  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5348</pre></td></tr>
5349
5350
5351<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>
5352<tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
5353
5354(Note: Clang's AST refers to other conversions as "casts" too, and calls
5355actual casts "explicit" casts.)
5356</pre></td></tr>
5357
5358
5359<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('hasType4')"><a name="hasType4Anchor">hasType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5360<tr><td colspan="4" class="doc" id="hasType4"><pre>Overloaded to match the declaration of the expression's or value
5361declaration's type.
5362
5363In case of a value declaration (for example a variable declaration),
5364this resolves one layer of indirection. For example, in the value
5365declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5366X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5367declaration of x.
5368
5369Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5370            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5371            and friend class X (matcher = friendDecl(hasType("X"))
5372 class X {};
5373 void y(X &amp;x) { x; X z; }
5374 class Y { friend class X; };
5375
5376Usable 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;
5377</pre></td></tr>
5378
5379
5380<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>
5381<tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
5382matcher.
5383
5384Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5385            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5386            and U (matcher = typedefDecl(hasType(asString("int")))
5387            and friend class X (matcher = friendDecl(hasType("X"))
5388 class X {};
5389 void y(X &amp;x) { x; X z; }
5390 typedef int U;
5391 class Y { friend class X; };
5392</pre></td></tr>
5393
5394
5395<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>
5396<tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
5397are stripped off.
5398
5399Parentheses and explicit casts are not discarded.
5400Given
5401  int arr[5];
5402  int a = 0;
5403  char b = 0;
5404  const int c = a;
5405  int *d = arr;
5406  long e = (long) 0l;
5407The matchers
5408   varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
5409   varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
5410would match the declarations for a, b, c, and d, but not e.
5411While
5412   varDecl(hasInitializer(integerLiteral()))
5413   varDecl(hasInitializer(declRefExpr()))
5414only match the declarations for b, c, and d.
5415</pre></td></tr>
5416
5417
5418<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('ignoringImplicit0')"><a name="ignoringImplicit0Anchor">ignoringImplicit</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5419<tr><td colspan="4" class="doc" id="ignoringImplicit0"><pre>Matches expressions that match InnerMatcher after any implicit AST
5420nodes are stripped off.
5421
5422Parentheses and explicit casts are not discarded.
5423Given
5424  class C {};
5425  C a = C();
5426  C b;
5427  C c = b;
5428The matchers
5429   varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr())))
5430would match the declarations for a, b, and c.
5431While
5432   varDecl(hasInitializer(cxxConstructExpr()))
5433only match the declarations for b and c.
5434</pre></td></tr>
5435
5436
5437<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>
5438<tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
5439casts are stripped off.
5440
5441Implicit and non-C Style casts are also discarded.
5442Given
5443  int a = 0;
5444  char b = (0);
5445  void* c = reinterpret_cast&lt;char*&gt;(0);
5446  char d = char(0);
5447The matcher
5448   varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
5449would match the declarations for a, b, c, and d.
5450while
5451   varDecl(hasInitializer(integerLiteral()))
5452only match the declaration for a.
5453</pre></td></tr>
5454
5455
5456<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>
5457<tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
5458parentheses are stripped off.
5459
5460Explicit casts are not discarded.
5461Given
5462  int arr[5];
5463  int a = 0;
5464  char b = (0);
5465  const int c = a;
5466  int *d = (arr);
5467  long e = ((long) 0l);
5468The matchers
5469   varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
5470   varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
5471would match the declarations for a, b, c, and d, but not e.
5472while
5473   varDecl(hasInitializer(integerLiteral()))
5474   varDecl(hasInitializer(declRefExpr()))
5475would only match the declaration for a.
5476</pre></td></tr>
5477
5478
5479<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt;</td><td class="name" onclick="toggle('hasInClassInitializer0')"><a name="hasInClassInitializer0Anchor">hasInClassInitializer</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5480<tr><td colspan="4" class="doc" id="hasInClassInitializer0"><pre>Matches non-static data members that have an in-class initializer.
5481
5482Given
5483  class C {
5484    int a = 2;
5485    int b = 3;
5486    int c;
5487  };
5488fieldDecl(hasInClassInitializer(integerLiteral(equals(2))))
5489  matches 'int a;' but not 'int b;'.
5490fieldDecl(hasInClassInitializer(anything()))
5491  matches 'int a;' and 'int b;' but not 'int c;'.
5492</pre></td></tr>
5493
5494
5495<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>
5496<tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', 'do while' statement or a function
5497definition that has a given body.
5498
5499Given
5500  for (;;) {}
5501hasBody(compoundStmt())
5502  matches 'for (;;) {}'
5503with compoundStmt()
5504  matching '{}'
5505</pre></td></tr>
5506
5507
5508<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>
5509<tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
5510switch statement or conditional operator.
5511
5512Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5513  if (true) {}
5514</pre></td></tr>
5515
5516
5517<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>
5518<tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
5519
5520Example:
5521    forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
5522matches '++x' in
5523    for (x; x &lt; N; ++x) { }
5524</pre></td></tr>
5525
5526
5527<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>
5528<tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
5529
5530Example:
5531    forStmt(hasLoopInit(declStmt()))
5532matches 'int x = 0' in
5533    for (int x = 0; x &lt; N; ++x) { }
5534</pre></td></tr>
5535
5536
5537<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FriendDecl.html">FriendDecl</a>&gt;</td><td class="name" onclick="toggle('hasType5')"><a name="hasType5Anchor">hasType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5538<tr><td colspan="4" class="doc" id="hasType5"><pre>Overloaded to match the declaration of the expression's or value
5539declaration's type.
5540
5541In case of a value declaration (for example a variable declaration),
5542this resolves one layer of indirection. For example, in the value
5543declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5544X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5545declaration of x.
5546
5547Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5548            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5549            and friend class X (matcher = friendDecl(hasType("X"))
5550 class X {};
5551 void y(X &amp;x) { x; X z; }
5552 class Y { friend class X; };
5553
5554Usable 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;
5555</pre></td></tr>
5556
5557
5558<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FriendDecl.html">FriendDecl</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>
5559<tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
5560matcher.
5561
5562Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5563            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5564            and U (matcher = typedefDecl(hasType(asString("int")))
5565            and friend class X (matcher = friendDecl(hasType("X"))
5566 class X {};
5567 void y(X &amp;x) { x; X z; }
5568 typedef int U;
5569 class Y { friend class X; };
5570</pre></td></tr>
5571
5572
5573<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>
5574<tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function or an ObjC method declaration or a
5575block.
5576
5577Does not match the 'this' parameter of a method.
5578
5579Given
5580  class X { void f(int x, int y, int z) {} };
5581cxxMethodDecl(hasAnyParameter(hasName("y")))
5582  matches f(int x, int y, int z) {}
5583with hasAnyParameter(...)
5584  matching int y
5585
5586For ObjectiveC, given
5587  @interface I - (void) f:(int) y; @end
5588
5589the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
5590matches the declaration of method f with hasParameter
5591matching y.
5592
5593For blocks, given
5594  b = ^(int y) { printf("%d", y) };
5595
5596the matcher blockDecl(hasAnyParameter(hasName("y")))
5597matches the declaration of the block b with hasParameter
5598matching y.
5599</pre></td></tr>
5600
5601
5602<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgument2')"><a name="hasAnyTemplateArgument2Anchor">hasAnyTemplateArgument</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
5603<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5604functionDecl that have at least one TemplateArgument matching the given
5605InnerMatcher.
5606
5607Given
5608  template&lt;typename T&gt; class A {};
5609  template&lt;&gt; class A&lt;double&gt; {};
5610  A&lt;int&gt; a;
5611
5612  template&lt;typename T&gt; f() {};
5613  void func() { f&lt;int&gt;(); };
5614
5615classTemplateSpecializationDecl(hasAnyTemplateArgument(
5616    refersToType(asString("int"))))
5617  matches the specialization A&lt;int&gt;
5618
5619functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
5620  matches the specialization f&lt;int&gt;
5621</pre></td></tr>
5622
5623
5624<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasBody4')"><a name="hasBody4Anchor">hasBody</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5625<tr><td colspan="4" class="doc" id="hasBody4"><pre>Matches a 'for', 'while', 'do while' statement or a function
5626definition that has a given body.
5627
5628Given
5629  for (;;) {}
5630hasBody(compoundStmt())
5631  matches 'for (;;) {}'
5632with compoundStmt()
5633  matching '{}'
5634</pre></td></tr>
5635
5636
5637<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>
5638<tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function or an ObjC method
5639declaration or a block.
5640
5641Given
5642  class X { void f(int x) {} };
5643cxxMethodDecl(hasParameter(0, hasType(varDecl())))
5644  matches f(int x) {}
5645with hasParameter(...)
5646  matching int x
5647
5648For ObjectiveC, given
5649  @interface I - (void) f:(int) y; @end
5650
5651the matcher objcMethodDecl(hasParameter(0, hasName("y")))
5652matches the declaration of method f with hasParameter
5653matching y.
5654</pre></td></tr>
5655
5656
5657<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgument2')"><a name="hasTemplateArgument2Anchor">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>
5658<tr><td colspan="4" class="doc" id="hasTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5659functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
5660
5661Given
5662  template&lt;typename T, typename U&gt; class A {};
5663  A&lt;bool, int&gt; b;
5664  A&lt;int, bool&gt; c;
5665
5666  template&lt;typename T&gt; void f() {}
5667  void func() { f&lt;int&gt;(); };
5668classTemplateSpecializationDecl(hasTemplateArgument(
5669    1, refersToType(asString("int"))))
5670  matches the specialization A&lt;bool, int&gt;
5671
5672functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
5673  matches the specialization f&lt;int&gt;
5674</pre></td></tr>
5675
5676
5677<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>
5678<tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
5679
5680Given:
5681  class X { int f() { return 1; } };
5682cxxMethodDecl(returns(asString("int")))
5683  matches int f() { return 1; }
5684</pre></td></tr>
5685
5686
5687<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>
5688<tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
5689switch statement or conditional operator.
5690
5691Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5692  if (true) {}
5693</pre></td></tr>
5694
5695
5696<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>
5697<tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
5698
5699Given
5700  if (A* a = GetAPointer()) {}
5701hasConditionVariableStatement(...)
5702  matches 'A* a = GetAPointer()'.
5703</pre></td></tr>
5704
5705
5706<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>
5707<tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
5708
5709Examples matches the if statement
5710  (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
5711  if (false) false; else true;
5712</pre></td></tr>
5713
5714
5715<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>
5716<tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
5717
5718Examples matches the if statement
5719  (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
5720  if (false) true; else false;
5721</pre></td></tr>
5722
5723
5724<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>
5725<tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
5726matcher.
5727
5728FIXME: Unit test this matcher
5729</pre></td></tr>
5730
5731
5732<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InitListExpr.html">InitListExpr</a>&gt;</td><td class="name" onclick="toggle('hasSyntacticForm0')"><a name="hasSyntacticForm0Anchor">hasSyntacticForm</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5733<tr><td colspan="4" class="doc" id="hasSyntacticForm0"><pre>Matches the syntactic form of init list expressions
5734(if expression have it).
5735</pre></td></tr>
5736
5737
5738<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5739<tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
5740matches the given matcher.
5741
5742The associated declaration is:
5743- for type nodes, the declaration of the underlying type
5744- for CallExpr, the declaration of the callee
5745- for MemberExpr, the declaration of the referenced member
5746- for CXXConstructExpr, the declaration of the constructor
5747- for CXXNewExpr, the declaration of the operator new
5748- for ObjCIvarExpr, the declaration of the ivar
5749
5750For type nodes, hasDeclaration will generally match the declaration of the
5751sugared type. Given
5752  class X {};
5753  typedef X Y;
5754  Y y;
5755in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5756typedefDecl. A common use case is to match the underlying, desugared type.
5757This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5758  varDecl(hasType(hasUnqualifiedDesugaredType(
5759      recordType(hasDeclaration(decl())))))
5760In this matcher, the decl will match the CXXRecordDecl of class X.
5761
5762Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5763  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5764  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5765  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5766  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5767  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5768  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5769</pre></td></tr>
5770
5771
5772<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5773<tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
5774matches the given matcher.
5775
5776The associated declaration is:
5777- for type nodes, the declaration of the underlying type
5778- for CallExpr, the declaration of the callee
5779- for MemberExpr, the declaration of the referenced member
5780- for CXXConstructExpr, the declaration of the constructor
5781- for CXXNewExpr, the declaration of the operator new
5782- for ObjCIvarExpr, the declaration of the ivar
5783
5784For type nodes, hasDeclaration will generally match the declaration of the
5785sugared type. Given
5786  class X {};
5787  typedef X Y;
5788  Y y;
5789in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5790typedefDecl. A common use case is to match the underlying, desugared type.
5791This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5792  varDecl(hasType(hasUnqualifiedDesugaredType(
5793      recordType(hasDeclaration(decl())))))
5794In this matcher, the decl will match the CXXRecordDecl of class X.
5795
5796Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5797  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5798  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5799  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5800  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5801  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5802  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5803</pre></td></tr>
5804
5805
5806<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5807<tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
5808matches the given matcher.
5809
5810The associated declaration is:
5811- for type nodes, the declaration of the underlying type
5812- for CallExpr, the declaration of the callee
5813- for MemberExpr, the declaration of the referenced member
5814- for CXXConstructExpr, the declaration of the constructor
5815- for CXXNewExpr, the declaration of the operator new
5816- for ObjCIvarExpr, the declaration of the ivar
5817
5818For type nodes, hasDeclaration will generally match the declaration of the
5819sugared type. Given
5820  class X {};
5821  typedef X Y;
5822  Y y;
5823in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5824typedefDecl. A common use case is to match the underlying, desugared type.
5825This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5826  varDecl(hasType(hasUnqualifiedDesugaredType(
5827      recordType(hasDeclaration(decl())))))
5828In this matcher, the decl will match the CXXRecordDecl of class X.
5829
5830Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5831  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5832  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5833  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5834  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5835  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5836  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5837</pre></td></tr>
5838
5839
5840<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>
5841<tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is
5842matched by a given matcher.
5843
5844Given
5845  struct X { int m; };
5846  void f(X x) { x.m; m; }
5847memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
5848  matches "x.m" and "m"
5849with hasObjectExpression(...)
5850  matching "x" and the implicit object expression of "m" which has type X*.
5851</pre></td></tr>
5852
5853
5854<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>
5855<tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
5856given matcher.
5857
5858Given
5859  struct { int first, second; } first, second;
5860  int i(second.first);
5861  int j(first.second);
5862memberExpr(member(hasName("first")))
5863  matches second.first
5864  but not first.second (because the member name there is "second").
5865</pre></td></tr>
5866
5867
5868<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>
5869<tr><td colspan="4" class="doc" id="pointeeLoc1"><pre>Narrows PointerType (and similar) matchers to those where the
5870pointee matches a given matcher.
5871
5872Given
5873  int *a;
5874  int const *b;
5875  float const *f;
5876pointerType(pointee(isConstQualified(), isInteger()))
5877  matches "int const *b"
5878
5879Usable 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;,
5880  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;
5881</pre></td></tr>
5882
5883
5884<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>
5885<tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
5886pointee matches a given matcher.
5887
5888Given
5889  int *a;
5890  int const *b;
5891  float const *f;
5892pointerType(pointee(isConstQualified(), isInteger()))
5893  matches "int const *b"
5894
5895Usable 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;,
5896  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;
5897</pre></td></tr>
5898
5899
5900<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</td><td class="name" onclick="toggle('hasUnderlyingDecl0')"><a name="hasUnderlyingDecl0Anchor">hasUnderlyingDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; InnerMatcher</td></tr>
5901<tr><td colspan="4" class="doc" id="hasUnderlyingDecl0"><pre>Matches a NamedDecl whose underlying declaration matches the given
5902matcher.
5903
5904Given
5905  namespace N { template&lt;class T&gt; void f(T t); }
5906  template &lt;class T&gt; void g() { using N::f; f(T()); }
5907unresolvedLookupExpr(hasAnyDeclaration(
5908    namedDecl(hasUnderlyingDecl(hasName("::N::f")))))
5909  matches the use of f in g() .
5910</pre></td></tr>
5911
5912
5913<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>
5914<tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
5915
5916Given
5917  struct A { struct B { struct C {}; }; };
5918  A::B::C c;
5919nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
5920  matches "A::"
5921</pre></td></tr>
5922
5923
5924<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>
5925<tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
5926given TypeLoc.
5927
5928Given
5929  struct A { struct B { struct C {}; }; };
5930  A::B::C c;
5931nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
5932  hasDeclaration(cxxRecordDecl(hasName("A")))))))
5933  matches "A::"
5934</pre></td></tr>
5935
5936
5937<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>
5938<tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
5939
5940Given
5941  struct A { struct B { struct C {}; }; };
5942  A::B::C c;
5943nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
5944  matches "A::"
5945</pre></td></tr>
5946
5947
5948<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>
5949<tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
5950given namespace matcher.
5951
5952Given
5953  namespace ns { struct A {}; }
5954  ns::A a;
5955nestedNameSpecifier(specifiesNamespace(hasName("ns")))
5956  matches "ns::"
5957</pre></td></tr>
5958
5959
5960<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>
5961<tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
5962given QualType matcher without qualifiers.
5963
5964Given
5965  struct A { struct B { struct C {}; }; };
5966  A::B::C c;
5967nestedNameSpecifier(specifiesType(
5968  hasDeclaration(cxxRecordDecl(hasName("A")))
5969))
5970  matches "A::"
5971</pre></td></tr>
5972
5973
5974<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyArgument3')"><a name="hasAnyArgument3Anchor">hasAnyArgument</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5975<tr><td colspan="4" class="doc" id="hasAnyArgument3"><pre>Matches any argument of a call expression or a constructor call
5976expression, or an ObjC-message-send expression.
5977
5978Given
5979  void x(int, int, int) { int y; x(1, y, 42); }
5980callExpr(hasAnyArgument(declRefExpr()))
5981  matches x(1, y, 42)
5982with hasAnyArgument(...)
5983  matching y
5984
5985For ObjectiveC, given
5986  @interface I - (void) f:(int) y; @end
5987  void foo(I *i) { [i f:12]; }
5988objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
5989  matches [i f:12]
5990</pre></td></tr>
5991
5992
5993<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasArgument2')"><a name="hasArgument2Anchor">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>
5994<tr><td colspan="4" class="doc" id="hasArgument2"><pre>Matches the n'th argument of a call expression or a constructor
5995call expression.
5996
5997Example matches y in x(y)
5998    (matcher = callExpr(hasArgument(0, declRefExpr())))
5999  void x(int) { int y; x(y); }
6000</pre></td></tr>
6001
6002
6003<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasReceiver0')"><a name="hasReceiver0Anchor">hasReceiver</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6004<tr><td colspan="4" class="doc" id="hasReceiver0"><pre>Matches if the Objective-C message is sent to an instance,
6005and the inner matcher matches on that instance.
6006
6007For example the method call in
6008  NSString *x = @"hello";
6009  [x containsString:@"h"];
6010is matched by
6011objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
6012</pre></td></tr>
6013
6014
6015<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasReceiverType0')"><a name="hasReceiverType0Anchor">hasReceiverType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6016<tr><td colspan="4" class="doc" id="hasReceiverType0"><pre>Matches on the receiver of an ObjectiveC Message expression.
6017
6018Example
6019matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *")));
6020matches the [webView ...] message invocation.
6021  NSString *webViewJavaScript = ...
6022  UIWebView *webView = ...
6023  [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
6024</pre></td></tr>
6025
6026
6027<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyParameter1')"><a name="hasAnyParameter1Anchor">hasAnyParameter</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
6028<tr><td colspan="4" class="doc" id="hasAnyParameter1"><pre>Matches any parameter of a function or an ObjC method declaration or a
6029block.
6030
6031Does not match the 'this' parameter of a method.
6032
6033Given
6034  class X { void f(int x, int y, int z) {} };
6035cxxMethodDecl(hasAnyParameter(hasName("y")))
6036  matches f(int x, int y, int z) {}
6037with hasAnyParameter(...)
6038  matching int y
6039
6040For ObjectiveC, given
6041  @interface I - (void) f:(int) y; @end
6042
6043the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
6044matches the declaration of method f with hasParameter
6045matching y.
6046
6047For blocks, given
6048  b = ^(int y) { printf("%d", y) };
6049
6050the matcher blockDecl(hasAnyParameter(hasName("y")))
6051matches the declaration of the block b with hasParameter
6052matching y.
6053</pre></td></tr>
6054
6055
6056<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;</td><td class="name" onclick="toggle('hasParameter1')"><a name="hasParameter1Anchor">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>
6057<tr><td colspan="4" class="doc" id="hasParameter1"><pre>Matches the n'th parameter of a function or an ObjC method
6058declaration or a block.
6059
6060Given
6061  class X { void f(int x) {} };
6062cxxMethodDecl(hasParameter(0, hasType(varDecl())))
6063  matches f(int x) {}
6064with hasParameter(...)
6065  matching int x
6066
6067For ObjectiveC, given
6068  @interface I - (void) f:(int) y; @end
6069
6070the matcher objcMethodDecl(hasParameter(0, hasName("y")))
6071matches the declaration of method f with hasParameter
6072matching y.
6073</pre></td></tr>
6074
6075
6076<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1OpaqueValueExpr.html">OpaqueValueExpr</a>&gt;</td><td class="name" onclick="toggle('hasSourceExpression1')"><a name="hasSourceExpression1Anchor">hasSourceExpression</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6077<tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre>Matches if the cast's source expression
6078or opaque value's source expression matches the given matcher.
6079
6080Example 1: matches "a string"
6081(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
6082class URL { URL(string); };
6083URL url = "a string";
6084
6085Example 2: matches 'b' (matcher =
6086opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
6087int a = b ?: 1;
6088</pre></td></tr>
6089
6090
6091<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1OverloadExpr.html">OverloadExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyDeclaration0')"><a name="hasAnyDeclaration0Anchor">hasAnyDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6092<tr><td colspan="4" class="doc" id="hasAnyDeclaration0"><pre>Matches an OverloadExpr if any of the declarations in the set of
6093overloads matches the given matcher.
6094
6095Given
6096  template &lt;typename T&gt; void foo(T);
6097  template &lt;typename T&gt; void bar(T);
6098  template &lt;typename T&gt; void baz(T t) {
6099    foo(t);
6100    bar(t);
6101  }
6102unresolvedLookupExpr(hasAnyDeclaration(
6103    functionTemplateDecl(hasName("foo"))))
6104  matches foo in foo(t); but not bar in bar(t);
6105</pre></td></tr>
6106
6107
6108<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>
6109<tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
6110
6111Given
6112  int (*ptr_to_array)[4];
6113  int (*ptr_to_func)(int);
6114
6115varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
6116ptr_to_func but not ptr_to_array.
6117
6118Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
6119</pre></td></tr>
6120
6121
6122<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>
6123<tr><td colspan="4" class="doc" id="pointeeLoc2"><pre>Narrows PointerType (and similar) matchers to those where the
6124pointee matches a given matcher.
6125
6126Given
6127  int *a;
6128  int const *b;
6129  float const *f;
6130pointerType(pointee(isConstQualified(), isInteger()))
6131  matches "int const *b"
6132
6133Usable 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;,
6134  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;
6135</pre></td></tr>
6136
6137
6138<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>
6139<tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
6140pointee matches a given matcher.
6141
6142Given
6143  int *a;
6144  int const *b;
6145  float const *f;
6146pointerType(pointee(isConstQualified(), isInteger()))
6147  matches "int const *b"
6148
6149Usable 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;,
6150  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;
6151</pre></td></tr>
6152
6153
6154<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>
6155<tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
6156
6157Given:
6158  typedef int &amp;int_ref;
6159  int a;
6160  int_ref b = a;
6161
6162varDecl(hasType(qualType(referenceType()))))) will not match the
6163declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
6164</pre></td></tr>
6165
6166
6167<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6168<tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
6169matches the given matcher.
6170
6171The associated declaration is:
6172- for type nodes, the declaration of the underlying type
6173- for CallExpr, the declaration of the callee
6174- for MemberExpr, the declaration of the referenced member
6175- for CXXConstructExpr, the declaration of the constructor
6176- for CXXNewExpr, the declaration of the operator new
6177- for ObjCIvarExpr, the declaration of the ivar
6178
6179For type nodes, hasDeclaration will generally match the declaration of the
6180sugared type. Given
6181  class X {};
6182  typedef X Y;
6183  Y y;
6184in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6185typedefDecl. A common use case is to match the underlying, desugared type.
6186This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6187  varDecl(hasType(hasUnqualifiedDesugaredType(
6188      recordType(hasDeclaration(decl())))))
6189In this matcher, the decl will match the CXXRecordDecl of class X.
6190
6191Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6192  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6193  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6194  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6195  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6196  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6197  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6198</pre></td></tr>
6199
6200
6201<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('ignoringParens0')"><a name="ignoringParens0Anchor">ignoringParens</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6202<tr><td colspan="4" class="doc" id="ignoringParens0"><pre>Matches types that match InnerMatcher after any parens are stripped.
6203
6204Given
6205  void (*fp)(void);
6206The matcher
6207  varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
6208would match the declaration for fp.
6209</pre></td></tr>
6210
6211
6212<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>
6213<tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
6214</pre></td></tr>
6215
6216
6217<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>
6218<tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
6219matches the specified matcher.
6220
6221Example matches y-&gt;x()
6222  (matcher = cxxMemberCallExpr(on(hasType(pointsTo
6223     cxxRecordDecl(hasName("Y")))))))
6224  class Y { public: void x(); };
6225  void z() { Y *y; y-&gt;x(); }
6226</pre></td></tr>
6227
6228
6229<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>
6230<tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
6231</pre></td></tr>
6232
6233
6234<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>
6235<tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
6236type matches the specified matcher.
6237
6238Example matches X &amp;x and const X &amp;y
6239    (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
6240  class X {
6241    void a(X b) {
6242      X &amp;x = b;
6243      const X &amp;y = b;
6244    }
6245  };
6246</pre></td></tr>
6247
6248
6249<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6250<tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
6251matches the given matcher.
6252
6253The associated declaration is:
6254- for type nodes, the declaration of the underlying type
6255- for CallExpr, the declaration of the callee
6256- for MemberExpr, the declaration of the referenced member
6257- for CXXConstructExpr, the declaration of the constructor
6258- for CXXNewExpr, the declaration of the operator new
6259- for ObjCIvarExpr, the declaration of the ivar
6260
6261For type nodes, hasDeclaration will generally match the declaration of the
6262sugared type. Given
6263  class X {};
6264  typedef X Y;
6265  Y y;
6266in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6267typedefDecl. A common use case is to match the underlying, desugared type.
6268This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6269  varDecl(hasType(hasUnqualifiedDesugaredType(
6270      recordType(hasDeclaration(decl())))))
6271In this matcher, the decl will match the CXXRecordDecl of class X.
6272
6273Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6274  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6275  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6276  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6277  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6278  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6279  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6280</pre></td></tr>
6281
6282
6283<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>
6284<tr><td colspan="4" class="doc" id="pointeeLoc3"><pre>Narrows PointerType (and similar) matchers to those where the
6285pointee matches a given matcher.
6286
6287Given
6288  int *a;
6289  int const *b;
6290  float const *f;
6291pointerType(pointee(isConstQualified(), isInteger()))
6292  matches "int const *b"
6293
6294Usable 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;,
6295  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;
6296</pre></td></tr>
6297
6298
6299<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>
6300<tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
6301pointee matches a given matcher.
6302
6303Given
6304  int *a;
6305  int const *b;
6306  float const *f;
6307pointerType(pointee(isConstQualified(), isInteger()))
6308  matches "int const *b"
6309
6310Usable 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;,
6311  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;
6312</pre></td></tr>
6313
6314
6315<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ReturnStmt.html">ReturnStmt</a>&gt;</td><td class="name" onclick="toggle('hasReturnValue0')"><a name="hasReturnValue0Anchor">hasReturnValue</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6316<tr><td colspan="4" class="doc" id="hasReturnValue0"><pre>Matches the return value expression of a return statement
6317
6318Given
6319  return a + b;
6320hasReturnValue(binaryOperator())
6321  matches 'return a + b'
6322with binaryOperator()
6323  matching 'a + b'
6324</pre></td></tr>
6325
6326
6327<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1StmtExpr.html">StmtExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnySubstatement1')"><a name="hasAnySubstatement1Anchor">hasAnySubstatement</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
6328<tr><td colspan="4" class="doc" id="hasAnySubstatement1"><pre>Matches compound statements where at least one substatement matches
6329a given matcher. Also matches StmtExprs that have CompoundStmt as children.
6330
6331Given
6332  { {}; 1+2; }
6333hasAnySubstatement(compoundStmt())
6334  matches '{ {}; 1+2; }'
6335with compoundStmt()
6336  matching '{}'
6337</pre></td></tr>
6338
6339
6340<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;  InnerMatcher</td></tr>
6341<tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
6342alignof.
6343</pre></td></tr>
6344
6345
6346<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('forFunction0')"><a name="forFunction0Anchor">forFunction</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt; InnerMatcher</td></tr>
6347<tr><td colspan="4" class="doc" id="forFunction0"><pre>Matches declaration of the function the statement belongs to
6348
6349Given:
6350F&amp; operator=(const F&amp; o) {
6351  std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
6352  return *this;
6353}
6354returnStmt(forFunction(hasName("operator=")))
6355  matches 'return *this'
6356  but does match 'return &gt; 0'
6357</pre></td></tr>
6358
6359
6360<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;  InnerMatcher</td></tr>
6361<tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
6362sizeof.
6363</pre></td></tr>
6364
6365
6366<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1SubstTemplateTypeParmType.html">SubstTemplateTypeParmType</a>&gt;</td><td class="name" onclick="toggle('hasReplacementType0')"><a name="hasReplacementType0Anchor">hasReplacementType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
6367<tr><td colspan="4" class="doc" id="hasReplacementType0"><pre>Matches template type parameter substitutions that have a replacement
6368type that matches the provided matcher.
6369
6370Given
6371  template &lt;typename T&gt;
6372  double F(T t);
6373  int i;
6374  double j = F(i);
6375
6376substTemplateTypeParmType(hasReplacementType(type())) matches int
6377</pre></td></tr>
6378
6379
6380<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>
6381<tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
6382statement. This matcher may produce multiple matches.
6383
6384Given
6385  switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
6386switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
6387  matches four times, with "c" binding each of "case 1:", "case 2:",
6388"case 3:" and "case 4:", and "s" respectively binding "switch (1)",
6389"switch (1)", "switch (2)" and "switch (2)".
6390</pre></td></tr>
6391
6392
6393<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1SwitchStmt.html">SwitchStmt</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>
6394<tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
6395switch statement or conditional operator.
6396
6397Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6398  if (true) {}
6399</pre></td></tr>
6400
6401
6402<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6403<tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
6404matches the given matcher.
6405
6406The associated declaration is:
6407- for type nodes, the declaration of the underlying type
6408- for CallExpr, the declaration of the callee
6409- for MemberExpr, the declaration of the referenced member
6410- for CXXConstructExpr, the declaration of the constructor
6411- for CXXNewExpr, the declaration of the operator new
6412- for ObjCIvarExpr, the declaration of the ivar
6413
6414For type nodes, hasDeclaration will generally match the declaration of the
6415sugared type. Given
6416  class X {};
6417  typedef X Y;
6418  Y y;
6419in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6420typedefDecl. A common use case is to match the underlying, desugared type.
6421This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6422  varDecl(hasType(hasUnqualifiedDesugaredType(
6423      recordType(hasDeclaration(decl())))))
6424In this matcher, the decl will match the CXXRecordDecl of class X.
6425
6426Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6427  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6428  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6429  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6430  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6431  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6432  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6433</pre></td></tr>
6434
6435
6436<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>
6437<tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
6438
6439Given
6440  struct B { int next; };
6441  template&lt;int(B::*next_ptr)&gt; struct A {};
6442  A&lt;&amp;B::next&gt; a;
6443templateSpecializationType(hasAnyTemplateArgument(
6444  isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
6445  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
6446    B::next
6447</pre></td></tr>
6448
6449
6450<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>
6451<tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
6452declaration.
6453
6454Given
6455  struct B { int next; };
6456  template&lt;int(B::*next_ptr)&gt; struct A {};
6457  A&lt;&amp;B::next&gt; a;
6458classTemplateSpecializationDecl(hasAnyTemplateArgument(
6459    refersToDeclaration(fieldDecl(hasName("next")))))
6460  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
6461    B::next
6462</pre></td></tr>
6463
6464
6465<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>
6466<tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that referes to an integral type.
6467
6468Given
6469  template&lt;int T&gt; struct C {};
6470  C&lt;42&gt; c;
6471classTemplateSpecializationDecl(
6472  hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
6473  matches the implicit instantiation of C in C&lt;42&gt;.
6474</pre></td></tr>
6475
6476
6477<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;</td><td class="name" onclick="toggle('refersToTemplate0')"><a name="refersToTemplate0Anchor">refersToTemplate</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateName.html">TemplateName</a>&gt; InnerMatcher</td></tr>
6478<tr><td colspan="4" class="doc" id="refersToTemplate0"><pre>Matches a TemplateArgument that refers to a certain template.
6479
6480Given
6481  template&lt;template &lt;typename&gt; class S&gt; class X {};
6482  template&lt;typename T&gt; class Y {};"
6483  X&lt;Y&gt; xi;
6484classTemplateSpecializationDecl(hasAnyTemplateArgument(
6485    refersToTemplate(templateName())))
6486  matches the specialization X&lt;Y&gt;
6487</pre></td></tr>
6488
6489
6490<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>
6491<tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
6492
6493Given
6494  struct X {};
6495  template&lt;typename T&gt; struct A {};
6496  A&lt;X&gt; a;
6497classTemplateSpecializationDecl(hasAnyTemplateArgument(
6498    refersToType(class(hasName("X")))))
6499  matches the specialization A&lt;X&gt;
6500</pre></td></tr>
6501
6502
6503<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>
6504<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6505functionDecl that have at least one TemplateArgument matching the given
6506InnerMatcher.
6507
6508Given
6509  template&lt;typename T&gt; class A {};
6510  template&lt;&gt; class A&lt;double&gt; {};
6511  A&lt;int&gt; a;
6512
6513  template&lt;typename T&gt; f() {};
6514  void func() { f&lt;int&gt;(); };
6515
6516classTemplateSpecializationDecl(hasAnyTemplateArgument(
6517    refersToType(asString("int"))))
6518  matches the specialization A&lt;int&gt;
6519
6520functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
6521  matches the specialization f&lt;int&gt;
6522</pre></td></tr>
6523
6524
6525<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6526<tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
6527matches the given matcher.
6528
6529The associated declaration is:
6530- for type nodes, the declaration of the underlying type
6531- for CallExpr, the declaration of the callee
6532- for MemberExpr, the declaration of the referenced member
6533- for CXXConstructExpr, the declaration of the constructor
6534- for CXXNewExpr, the declaration of the operator new
6535- for ObjCIvarExpr, the declaration of the ivar
6536
6537For type nodes, hasDeclaration will generally match the declaration of the
6538sugared type. Given
6539  class X {};
6540  typedef X Y;
6541  Y y;
6542in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6543typedefDecl. A common use case is to match the underlying, desugared type.
6544This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6545  varDecl(hasType(hasUnqualifiedDesugaredType(
6546      recordType(hasDeclaration(decl())))))
6547In this matcher, the decl will match the CXXRecordDecl of class X.
6548
6549Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6550  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6551  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6552  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6553  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6554  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6555  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6556</pre></td></tr>
6557
6558
6559<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>
6560<tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6561functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
6562
6563Given
6564  template&lt;typename T, typename U&gt; class A {};
6565  A&lt;bool, int&gt; b;
6566  A&lt;int, bool&gt; c;
6567
6568  template&lt;typename T&gt; void f() {}
6569  void func() { f&lt;int&gt;(); };
6570classTemplateSpecializationDecl(hasTemplateArgument(
6571    1, refersToType(asString("int"))))
6572  matches the specialization A&lt;bool, int&gt;
6573
6574functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
6575  matches the specialization f&lt;int&gt;
6576</pre></td></tr>
6577
6578
6579<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6580<tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
6581matches the given matcher.
6582
6583The associated declaration is:
6584- for type nodes, the declaration of the underlying type
6585- for CallExpr, the declaration of the callee
6586- for MemberExpr, the declaration of the referenced member
6587- for CXXConstructExpr, the declaration of the constructor
6588- for CXXNewExpr, the declaration of the operator new
6589- for ObjCIvarExpr, the declaration of the ivar
6590
6591For type nodes, hasDeclaration will generally match the declaration of the
6592sugared type. Given
6593  class X {};
6594  typedef X Y;
6595  Y y;
6596in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6597typedefDecl. A common use case is to match the underlying, desugared type.
6598This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6599  varDecl(hasType(hasUnqualifiedDesugaredType(
6600      recordType(hasDeclaration(decl())))))
6601In this matcher, the decl will match the CXXRecordDecl of class X.
6602
6603Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6604  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6605  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6606  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6607  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6608  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6609  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6610</pre></td></tr>
6611
6612
6613<tr><td>Matcher&lt;T&gt;</td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>const Matcher&lt;T&gt;  Matcher</td></tr>
6614<tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
6615
6616Generates results for each match.
6617
6618For example, in:
6619  class A { class B {}; class C {}; };
6620The matcher:
6621  cxxRecordDecl(hasName("::A"),
6622                findAll(cxxRecordDecl(isDefinition()).bind("m")))
6623will generate results for A, B and C.
6624
6625Usable as: Any Matcher
6626</pre></td></tr>
6627
6628
6629<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</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_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6630<tr><td colspan="4" class="doc" id="hasType2"><pre>Matches if the expression's or declaration's type matches a type
6631matcher.
6632
6633Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6634            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6635            and U (matcher = typedefDecl(hasType(asString("int")))
6636            and friend class X (matcher = friendDecl(hasType("X"))
6637 class X {};
6638 void y(X &amp;x) { x; X z; }
6639 typedef int U;
6640 class Y { friend class X; };
6641</pre></td></tr>
6642
6643
6644<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6645<tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
6646matches the given matcher.
6647
6648The associated declaration is:
6649- for type nodes, the declaration of the underlying type
6650- for CallExpr, the declaration of the callee
6651- for MemberExpr, the declaration of the referenced member
6652- for CXXConstructExpr, the declaration of the constructor
6653- for CXXNewExpr, the declaration of the operator new
6654- for ObjCIvarExpr, the declaration of the ivar
6655
6656For type nodes, hasDeclaration will generally match the declaration of the
6657sugared type. Given
6658  class X {};
6659  typedef X Y;
6660  Y y;
6661in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6662typedefDecl. A common use case is to match the underlying, desugared type.
6663This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6664  varDecl(hasType(hasUnqualifiedDesugaredType(
6665      recordType(hasDeclaration(decl())))))
6666In this matcher, the decl will match the CXXRecordDecl of class X.
6667
6668Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6669  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6670  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6671  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6672  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6673  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6674  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6675</pre></td></tr>
6676
6677
6678<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('hasUnqualifiedDesugaredType0')"><a name="hasUnqualifiedDesugaredType0Anchor">hasUnqualifiedDesugaredType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt; InnerMatcher</td></tr>
6679<tr><td colspan="4" class="doc" id="hasUnqualifiedDesugaredType0"><pre>Matches if the matched type matches the unqualified desugared
6680type of the matched node.
6681
6682For example, in:
6683  class A {};
6684  using B = A;
6685The matcher type(hasUnqualifiedDesugaredType(recordType())) matches
6686both B and A.
6687</pre></td></tr>
6688
6689
6690<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>
6691<tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
6692
6693Given
6694  int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
6695unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
6696  matches sizeof(a) and alignof(c)
6697</pre></td></tr>
6698
6699
6700<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>
6701<tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
6702
6703Example matches true (matcher = hasUnaryOperand(
6704                                  cxxBoolLiteral(equals(true))))
6705  !true
6706</pre></td></tr>
6707
6708
6709<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedMemberExpr.html">UnresolvedMemberExpr</a>&gt;</td><td class="name" onclick="toggle('hasObjectExpression1')"><a name="hasObjectExpression1Anchor">hasObjectExpression</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6710<tr><td colspan="4" class="doc" id="hasObjectExpression1"><pre>Matches a member expression where the object expression is
6711matched by a given matcher.
6712
6713Given
6714  struct X { int m; };
6715  void f(X x) { x.m; m; }
6716memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
6717  matches "x.m" and "m"
6718with hasObjectExpression(...)
6719  matching "x" and the implicit object expression of "m" which has type X*.
6720</pre></td></tr>
6721
6722
6723<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>const Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6724<tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
6725matches the given matcher.
6726
6727The associated declaration is:
6728- for type nodes, the declaration of the underlying type
6729- for CallExpr, the declaration of the callee
6730- for MemberExpr, the declaration of the referenced member
6731- for CXXConstructExpr, the declaration of the constructor
6732- for CXXNewExpr, the declaration of the operator new
6733- for ObjCIvarExpr, the declaration of the ivar
6734
6735For type nodes, hasDeclaration will generally match the declaration of the
6736sugared type. Given
6737  class X {};
6738  typedef X Y;
6739  Y y;
6740in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6741typedefDecl. A common use case is to match the underlying, desugared type.
6742This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6743  varDecl(hasType(hasUnqualifiedDesugaredType(
6744      recordType(hasDeclaration(decl())))))
6745In this matcher, the decl will match the CXXRecordDecl of class X.
6746
6747Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6748  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6749  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6750  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6751  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6752  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6753  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6754</pre></td></tr>
6755
6756
6757<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>
6758<tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
6759
6760Given
6761  namespace X { void b(); }
6762  using X::b;
6763usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
6764  matches using X::b </pre></td></tr>
6765
6766
6767<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>
6768<tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
6769matched by the given matcher.
6770
6771Given
6772  namespace X { int a; void b(); }
6773  using X::a;
6774  using X::b;
6775usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
6776  matches using X::b but not using X::a </pre></td></tr>
6777
6778
6779<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;</td><td class="name" onclick="toggle('hasType6')"><a name="hasType6Anchor">hasType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6780<tr><td colspan="4" class="doc" id="hasType6"><pre>Overloaded to match the declaration of the expression's or value
6781declaration's type.
6782
6783In case of a value declaration (for example a variable declaration),
6784this resolves one layer of indirection. For example, in the value
6785declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
6786X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
6787declaration of x.
6788
6789Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6790            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6791            and friend class X (matcher = friendDecl(hasType("X"))
6792 class X {};
6793 void y(X &amp;x) { x; X z; }
6794 class Y { friend class X; };
6795
6796Usable 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;
6797</pre></td></tr>
6798
6799
6800<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_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6801<tr><td colspan="4" class="doc" id="hasType3"><pre>Matches if the expression's or declaration's type matches a type
6802matcher.
6803
6804Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6805            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6806            and U (matcher = typedefDecl(hasType(asString("int")))
6807            and friend class X (matcher = friendDecl(hasType("X"))
6808 class X {};
6809 void y(X &amp;x) { x; X z; }
6810 typedef int U;
6811 class Y { friend class X; };
6812</pre></td></tr>
6813
6814
6815<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>
6816<tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
6817that matches the given matcher.
6818
6819Example matches x (matcher = varDecl(hasInitializer(callExpr())))
6820  bool y() { return true; }
6821  bool x = y();
6822</pre></td></tr>
6823
6824
6825<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>
6826<tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
6827expression.
6828
6829Given
6830  void f(int b) {
6831    int a[b];
6832  }
6833variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
6834  varDecl(hasName("b")))))))
6835  matches "int a[b]"
6836</pre></td></tr>
6837
6838
6839<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>
6840<tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', 'do while' statement or a function
6841definition that has a given body.
6842
6843Given
6844  for (;;) {}
6845hasBody(compoundStmt())
6846  matches 'for (;;) {}'
6847with compoundStmt()
6848  matching '{}'
6849</pre></td></tr>
6850
6851
6852<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>
6853<tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
6854switch statement or conditional operator.
6855
6856Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6857  if (true) {}
6858</pre></td></tr>
6859
6860
6861<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>
6862<tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
6863NestedNameSpecifier-matcher matches.
6864</pre></td></tr>
6865
6866
6867<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>
6868<tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
6869QualType-matcher matches.
6870</pre></td></tr>
6871
6872<!--END_TRAVERSAL_MATCHERS -->
6873</table>
6874
6875</div>
6876</body>
6877</html>
6878
6879
6880