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_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;</td><td class="name" onclick="toggle('isArrow2')"><a name="isArrow2Anchor">isArrow</a></td><td></td></tr>
2239<tr><td colspan="4" class="doc" id="isArrow2"><pre>Matches member expressions that are called with '-&gt;' as opposed
2240to '.'.
2241
2242Member calls on the implicit this pointer match as called with '-&gt;'.
2243
2244Given
2245  class Y {
2246    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
2247    template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
2248    int a;
2249    static int b;
2250  };
2251  template &lt;class T&gt;
2252  class Z {
2253    void x() { this-&gt;m; }
2254  };
2255memberExpr(isArrow())
2256  matches this-&gt;x, x, y.x, a, this-&gt;b
2257cxxDependentScopeMemberExpr(isArrow())
2258  matches this-&gt;m
2259unresolvedMemberExpr(isArrow())
2260  matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
2261</pre></td></tr>
2262
2263
2264<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>
2265<tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
2266
2267Given
2268struct A {
2269  void foo() const;
2270  void bar();
2271};
2272
2273cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
2274</pre></td></tr>
2275
2276
2277<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>
2278<tr><td colspan="4" class="doc" id="isCopyAssignmentOperator0"><pre>Matches if the given method declaration declares a copy assignment
2279operator.
2280
2281Given
2282struct A {
2283  A &amp;operator=(const A &amp;);
2284  A &amp;operator=(A &amp;&amp;);
2285};
2286
2287cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
2288the second one.
2289</pre></td></tr>
2290
2291
2292<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>
2293<tr><td colspan="4" class="doc" id="isFinal1"><pre>Matches if the given method or class declaration is final.
2294
2295Given:
2296  class A final {};
2297
2298  struct B {
2299    virtual void f();
2300  };
2301
2302  struct C : B {
2303    void f() final;
2304  };
2305matches A and C::f, but not B, C, or B::f
2306</pre></td></tr>
2307
2308
2309<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>
2310<tr><td colspan="4" class="doc" id="isMoveAssignmentOperator0"><pre>Matches if the given method declaration declares a move assignment
2311operator.
2312
2313Given
2314struct A {
2315  A &amp;operator=(const A &amp;);
2316  A &amp;operator=(A &amp;&amp;);
2317};
2318
2319cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
2320the first one.
2321</pre></td></tr>
2322
2323
2324<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>
2325<tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
2326
2327Given
2328  class A {
2329   public:
2330    virtual void x();
2331  };
2332  class B : public A {
2333   public:
2334    virtual void x();
2335  };
2336  matches B::x
2337</pre></td></tr>
2338
2339
2340<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>
2341<tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure.
2342
2343Given
2344  class A {
2345   public:
2346    virtual void x() = 0;
2347  };
2348  matches A::x
2349</pre></td></tr>
2350
2351
2352<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>
2353<tr><td colspan="4" class="doc" id="isUserProvided0"><pre>Matches method declarations that are user-provided.
2354
2355Given
2356  struct S {
2357    S(); #1
2358    S(const S &amp;) = default; #2
2359    S(S &amp;&amp;) = delete; #3
2360  };
2361cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3.
2362</pre></td></tr>
2363
2364
2365<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>
2366<tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches if the given method declaration is virtual.
2367
2368Given
2369  class A {
2370   public:
2371    virtual void x();
2372  };
2373  matches A::x
2374</pre></td></tr>
2375
2376
2377<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>
2378<tr><td colspan="4" class="doc" id="isVirtualAsWritten0"><pre>Matches if the given method declaration has an explicit "virtual".
2379
2380Given
2381  class A {
2382   public:
2383    virtual void x();
2384  };
2385  class B : public A {
2386   public:
2387    void x();
2388  };
2389  matches A::x but not B::x
2390</pre></td></tr>
2391
2392
2393<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>
2394<tr><td colspan="4" class="doc" id="isArray0"><pre>Matches array new expressions.
2395
2396Given:
2397  MyClass *p1 = new MyClass[10];
2398cxxNewExpr(isArray())
2399  matches the expression 'new MyClass[10]'.
2400</pre></td></tr>
2401
2402
2403<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>
2404<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
2405
2406Matches overloaded operator names specified in strings without the
2407"operator" prefix: e.g. "&lt;&lt;".
2408
2409Given:
2410  class A { int operator*(); };
2411  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
2412  A a;
2413  a &lt;&lt; a;   &lt;-- This matches
2414
2415cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
2416specified line and
2417cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
2418matches the declaration of A.
2419
2420Usable 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;
2421</pre></td></tr>
2422
2423
2424<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>
2425<tr><td colspan="4" class="doc" id="isAssignmentOperator1"><pre>Matches all kinds of assignment operators.
2426
2427Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2428  if (a == b)
2429    a += b;
2430
2431Example 2: matches s1 = s2
2432           (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
2433  struct S { S&amp; operator=(const S&amp;); };
2434  void x() { S s1, s2; s1 = s2; })
2435</pre></td></tr>
2436
2437
2438<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>
2439<tr><td colspan="4" class="doc" id="hasDefinition0"><pre>Matches a class declaration that is defined.
2440
2441Example matches x (matcher = cxxRecordDecl(hasDefinition()))
2442class x {};
2443class y;
2444</pre></td></tr>
2445
2446
2447<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>
2448<tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
2449</pre></td></tr>
2450
2451
2452<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>
2453<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
2454static member variable template instantiations.
2455
2456Given
2457  template&lt;typename T&gt; void A(T t) { }
2458  template&lt;&gt; void A(int N) { }
2459functionDecl(isExplicitTemplateSpecialization())
2460  matches the specialization A&lt;int&gt;().
2461
2462Usable 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;
2463</pre></td></tr>
2464
2465
2466<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>
2467<tr><td colspan="4" class="doc" id="isFinal0"><pre>Matches if the given method or class declaration is final.
2468
2469Given:
2470  class A final {};
2471
2472  struct B {
2473    virtual void f();
2474  };
2475
2476  struct C : B {
2477    void f() final;
2478  };
2479matches A and C::f, but not B, C, or B::f
2480</pre></td></tr>
2481
2482
2483<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>
2484<tr><td colspan="4" class="doc" id="isLambda0"><pre>Matches the generated class of lambda expressions.
2485
2486Given:
2487  auto x = []{};
2488
2489cxxRecordDecl(isLambda()) matches the implicit class declaration of
2490decltype(x)
2491</pre></td></tr>
2492
2493
2494<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>
2495<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Overloaded method as shortcut for
2496isSameOrDerivedFrom(hasName(...)).
2497</pre></td></tr>
2498
2499
2500<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>
2501<tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
2502member variable template instantiations.
2503
2504Given
2505  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
2506or
2507  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
2508or
2509  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
2510cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2511  matches the template instantiation of X&lt;A&gt;.
2512
2513But given
2514  template &lt;typename T&gt;  class X {}; class A {};
2515  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
2516cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2517  does not match, as X&lt;A&gt; is an explicit template specialization.
2518
2519Usable 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;
2520</pre></td></tr>
2521
2522
2523<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>
2524<tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
2525a specific number of arguments (including absent default arguments).
2526
2527Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2528  void f(int x, int y);
2529  f(0, 0);
2530</pre></td></tr>
2531
2532
2533<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>
2534<tr><td colspan="4" class="doc" id="hasCastKind0"><pre>Matches casts that has a given cast kind.
2535
2536Example: matches the implicit cast around 0
2537(matcher = castExpr(hasCastKind(CK_NullToPointer)))
2538  int *p = 0;
2539</pre></td></tr>
2540
2541
2542<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>
2543<tr><td colspan="4" class="doc" id="equals4"><pre></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('equals3')"><a name="equals3Anchor">equals</a></td><td>const ValueT  Value</td></tr>
2547<tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value of type ValueT.
2548
2549Given
2550  f('false, 3.14, 42);
2551characterLiteral(equals(0))
2552  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2553  match false
2554floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2555  match 3.14
2556integerLiteral(equals(42))
2557  matches 42
2558
2559Note that you cannot directly match a negative numeric literal because the
2560minus sign is not part of the literal: It is a unary operator whose operand
2561is the positive numeric literal. Instead, you must use a unaryOperator()
2562matcher to match the minus sign:
2563
2564unaryOperator(hasOperatorName("-"),
2565              hasUnaryOperand(integerLiteral(equals(13))))
2566
2567Usable 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;,
2568           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;
2569</pre></td></tr>
2570
2571
2572<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>
2573<tr><td colspan="4" class="doc" id="equals10"><pre></pre></td></tr>
2574
2575
2576<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>
2577<tr><td colspan="4" class="doc" id="equals7"><pre></pre></td></tr>
2578
2579
2580<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>
2581<tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N.
2582
2583Given
2584  template&lt;typename T&gt; struct C {};
2585  C&lt;int&gt; c;
2586classTemplateSpecializationDecl(templateArgumentCountIs(1))
2587  matches C&lt;int&gt;.
2588</pre></td></tr>
2589
2590
2591<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>
2592<tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
2593child statements.
2594
2595Example: Given
2596  { for (;;) {} }
2597compoundStmt(statementCountIs(0)))
2598  matches '{}'
2599  but does not match the outer compound statement.
2600</pre></td></tr>
2601
2602
2603<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>
2604<tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches nodes that have the specified size.
2605
2606Given
2607  int a[42];
2608  int b[2 * 21];
2609  int c[41], d[43];
2610  char *s = "abcd";
2611  wchar_t *ws = L"abcd";
2612  char *w = "a";
2613constantArrayType(hasSize(42))
2614  matches "int a[42]" and "int b[2 * 21]"
2615stringLiteral(hasSize(4))
2616  matches "abcd", L"abcd"
2617</pre></td></tr>
2618
2619
2620<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>
2621<tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
2622declarations.
2623
2624Example: Given
2625  int a, b;
2626  int c;
2627  int d = 2, e;
2628declCountIs(2)
2629  matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
2630</pre></td></tr>
2631
2632
2633<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>
2634<tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
2635
2636Matches a node if it equals the node previously bound to ID.
2637
2638Given
2639  class X { int a; int b; };
2640cxxRecordDecl(
2641    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
2642    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
2643  matches the class X, as a and b have the same type.
2644
2645Note that when multiple matches are involved via forEach* matchers,
2646equalsBoundNodes acts as a filter.
2647For example:
2648compoundStmt(
2649    forEachDescendant(varDecl().bind("d")),
2650    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
2651will trigger a match for each combination of variable declaration
2652and reference to that variable declaration within a compound statement.
2653</pre></td></tr>
2654
2655
2656<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>
2657<tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node.
2658
2659Decl has pointer identity in the AST.
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('hasAttr0')"><a name="hasAttr0Anchor">hasAttr</a></td><td>attr::Kind AttrKind</td></tr>
2664<tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute.
2665
2666Given
2667  __attribute__((device)) void f() { ... }
2668decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
2669f. If the matcher is use from clang-query, attr::Kind parameter should be
2670passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
2671</pre></td></tr>
2672
2673
2674<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>
2675<tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is
2676partially matching a given regex.
2677
2678Example matches Y but not X
2679    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
2680  #include "ASTMatcher.h"
2681  class X {};
2682ASTMatcher.h:
2683  class Y {};
2684
2685Usable 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;
2686</pre></td></tr>
2687
2688
2689<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>
2690<tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file.
2691
2692Example matches X but not Y
2693  (matcher = cxxRecordDecl(isExpansionInMainFile())
2694  #include &lt;Y.h&gt;
2695  class X {};
2696Y.h:
2697  class Y {};
2698
2699Usable 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;
2700</pre></td></tr>
2701
2702
2703<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>
2704<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files.
2705
2706Example matches Y but not X
2707    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
2708  #include &lt;SystemHeader.h&gt;
2709  class X {};
2710SystemHeader.h:
2711  class Y {};
2712
2713Usable 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;
2714</pre></td></tr>
2715
2716
2717<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>
2718<tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a declaration that has been implicitly added
2719by the compiler (eg. implicit defaultcopy constructors).
2720</pre></td></tr>
2721
2722
2723<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>
2724<tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations.
2725
2726Given
2727  class C {
2728  public:    int a;
2729  protected: int b;
2730  private:   int c;
2731  };
2732fieldDecl(isPrivate())
2733  matches 'int c;'
2734</pre></td></tr>
2735
2736
2737<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>
2738<tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations.
2739
2740Given
2741  class C {
2742  public:    int a;
2743  protected: int b;
2744  private:   int c;
2745  };
2746fieldDecl(isProtected())
2747  matches 'int b;'
2748</pre></td></tr>
2749
2750
2751<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>
2752<tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations.
2753
2754Given
2755  class C {
2756  public:    int a;
2757  protected: int b;
2758  private:   int c;
2759  };
2760fieldDecl(isPublic())
2761  matches 'int a;'
2762</pre></td></tr>
2763
2764
2765<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>
2766<tr><td colspan="4" class="doc" id="designatorCountIs0"><pre>Matches designated initializer expressions that contain
2767a specific number of designators.
2768
2769Example: Given
2770  point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
2771  point ptarray2[10] = { [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 };
2772designatorCountIs(2)
2773  matches '{ [2].y = 1.0, [0].x = 1.0 }',
2774  but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'.
2775</pre></td></tr>
2776
2777
2778<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>
2779<tr><td colspan="4" class="doc" id="isScoped0"><pre>Matches C++11 scoped enum declaration.
2780
2781Example matches Y (matcher = enumDecl(isScoped()))
2782enum X {};
2783enum class Y {};
2784</pre></td></tr>
2785
2786
2787<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('isInstantiationDependent0')"><a name="isInstantiationDependent0Anchor">isInstantiationDependent</a></td><td></td></tr>
2788<tr><td colspan="4" class="doc" id="isInstantiationDependent0"><pre>Matches expressions that are instantiation-dependent even if it is
2789neither type- nor value-dependent.
2790
2791In the following example, the expression sizeof(sizeof(T() + T()))
2792is instantiation-dependent (since it involves a template parameter T),
2793but is neither type- nor value-dependent, since the type of the inner
2794sizeof is known (std::size_t) and therefore the size of the outer
2795sizeof is known.
2796  template&lt;typename T&gt;
2797  void f(T x, T y) { sizeof(sizeof(T() + T()); }
2798expr(isInstantiationDependent()) matches sizeof(sizeof(T() + T())
2799</pre></td></tr>
2800
2801
2802<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('isTypeDependent0')"><a name="isTypeDependent0Anchor">isTypeDependent</a></td><td></td></tr>
2803<tr><td colspan="4" class="doc" id="isTypeDependent0"><pre>Matches expressions that are type-dependent because the template type
2804is not yet instantiated.
2805
2806For example, the expressions "x" and "x + y" are type-dependent in
2807the following code, but "y" is not type-dependent:
2808  template&lt;typename T&gt;
2809  void add(T x, int y) {
2810    x + y;
2811  }
2812expr(isTypeDependent()) matches x + y
2813</pre></td></tr>
2814
2815
2816<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('isValueDependent0')"><a name="isValueDependent0Anchor">isValueDependent</a></td><td></td></tr>
2817<tr><td colspan="4" class="doc" id="isValueDependent0"><pre>Matches expression that are value-dependent because they contain a
2818non-type template parameter.
2819
2820For example, the array bound of "Chars" in the following example is
2821value-dependent.
2822  template&lt;int Size&gt; int f() { return Size; }
2823expr(isValueDependent()) matches return Size
2824</pre></td></tr>
2825
2826
2827<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>
2828<tr><td colspan="4" class="doc" id="hasBitWidth0"><pre>Matches non-static data members that are bit-fields of the specified
2829bit width.
2830
2831Given
2832  class C {
2833    int a : 2;
2834    int b : 4;
2835    int c : 2;
2836  };
2837fieldDecl(hasBitWidth(2))
2838  matches 'int a;' and 'int c;' but not 'int b;'.
2839</pre></td></tr>
2840
2841
2842<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>
2843<tr><td colspan="4" class="doc" id="isBitField0"><pre>Matches non-static data members that are bit-fields.
2844
2845Given
2846  class C {
2847    int a : 2;
2848    int b;
2849  };
2850fieldDecl(isBitField())
2851  matches 'int a;' but not 'int b;'.
2852</pre></td></tr>
2853
2854
2855<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>
2856<tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value of type ValueT.
2857
2858Given
2859  f('false, 3.14, 42);
2860characterLiteral(equals(0))
2861  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2862  match false
2863floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2864  match 3.14
2865integerLiteral(equals(42))
2866  matches 42
2867
2868Note that you cannot directly match a negative numeric literal because the
2869minus sign is not part of the literal: It is a unary operator whose operand
2870is the positive numeric literal. Instead, you must use a unaryOperator()
2871matcher to match the minus sign:
2872
2873unaryOperator(hasOperatorName("-"),
2874              hasUnaryOperand(integerLiteral(equals(13))))
2875
2876Usable 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;,
2877           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;
2878</pre></td></tr>
2879
2880
2881<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>
2882<tr><td colspan="4" class="doc" id="equals12"><pre></pre></td></tr>
2883
2884
2885<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>
2886<tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec0"><pre>Matches functions that have a dynamic exception specification.
2887
2888Given:
2889  void f();
2890  void g() noexcept;
2891  void h() noexcept(true);
2892  void i() noexcept(false);
2893  void j() throw();
2894  void k() throw(int);
2895  void l() throw(...);
2896functionDecl(hasDynamicExceptionSpec()) and
2897  functionProtoType(hasDynamicExceptionSpec())
2898  match the declarations of j, k, and l, but not f, g, h, or i.
2899</pre></td></tr>
2900
2901
2902<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>
2903<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names.
2904
2905Matches overloaded operator names specified in strings without the
2906"operator" prefix: e.g. "&lt;&lt;".
2907
2908Given:
2909  class A { int operator*(); };
2910  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
2911  A a;
2912  a &lt;&lt; a;   &lt;-- This matches
2913
2914cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
2915specified line and
2916cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
2917matches the declaration of A.
2918
2919Usable 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;
2920</pre></td></tr>
2921
2922
2923<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>
2924<tr><td colspan="4" class="doc" id="hasTrailingReturn0"><pre>Matches a function declared with a trailing return type.
2925
2926Example matches Y (matcher = functionDecl(hasTrailingReturn()))
2927int X() {}
2928auto Y() -&gt; int {}
2929</pre></td></tr>
2930
2931
2932<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>
2933<tr><td colspan="4" class="doc" id="isConstexpr1"><pre>Matches constexpr variable and function declarations,
2934       and if constexpr.
2935
2936Given:
2937  constexpr int foo = 42;
2938  constexpr int bar();
2939  void baz() { if constexpr(1 &gt; 0) {} }
2940varDecl(isConstexpr())
2941  matches the declaration of foo.
2942functionDecl(isConstexpr())
2943  matches the declaration of bar.
2944ifStmt(isConstexpr())
2945  matches the if statement in baz.
2946</pre></td></tr>
2947
2948
2949<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>
2950<tr><td colspan="4" class="doc" id="isDefaulted0"><pre>Matches defaulted function declarations.
2951
2952Given:
2953  class A { ~A(); };
2954  class B { ~B() = default; };
2955functionDecl(isDefaulted())
2956  matches the declaration of ~B, but not ~A.
2957</pre></td></tr>
2958
2959
2960<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>
2961<tr><td colspan="4" class="doc" id="isDefinition3"><pre>Matches if a declaration has a body attached.
2962
2963Example matches A, va, fa
2964  class A {};
2965  class B;  Doesn't match, as it has no body.
2966  int va;
2967  extern int vb;  Doesn't match, as it doesn't define the variable.
2968  void fa() {}
2969  void fb();  Doesn't match, as it has no body.
2970  @interface X
2971  - (void)ma; Doesn't match, interface is declaration.
2972  @end
2973  @implementation X
2974  - (void)ma {}
2975  @end
2976
2977Usable 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;,
2978  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
2979</pre></td></tr>
2980
2981
2982<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>
2983<tr><td colspan="4" class="doc" id="isDeleted0"><pre>Matches deleted function declarations.
2984
2985Given:
2986  void Func();
2987  void DeletedFunc() = delete;
2988functionDecl(isDeleted())
2989  matches the declaration of DeletedFunc, but not Func.
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('isExplicitTemplateSpecialization0')"><a name="isExplicitTemplateSpecialization0Anchor">isExplicitTemplateSpecialization</a></td><td></td></tr>
2994<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or
2995static member variable template instantiations.
2996
2997Given
2998  template&lt;typename T&gt; void A(T t) { }
2999  template&lt;&gt; void A(int N) { }
3000functionDecl(isExplicitTemplateSpecialization())
3001  matches the specialization A&lt;int&gt;().
3002
3003Usable 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;
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('isExternC0')"><a name="isExternC0Anchor">isExternC</a></td><td></td></tr>
3008<tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function or variable declarations.
3009
3010Given:
3011  extern "C" void f() {}
3012  extern "C" { void g() {} }
3013  void h() {}
3014  extern "C" int x = 1;
3015  extern "C" int y = 2;
3016  int z = 3;
3017functionDecl(isExternC())
3018  matches the declaration of f and g, but not the declaration of h.
3019varDecl(isExternC())
3020  matches the declaration of x and y, but not the declaration of z.
3021</pre></td></tr>
3022
3023
3024<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>
3025<tr><td colspan="4" class="doc" id="isInline1"><pre>Matches function and namespace declarations that are marked with
3026the inline keyword.
3027
3028Given
3029  inline void f();
3030  void g();
3031  namespace n {
3032  inline namespace m {}
3033  }
3034functionDecl(isInline()) will match ::f().
3035namespaceDecl(isInline()) will match n::m.
3036</pre></td></tr>
3037
3038
3039<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>
3040<tr><td colspan="4" class="doc" id="isMain0"><pre>Determines whether the function is "main", which is the entry point
3041into an executable program.
3042</pre></td></tr>
3043
3044
3045<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>
3046<tr><td colspan="4" class="doc" id="isNoReturn0"><pre>Matches FunctionDecls that have a noreturn attribute.
3047
3048Given
3049  void nope();
3050  [[noreturn]] void a();
3051  __attribute__((noreturn)) void b();
3052  struct c { [[noreturn]] c(); };
3053functionDecl(isNoReturn())
3054  matches all of those except
3055  void nope();
3056</pre></td></tr>
3057
3058
3059<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>
3060<tr><td colspan="4" class="doc" id="isNoThrow0"><pre>Matches functions that have a non-throwing exception specification.
3061
3062Given:
3063  void f();
3064  void g() noexcept;
3065  void h() throw();
3066  void i() throw(int);
3067  void j() noexcept(false);
3068functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
3069  match the declarations of g, and h, but not f, i or j.
3070</pre></td></tr>
3071
3072
3073<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>
3074<tr><td colspan="4" class="doc" id="isStaticStorageClass0"><pre>Matches variablefunction declarations that have "static" storage
3075class specifier ("static" keyword) written in the source.
3076
3077Given:
3078  static void f() {}
3079  static int i = 0;
3080  extern int j;
3081  int k;
3082functionDecl(isStaticStorageClass())
3083  matches the function declaration f.
3084varDecl(isStaticStorageClass())
3085  matches the variable declaration i.
3086</pre></td></tr>
3087
3088
3089<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>
3090<tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static
3091member variable template instantiations.
3092
3093Given
3094  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
3095or
3096  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
3097or
3098  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
3099cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3100  matches the template instantiation of X&lt;A&gt;.
3101
3102But given
3103  template &lt;typename T&gt;  class X {}; class A {};
3104  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
3105cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3106  does not match, as X&lt;A&gt; is an explicit template specialization.
3107
3108Usable 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;
3109</pre></td></tr>
3110
3111
3112<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>
3113<tr><td colspan="4" class="doc" id="isVariadic0"><pre>Matches if a function declaration is variadic.
3114
3115Example matches f, but not g or h. The function i will not match, even when
3116compiled in C mode.
3117  void f(...);
3118  void g(int);
3119  template &lt;typename... Ts&gt; void h(Ts...);
3120  void i();
3121</pre></td></tr>
3122
3123
3124<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>
3125<tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
3126specific parameter count.
3127
3128Given
3129  void f(int i) {}
3130  void g(int i, int j) {}
3131  void h(int i, int j);
3132  void j(int i);
3133  void k(int x, int y, int z, ...);
3134functionDecl(parameterCountIs(2))
3135  matches g and h
3136functionProtoType(parameterCountIs(2))
3137  matches g and h
3138functionProtoType(parameterCountIs(3))
3139  matches k
3140</pre></td></tr>
3141
3142
3143<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>
3144<tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec1"><pre>Matches functions that have a dynamic exception specification.
3145
3146Given:
3147  void f();
3148  void g() noexcept;
3149  void h() noexcept(true);
3150  void i() noexcept(false);
3151  void j() throw();
3152  void k() throw(int);
3153  void l() throw(...);
3154functionDecl(hasDynamicExceptionSpec()) and
3155  functionProtoType(hasDynamicExceptionSpec())
3156  match the declarations of j, k, and l, but not f, g, h, or i.
3157</pre></td></tr>
3158
3159
3160<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>
3161<tr><td colspan="4" class="doc" id="isNoThrow1"><pre>Matches functions that have a non-throwing exception specification.
3162
3163Given:
3164  void f();
3165  void g() noexcept;
3166  void h() throw();
3167  void i() throw(int);
3168  void j() noexcept(false);
3169functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
3170  match the declarations of g, and h, but not f, i or j.
3171</pre></td></tr>
3172
3173
3174<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>
3175<tr><td colspan="4" class="doc" id="parameterCountIs1"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
3176specific parameter count.
3177
3178Given
3179  void f(int i) {}
3180  void g(int i, int j) {}
3181  void h(int i, int j);
3182  void j(int i);
3183  void k(int x, int y, int z, ...);
3184functionDecl(parameterCountIs(2))
3185  matches g and h
3186functionProtoType(parameterCountIs(2))
3187  matches g and h
3188functionProtoType(parameterCountIs(3))
3189  matches k
3190</pre></td></tr>
3191
3192
3193<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>
3194<tr><td colspan="4" class="doc" id="isConstexpr2"><pre>Matches constexpr variable and function declarations,
3195       and if constexpr.
3196
3197Given:
3198  constexpr int foo = 42;
3199  constexpr int bar();
3200  void baz() { if constexpr(1 &gt; 0) {} }
3201varDecl(isConstexpr())
3202  matches the declaration of foo.
3203functionDecl(isConstexpr())
3204  matches the declaration of bar.
3205ifStmt(isConstexpr())
3206  matches the if statement in baz.
3207</pre></td></tr>
3208
3209
3210<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>
3211<tr><td colspan="4" class="doc" id="equals6"><pre></pre></td></tr>
3212
3213
3214<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>
3215<tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value of type ValueT.
3216
3217Given
3218  f('false, 3.14, 42);
3219characterLiteral(equals(0))
3220  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
3221  match false
3222floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
3223  match 3.14
3224integerLiteral(equals(42))
3225  matches 42
3226
3227Note that you cannot directly match a negative numeric literal because the
3228minus sign is not part of the literal: It is a unary operator whose operand
3229is the positive numeric literal. Instead, you must use a unaryOperator()
3230matcher to match the minus sign:
3231
3232unaryOperator(hasOperatorName("-"),
3233              hasUnaryOperand(integerLiteral(equals(13))))
3234
3235Usable 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;,
3236           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;
3237</pre></td></tr>
3238
3239
3240<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>
3241<tr><td colspan="4" class="doc" id="equals13"><pre></pre></td></tr>
3242
3243
3244<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>
3245<tr><td colspan="4" class="doc" id="equals9"><pre></pre></td></tr>
3246
3247
3248<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>
3249<tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '-&gt;' as opposed
3250to '.'.
3251
3252Member calls on the implicit this pointer match as called with '-&gt;'.
3253
3254Given
3255  class Y {
3256    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
3257    template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
3258    int a;
3259    static int b;
3260  };
3261  template &lt;class T&gt;
3262  class Z {
3263    void x() { this-&gt;m; }
3264  };
3265memberExpr(isArrow())
3266  matches this-&gt;x, x, y.x, a, this-&gt;b
3267cxxDependentScopeMemberExpr(isArrow())
3268  matches this-&gt;m
3269unresolvedMemberExpr(isArrow())
3270  matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
3271</pre></td></tr>
3272
3273
3274<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>
3275<tr><td colspan="4" class="doc" id="hasExternalFormalLinkage0"><pre>Matches a declaration that has external formal linkage.
3276
3277Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
3278void f() {
3279  int x;
3280  static int y;
3281}
3282int z;
3283
3284Example matches f() because it has external formal linkage despite being
3285unique to the translation unit as though it has internal likage
3286(matcher = functionDecl(hasExternalFormalLinkage()))
3287
3288namespace {
3289void f() {}
3290}
3291</pre></td></tr>
3292
3293
3294<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>
3295<tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name.
3296
3297Supports specifying enclosing namespaces or classes by prefixing the name
3298with '&lt;enclosing&gt;::'.
3299Does not match typedefs of an underlying type with the given name.
3300
3301Example matches X (Name == "X")
3302  class X;
3303
3304Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
3305  namespace a { namespace b { class X; } }
3306</pre></td></tr>
3307
3308
3309<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>
3310<tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain
3311a substring matched by the given RegExp.
3312
3313Supports specifying enclosing namespaces or classes by
3314prefixing the name with '&lt;enclosing&gt;::'.  Does not match typedefs
3315of an underlying type with the given name.
3316
3317Example matches X (regexp == "::X")
3318  class X;
3319
3320Example matches X (regexp is one of "::X", "^foo::.*X", among others)
3321  namespace foo { namespace bar { class X; } }
3322</pre></td></tr>
3323
3324
3325<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>
3326<tr><td colspan="4" class="doc" id="isAnonymous0"><pre>Matches anonymous namespace declarations.
3327
3328Given
3329  namespace n {
3330  namespace {} #1
3331  }
3332namespaceDecl(isAnonymous()) will match #1 but not ::n.
3333</pre></td></tr>
3334
3335
3336<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>
3337<tr><td colspan="4" class="doc" id="isInline0"><pre>Matches function and namespace declarations that are marked with
3338the inline keyword.
3339
3340Given
3341  inline void f();
3342  void g();
3343  namespace n {
3344  inline namespace m {}
3345  }
3346functionDecl(isInline()) will match ::f().
3347namespaceDecl(isInline()) will match n::m.
3348</pre></td></tr>
3349
3350
3351<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>
3352<tr><td colspan="4" class="doc" id="argumentCountIs2"><pre>Checks that a call expression or a constructor call expression has
3353a specific number of arguments (including absent default arguments).
3354
3355Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3356  void f(int x, int y);
3357  f(0, 0);
3358</pre></td></tr>
3359
3360
3361<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>
3362<tr><td colspan="4" class="doc" id="hasKeywordSelector0"><pre>Matches when the selector is a keyword selector
3363
3364objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
3365message expression in
3366
3367  UIWebView *webView = ...;
3368  CGRect bodyFrame = webView.frame;
3369  bodyFrame.size.height = self.bodyContentHeight;
3370  webView.frame = bodyFrame;
3371      ^---- matches here
3372</pre></td></tr>
3373
3374
3375<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>
3376<tr><td colspan="4" class="doc" id="hasNullSelector0"><pre>Matches when the selector is the empty selector
3377
3378Matches only when the selector of the objCMessageExpr is NULL. This may
3379represent an error condition in the tree!
3380</pre></td></tr>
3381
3382
3383<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>
3384<tr><td colspan="4" class="doc" id="hasSelector0"><pre>Matches when BaseName == Selector.getAsString()
3385
3386 matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:"));
3387 matches the outer message expr in the code below, but NOT the message
3388 invocation for self.bodyView.
3389    [self.bodyView loadHTMLString:html baseURL:NULL];
3390</pre></td></tr>
3391
3392
3393<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>
3394<tr><td colspan="4" class="doc" id="hasUnarySelector0"><pre>Matches when the selector is a Unary Selector
3395
3396 matcher = objCMessageExpr(matchesSelector(hasUnarySelector());
3397 matches self.bodyView in the code below, but NOT the outer message
3398 invocation of "loadHTMLString:baseURL:".
3399    [self.bodyView loadHTMLString:html baseURL:NULL];
3400</pre></td></tr>
3401
3402
3403<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>
3404<tr><td colspan="4" class="doc" id="isInstanceMessage0"><pre>Returns true when the Objective-C message is sent to an instance.
3405
3406Example
3407matcher = objcMessagaeExpr(isInstanceMessage())
3408matches
3409  NSString *x = @"hello";
3410  [x containsString:@"h"];
3411but not
3412  [NSString stringWithFormat:@"format"];
3413</pre></td></tr>
3414
3415
3416<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>
3417<tr><td colspan="4" class="doc" id="matchesSelector0"><pre>Matches ObjC selectors whose name contains
3418a substring matched by the given RegExp.
3419 matcher = objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
3420 invocation for self.bodyView.
3421    [self.bodyView loadHTMLString:html baseURL:NULL];
3422</pre></td></tr>
3423
3424
3425<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>
3426<tr><td colspan="4" class="doc" id="numSelectorArgs0"><pre>Matches when the selector has the specified number of arguments
3427
3428 matcher = objCMessageExpr(numSelectorArgs(0));
3429 matches self.bodyView in the code below
3430
3431 matcher = objCMessageExpr(numSelectorArgs(2));
3432 matches the invocation of "loadHTMLString:baseURL:" but not that
3433 of self.bodyView
3434    [self.bodyView loadHTMLString:html baseURL:NULL];
3435</pre></td></tr>
3436
3437
3438<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>
3439<tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached.
3440
3441Example matches A, va, fa
3442  class A {};
3443  class B;  Doesn't match, as it has no body.
3444  int va;
3445  extern int vb;  Doesn't match, as it doesn't define the variable.
3446  void fa() {}
3447  void fb();  Doesn't match, as it has no body.
3448  @interface X
3449  - (void)ma; Doesn't match, interface is declaration.
3450  @end
3451  @implementation X
3452  - (void)ma {}
3453  @end
3454
3455Usable 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;,
3456  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3457</pre></td></tr>
3458
3459
3460<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>
3461<tr><td colspan="4" class="doc" id="hasDefaultArgument0"><pre>Matches a declaration that has default arguments.
3462
3463Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
3464void x(int val) {}
3465void y(int val = 0) {}
3466</pre></td></tr>
3467
3468
3469<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>
3470<tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string.
3471
3472Given
3473  class Y { public: void x(); };
3474  void z() { Y* y; y-&gt;x(); }
3475cxxMemberCallExpr(on(hasType(asString("class Y *"))))
3476  matches y-&gt;x()
3477</pre></td></tr>
3478
3479
3480<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>
3481<tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node.
3482
3483Matches a node if it equals the node previously bound to ID.
3484
3485Given
3486  class X { int a; int b; };
3487cxxRecordDecl(
3488    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3489    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3490  matches the class X, as a and b have the same type.
3491
3492Note that when multiple matches are involved via forEach* matchers,
3493equalsBoundNodes acts as a filter.
3494For example:
3495compoundStmt(
3496    forEachDescendant(varDecl().bind("d")),
3497    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3498will trigger a match for each combination of variable declaration
3499and reference to that variable declaration within a compound statement.
3500</pre></td></tr>
3501
3502
3503<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>
3504<tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to
3505the node, not hidden within a typedef.
3506
3507Given
3508  typedef const int const_int;
3509  const_int i;
3510  int *const j;
3511  int *volatile k;
3512  int m;
3513varDecl(hasType(hasLocalQualifiers())) matches only j and k.
3514i is const-qualified but the qualifier is not local.
3515</pre></td></tr>
3516
3517
3518<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>
3519<tr><td colspan="4" class="doc" id="isAnyCharacter0"><pre>Matches QualType nodes that are of character type.
3520
3521Given
3522  void a(char);
3523  void b(wchar_t);
3524  void c(double);
3525functionDecl(hasAnyParameter(hasType(isAnyCharacter())))
3526matches "a(char)", "b(wchar_t)", but not "c(double)".
3527</pre></td></tr>
3528
3529
3530<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>
3531<tr><td colspan="4" class="doc" id="isAnyPointer0"><pre>Matches QualType nodes that are of any pointer type; this includes
3532the Objective-C object pointer type, which is different despite being
3533syntactically similar.
3534
3535Given
3536  int *i = nullptr;
3537
3538  @interface Foo
3539  @end
3540  Foo *f;
3541
3542  int j;
3543varDecl(hasType(isAnyPointer()))
3544  matches "int *i" and "Foo *f", but not "int j".
3545</pre></td></tr>
3546
3547
3548<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>
3549<tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that
3550include "top-level" const.
3551
3552Given
3553  void a(int);
3554  void b(int const);
3555  void c(const int);
3556  void d(const int*);
3557  void e(int const) {};
3558functionDecl(hasAnyParameter(hasType(isConstQualified())))
3559  matches "void b(int const)", "void c(const int)" and
3560  "void e(int const) {}". It does not match d as there
3561  is no top-level const on the parameter type "const int *".
3562</pre></td></tr>
3563
3564
3565<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>
3566<tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type.
3567
3568Given
3569  void a(int);
3570  void b(long);
3571  void c(double);
3572functionDecl(hasAnyParameter(hasType(isInteger())))
3573matches "a(int)", "b(long)", but not "c(double)".
3574</pre></td></tr>
3575
3576
3577<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>
3578<tr><td colspan="4" class="doc" id="isSignedInteger0"><pre>Matches QualType nodes that are of signed integer type.
3579
3580Given
3581  void a(int);
3582  void b(unsigned long);
3583  void c(double);
3584functionDecl(hasAnyParameter(hasType(isSignedInteger())))
3585matches "a(int)", but not "b(unsigned long)" and "c(double)".
3586</pre></td></tr>
3587
3588
3589<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>
3590<tr><td colspan="4" class="doc" id="isUnsignedInteger0"><pre>Matches QualType nodes that are of unsigned integer type.
3591
3592Given
3593  void a(int);
3594  void b(unsigned long);
3595  void c(double);
3596functionDecl(hasAnyParameter(hasType(isUnsignedInteger())))
3597matches "b(unsigned long)", but not "a(int)" and "c(double)".
3598</pre></td></tr>
3599
3600
3601<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>
3602<tr><td colspan="4" class="doc" id="isVolatileQualified0"><pre>Matches QualType nodes that are volatile-qualified, i.e., that
3603include "top-level" volatile.
3604
3605Given
3606  void a(int);
3607  void b(int volatile);
3608  void c(volatile int);
3609  void d(volatile int*);
3610  void e(int volatile) {};
3611functionDecl(hasAnyParameter(hasType(isVolatileQualified())))
3612  matches "void b(int volatile)", "void c(volatile int)" and
3613  "void e(int volatile) {}". It does not match d as there
3614  is no top-level volatile on the parameter type "volatile int *".
3615</pre></td></tr>
3616
3617
3618<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>
3619<tr><td colspan="4" class="doc" id="isClass0"><pre>Matches RecordDecl object that are spelled with "class."
3620
3621Example matches C, but not S or U.
3622  struct S {};
3623  class C {};
3624  union U {};
3625</pre></td></tr>
3626
3627
3628<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>
3629<tr><td colspan="4" class="doc" id="isStruct0"><pre>Matches RecordDecl object that are spelled with "struct."
3630
3631Example matches S, but not C or U.
3632  struct S {};
3633  class C {};
3634  union U {};
3635</pre></td></tr>
3636
3637
3638<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>
3639<tr><td colspan="4" class="doc" id="isUnion0"><pre>Matches RecordDecl object that are spelled with "union."
3640
3641Example matches U, but not C or S.
3642  struct S {};
3643  class C {};
3644  union U {};
3645</pre></td></tr>
3646
3647
3648<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>
3649<tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node.
3650
3651Matches a node if it equals the node previously bound to ID.
3652
3653Given
3654  class X { int a; int b; };
3655cxxRecordDecl(
3656    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3657    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3658  matches the class X, as a and b have the same type.
3659
3660Note that when multiple matches are involved via forEach* matchers,
3661equalsBoundNodes acts as a filter.
3662For example:
3663compoundStmt(
3664    forEachDescendant(varDecl().bind("d")),
3665    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3666will trigger a match for each combination of variable declaration
3667and reference to that variable declaration within a compound statement.
3668</pre></td></tr>
3669
3670
3671<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>
3672<tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node.
3673
3674Stmt has pointer identity in the AST.
3675</pre></td></tr>
3676
3677
3678<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>
3679<tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches AST nodes that were expanded within files whose name is
3680partially matching a given regex.
3681
3682Example matches Y but not X
3683    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3684  #include "ASTMatcher.h"
3685  class X {};
3686ASTMatcher.h:
3687  class Y {};
3688
3689Usable 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;
3690</pre></td></tr>
3691
3692
3693<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>
3694<tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches AST nodes that were expanded within the main-file.
3695
3696Example matches X but not Y
3697  (matcher = cxxRecordDecl(isExpansionInMainFile())
3698  #include &lt;Y.h&gt;
3699  class X {};
3700Y.h:
3701  class Y {};
3702
3703Usable 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;
3704</pre></td></tr>
3705
3706
3707<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>
3708<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches AST nodes that were expanded within system-header-files.
3709
3710Example matches Y but not X
3711    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3712  #include &lt;SystemHeader.h&gt;
3713  class X {};
3714SystemHeader.h:
3715  class Y {};
3716
3717Usable 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;
3718</pre></td></tr>
3719
3720
3721<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>
3722<tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
3723
3724Given
3725  int a[42];
3726  int b[2 * 21];
3727  int c[41], d[43];
3728  char *s = "abcd";
3729  wchar_t *ws = L"abcd";
3730  char *w = "a";
3731constantArrayType(hasSize(42))
3732  matches "int a[42]" and "int b[2 * 21]"
3733stringLiteral(hasSize(4))
3734  matches "abcd", L"abcd"
3735</pre></td></tr>
3736
3737
3738<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>
3739<tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
3740
3741Example matches A, va, fa
3742  class A {};
3743  class B;  Doesn't match, as it has no body.
3744  int va;
3745  extern int vb;  Doesn't match, as it doesn't define the variable.
3746  void fa() {}
3747  void fb();  Doesn't match, as it has no body.
3748  @interface X
3749  - (void)ma; Doesn't match, interface is declaration.
3750  @end
3751  @implementation X
3752  - (void)ma {}
3753  @end
3754
3755Usable 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;,
3756  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3757</pre></td></tr>
3758
3759
3760<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>
3761<tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value.
3762
3763Note that 'Value' is a string as the template argument's value is
3764an arbitrary precision integer. 'Value' must be euqal to the canonical
3765representation of that integral value in base 10.
3766
3767Given
3768  template&lt;int T&gt; struct C {};
3769  C&lt;42&gt; c;
3770classTemplateSpecializationDecl(
3771  hasAnyTemplateArgument(equalsIntegralValue("42")))
3772  matches the implicit instantiation of C in C&lt;42&gt;.
3773</pre></td></tr>
3774
3775
3776<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>
3777<tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value.
3778
3779Given
3780  template&lt;int T&gt; struct C {};
3781  C&lt;42&gt; c;
3782classTemplateSpecializationDecl(
3783  hasAnyTemplateArgument(isIntegral()))
3784  matches the implicit instantiation of C in C&lt;42&gt;
3785  with isIntegral() matching 42.
3786</pre></td></tr>
3787
3788
3789<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>
3790<tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N.
3791
3792Given
3793  template&lt;typename T&gt; struct C {};
3794  C&lt;int&gt; c;
3795classTemplateSpecializationDecl(templateArgumentCountIs(1))
3796  matches C&lt;int&gt;.
3797</pre></td></tr>
3798
3799
3800<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>
3801<tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is
3802partially matching a given regex.
3803
3804Example matches Y but not X
3805    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3806  #include "ASTMatcher.h"
3807  class X {};
3808ASTMatcher.h:
3809  class Y {};
3810
3811Usable 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;
3812</pre></td></tr>
3813
3814
3815<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>
3816<tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file.
3817
3818Example matches X but not Y
3819  (matcher = cxxRecordDecl(isExpansionInMainFile())
3820  #include &lt;Y.h&gt;
3821  class X {};
3822Y.h:
3823  class Y {};
3824
3825Usable 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;
3826</pre></td></tr>
3827
3828
3829<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>
3830<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files.
3831
3832Example matches Y but not X
3833    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3834  #include &lt;SystemHeader.h&gt;
3835  class X {};
3836SystemHeader.h:
3837  class Y {};
3838
3839Usable 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;
3840</pre></td></tr>
3841
3842
3843<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>
3844<tr><td colspan="4" class="doc" id="booleanType0"><pre>Matches type bool.
3845
3846Given
3847 struct S { bool func(); };
3848functionDecl(returns(booleanType()))
3849  matches "bool func();"
3850</pre></td></tr>
3851
3852
3853<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>
3854<tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
3855
3856Matches a node if it equals the node previously bound to ID.
3857
3858Given
3859  class X { int a; int b; };
3860cxxRecordDecl(
3861    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3862    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3863  matches the class X, as a and b have the same type.
3864
3865Note that when multiple matches are involved via forEach* matchers,
3866equalsBoundNodes acts as a filter.
3867For example:
3868compoundStmt(
3869    forEachDescendant(varDecl().bind("d")),
3870    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3871will trigger a match for each combination of variable declaration
3872and reference to that variable declaration within a compound statement.
3873</pre></td></tr>
3874
3875
3876<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>
3877<tr><td colspan="4" class="doc" id="equalsNode2"><pre>Matches if a node equals another node.
3878
3879Type has pointer identity in the AST.
3880</pre></td></tr>
3881
3882
3883<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>
3884<tr><td colspan="4" class="doc" id="realFloatingPointType0"><pre>Matches any real floating-point type (float, double, long double).
3885
3886Given
3887  int i;
3888  float f;
3889realFloatingPointType()
3890  matches "float f" but not "int i"
3891</pre></td></tr>
3892
3893
3894<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>
3895<tr><td colspan="4" class="doc" id="voidType0"><pre>Matches type void.
3896
3897Given
3898 struct S { void func(); };
3899functionDecl(returns(voidType()))
3900  matches "void func();"
3901</pre></td></tr>
3902
3903
3904<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>
3905<tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
3906
3907Given
3908  int x;
3909  int s = sizeof(x) + alignof(x)
3910unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
3911  matches sizeof(x)
3912</pre></td></tr>
3913
3914
3915<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>
3916<tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or
3917unary).
3918
3919Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3920  !(a || b)
3921</pre></td></tr>
3922
3923
3924<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedMemberExpr.html">UnresolvedMemberExpr</a>&gt;</td><td class="name" onclick="toggle('isArrow1')"><a name="isArrow1Anchor">isArrow</a></td><td></td></tr>
3925<tr><td colspan="4" class="doc" id="isArrow1"><pre>Matches member expressions that are called with '-&gt;' as opposed
3926to '.'.
3927
3928Member calls on the implicit this pointer match as called with '-&gt;'.
3929
3930Given
3931  class Y {
3932    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
3933    template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
3934    int a;
3935    static int b;
3936  };
3937  template &lt;class T&gt;
3938  class Z {
3939    void x() { this-&gt;m; }
3940  };
3941memberExpr(isArrow())
3942  matches this-&gt;x, x, y.x, a, this-&gt;b
3943cxxDependentScopeMemberExpr(isArrow())
3944  matches this-&gt;m
3945unresolvedMemberExpr(isArrow())
3946  matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
3947</pre></td></tr>
3948
3949
3950<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>
3951<tr><td colspan="4" class="doc" id="hasAutomaticStorageDuration0"><pre>Matches a variable declaration that has automatic storage duration.
3952
3953Example matches x, but not y, z, or a.
3954(matcher = varDecl(hasAutomaticStorageDuration())
3955void f() {
3956  int x;
3957  static int y;
3958  thread_local int z;
3959}
3960int a;
3961</pre></td></tr>
3962
3963
3964<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>
3965<tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
3966
3967Example matches y and z (matcher = varDecl(hasGlobalStorage())
3968void f() {
3969  int x;
3970  static int y;
3971}
3972int z;
3973</pre></td></tr>
3974
3975
3976<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>
3977<tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a
3978non-static local variable.
3979
3980Example matches x (matcher = varDecl(hasLocalStorage())
3981void f() {
3982  int x;
3983  static int y;
3984}
3985int z;
3986</pre></td></tr>
3987
3988
3989<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>
3990<tr><td colspan="4" class="doc" id="hasStaticStorageDuration0"><pre>Matches a variable declaration that has static storage duration.
3991It includes the variable declared at namespace scope and those declared
3992with "static" and "extern" storage class specifiers.
3993
3994void f() {
3995  int x;
3996  static int y;
3997  thread_local int z;
3998}
3999int a;
4000static int b;
4001extern int c;
4002varDecl(hasStaticStorageDuration())
4003  matches the function declaration y, a, b and c.
4004</pre></td></tr>
4005
4006
4007<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>
4008<tr><td colspan="4" class="doc" id="hasThreadStorageDuration0"><pre>Matches a variable declaration that has thread storage duration.
4009
4010Example matches z, but not x, z, or a.
4011(matcher = varDecl(hasThreadStorageDuration())
4012void f() {
4013  int x;
4014  static int y;
4015  thread_local int z;
4016}
4017int a;
4018</pre></td></tr>
4019
4020
4021<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>
4022<tr><td colspan="4" class="doc" id="isConstexpr0"><pre>Matches constexpr variable and function declarations,
4023       and if constexpr.
4024
4025Given:
4026  constexpr int foo = 42;
4027  constexpr int bar();
4028  void baz() { if constexpr(1 &gt; 0) {} }
4029varDecl(isConstexpr())
4030  matches the declaration of foo.
4031functionDecl(isConstexpr())
4032  matches the declaration of bar.
4033ifStmt(isConstexpr())
4034  matches the if statement in baz.
4035</pre></td></tr>
4036
4037
4038<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>
4039<tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
4040
4041Example matches A, va, fa
4042  class A {};
4043  class B;  Doesn't match, as it has no body.
4044  int va;
4045  extern int vb;  Doesn't match, as it doesn't define the variable.
4046  void fa() {}
4047  void fb();  Doesn't match, as it has no body.
4048  @interface X
4049  - (void)ma; Doesn't match, interface is declaration.
4050  @end
4051  @implementation X
4052  - (void)ma {}
4053  @end
4054
4055Usable 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;,
4056  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
4057</pre></td></tr>
4058
4059
4060<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>
4061<tr><td colspan="4" class="doc" id="isExceptionVariable0"><pre>Matches a variable declaration that is an exception variable from
4062a C++ catch block, or an Objective-C statement.
4063
4064Example matches x (matcher = varDecl(isExceptionVariable())
4065void f(int y) {
4066  try {
4067  } catch (int x) {
4068  }
4069}
4070</pre></td></tr>
4071
4072
4073<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>
4074<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
4075static member variable template instantiations.
4076
4077Given
4078  template&lt;typename T&gt; void A(T t) { }
4079  template&lt;&gt; void A(int N) { }
4080functionDecl(isExplicitTemplateSpecialization())
4081  matches the specialization A&lt;int&gt;().
4082
4083Usable 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;
4084</pre></td></tr>
4085
4086
4087<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>
4088<tr><td colspan="4" class="doc" id="isExternC1"><pre>Matches extern "C" function or variable declarations.
4089
4090Given:
4091  extern "C" void f() {}
4092  extern "C" { void g() {} }
4093  void h() {}
4094  extern "C" int x = 1;
4095  extern "C" int y = 2;
4096  int z = 3;
4097functionDecl(isExternC())
4098  matches the declaration of f and g, but not the declaration of h.
4099varDecl(isExternC())
4100  matches the declaration of x and y, but not the declaration of z.
4101</pre></td></tr>
4102
4103
4104<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>
4105<tr><td colspan="4" class="doc" id="isStaticStorageClass1"><pre>Matches variablefunction declarations that have "static" storage
4106class specifier ("static" keyword) written in the source.
4107
4108Given:
4109  static void f() {}
4110  static int i = 0;
4111  extern int j;
4112  int k;
4113functionDecl(isStaticStorageClass())
4114  matches the function declaration f.
4115varDecl(isStaticStorageClass())
4116  matches the variable declaration i.
4117</pre></td></tr>
4118
4119
4120<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>
4121<tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
4122member variable template instantiations.
4123
4124Given
4125  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
4126or
4127  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
4128or
4129  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
4130cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4131  matches the template instantiation of X&lt;A&gt;.
4132
4133But given
4134  template &lt;typename T&gt;  class X {}; class A {};
4135  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
4136cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4137  does not match, as X&lt;A&gt; is an explicit template specialization.
4138
4139Usable 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;
4140</pre></td></tr>
4141
4142
4143<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>
4144<tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
4145template instantiations.
4146
4147Given
4148  template&lt;typename T&gt; void A(T t) { T i; }
4149  A(0);
4150  A(0U);
4151functionDecl(isInstantiated())
4152  matches 'A(int) {...};' and 'A(unsigned) {...}'.
4153</pre></td></tr>
4154
4155
4156<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>
4157<tr><td colspan="4" class="doc" id="nullPointerConstant0"><pre>Matches expressions that resolve to a null pointer constant, such as
4158GNU's __null, C++11's nullptr, or C's NULL macro.
4159
4160Given:
4161  void *v1 = NULL;
4162  void *v2 = nullptr;
4163  void *v3 = __null; GNU extension
4164  char *cp = (char *)0;
4165  int *ip = 0;
4166  int i = 0;
4167expr(nullPointerConstant())
4168  matches the initializer for v1, v2, v3, cp, and ip. Does not match the
4169  initializer for i.
4170</pre></td></tr>
4171
4172
4173<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>
4174<tr><td colspan="4" class="doc" id="hasAnyName0"><pre>Matches NamedDecl nodes that have any of the specified names.
4175
4176This matcher is only provided as a performance optimization of hasName.
4177    hasAnyName(a, b, c)
4178 is equivalent to, but faster than
4179    anyOf(hasName(a), hasName(b), hasName(c))
4180</pre></td></tr>
4181
4182
4183<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>
4184<tr><td colspan="4" class="doc" id="hasAnySelector0"><pre>Matches when at least one of the supplied string equals to the
4185Selector.getAsString()
4186
4187 matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
4188 matches both of the expressions below:
4189    [myObj methodA:argA];
4190    [myObj methodB:argB];
4191</pre></td></tr>
4192
4193
4194<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>
4195<tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
4196
4197Given
4198  int j;
4199  template&lt;typename T&gt; void A(T t) { T i; j += 42;}
4200  A(0);
4201  A(0U);
4202declStmt(isInTemplateInstantiation())
4203  matches 'int i;' and 'unsigned i'.
4204unless(stmt(isInTemplateInstantiation()))
4205  will NOT match j += 42; as it's shared between the template definition and
4206  instantiation.
4207</pre></td></tr>
4208
4209<!--END_NARROWING_MATCHERS -->
4210</table>
4211
4212<!-- ======================================================================= -->
4213<h2 id="traversal-matchers">AST Traversal Matchers</h2>
4214<!-- ======================================================================= -->
4215
4216<p>Traversal matchers specify the relationship to other nodes that are
4217reachable from the current node.</p>
4218
4219<p>Note that there are special traversal matchers (has, hasDescendant, forEach and
4220forEachDescendant) which work on all nodes and allow users to write more generic
4221match expressions.</p>
4222
4223<table>
4224<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
4225<!-- START_TRAVERSAL_MATCHERS -->
4226
4227<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>
4228<tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
4229
4230Unlike anyOf, eachOf will generate a match result for each
4231matching submatcher.
4232
4233For example, in:
4234  class A { int a; int b; };
4235The matcher:
4236  cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
4237                       has(fieldDecl(hasName("b")).bind("v"))))
4238will generate two results binding "v", the first of which binds
4239the field declaration of a, the second the field declaration of
4240b.
4241
4242Usable as: Any Matcher
4243</pre></td></tr>
4244
4245
4246<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4247<tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4248provided matcher.
4249
4250Example matches X, A, A::X, B, B::C, B::C::X
4251  (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
4252  class X {};
4253  class A { class X {}; };  Matches A, because A::X is a class of name
4254                            X inside A.
4255  class B { class C { class X {}; }; };
4256
4257DescendantT must be an AST base type.
4258
4259As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
4260each result that matches instead of only on the first one.
4261
4262Note: Recursively combined ForEachDescendant can cause many matches:
4263  cxxRecordDecl(forEachDescendant(cxxRecordDecl(
4264    forEachDescendant(cxxRecordDecl())
4265  )))
4266will match 10 times (plus injected class name matches) on:
4267  class A { class B { class C { class D { class E {}; }; }; }; };
4268
4269Usable as: Any Matcher
4270</pre></td></tr>
4271
4272
4273<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
4274<tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
4275provided matcher.
4276
4277Example matches X, Y, Y::X, Z::Y, Z::Y::X
4278  (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
4279  class X {};
4280  class Y { class X {}; };  Matches Y, because Y::X is a class of name X
4281                            inside Y.
4282  class Z { class Y { class X {}; }; };  Does not match Z.
4283
4284ChildT must be an AST base type.
4285
4286As opposed to 'has', 'forEach' will cause a match for each result that
4287matches instead of only on the first one.
4288
4289Usable as: Any Matcher
4290</pre></td></tr>
4291
4292
4293<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
4294<tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
4295matcher.
4296
4297Given
4298void f() { if (true) { int x = 42; } }
4299void g() { for (;;) { int x = 43; } }
4300expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
4301
4302Usable as: Any Matcher
4303</pre></td></tr>
4304
4305
4306<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4307<tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4308provided matcher.
4309
4310Example matches X, Y, Z
4311    (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
4312  class X {};  Matches X, because X::X is a class of name X inside X.
4313  class Y { class X {}; };
4314  class Z { class Y { class X {}; }; };
4315
4316DescendantT must be an AST base type.
4317
4318Usable as: Any Matcher
4319</pre></td></tr>
4320
4321
4322<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
4323<tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
4324provided matcher.
4325
4326Example matches X, Y
4327  (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
4328  class X {};  Matches X, because X::X is a class of name X inside X.
4329  class Y { class X {}; };
4330  class Z { class Y { class X {}; }; };  Does not match Z.
4331
4332ChildT must be an AST base type.
4333
4334Usable as: Any Matcher
4335Note that has is direct matcher, so it also matches things like implicit
4336casts and paren casts. If you are matching with expr then you should
4337probably consider using ignoringParenImpCasts like:
4338has(ignoringParenImpCasts(expr())).
4339</pre></td></tr>
4340
4341
4342<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
4343<tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
4344matcher.
4345
4346Given
4347void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
4348compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
4349
4350Usable as: Any Matcher
4351</pre></td></tr>
4352
4353
4354<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>
4355<tr><td colspan="4" class="doc" id="hasCondition5"><pre>Matches the condition expression of an if statement, for loop,
4356switch statement or conditional operator.
4357
4358Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
4359  if (true) {}
4360</pre></td></tr>
4361
4362
4363<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>
4364<tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator
4365(binary or ternary).
4366
4367Example matches b
4368  condition ? a : b
4369  condition ?: b
4370</pre></td></tr>
4371
4372
4373<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>
4374<tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
4375
4376Example 1 (conditional ternary operator): matches a
4377  condition ? a : b
4378
4379Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
4380  condition ?: b
4381</pre></td></tr>
4382
4383
4384<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>
4385<tr><td colspan="4" class="doc" id="hasDeclaration15"><pre>Matches a node if the declaration associated with that node
4386matches the given matcher.
4387
4388The associated declaration is:
4389- for type nodes, the declaration of the underlying type
4390- for CallExpr, the declaration of the callee
4391- for MemberExpr, the declaration of the referenced member
4392- for CXXConstructExpr, the declaration of the constructor
4393- for CXXNewExpr, the declaration of the operator new
4394- for ObjCIvarExpr, the declaration of the ivar
4395
4396For type nodes, hasDeclaration will generally match the declaration of the
4397sugared type. Given
4398  class X {};
4399  typedef X Y;
4400  Y y;
4401in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4402typedefDecl. A common use case is to match the underlying, desugared type.
4403This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4404  varDecl(hasType(hasUnqualifiedDesugaredType(
4405      recordType(hasDeclaration(decl())))))
4406In this matcher, the decl will match the CXXRecordDecl of class X.
4407
4408Usable 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;,
4409  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;,
4410  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;,
4411  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;,
4412  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;,
4413  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;,
4414  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4415</pre></td></tr>
4416
4417
4418<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>
4419<tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
4420
4421Given
4422  int i[5];
4423  void f() { i[1] = 42; }
4424arraySubscriptExpression(hasBase(implicitCastExpr(
4425    hasSourceExpression(declRefExpr()))))
4426  matches i[1] with the declRefExpr() matching i
4427</pre></td></tr>
4428
4429
4430<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>
4431<tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
4432
4433Given
4434  int i[5];
4435  void f() { i[1] = 42; }
4436arraySubscriptExpression(hasIndex(integerLiteral()))
4437  matches i[1] with the integerLiteral() matching 1
4438</pre></td></tr>
4439
4440
4441<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>
4442<tr><td colspan="4" class="doc" id="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
4443
4444Example matches a (matcher = binaryOperator(hasLHS()))
4445  a || b
4446</pre></td></tr>
4447
4448
4449<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>
4450<tr><td colspan="4" class="doc" id="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
4451
4452Example matches b (matcher = binaryOperator(hasRHS()))
4453  a || b
4454</pre></td></tr>
4455
4456
4457<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>
4458<tr><td colspan="4" class="doc" id="hasElementTypeLoc0"><pre>Matches arrays and C99 complex types that have a specific element
4459type.
4460
4461Given
4462  struct A {};
4463  A a[7];
4464  int b[7];
4465arrayType(hasElementType(builtinType()))
4466  matches "int b[7]"
4467
4468Usable 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;
4469</pre></td></tr>
4470
4471
4472<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>
4473<tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
4474type.
4475
4476Given
4477  struct A {};
4478  A a[7];
4479  int b[7];
4480arrayType(hasElementType(builtinType()))
4481  matches "int b[7]"
4482
4483Usable 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;
4484</pre></td></tr>
4485
4486
4487<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>
4488<tr><td colspan="4" class="doc" id="hasValueTypeLoc0"><pre>Matches atomic types with a specific value type.
4489
4490Given
4491  _Atomic(int) i;
4492  _Atomic(float) f;
4493atomicType(hasValueType(isInteger()))
4494 matches "_Atomic(int) i"
4495
4496Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
4497</pre></td></tr>
4498
4499
4500<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>
4501<tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
4502
4503Given
4504  _Atomic(int) i;
4505  _Atomic(float) f;
4506atomicType(hasValueType(isInteger()))
4507 matches "_Atomic(int) i"
4508
4509Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
4510</pre></td></tr>
4511
4512
4513<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>
4514<tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
4515
4516Note: There is no TypeLoc for the deduced type and thus no
4517getDeducedLoc() matcher.
4518
4519Given
4520  auto a = 1;
4521  auto b = 2.0;
4522autoType(hasDeducedType(isInteger()))
4523  matches "auto a"
4524
4525Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
4526</pre></td></tr>
4527
4528
4529<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>
4530<tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
4531binary operator matches.
4532</pre></td></tr>
4533
4534
4535<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>
4536<tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
4537
4538Example matches a (matcher = binaryOperator(hasLHS()))
4539  a || b
4540</pre></td></tr>
4541
4542
4543<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>
4544<tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
4545
4546Example matches b (matcher = binaryOperator(hasRHS()))
4547  a || b
4548</pre></td></tr>
4549
4550
4551<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>
4552<tr><td colspan="4" class="doc" id="hasAnyParameter2"><pre>Matches any parameter of a function or an ObjC method declaration or a
4553block.
4554
4555Does not match the 'this' parameter of a method.
4556
4557Given
4558  class X { void f(int x, int y, int z) {} };
4559cxxMethodDecl(hasAnyParameter(hasName("y")))
4560  matches f(int x, int y, int z) {}
4561with hasAnyParameter(...)
4562  matching int y
4563
4564For ObjectiveC, given
4565  @interface I - (void) f:(int) y; @end
4566
4567the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
4568matches the declaration of method f with hasParameter
4569matching y.
4570
4571For blocks, given
4572  b = ^(int y) { printf("%d", y) };
4573
4574the matcher blockDecl(hasAnyParameter(hasName("y")))
4575matches the declaration of the block b with hasParameter
4576matching y.
4577</pre></td></tr>
4578
4579
4580<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>
4581<tr><td colspan="4" class="doc" id="hasParameter2"><pre>Matches the n'th parameter of a function or an ObjC method
4582declaration or a block.
4583
4584Given
4585  class X { void f(int x) {} };
4586cxxMethodDecl(hasParameter(0, hasType(varDecl())))
4587  matches f(int x) {}
4588with hasParameter(...)
4589  matching int x
4590
4591For ObjectiveC, given
4592  @interface I - (void) f:(int) y; @end
4593
4594the matcher objcMethodDecl(hasParameter(0, hasName("y")))
4595matches the declaration of method f with hasParameter
4596matching y.
4597</pre></td></tr>
4598
4599
4600<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>
4601<tr><td colspan="4" class="doc" id="pointeeLoc0"><pre>Narrows PointerType (and similar) matchers to those where the
4602pointee matches a given matcher.
4603
4604Given
4605  int *a;
4606  int const *b;
4607  float const *f;
4608pointerType(pointee(isConstQualified(), isInteger()))
4609  matches "int const *b"
4610
4611Usable 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;,
4612  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;
4613</pre></td></tr>
4614
4615
4616<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>
4617<tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
4618pointee matches a given matcher.
4619
4620Given
4621  int *a;
4622  int const *b;
4623  float const *f;
4624pointerType(pointee(isConstQualified(), isInteger()))
4625  matches "int const *b"
4626
4627Usable 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;,
4628  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;
4629</pre></td></tr>
4630
4631
4632<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>
4633<tr><td colspan="4" class="doc" id="forEachArgumentWithParam1"><pre>Matches all arguments and their respective ParmVarDecl.
4634
4635Given
4636  void f(int i);
4637  int y;
4638  f(y);
4639callExpr(
4640  forEachArgumentWithParam(
4641    declRefExpr(to(varDecl(hasName("y")))),
4642    parmVarDecl(hasType(isInteger()))
4643))
4644  matches f(y);
4645with declRefExpr(...)
4646  matching int y
4647and parmVarDecl(...)
4648  matching int i
4649</pre></td></tr>
4650
4651
4652<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>
4653<tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
4654expression, or an ObjC-message-send expression.
4655
4656Given
4657  void x(int, int, int) { int y; x(1, y, 42); }
4658callExpr(hasAnyArgument(declRefExpr()))
4659  matches x(1, y, 42)
4660with hasAnyArgument(...)
4661  matching y
4662
4663For ObjectiveC, given
4664  @interface I - (void) f:(int) y; @end
4665  void foo(I *i) { [i f:12]; }
4666objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
4667  matches [i f:12]
4668</pre></td></tr>
4669
4670
4671<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>
4672<tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
4673call expression.
4674
4675Example matches y in x(y)
4676    (matcher = callExpr(hasArgument(0, declRefExpr())))
4677  void x(int) { int y; x(y); }
4678</pre></td></tr>
4679
4680
4681<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>
4682<tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
4683matches the given matcher.
4684
4685The associated declaration is:
4686- for type nodes, the declaration of the underlying type
4687- for CallExpr, the declaration of the callee
4688- for MemberExpr, the declaration of the referenced member
4689- for CXXConstructExpr, the declaration of the constructor
4690- for CXXNewExpr, the declaration of the operator new
4691- for ObjCIvarExpr, the declaration of the ivar
4692
4693For type nodes, hasDeclaration will generally match the declaration of the
4694sugared type. Given
4695  class X {};
4696  typedef X Y;
4697  Y y;
4698in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4699typedefDecl. A common use case is to match the underlying, desugared type.
4700This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4701  varDecl(hasType(hasUnqualifiedDesugaredType(
4702      recordType(hasDeclaration(decl())))))
4703In this matcher, the decl will match the CXXRecordDecl of class X.
4704
4705Usable 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;,
4706  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;,
4707  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;,
4708  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;,
4709  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;,
4710  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;,
4711  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4712</pre></td></tr>
4713
4714
4715<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>
4716<tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
4717
4718Given
4719  class A { A() : i(42), j(42) {} int i; int j; };
4720cxxConstructorDecl(forEachConstructorInitializer(
4721  forField(decl().bind("x"))
4722))
4723  will trigger two matches, binding for 'i' and 'j' respectively.
4724</pre></td></tr>
4725
4726
4727<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>
4728<tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
4729
4730Given
4731  struct Foo {
4732    Foo() : foo_(1) { }
4733    int foo_;
4734  };
4735cxxRecordDecl(has(cxxConstructorDecl(
4736  hasAnyConstructorInitializer(anything())
4737)))
4738  record matches Foo, hasAnyConstructorInitializer matches foo_(1)
4739</pre></td></tr>
4740
4741
4742<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>
4743<tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
4744
4745Given
4746  struct Foo {
4747    Foo() : foo_(1) { }
4748    int foo_;
4749  };
4750cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
4751    forField(hasName("foo_"))))))
4752  matches Foo
4753with forField matching foo_
4754</pre></td></tr>
4755
4756
4757<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>
4758<tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
4759
4760Given
4761  struct Foo {
4762    Foo() : foo_(1) { }
4763    int foo_;
4764  };
4765cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
4766    withInitializer(integerLiteral(equals(1)))))))
4767  matches Foo
4768with withInitializer matching (1)
4769</pre></td></tr>
4770
4771
4772<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>
4773<tr><td colspan="4" class="doc" id="hasObjectExpression2"><pre>Matches a member expression where the object expression is
4774matched by a given matcher.
4775
4776Given
4777  struct X { int m; };
4778  void f(X x) { x.m; m; }
4779memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
4780  matches "x.m" and "m"
4781with hasObjectExpression(...)
4782  matching "x" and the implicit object expression of "m" which has type X*.
4783</pre></td></tr>
4784
4785
4786<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>
4787<tr><td colspan="4" class="doc" id="hasBody3"><pre>Matches a 'for', 'while', 'do while' statement or a function
4788definition that has a given body.
4789
4790Given
4791  for (;;) {}
4792hasBody(compoundStmt())
4793  matches 'for (;;) {}'
4794with compoundStmt()
4795  matching '{}'
4796</pre></td></tr>
4797
4798
4799<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>
4800<tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
4801
4802Example:
4803    forStmt(hasLoopVariable(anything()))
4804matches 'int x' in
4805    for (int x : a) { }
4806</pre></td></tr>
4807
4808
4809<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>
4810<tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
4811
4812Example:
4813    forStmt(hasRangeInit(anything()))
4814matches 'a' in
4815    for (int x : a) { }
4816</pre></td></tr>
4817
4818
4819<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>
4820<tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre></pre></td></tr>
4821
4822
4823<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>
4824<tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression.
4825
4826Example matches y.x()
4827  (matcher = cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y"))))))
4828  class Y { public: void x(); };
4829  void z() { Y y; y.x(); }
4830
4831FIXME: Overload to allow directly matching types?
4832</pre></td></tr>
4833
4834
4835<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>
4836<tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
4837</pre></td></tr>
4838
4839
4840<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>
4841<tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the expression's type either matches the specified
4842matcher, or is a pointer to a type that matches the InnerMatcher.
4843</pre></td></tr>
4844
4845
4846<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>
4847<tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overridden by the given method. This matcher may
4848produce multiple matches.
4849
4850Given
4851  class A { virtual void f(); };
4852  class B : public A { void f(); };
4853  class C : public B { void f(); };
4854cxxMethodDecl(ofClass(hasName("C")),
4855              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4856  matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
4857  that B::f is not overridden by C::f).
4858
4859The check can produce multiple matches in case of multiple inheritance, e.g.
4860  class A1 { virtual void f(); };
4861  class A2 { virtual void f(); };
4862  class C : public A1, public A2 { void f(); };
4863cxxMethodDecl(ofClass(hasName("C")),
4864              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4865  matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
4866  once with "b" binding "A2::f" and "d" binding "C::f".
4867</pre></td></tr>
4868
4869
4870<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>
4871<tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
4872belongs to.
4873
4874FIXME: Generalize this for other kinds of declarations.
4875FIXME: What other kind of declarations would we need to generalize
4876this to?
4877
4878Example matches A() in the last line
4879    (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
4880        ofClass(hasName("A"))))))
4881  class A {
4882   public:
4883    A();
4884  };
4885  A a = A();
4886</pre></td></tr>
4887
4888
4889<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>
4890<tr><td colspan="4" class="doc" id="hasArraySize0"><pre>Matches array new expressions with a given array size.
4891
4892Given:
4893  MyClass *p1 = new MyClass[10];
4894cxxNewExpr(hasArraySize(intgerLiteral(equals(10))))
4895  matches the expression 'new MyClass[10]'.
4896</pre></td></tr>
4897
4898
4899<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>
4900<tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
4901matches the given matcher.
4902
4903The associated declaration is:
4904- for type nodes, the declaration of the underlying type
4905- for CallExpr, the declaration of the callee
4906- for MemberExpr, the declaration of the referenced member
4907- for CXXConstructExpr, the declaration of the constructor
4908- for CXXNewExpr, the declaration of the operator new
4909- for ObjCIvarExpr, the declaration of the ivar
4910
4911For type nodes, hasDeclaration will generally match the declaration of the
4912sugared type. Given
4913  class X {};
4914  typedef X Y;
4915  Y y;
4916in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4917typedefDecl. A common use case is to match the underlying, desugared type.
4918This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4919  varDecl(hasType(hasUnqualifiedDesugaredType(
4920      recordType(hasDeclaration(decl())))))
4921In this matcher, the decl will match the CXXRecordDecl of class X.
4922
4923Usable 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;,
4924  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;,
4925  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;,
4926  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;,
4927  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;,
4928  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;,
4929  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4930</pre></td></tr>
4931
4932
4933<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>
4934<tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
4935
4936Given:
4937  class A { void func(); };
4938  class B { void member(); };
4939
4940cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
4941A but not B.
4942</pre></td></tr>
4943
4944
4945<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>
4946<tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from
4947a class matching Base.
4948
4949Note that a class is not considered to be derived from itself.
4950
4951Example matches Y, Z, C (Base == hasName("X"))
4952  class X;
4953  class Y : public X {};  directly derived
4954  class Z : public Y {};  indirectly derived
4955  typedef X A;
4956  typedef A B;
4957  class C : public B {};  derived from a typedef of X
4958
4959In the following example, Bar matches isDerivedFrom(hasName("X")):
4960  class Foo;
4961  typedef Foo X;
4962  class Bar : public Foo {};  derived from a type that X is a typedef of
4963</pre></td></tr>
4964
4965
4966<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>
4967<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
4968match Base.
4969</pre></td></tr>
4970
4971
4972<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>
4973<tr><td colspan="4" class="doc" id="hasAnyArgument2"><pre>Matches any argument of a call expression or a constructor call
4974expression, or an ObjC-message-send expression.
4975
4976Given
4977  void x(int, int, int) { int y; x(1, y, 42); }
4978callExpr(hasAnyArgument(declRefExpr()))
4979  matches x(1, y, 42)
4980with hasAnyArgument(...)
4981  matching y
4982
4983For ObjectiveC, given
4984  @interface I - (void) f:(int) y; @end
4985  void foo(I *i) { [i f:12]; }
4986objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
4987  matches [i f:12]
4988</pre></td></tr>
4989
4990
4991<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>
4992<tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
4993given matcher.
4994
4995Example matches y.x() (matcher = callExpr(callee(
4996                                   cxxMethodDecl(hasName("x")))))
4997  class Y { public: void x(); };
4998  void z() { Y y; y.x(); }
4999</pre></td></tr>
5000
5001
5002<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>
5003<tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches.
5004
5005Given
5006  class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
5007  void f() { f(); }
5008callExpr(callee(expr()))
5009  matches this-&gt;x(), x(), y.x(), f()
5010with callee(...)
5011  matching this-&gt;x, x, y.x, f respectively
5012
5013Note: Callee cannot take the more general internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
5014because this introduces ambiguous overloads with calls to Callee taking a
5015internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
5016implemented in terms of implicit casts.
5017</pre></td></tr>
5018
5019
5020<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>
5021<tr><td colspan="4" class="doc" id="forEachArgumentWithParam0"><pre>Matches all arguments and their respective ParmVarDecl.
5022
5023Given
5024  void f(int i);
5025  int y;
5026  f(y);
5027callExpr(
5028  forEachArgumentWithParam(
5029    declRefExpr(to(varDecl(hasName("y")))),
5030    parmVarDecl(hasType(isInteger()))
5031))
5032  matches f(y);
5033with declRefExpr(...)
5034  matching int y
5035and parmVarDecl(...)
5036  matching int i
5037</pre></td></tr>
5038
5039
5040<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>
5041<tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
5042expression, or an ObjC-message-send expression.
5043
5044Given
5045  void x(int, int, int) { int y; x(1, y, 42); }
5046callExpr(hasAnyArgument(declRefExpr()))
5047  matches x(1, y, 42)
5048with hasAnyArgument(...)
5049  matching y
5050
5051For ObjectiveC, given
5052  @interface I - (void) f:(int) y; @end
5053  void foo(I *i) { [i f:12]; }
5054objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
5055  matches [i f:12]
5056</pre></td></tr>
5057
5058
5059<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>
5060<tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
5061call expression.
5062
5063Example matches y in x(y)
5064    (matcher = callExpr(hasArgument(0, declRefExpr())))
5065  void x(int) { int y; x(y); }
5066</pre></td></tr>
5067
5068
5069<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>
5070<tr><td colspan="4" class="doc" id="hasDeclaration14"><pre>Matches a node if the declaration associated with that node
5071matches the given matcher.
5072
5073The associated declaration is:
5074- for type nodes, the declaration of the underlying type
5075- for CallExpr, the declaration of the callee
5076- for MemberExpr, the declaration of the referenced member
5077- for CXXConstructExpr, the declaration of the constructor
5078- for CXXNewExpr, the declaration of the operator new
5079- for ObjCIvarExpr, the declaration of the ivar
5080
5081For type nodes, hasDeclaration will generally match the declaration of the
5082sugared type. Given
5083  class X {};
5084  typedef X Y;
5085  Y y;
5086in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5087typedefDecl. A common use case is to match the underlying, desugared type.
5088This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5089  varDecl(hasType(hasUnqualifiedDesugaredType(
5090      recordType(hasDeclaration(decl())))))
5091In this matcher, the decl will match the CXXRecordDecl of class X.
5092
5093Usable 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;,
5094  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;,
5095  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;,
5096  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;,
5097  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;,
5098  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;,
5099  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5100</pre></td></tr>
5101
5102
5103<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>
5104<tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
5105extension, matches the constant given in the statement.
5106
5107Given
5108  switch (1) { case 1: case 1+1: case 3 ... 4: ; }
5109caseStmt(hasCaseConstant(integerLiteral()))
5110  matches "case 1:"
5111</pre></td></tr>
5112
5113
5114<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>
5115<tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression
5116or opaque value's source expression matches the given matcher.
5117
5118Example 1: matches "a string"
5119(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
5120class URL { URL(string); };
5121URL url = "a string";
5122
5123Example 2: matches 'b' (matcher =
5124opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
5125int a = b ?: 1;
5126</pre></td></tr>
5127
5128
5129<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>
5130<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5131functionDecl that have at least one TemplateArgument matching the given
5132InnerMatcher.
5133
5134Given
5135  template&lt;typename T&gt; class A {};
5136  template&lt;&gt; class A&lt;double&gt; {};
5137  A&lt;int&gt; a;
5138
5139  template&lt;typename T&gt; f() {};
5140  void func() { f&lt;int&gt;(); };
5141
5142classTemplateSpecializationDecl(hasAnyTemplateArgument(
5143    refersToType(asString("int"))))
5144  matches the specialization A&lt;int&gt;
5145
5146functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
5147  matches the specialization f&lt;int&gt;
5148</pre></td></tr>
5149
5150
5151<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>
5152<tr><td colspan="4" class="doc" id="hasSpecializedTemplate0"><pre>Matches the specialized template of a specialization declaration.
5153
5154Given
5155  tempalate&lt;typename T&gt; class A {};
5156  typedef A&lt;int&gt; B;
5157classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl()))
5158  matches 'B' with classTemplateDecl() matching the class template
5159  declaration of 'A'.
5160</pre></td></tr>
5161
5162
5163<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>
5164<tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5165functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
5166
5167Given
5168  template&lt;typename T, typename U&gt; class A {};
5169  A&lt;bool, int&gt; b;
5170  A&lt;int, bool&gt; c;
5171
5172  template&lt;typename T&gt; void f() {}
5173  void func() { f&lt;int&gt;(); };
5174classTemplateSpecializationDecl(hasTemplateArgument(
5175    1, refersToType(asString("int"))))
5176  matches the specialization A&lt;bool, int&gt;
5177
5178functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
5179  matches the specialization f&lt;int&gt;
5180</pre></td></tr>
5181
5182
5183<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>
5184<tr><td colspan="4" class="doc" id="hasElementTypeLoc1"><pre>Matches arrays and C99 complex types that have a specific element
5185type.
5186
5187Given
5188  struct A {};
5189  A a[7];
5190  int b[7];
5191arrayType(hasElementType(builtinType()))
5192  matches "int b[7]"
5193
5194Usable 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;
5195</pre></td></tr>
5196
5197
5198<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>
5199<tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
5200type.
5201
5202Given
5203  struct A {};
5204  A a[7];
5205  int b[7];
5206arrayType(hasElementType(builtinType()))
5207  matches "int b[7]"
5208
5209Usable 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;
5210</pre></td></tr>
5211
5212
5213<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>
5214<tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
5215a given matcher. Also matches StmtExprs that have CompoundStmt as children.
5216
5217Given
5218  { {}; 1+2; }
5219hasAnySubstatement(compoundStmt())
5220  matches '{ {}; 1+2; }'
5221with compoundStmt()
5222  matching '{}'
5223</pre></td></tr>
5224
5225
5226<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>
5227<tr><td colspan="4" class="doc" id="hasDecayedType0"><pre>Matches the decayed type, whos decayed type matches InnerMatcher
5228</pre></td></tr>
5229
5230
5231<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>
5232<tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
5233matches the given matcher.
5234
5235The associated declaration is:
5236- for type nodes, the declaration of the underlying type
5237- for CallExpr, the declaration of the callee
5238- for MemberExpr, the declaration of the referenced member
5239- for CXXConstructExpr, the declaration of the constructor
5240- for CXXNewExpr, the declaration of the operator new
5241- for ObjCIvarExpr, the declaration of the ivar
5242
5243For type nodes, hasDeclaration will generally match the declaration of the
5244sugared type. Given
5245  class X {};
5246  typedef X Y;
5247  Y y;
5248in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5249typedefDecl. A common use case is to match the underlying, desugared type.
5250This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5251  varDecl(hasType(hasUnqualifiedDesugaredType(
5252      recordType(hasDeclaration(decl())))))
5253In this matcher, the decl will match the CXXRecordDecl of class X.
5254
5255Usable 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;,
5256  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;,
5257  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;,
5258  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;,
5259  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;,
5260  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;,
5261  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5262</pre></td></tr>
5263
5264
5265<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>
5266<tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a
5267specific using shadow declaration.
5268
5269Given
5270  namespace a { void f() {} }
5271  using a::f;
5272  void g() {
5273    f();     Matches this ..
5274    a::f();  .. but not this.
5275  }
5276declRefExpr(throughUsingDecl(anything()))
5277  matches f()
5278</pre></td></tr>
5279
5280
5281<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>
5282<tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
5283specified matcher.
5284
5285Example matches x in if(x)
5286    (matcher = declRefExpr(to(varDecl(hasName("x")))))
5287  bool x;
5288  if (x) {}
5289</pre></td></tr>
5290
5291
5292<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>
5293<tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
5294
5295Note that this does not work for global declarations because the AST
5296breaks up multiple-declaration DeclStmt's into multiple single-declaration
5297DeclStmt's.
5298Example: Given non-global declarations
5299  int a, b = 0;
5300  int c;
5301  int d = 2, e;
5302declStmt(containsDeclaration(
5303      0, varDecl(hasInitializer(anything()))))
5304  matches only 'int d = 2, e;', and
5305declStmt(containsDeclaration(1, varDecl()))
5306  matches 'int a, b = 0' as well as 'int d = 2, e;'
5307  but 'int c;' is not matched.
5308</pre></td></tr>
5309
5310
5311<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>
5312<tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
5313
5314Given
5315  int a, b;
5316  int c;
5317declStmt(hasSingleDecl(anything()))
5318  matches 'int c;' but not 'int a, b;'.
5319</pre></td></tr>
5320
5321
5322<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>
5323<tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches
5324the inner matcher.
5325
5326Given
5327  int x;
5328declaratorDecl(hasTypeLoc(loc(asString("int"))))
5329  matches int x
5330</pre></td></tr>
5331
5332
5333<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>
5334<tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
5335Decl, matches InnerMatcher.
5336
5337Given
5338  namespace N {
5339    namespace M {
5340      class D {};
5341    }
5342  }
5343
5344cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
5345declaration of class D.
5346</pre></td></tr>
5347
5348
5349<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>
5350<tr><td colspan="4" class="doc" id="hasUnderlyingType0"><pre>Matches DecltypeType nodes to find out the underlying type.
5351
5352Given
5353  decltype(1) a = 1;
5354  decltype(2.0) b = 2.0;
5355decltypeType(hasUnderlyingType(isInteger()))
5356  matches "auto a"
5357
5358Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;
5359</pre></td></tr>
5360
5361
5362<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>
5363<tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', 'do while' statement or a function
5364definition that has a given body.
5365
5366Given
5367  for (;;) {}
5368hasBody(compoundStmt())
5369  matches 'for (;;) {}'
5370with compoundStmt()
5371  matching '{}'
5372</pre></td></tr>
5373
5374
5375<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>
5376<tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
5377switch statement or conditional operator.
5378
5379Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5380  if (true) {}
5381</pre></td></tr>
5382
5383
5384<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>
5385<tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
5386matches InnerMatcher if the qualifier exists.
5387
5388Given
5389  namespace N {
5390    namespace M {
5391      class D {};
5392    }
5393  }
5394  N::M::D d;
5395
5396elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
5397matches the type of the variable declaration of d.
5398</pre></td></tr>
5399
5400
5401<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>
5402<tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
5403
5404Given
5405  namespace N {
5406    namespace M {
5407      class D {};
5408    }
5409  }
5410  N::M::D d;
5411
5412elaboratedType(namesType(recordType(
5413hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
5414declaration of d.
5415</pre></td></tr>
5416
5417
5418<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>
5419<tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
5420matches the given matcher.
5421
5422The associated declaration is:
5423- for type nodes, the declaration of the underlying type
5424- for CallExpr, the declaration of the callee
5425- for MemberExpr, the declaration of the referenced member
5426- for CXXConstructExpr, the declaration of the constructor
5427- for CXXNewExpr, the declaration of the operator new
5428- for ObjCIvarExpr, the declaration of the ivar
5429
5430For type nodes, hasDeclaration will generally match the declaration of the
5431sugared type. Given
5432  class X {};
5433  typedef X Y;
5434  Y y;
5435in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5436typedefDecl. A common use case is to match the underlying, desugared type.
5437This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5438  varDecl(hasType(hasUnqualifiedDesugaredType(
5439      recordType(hasDeclaration(decl())))))
5440In this matcher, the decl will match the CXXRecordDecl of class X.
5441
5442Usable 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;,
5443  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;,
5444  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;,
5445  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;,
5446  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;,
5447  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;,
5448  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5449</pre></td></tr>
5450
5451
5452<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>
5453<tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
5454
5455(Note: Clang's AST refers to other conversions as "casts" too, and calls
5456actual casts "explicit" casts.)
5457</pre></td></tr>
5458
5459
5460<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>
5461<tr><td colspan="4" class="doc" id="hasType4"><pre>Overloaded to match the declaration of the expression's or value
5462declaration's type.
5463
5464In case of a value declaration (for example a variable declaration),
5465this resolves one layer of indirection. For example, in the value
5466declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5467X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5468declaration of x.
5469
5470Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5471            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5472            and friend class X (matcher = friendDecl(hasType("X"))
5473 class X {};
5474 void y(X &amp;x) { x; X z; }
5475 class Y { friend class X; };
5476
5477Usable 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;
5478</pre></td></tr>
5479
5480
5481<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>
5482<tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
5483matcher.
5484
5485Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5486            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5487            and U (matcher = typedefDecl(hasType(asString("int")))
5488            and friend class X (matcher = friendDecl(hasType("X"))
5489 class X {};
5490 void y(X &amp;x) { x; X z; }
5491 typedef int U;
5492 class Y { friend class X; };
5493</pre></td></tr>
5494
5495
5496<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>
5497<tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
5498are stripped off.
5499
5500Parentheses and explicit casts are not discarded.
5501Given
5502  int arr[5];
5503  int a = 0;
5504  char b = 0;
5505  const int c = a;
5506  int *d = arr;
5507  long e = (long) 0l;
5508The matchers
5509   varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
5510   varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
5511would match the declarations for a, b, c, and d, but not e.
5512While
5513   varDecl(hasInitializer(integerLiteral()))
5514   varDecl(hasInitializer(declRefExpr()))
5515only match the declarations for b, c, and d.
5516</pre></td></tr>
5517
5518
5519<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>
5520<tr><td colspan="4" class="doc" id="ignoringImplicit0"><pre>Matches expressions that match InnerMatcher after any implicit AST
5521nodes are stripped off.
5522
5523Parentheses and explicit casts are not discarded.
5524Given
5525  class C {};
5526  C a = C();
5527  C b;
5528  C c = b;
5529The matchers
5530   varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr())))
5531would match the declarations for a, b, and c.
5532While
5533   varDecl(hasInitializer(cxxConstructExpr()))
5534only match the declarations for b and c.
5535</pre></td></tr>
5536
5537
5538<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>
5539<tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
5540casts are stripped off.
5541
5542Implicit and non-C Style casts are also discarded.
5543Given
5544  int a = 0;
5545  char b = (0);
5546  void* c = reinterpret_cast&lt;char*&gt;(0);
5547  char d = char(0);
5548The matcher
5549   varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
5550would match the declarations for a, b, c, and d.
5551while
5552   varDecl(hasInitializer(integerLiteral()))
5553only match the declaration for a.
5554</pre></td></tr>
5555
5556
5557<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>
5558<tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
5559parentheses are stripped off.
5560
5561Explicit casts are not discarded.
5562Given
5563  int arr[5];
5564  int a = 0;
5565  char b = (0);
5566  const int c = a;
5567  int *d = (arr);
5568  long e = ((long) 0l);
5569The matchers
5570   varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
5571   varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
5572would match the declarations for a, b, c, and d, but not e.
5573while
5574   varDecl(hasInitializer(integerLiteral()))
5575   varDecl(hasInitializer(declRefExpr()))
5576would only match the declaration for a.
5577</pre></td></tr>
5578
5579
5580<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>
5581<tr><td colspan="4" class="doc" id="hasInClassInitializer0"><pre>Matches non-static data members that have an in-class initializer.
5582
5583Given
5584  class C {
5585    int a = 2;
5586    int b = 3;
5587    int c;
5588  };
5589fieldDecl(hasInClassInitializer(integerLiteral(equals(2))))
5590  matches 'int a;' but not 'int b;'.
5591fieldDecl(hasInClassInitializer(anything()))
5592  matches 'int a;' and 'int b;' but not 'int c;'.
5593</pre></td></tr>
5594
5595
5596<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>
5597<tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', 'do while' statement or a function
5598definition that has a given body.
5599
5600Given
5601  for (;;) {}
5602hasBody(compoundStmt())
5603  matches 'for (;;) {}'
5604with compoundStmt()
5605  matching '{}'
5606</pre></td></tr>
5607
5608
5609<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>
5610<tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
5611switch statement or conditional operator.
5612
5613Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5614  if (true) {}
5615</pre></td></tr>
5616
5617
5618<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>
5619<tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
5620
5621Example:
5622    forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
5623matches '++x' in
5624    for (x; x &lt; N; ++x) { }
5625</pre></td></tr>
5626
5627
5628<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>
5629<tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
5630
5631Example:
5632    forStmt(hasLoopInit(declStmt()))
5633matches 'int x = 0' in
5634    for (int x = 0; x &lt; N; ++x) { }
5635</pre></td></tr>
5636
5637
5638<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>
5639<tr><td colspan="4" class="doc" id="hasType5"><pre>Overloaded to match the declaration of the expression's or value
5640declaration's type.
5641
5642In case of a value declaration (for example a variable declaration),
5643this resolves one layer of indirection. For example, in the value
5644declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5645X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5646declaration of x.
5647
5648Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5649            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5650            and friend class X (matcher = friendDecl(hasType("X"))
5651 class X {};
5652 void y(X &amp;x) { x; X z; }
5653 class Y { friend class X; };
5654
5655Usable 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;
5656</pre></td></tr>
5657
5658
5659<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>
5660<tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
5661matcher.
5662
5663Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5664            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5665            and U (matcher = typedefDecl(hasType(asString("int")))
5666            and friend class X (matcher = friendDecl(hasType("X"))
5667 class X {};
5668 void y(X &amp;x) { x; X z; }
5669 typedef int U;
5670 class Y { friend class X; };
5671</pre></td></tr>
5672
5673
5674<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>
5675<tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function or an ObjC method declaration or a
5676block.
5677
5678Does not match the 'this' parameter of a method.
5679
5680Given
5681  class X { void f(int x, int y, int z) {} };
5682cxxMethodDecl(hasAnyParameter(hasName("y")))
5683  matches f(int x, int y, int z) {}
5684with hasAnyParameter(...)
5685  matching int y
5686
5687For ObjectiveC, given
5688  @interface I - (void) f:(int) y; @end
5689
5690the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
5691matches the declaration of method f with hasParameter
5692matching y.
5693
5694For blocks, given
5695  b = ^(int y) { printf("%d", y) };
5696
5697the matcher blockDecl(hasAnyParameter(hasName("y")))
5698matches the declaration of the block b with hasParameter
5699matching y.
5700</pre></td></tr>
5701
5702
5703<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>
5704<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5705functionDecl that have at least one TemplateArgument matching the given
5706InnerMatcher.
5707
5708Given
5709  template&lt;typename T&gt; class A {};
5710  template&lt;&gt; class A&lt;double&gt; {};
5711  A&lt;int&gt; a;
5712
5713  template&lt;typename T&gt; f() {};
5714  void func() { f&lt;int&gt;(); };
5715
5716classTemplateSpecializationDecl(hasAnyTemplateArgument(
5717    refersToType(asString("int"))))
5718  matches the specialization A&lt;int&gt;
5719
5720functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
5721  matches the specialization f&lt;int&gt;
5722</pre></td></tr>
5723
5724
5725<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>
5726<tr><td colspan="4" class="doc" id="hasBody4"><pre>Matches a 'for', 'while', 'do while' statement or a function
5727definition that has a given body.
5728
5729Given
5730  for (;;) {}
5731hasBody(compoundStmt())
5732  matches 'for (;;) {}'
5733with compoundStmt()
5734  matching '{}'
5735</pre></td></tr>
5736
5737
5738<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>
5739<tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function or an ObjC method
5740declaration or a block.
5741
5742Given
5743  class X { void f(int x) {} };
5744cxxMethodDecl(hasParameter(0, hasType(varDecl())))
5745  matches f(int x) {}
5746with hasParameter(...)
5747  matching int x
5748
5749For ObjectiveC, given
5750  @interface I - (void) f:(int) y; @end
5751
5752the matcher objcMethodDecl(hasParameter(0, hasName("y")))
5753matches the declaration of method f with hasParameter
5754matching y.
5755</pre></td></tr>
5756
5757
5758<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>
5759<tr><td colspan="4" class="doc" id="hasTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5760functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
5761
5762Given
5763  template&lt;typename T, typename U&gt; class A {};
5764  A&lt;bool, int&gt; b;
5765  A&lt;int, bool&gt; c;
5766
5767  template&lt;typename T&gt; void f() {}
5768  void func() { f&lt;int&gt;(); };
5769classTemplateSpecializationDecl(hasTemplateArgument(
5770    1, refersToType(asString("int"))))
5771  matches the specialization A&lt;bool, int&gt;
5772
5773functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
5774  matches the specialization f&lt;int&gt;
5775</pre></td></tr>
5776
5777
5778<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>
5779<tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
5780
5781Given:
5782  class X { int f() { return 1; } };
5783cxxMethodDecl(returns(asString("int")))
5784  matches int f() { return 1; }
5785</pre></td></tr>
5786
5787
5788<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>
5789<tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
5790switch statement or conditional operator.
5791
5792Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5793  if (true) {}
5794</pre></td></tr>
5795
5796
5797<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>
5798<tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
5799
5800Given
5801  if (A* a = GetAPointer()) {}
5802hasConditionVariableStatement(...)
5803  matches 'A* a = GetAPointer()'.
5804</pre></td></tr>
5805
5806
5807<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>
5808<tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
5809
5810Examples matches the if statement
5811  (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
5812  if (false) false; else true;
5813</pre></td></tr>
5814
5815
5816<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>
5817<tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
5818
5819Examples matches the if statement
5820  (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
5821  if (false) true; else false;
5822</pre></td></tr>
5823
5824
5825<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>
5826<tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
5827matcher.
5828
5829FIXME: Unit test this matcher
5830</pre></td></tr>
5831
5832
5833<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>
5834<tr><td colspan="4" class="doc" id="hasSyntacticForm0"><pre>Matches the syntactic form of init list expressions
5835(if expression have it).
5836</pre></td></tr>
5837
5838
5839<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>
5840<tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
5841matches the given matcher.
5842
5843The associated declaration is:
5844- for type nodes, the declaration of the underlying type
5845- for CallExpr, the declaration of the callee
5846- for MemberExpr, the declaration of the referenced member
5847- for CXXConstructExpr, the declaration of the constructor
5848- for CXXNewExpr, the declaration of the operator new
5849- for ObjCIvarExpr, the declaration of the ivar
5850
5851For type nodes, hasDeclaration will generally match the declaration of the
5852sugared type. Given
5853  class X {};
5854  typedef X Y;
5855  Y y;
5856in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5857typedefDecl. A common use case is to match the underlying, desugared type.
5858This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5859  varDecl(hasType(hasUnqualifiedDesugaredType(
5860      recordType(hasDeclaration(decl())))))
5861In this matcher, the decl will match the CXXRecordDecl of class X.
5862
5863Usable 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;,
5864  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;,
5865  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;,
5866  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;,
5867  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;,
5868  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;,
5869  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5870</pre></td></tr>
5871
5872
5873<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>
5874<tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
5875matches the given matcher.
5876
5877The associated declaration is:
5878- for type nodes, the declaration of the underlying type
5879- for CallExpr, the declaration of the callee
5880- for MemberExpr, the declaration of the referenced member
5881- for CXXConstructExpr, the declaration of the constructor
5882- for CXXNewExpr, the declaration of the operator new
5883- for ObjCIvarExpr, the declaration of the ivar
5884
5885For type nodes, hasDeclaration will generally match the declaration of the
5886sugared type. Given
5887  class X {};
5888  typedef X Y;
5889  Y y;
5890in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5891typedefDecl. A common use case is to match the underlying, desugared type.
5892This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5893  varDecl(hasType(hasUnqualifiedDesugaredType(
5894      recordType(hasDeclaration(decl())))))
5895In this matcher, the decl will match the CXXRecordDecl of class X.
5896
5897Usable 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;,
5898  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;,
5899  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;,
5900  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;,
5901  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;,
5902  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;,
5903  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5904</pre></td></tr>
5905
5906
5907<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>
5908<tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
5909matches the given matcher.
5910
5911The associated declaration is:
5912- for type nodes, the declaration of the underlying type
5913- for CallExpr, the declaration of the callee
5914- for MemberExpr, the declaration of the referenced member
5915- for CXXConstructExpr, the declaration of the constructor
5916- for CXXNewExpr, the declaration of the operator new
5917- for ObjCIvarExpr, the declaration of the ivar
5918
5919For type nodes, hasDeclaration will generally match the declaration of the
5920sugared type. Given
5921  class X {};
5922  typedef X Y;
5923  Y y;
5924in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5925typedefDecl. A common use case is to match the underlying, desugared type.
5926This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5927  varDecl(hasType(hasUnqualifiedDesugaredType(
5928      recordType(hasDeclaration(decl())))))
5929In this matcher, the decl will match the CXXRecordDecl of class X.
5930
5931Usable 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;,
5932  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;,
5933  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;,
5934  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;,
5935  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;,
5936  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;,
5937  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5938</pre></td></tr>
5939
5940
5941<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>
5942<tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is
5943matched by a given matcher.
5944
5945Given
5946  struct X { int m; };
5947  void f(X x) { x.m; m; }
5948memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
5949  matches "x.m" and "m"
5950with hasObjectExpression(...)
5951  matching "x" and the implicit object expression of "m" which has type X*.
5952</pre></td></tr>
5953
5954
5955<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>
5956<tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
5957given matcher.
5958
5959Given
5960  struct { int first, second; } first, second;
5961  int i(second.first);
5962  int j(first.second);
5963memberExpr(member(hasName("first")))
5964  matches second.first
5965  but not first.second (because the member name there is "second").
5966</pre></td></tr>
5967
5968
5969<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>
5970<tr><td colspan="4" class="doc" id="pointeeLoc1"><pre>Narrows PointerType (and similar) matchers to those where the
5971pointee matches a given matcher.
5972
5973Given
5974  int *a;
5975  int const *b;
5976  float const *f;
5977pointerType(pointee(isConstQualified(), isInteger()))
5978  matches "int const *b"
5979
5980Usable 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;,
5981  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;
5982</pre></td></tr>
5983
5984
5985<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>
5986<tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
5987pointee matches a given matcher.
5988
5989Given
5990  int *a;
5991  int const *b;
5992  float const *f;
5993pointerType(pointee(isConstQualified(), isInteger()))
5994  matches "int const *b"
5995
5996Usable 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;,
5997  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;
5998</pre></td></tr>
5999
6000
6001<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>
6002<tr><td colspan="4" class="doc" id="hasUnderlyingDecl0"><pre>Matches a NamedDecl whose underlying declaration matches the given
6003matcher.
6004
6005Given
6006  namespace N { template&lt;class T&gt; void f(T t); }
6007  template &lt;class T&gt; void g() { using N::f; f(T()); }
6008unresolvedLookupExpr(hasAnyDeclaration(
6009    namedDecl(hasUnderlyingDecl(hasName("::N::f")))))
6010  matches the use of f in g() .
6011</pre></td></tr>
6012
6013
6014<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>
6015<tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
6016
6017Given
6018  struct A { struct B { struct C {}; }; };
6019  A::B::C c;
6020nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
6021  matches "A::"
6022</pre></td></tr>
6023
6024
6025<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>
6026<tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
6027given TypeLoc.
6028
6029Given
6030  struct A { struct B { struct C {}; }; };
6031  A::B::C c;
6032nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
6033  hasDeclaration(cxxRecordDecl(hasName("A")))))))
6034  matches "A::"
6035</pre></td></tr>
6036
6037
6038<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>
6039<tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
6040
6041Given
6042  struct A { struct B { struct C {}; }; };
6043  A::B::C c;
6044nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
6045  matches "A::"
6046</pre></td></tr>
6047
6048
6049<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>
6050<tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
6051given namespace matcher.
6052
6053Given
6054  namespace ns { struct A {}; }
6055  ns::A a;
6056nestedNameSpecifier(specifiesNamespace(hasName("ns")))
6057  matches "ns::"
6058</pre></td></tr>
6059
6060
6061<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>
6062<tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
6063given QualType matcher without qualifiers.
6064
6065Given
6066  struct A { struct B { struct C {}; }; };
6067  A::B::C c;
6068nestedNameSpecifier(specifiesType(
6069  hasDeclaration(cxxRecordDecl(hasName("A")))
6070))
6071  matches "A::"
6072</pre></td></tr>
6073
6074
6075<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>
6076<tr><td colspan="4" class="doc" id="hasAnyArgument3"><pre>Matches any argument of a call expression or a constructor call
6077expression, or an ObjC-message-send expression.
6078
6079Given
6080  void x(int, int, int) { int y; x(1, y, 42); }
6081callExpr(hasAnyArgument(declRefExpr()))
6082  matches x(1, y, 42)
6083with hasAnyArgument(...)
6084  matching y
6085
6086For ObjectiveC, given
6087  @interface I - (void) f:(int) y; @end
6088  void foo(I *i) { [i f:12]; }
6089objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
6090  matches [i f:12]
6091</pre></td></tr>
6092
6093
6094<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>
6095<tr><td colspan="4" class="doc" id="hasArgument2"><pre>Matches the n'th argument of a call expression or a constructor
6096call expression.
6097
6098Example matches y in x(y)
6099    (matcher = callExpr(hasArgument(0, declRefExpr())))
6100  void x(int) { int y; x(y); }
6101</pre></td></tr>
6102
6103
6104<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>
6105<tr><td colspan="4" class="doc" id="hasReceiver0"><pre>Matches if the Objective-C message is sent to an instance,
6106and the inner matcher matches on that instance.
6107
6108For example the method call in
6109  NSString *x = @"hello";
6110  [x containsString:@"h"];
6111is matched by
6112objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
6113</pre></td></tr>
6114
6115
6116<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>
6117<tr><td colspan="4" class="doc" id="hasReceiverType0"><pre>Matches on the receiver of an ObjectiveC Message expression.
6118
6119Example
6120matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *")));
6121matches the [webView ...] message invocation.
6122  NSString *webViewJavaScript = ...
6123  UIWebView *webView = ...
6124  [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
6125</pre></td></tr>
6126
6127
6128<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>
6129<tr><td colspan="4" class="doc" id="hasAnyParameter1"><pre>Matches any parameter of a function or an ObjC method declaration or a
6130block.
6131
6132Does not match the 'this' parameter of a method.
6133
6134Given
6135  class X { void f(int x, int y, int z) {} };
6136cxxMethodDecl(hasAnyParameter(hasName("y")))
6137  matches f(int x, int y, int z) {}
6138with hasAnyParameter(...)
6139  matching int y
6140
6141For ObjectiveC, given
6142  @interface I - (void) f:(int) y; @end
6143
6144the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
6145matches the declaration of method f with hasParameter
6146matching y.
6147
6148For blocks, given
6149  b = ^(int y) { printf("%d", y) };
6150
6151the matcher blockDecl(hasAnyParameter(hasName("y")))
6152matches the declaration of the block b with hasParameter
6153matching y.
6154</pre></td></tr>
6155
6156
6157<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>
6158<tr><td colspan="4" class="doc" id="hasParameter1"><pre>Matches the n'th parameter of a function or an ObjC method
6159declaration or a block.
6160
6161Given
6162  class X { void f(int x) {} };
6163cxxMethodDecl(hasParameter(0, hasType(varDecl())))
6164  matches f(int x) {}
6165with hasParameter(...)
6166  matching int x
6167
6168For ObjectiveC, given
6169  @interface I - (void) f:(int) y; @end
6170
6171the matcher objcMethodDecl(hasParameter(0, hasName("y")))
6172matches the declaration of method f with hasParameter
6173matching y.
6174</pre></td></tr>
6175
6176
6177<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>
6178<tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre>Matches if the cast's source expression
6179or opaque value's source expression matches the given matcher.
6180
6181Example 1: matches "a string"
6182(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
6183class URL { URL(string); };
6184URL url = "a string";
6185
6186Example 2: matches 'b' (matcher =
6187opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
6188int a = b ?: 1;
6189</pre></td></tr>
6190
6191
6192<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>
6193<tr><td colspan="4" class="doc" id="hasAnyDeclaration0"><pre>Matches an OverloadExpr if any of the declarations in the set of
6194overloads matches the given matcher.
6195
6196Given
6197  template &lt;typename T&gt; void foo(T);
6198  template &lt;typename T&gt; void bar(T);
6199  template &lt;typename T&gt; void baz(T t) {
6200    foo(t);
6201    bar(t);
6202  }
6203unresolvedLookupExpr(hasAnyDeclaration(
6204    functionTemplateDecl(hasName("foo"))))
6205  matches foo in foo(t); but not bar in bar(t);
6206</pre></td></tr>
6207
6208
6209<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>
6210<tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
6211
6212Given
6213  int (*ptr_to_array)[4];
6214  int (*ptr_to_func)(int);
6215
6216varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
6217ptr_to_func but not ptr_to_array.
6218
6219Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
6220</pre></td></tr>
6221
6222
6223<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>
6224<tr><td colspan="4" class="doc" id="pointeeLoc2"><pre>Narrows PointerType (and similar) matchers to those where the
6225pointee matches a given matcher.
6226
6227Given
6228  int *a;
6229  int const *b;
6230  float const *f;
6231pointerType(pointee(isConstQualified(), isInteger()))
6232  matches "int const *b"
6233
6234Usable 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;,
6235  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;
6236</pre></td></tr>
6237
6238
6239<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>
6240<tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
6241pointee matches a given matcher.
6242
6243Given
6244  int *a;
6245  int const *b;
6246  float const *f;
6247pointerType(pointee(isConstQualified(), isInteger()))
6248  matches "int const *b"
6249
6250Usable 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;,
6251  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;
6252</pre></td></tr>
6253
6254
6255<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>
6256<tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
6257
6258Given:
6259  typedef int &amp;int_ref;
6260  int a;
6261  int_ref b = a;
6262
6263varDecl(hasType(qualType(referenceType()))))) will not match the
6264declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
6265</pre></td></tr>
6266
6267
6268<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>
6269<tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
6270matches the given matcher.
6271
6272The associated declaration is:
6273- for type nodes, the declaration of the underlying type
6274- for CallExpr, the declaration of the callee
6275- for MemberExpr, the declaration of the referenced member
6276- for CXXConstructExpr, the declaration of the constructor
6277- for CXXNewExpr, the declaration of the operator new
6278- for ObjCIvarExpr, the declaration of the ivar
6279
6280For type nodes, hasDeclaration will generally match the declaration of the
6281sugared type. Given
6282  class X {};
6283  typedef X Y;
6284  Y y;
6285in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6286typedefDecl. A common use case is to match the underlying, desugared type.
6287This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6288  varDecl(hasType(hasUnqualifiedDesugaredType(
6289      recordType(hasDeclaration(decl())))))
6290In this matcher, the decl will match the CXXRecordDecl of class X.
6291
6292Usable 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;,
6293  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;,
6294  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;,
6295  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;,
6296  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;,
6297  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;,
6298  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6299</pre></td></tr>
6300
6301
6302<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>
6303<tr><td colspan="4" class="doc" id="ignoringParens0"><pre>Matches types that match InnerMatcher after any parens are stripped.
6304
6305Given
6306  void (*fp)(void);
6307The matcher
6308  varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
6309would match the declaration for fp.
6310</pre></td></tr>
6311
6312
6313<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>
6314<tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
6315</pre></td></tr>
6316
6317
6318<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>
6319<tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
6320matches the specified matcher.
6321
6322Example matches y-&gt;x()
6323  (matcher = cxxMemberCallExpr(on(hasType(pointsTo
6324     cxxRecordDecl(hasName("Y")))))))
6325  class Y { public: void x(); };
6326  void z() { Y *y; y-&gt;x(); }
6327</pre></td></tr>
6328
6329
6330<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>
6331<tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
6332</pre></td></tr>
6333
6334
6335<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>
6336<tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
6337type matches the specified matcher.
6338
6339Example matches X &amp;x and const X &amp;y
6340    (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
6341  class X {
6342    void a(X b) {
6343      X &amp;x = b;
6344      const X &amp;y = b;
6345    }
6346  };
6347</pre></td></tr>
6348
6349
6350<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>
6351<tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
6352matches the given matcher.
6353
6354The associated declaration is:
6355- for type nodes, the declaration of the underlying type
6356- for CallExpr, the declaration of the callee
6357- for MemberExpr, the declaration of the referenced member
6358- for CXXConstructExpr, the declaration of the constructor
6359- for CXXNewExpr, the declaration of the operator new
6360- for ObjCIvarExpr, the declaration of the ivar
6361
6362For type nodes, hasDeclaration will generally match the declaration of the
6363sugared type. Given
6364  class X {};
6365  typedef X Y;
6366  Y y;
6367in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6368typedefDecl. A common use case is to match the underlying, desugared type.
6369This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6370  varDecl(hasType(hasUnqualifiedDesugaredType(
6371      recordType(hasDeclaration(decl())))))
6372In this matcher, the decl will match the CXXRecordDecl of class X.
6373
6374Usable 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;,
6375  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;,
6376  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;,
6377  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;,
6378  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;,
6379  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;,
6380  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6381</pre></td></tr>
6382
6383
6384<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>
6385<tr><td colspan="4" class="doc" id="pointeeLoc3"><pre>Narrows PointerType (and similar) matchers to those where the
6386pointee matches a given matcher.
6387
6388Given
6389  int *a;
6390  int const *b;
6391  float const *f;
6392pointerType(pointee(isConstQualified(), isInteger()))
6393  matches "int const *b"
6394
6395Usable 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;,
6396  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;
6397</pre></td></tr>
6398
6399
6400<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>
6401<tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
6402pointee matches a given matcher.
6403
6404Given
6405  int *a;
6406  int const *b;
6407  float const *f;
6408pointerType(pointee(isConstQualified(), isInteger()))
6409  matches "int const *b"
6410
6411Usable 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;,
6412  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;
6413</pre></td></tr>
6414
6415
6416<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>
6417<tr><td colspan="4" class="doc" id="hasReturnValue0"><pre>Matches the return value expression of a return statement
6418
6419Given
6420  return a + b;
6421hasReturnValue(binaryOperator())
6422  matches 'return a + b'
6423with binaryOperator()
6424  matching 'a + b'
6425</pre></td></tr>
6426
6427
6428<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>
6429<tr><td colspan="4" class="doc" id="hasAnySubstatement1"><pre>Matches compound statements where at least one substatement matches
6430a given matcher. Also matches StmtExprs that have CompoundStmt as children.
6431
6432Given
6433  { {}; 1+2; }
6434hasAnySubstatement(compoundStmt())
6435  matches '{ {}; 1+2; }'
6436with compoundStmt()
6437  matching '{}'
6438</pre></td></tr>
6439
6440
6441<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>
6442<tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
6443alignof.
6444</pre></td></tr>
6445
6446
6447<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>
6448<tr><td colspan="4" class="doc" id="forFunction0"><pre>Matches declaration of the function the statement belongs to
6449
6450Given:
6451F&amp; operator=(const F&amp; o) {
6452  std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
6453  return *this;
6454}
6455returnStmt(forFunction(hasName("operator=")))
6456  matches 'return *this'
6457  but does match 'return &gt; 0'
6458</pre></td></tr>
6459
6460
6461<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>
6462<tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
6463sizeof.
6464</pre></td></tr>
6465
6466
6467<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>
6468<tr><td colspan="4" class="doc" id="hasReplacementType0"><pre>Matches template type parameter substitutions that have a replacement
6469type that matches the provided matcher.
6470
6471Given
6472  template &lt;typename T&gt;
6473  double F(T t);
6474  int i;
6475  double j = F(i);
6476
6477substTemplateTypeParmType(hasReplacementType(type())) matches int
6478</pre></td></tr>
6479
6480
6481<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>
6482<tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
6483statement. This matcher may produce multiple matches.
6484
6485Given
6486  switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
6487switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
6488  matches four times, with "c" binding each of "case 1:", "case 2:",
6489"case 3:" and "case 4:", and "s" respectively binding "switch (1)",
6490"switch (1)", "switch (2)" and "switch (2)".
6491</pre></td></tr>
6492
6493
6494<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>
6495<tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
6496switch statement or conditional operator.
6497
6498Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6499  if (true) {}
6500</pre></td></tr>
6501
6502
6503<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>
6504<tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
6505matches the given matcher.
6506
6507The associated declaration is:
6508- for type nodes, the declaration of the underlying type
6509- for CallExpr, the declaration of the callee
6510- for MemberExpr, the declaration of the referenced member
6511- for CXXConstructExpr, the declaration of the constructor
6512- for CXXNewExpr, the declaration of the operator new
6513- for ObjCIvarExpr, the declaration of the ivar
6514
6515For type nodes, hasDeclaration will generally match the declaration of the
6516sugared type. Given
6517  class X {};
6518  typedef X Y;
6519  Y y;
6520in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6521typedefDecl. A common use case is to match the underlying, desugared type.
6522This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6523  varDecl(hasType(hasUnqualifiedDesugaredType(
6524      recordType(hasDeclaration(decl())))))
6525In this matcher, the decl will match the CXXRecordDecl of class X.
6526
6527Usable 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;,
6528  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;,
6529  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;,
6530  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;,
6531  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;,
6532  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;,
6533  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6534</pre></td></tr>
6535
6536
6537<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>
6538<tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
6539
6540Given
6541  struct B { int next; };
6542  template&lt;int(B::*next_ptr)&gt; struct A {};
6543  A&lt;&amp;B::next&gt; a;
6544templateSpecializationType(hasAnyTemplateArgument(
6545  isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
6546  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
6547    B::next
6548</pre></td></tr>
6549
6550
6551<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>
6552<tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
6553declaration.
6554
6555Given
6556  struct B { int next; };
6557  template&lt;int(B::*next_ptr)&gt; struct A {};
6558  A&lt;&amp;B::next&gt; a;
6559classTemplateSpecializationDecl(hasAnyTemplateArgument(
6560    refersToDeclaration(fieldDecl(hasName("next")))))
6561  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
6562    B::next
6563</pre></td></tr>
6564
6565
6566<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>
6567<tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that referes to an integral type.
6568
6569Given
6570  template&lt;int T&gt; struct C {};
6571  C&lt;42&gt; c;
6572classTemplateSpecializationDecl(
6573  hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
6574  matches the implicit instantiation of C in C&lt;42&gt;.
6575</pre></td></tr>
6576
6577
6578<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>
6579<tr><td colspan="4" class="doc" id="refersToTemplate0"><pre>Matches a TemplateArgument that refers to a certain template.
6580
6581Given
6582  template&lt;template &lt;typename&gt; class S&gt; class X {};
6583  template&lt;typename T&gt; class Y {};"
6584  X&lt;Y&gt; xi;
6585classTemplateSpecializationDecl(hasAnyTemplateArgument(
6586    refersToTemplate(templateName())))
6587  matches the specialization X&lt;Y&gt;
6588</pre></td></tr>
6589
6590
6591<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>
6592<tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
6593
6594Given
6595  struct X {};
6596  template&lt;typename T&gt; struct A {};
6597  A&lt;X&gt; a;
6598classTemplateSpecializationDecl(hasAnyTemplateArgument(
6599    refersToType(class(hasName("X")))))
6600  matches the specialization A&lt;X&gt;
6601</pre></td></tr>
6602
6603
6604<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>
6605<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6606functionDecl that have at least one TemplateArgument matching the given
6607InnerMatcher.
6608
6609Given
6610  template&lt;typename T&gt; class A {};
6611  template&lt;&gt; class A&lt;double&gt; {};
6612  A&lt;int&gt; a;
6613
6614  template&lt;typename T&gt; f() {};
6615  void func() { f&lt;int&gt;(); };
6616
6617classTemplateSpecializationDecl(hasAnyTemplateArgument(
6618    refersToType(asString("int"))))
6619  matches the specialization A&lt;int&gt;
6620
6621functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
6622  matches the specialization f&lt;int&gt;
6623</pre></td></tr>
6624
6625
6626<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>
6627<tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
6628matches the given matcher.
6629
6630The associated declaration is:
6631- for type nodes, the declaration of the underlying type
6632- for CallExpr, the declaration of the callee
6633- for MemberExpr, the declaration of the referenced member
6634- for CXXConstructExpr, the declaration of the constructor
6635- for CXXNewExpr, the declaration of the operator new
6636- for ObjCIvarExpr, the declaration of the ivar
6637
6638For type nodes, hasDeclaration will generally match the declaration of the
6639sugared type. Given
6640  class X {};
6641  typedef X Y;
6642  Y y;
6643in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6644typedefDecl. A common use case is to match the underlying, desugared type.
6645This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6646  varDecl(hasType(hasUnqualifiedDesugaredType(
6647      recordType(hasDeclaration(decl())))))
6648In this matcher, the decl will match the CXXRecordDecl of class X.
6649
6650Usable 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;,
6651  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;,
6652  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;,
6653  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;,
6654  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;,
6655  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;,
6656  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6657</pre></td></tr>
6658
6659
6660<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>
6661<tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6662functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
6663
6664Given
6665  template&lt;typename T, typename U&gt; class A {};
6666  A&lt;bool, int&gt; b;
6667  A&lt;int, bool&gt; c;
6668
6669  template&lt;typename T&gt; void f() {}
6670  void func() { f&lt;int&gt;(); };
6671classTemplateSpecializationDecl(hasTemplateArgument(
6672    1, refersToType(asString("int"))))
6673  matches the specialization A&lt;bool, int&gt;
6674
6675functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
6676  matches the specialization f&lt;int&gt;
6677</pre></td></tr>
6678
6679
6680<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>
6681<tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
6682matches the given matcher.
6683
6684The associated declaration is:
6685- for type nodes, the declaration of the underlying type
6686- for CallExpr, the declaration of the callee
6687- for MemberExpr, the declaration of the referenced member
6688- for CXXConstructExpr, the declaration of the constructor
6689- for CXXNewExpr, the declaration of the operator new
6690- for ObjCIvarExpr, the declaration of the ivar
6691
6692For type nodes, hasDeclaration will generally match the declaration of the
6693sugared type. Given
6694  class X {};
6695  typedef X Y;
6696  Y y;
6697in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6698typedefDecl. A common use case is to match the underlying, desugared type.
6699This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6700  varDecl(hasType(hasUnqualifiedDesugaredType(
6701      recordType(hasDeclaration(decl())))))
6702In this matcher, the decl will match the CXXRecordDecl of class X.
6703
6704Usable 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;,
6705  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;,
6706  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;,
6707  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;,
6708  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;,
6709  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;,
6710  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6711</pre></td></tr>
6712
6713
6714<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>
6715<tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
6716
6717Generates results for each match.
6718
6719For example, in:
6720  class A { class B {}; class C {}; };
6721The matcher:
6722  cxxRecordDecl(hasName("::A"),
6723                findAll(cxxRecordDecl(isDefinition()).bind("m")))
6724will generate results for A, B and C.
6725
6726Usable as: Any Matcher
6727</pre></td></tr>
6728
6729
6730<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>
6731<tr><td colspan="4" class="doc" id="hasType2"><pre>Matches if the expression's or declaration's type matches a type
6732matcher.
6733
6734Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6735            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6736            and U (matcher = typedefDecl(hasType(asString("int")))
6737            and friend class X (matcher = friendDecl(hasType("X"))
6738 class X {};
6739 void y(X &amp;x) { x; X z; }
6740 typedef int U;
6741 class Y { friend class X; };
6742</pre></td></tr>
6743
6744
6745<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>
6746<tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
6747matches the given matcher.
6748
6749The associated declaration is:
6750- for type nodes, the declaration of the underlying type
6751- for CallExpr, the declaration of the callee
6752- for MemberExpr, the declaration of the referenced member
6753- for CXXConstructExpr, the declaration of the constructor
6754- for CXXNewExpr, the declaration of the operator new
6755- for ObjCIvarExpr, the declaration of the ivar
6756
6757For type nodes, hasDeclaration will generally match the declaration of the
6758sugared type. Given
6759  class X {};
6760  typedef X Y;
6761  Y y;
6762in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6763typedefDecl. A common use case is to match the underlying, desugared type.
6764This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6765  varDecl(hasType(hasUnqualifiedDesugaredType(
6766      recordType(hasDeclaration(decl())))))
6767In this matcher, the decl will match the CXXRecordDecl of class X.
6768
6769Usable 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;,
6770  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;,
6771  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;,
6772  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;,
6773  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;,
6774  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;,
6775  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6776</pre></td></tr>
6777
6778
6779<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>
6780<tr><td colspan="4" class="doc" id="hasUnqualifiedDesugaredType0"><pre>Matches if the matched type matches the unqualified desugared
6781type of the matched node.
6782
6783For example, in:
6784  class A {};
6785  using B = A;
6786The matcher type(hasUnqualifiedDesugaredType(recordType())) matches
6787both B and A.
6788</pre></td></tr>
6789
6790
6791<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>
6792<tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
6793
6794Given
6795  int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
6796unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
6797  matches sizeof(a) and alignof(c)
6798</pre></td></tr>
6799
6800
6801<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>
6802<tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
6803
6804Example matches true (matcher = hasUnaryOperand(
6805                                  cxxBoolLiteral(equals(true))))
6806  !true
6807</pre></td></tr>
6808
6809
6810<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>
6811<tr><td colspan="4" class="doc" id="hasObjectExpression1"><pre>Matches a member expression where the object expression is
6812matched by a given matcher.
6813
6814Given
6815  struct X { int m; };
6816  void f(X x) { x.m; m; }
6817memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
6818  matches "x.m" and "m"
6819with hasObjectExpression(...)
6820  matching "x" and the implicit object expression of "m" which has type X*.
6821</pre></td></tr>
6822
6823
6824<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>
6825<tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
6826matches the given matcher.
6827
6828The associated declaration is:
6829- for type nodes, the declaration of the underlying type
6830- for CallExpr, the declaration of the callee
6831- for MemberExpr, the declaration of the referenced member
6832- for CXXConstructExpr, the declaration of the constructor
6833- for CXXNewExpr, the declaration of the operator new
6834- for ObjCIvarExpr, the declaration of the ivar
6835
6836For type nodes, hasDeclaration will generally match the declaration of the
6837sugared type. Given
6838  class X {};
6839  typedef X Y;
6840  Y y;
6841in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6842typedefDecl. A common use case is to match the underlying, desugared type.
6843This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6844  varDecl(hasType(hasUnqualifiedDesugaredType(
6845      recordType(hasDeclaration(decl())))))
6846In this matcher, the decl will match the CXXRecordDecl of class X.
6847
6848Usable 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;,
6849  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;,
6850  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;,
6851  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;,
6852  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;,
6853  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;,
6854  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6855</pre></td></tr>
6856
6857
6858<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>
6859<tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
6860
6861Given
6862  namespace X { void b(); }
6863  using X::b;
6864usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
6865  matches using X::b </pre></td></tr>
6866
6867
6868<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>
6869<tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
6870matched by the given matcher.
6871
6872Given
6873  namespace X { int a; void b(); }
6874  using X::a;
6875  using X::b;
6876usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
6877  matches using X::b but not using X::a </pre></td></tr>
6878
6879
6880<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>
6881<tr><td colspan="4" class="doc" id="hasType6"><pre>Overloaded to match the declaration of the expression's or value
6882declaration's type.
6883
6884In case of a value declaration (for example a variable declaration),
6885this resolves one layer of indirection. For example, in the value
6886declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
6887X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
6888declaration of x.
6889
6890Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6891            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6892            and friend class X (matcher = friendDecl(hasType("X"))
6893 class X {};
6894 void y(X &amp;x) { x; X z; }
6895 class Y { friend class X; };
6896
6897Usable 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;
6898</pre></td></tr>
6899
6900
6901<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>
6902<tr><td colspan="4" class="doc" id="hasType3"><pre>Matches if the expression's or declaration's type matches a type
6903matcher.
6904
6905Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6906            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6907            and U (matcher = typedefDecl(hasType(asString("int")))
6908            and friend class X (matcher = friendDecl(hasType("X"))
6909 class X {};
6910 void y(X &amp;x) { x; X z; }
6911 typedef int U;
6912 class Y { friend class X; };
6913</pre></td></tr>
6914
6915
6916<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>
6917<tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
6918that matches the given matcher.
6919
6920Example matches x (matcher = varDecl(hasInitializer(callExpr())))
6921  bool y() { return true; }
6922  bool x = y();
6923</pre></td></tr>
6924
6925
6926<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>
6927<tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
6928expression.
6929
6930Given
6931  void f(int b) {
6932    int a[b];
6933  }
6934variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
6935  varDecl(hasName("b")))))))
6936  matches "int a[b]"
6937</pre></td></tr>
6938
6939
6940<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>
6941<tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', 'do while' statement or a function
6942definition that has a given body.
6943
6944Given
6945  for (;;) {}
6946hasBody(compoundStmt())
6947  matches 'for (;;) {}'
6948with compoundStmt()
6949  matching '{}'
6950</pre></td></tr>
6951
6952
6953<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>
6954<tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
6955switch statement or conditional operator.
6956
6957Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6958  if (true) {}
6959</pre></td></tr>
6960
6961
6962<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>
6963<tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
6964NestedNameSpecifier-matcher matches.
6965</pre></td></tr>
6966
6967
6968<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>
6969<tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
6970QualType-matcher matches.
6971</pre></td></tr>
6972
6973<!--END_TRAVERSAL_MATCHERS -->
6974</table>
6975
6976</div>
6977</body>
6978</html>
6979
6980
6981