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