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('isStaticLocal0')"><a name="isStaticLocal0Anchor">isStaticLocal</a></td><td></td></tr>
4127<tr><td colspan="4" class="doc" id="isStaticLocal0"><pre>Matches a static variable with local scope.
4128
4129Example matches y (matcher = varDecl(isStaticLocal()))
4130void f() {
4131  int x;
4132  static int y;
4133}
4134static int z;
4135</pre></td></tr>
4136
4137
4138<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>
4139<tr><td colspan="4" class="doc" id="isStaticStorageClass1"><pre>Matches variablefunction declarations that have "static" storage
4140class specifier ("static" keyword) written in the source.
4141
4142Given:
4143  static void f() {}
4144  static int i = 0;
4145  extern int j;
4146  int k;
4147functionDecl(isStaticStorageClass())
4148  matches the function declaration f.
4149varDecl(isStaticStorageClass())
4150  matches the variable declaration i.
4151</pre></td></tr>
4152
4153
4154<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>
4155<tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
4156member variable template instantiations.
4157
4158Given
4159  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
4160or
4161  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
4162or
4163  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
4164cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4165  matches the template instantiation of X&lt;A&gt;.
4166
4167But given
4168  template &lt;typename T&gt;  class X {}; class A {};
4169  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
4170cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4171  does not match, as X&lt;A&gt; is an explicit template specialization.
4172
4173Usable 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;
4174</pre></td></tr>
4175
4176
4177<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>
4178<tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
4179template instantiations.
4180
4181Given
4182  template&lt;typename T&gt; void A(T t) { T i; }
4183  A(0);
4184  A(0U);
4185functionDecl(isInstantiated())
4186  matches 'A(int) {...};' and 'A(unsigned) {...}'.
4187</pre></td></tr>
4188
4189
4190<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>
4191<tr><td colspan="4" class="doc" id="nullPointerConstant0"><pre>Matches expressions that resolve to a null pointer constant, such as
4192GNU's __null, C++11's nullptr, or C's NULL macro.
4193
4194Given:
4195  void *v1 = NULL;
4196  void *v2 = nullptr;
4197  void *v3 = __null; GNU extension
4198  char *cp = (char *)0;
4199  int *ip = 0;
4200  int i = 0;
4201expr(nullPointerConstant())
4202  matches the initializer for v1, v2, v3, cp, and ip. Does not match the
4203  initializer for i.
4204</pre></td></tr>
4205
4206
4207<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>
4208<tr><td colspan="4" class="doc" id="hasAnyName0"><pre>Matches NamedDecl nodes that have any of the specified names.
4209
4210This matcher is only provided as a performance optimization of hasName.
4211    hasAnyName(a, b, c)
4212 is equivalent to, but faster than
4213    anyOf(hasName(a), hasName(b), hasName(c))
4214</pre></td></tr>
4215
4216
4217<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>
4218<tr><td colspan="4" class="doc" id="hasAnySelector0"><pre>Matches when at least one of the supplied string equals to the
4219Selector.getAsString()
4220
4221 matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
4222 matches both of the expressions below:
4223    [myObj methodA:argA];
4224    [myObj methodB:argB];
4225</pre></td></tr>
4226
4227
4228<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>
4229<tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
4230
4231Given
4232  int j;
4233  template&lt;typename T&gt; void A(T t) { T i; j += 42;}
4234  A(0);
4235  A(0U);
4236declStmt(isInTemplateInstantiation())
4237  matches 'int i;' and 'unsigned i'.
4238unless(stmt(isInTemplateInstantiation()))
4239  will NOT match j += 42; as it's shared between the template definition and
4240  instantiation.
4241</pre></td></tr>
4242
4243<!--END_NARROWING_MATCHERS -->
4244</table>
4245
4246<!-- ======================================================================= -->
4247<h2 id="traversal-matchers">AST Traversal Matchers</h2>
4248<!-- ======================================================================= -->
4249
4250<p>Traversal matchers specify the relationship to other nodes that are
4251reachable from the current node.</p>
4252
4253<p>Note that there are special traversal matchers (has, hasDescendant, forEach and
4254forEachDescendant) which work on all nodes and allow users to write more generic
4255match expressions.</p>
4256
4257<table>
4258<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
4259<!-- START_TRAVERSAL_MATCHERS -->
4260
4261<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>
4262<tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
4263
4264Unlike anyOf, eachOf will generate a match result for each
4265matching submatcher.
4266
4267For example, in:
4268  class A { int a; int b; };
4269The matcher:
4270  cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
4271                       has(fieldDecl(hasName("b")).bind("v"))))
4272will generate two results binding "v", the first of which binds
4273the field declaration of a, the second the field declaration of
4274b.
4275
4276Usable as: Any Matcher
4277</pre></td></tr>
4278
4279
4280<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4281<tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4282provided matcher.
4283
4284Example matches X, A, A::X, B, B::C, B::C::X
4285  (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
4286  class X {};
4287  class A { class X {}; };  Matches A, because A::X is a class of name
4288                            X inside A.
4289  class B { class C { class X {}; }; };
4290
4291DescendantT must be an AST base type.
4292
4293As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
4294each result that matches instead of only on the first one.
4295
4296Note: Recursively combined ForEachDescendant can cause many matches:
4297  cxxRecordDecl(forEachDescendant(cxxRecordDecl(
4298    forEachDescendant(cxxRecordDecl())
4299  )))
4300will match 10 times (plus injected class name matches) on:
4301  class A { class B { class C { class D { class E {}; }; }; }; };
4302
4303Usable as: Any Matcher
4304</pre></td></tr>
4305
4306
4307<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
4308<tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
4309provided matcher.
4310
4311Example matches X, Y, Y::X, Z::Y, Z::Y::X
4312  (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
4313  class X {};
4314  class Y { class X {}; };  Matches Y, because Y::X is a class of name X
4315                            inside Y.
4316  class Z { class Y { class X {}; }; };  Does not match Z.
4317
4318ChildT must be an AST base type.
4319
4320As opposed to 'has', 'forEach' will cause a match for each result that
4321matches instead of only on the first one.
4322
4323Usable as: Any Matcher
4324</pre></td></tr>
4325
4326
4327<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
4328<tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
4329matcher.
4330
4331Given
4332void f() { if (true) { int x = 42; } }
4333void g() { for (;;) { int x = 43; } }
4334expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
4335
4336Usable as: Any Matcher
4337</pre></td></tr>
4338
4339
4340<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4341<tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4342provided matcher.
4343
4344Example matches X, Y, Z
4345    (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
4346  class X {};  Matches X, because X::X is a class of name X inside X.
4347  class Y { class X {}; };
4348  class Z { class Y { class X {}; }; };
4349
4350DescendantT must be an AST base type.
4351
4352Usable as: Any Matcher
4353</pre></td></tr>
4354
4355
4356<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
4357<tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
4358provided matcher.
4359
4360Example matches X, Y
4361  (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
4362  class X {};  Matches X, because X::X is a class of name X inside X.
4363  class Y { class X {}; };
4364  class Z { class Y { class X {}; }; };  Does not match Z.
4365
4366ChildT must be an AST base type.
4367
4368Usable as: Any Matcher
4369Note that has is direct matcher, so it also matches things like implicit
4370casts and paren casts. If you are matching with expr then you should
4371probably consider using ignoringParenImpCasts like:
4372has(ignoringParenImpCasts(expr())).
4373</pre></td></tr>
4374
4375
4376<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
4377<tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
4378matcher.
4379
4380Given
4381void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
4382compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
4383
4384Usable as: Any Matcher
4385</pre></td></tr>
4386
4387
4388<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>
4389<tr><td colspan="4" class="doc" id="hasCondition5"><pre>Matches the condition expression of an if statement, for loop,
4390switch statement or conditional operator.
4391
4392Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
4393  if (true) {}
4394</pre></td></tr>
4395
4396
4397<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>
4398<tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator
4399(binary or ternary).
4400
4401Example matches b
4402  condition ? a : b
4403  condition ?: b
4404</pre></td></tr>
4405
4406
4407<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>
4408<tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
4409
4410Example 1 (conditional ternary operator): matches a
4411  condition ? a : b
4412
4413Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
4414  condition ?: b
4415</pre></td></tr>
4416
4417
4418<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>
4419<tr><td colspan="4" class="doc" id="hasDeclaration15"><pre>Matches a node if the declaration associated with that node
4420matches the given matcher.
4421
4422The associated declaration is:
4423- for type nodes, the declaration of the underlying type
4424- for CallExpr, the declaration of the callee
4425- for MemberExpr, the declaration of the referenced member
4426- for CXXConstructExpr, the declaration of the constructor
4427- for CXXNewExpr, the declaration of the operator new
4428- for ObjCIvarExpr, the declaration of the ivar
4429
4430For type nodes, hasDeclaration will generally match the declaration of the
4431sugared type. Given
4432  class X {};
4433  typedef X Y;
4434  Y y;
4435in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4436typedefDecl. A common use case is to match the underlying, desugared type.
4437This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4438  varDecl(hasType(hasUnqualifiedDesugaredType(
4439      recordType(hasDeclaration(decl())))))
4440In this matcher, the decl will match the CXXRecordDecl of class X.
4441
4442Usable 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;,
4443  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;,
4444  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;,
4445  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;,
4446  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;,
4447  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;,
4448  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
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('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>
4453<tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
4454
4455Given
4456  int i[5];
4457  void f() { i[1] = 42; }
4458arraySubscriptExpression(hasBase(implicitCastExpr(
4459    hasSourceExpression(declRefExpr()))))
4460  matches i[1] with the declRefExpr() matching i
4461</pre></td></tr>
4462
4463
4464<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>
4465<tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
4466
4467Given
4468  int i[5];
4469  void f() { i[1] = 42; }
4470arraySubscriptExpression(hasIndex(integerLiteral()))
4471  matches i[1] with the integerLiteral() matching 1
4472</pre></td></tr>
4473
4474
4475<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>
4476<tr><td colspan="4" class="doc" id="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
4477
4478Example matches a (matcher = binaryOperator(hasLHS()))
4479  a || b
4480</pre></td></tr>
4481
4482
4483<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>
4484<tr><td colspan="4" class="doc" id="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
4485
4486Example matches b (matcher = binaryOperator(hasRHS()))
4487  a || b
4488</pre></td></tr>
4489
4490
4491<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>
4492<tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
4493type.
4494
4495Given
4496  struct A {};
4497  A a[7];
4498  int b[7];
4499arrayType(hasElementType(builtinType()))
4500  matches "int b[7]"
4501
4502Usable 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;
4503</pre></td></tr>
4504
4505
4506<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>
4507<tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
4508
4509Given
4510  _Atomic(int) i;
4511  _Atomic(float) f;
4512atomicType(hasValueType(isInteger()))
4513 matches "_Atomic(int) i"
4514
4515Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
4516</pre></td></tr>
4517
4518
4519<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>
4520<tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
4521
4522Note: There is no TypeLoc for the deduced type and thus no
4523getDeducedLoc() matcher.
4524
4525Given
4526  auto a = 1;
4527  auto b = 2.0;
4528autoType(hasDeducedType(isInteger()))
4529  matches "auto a"
4530
4531Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
4532</pre></td></tr>
4533
4534
4535<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('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>
4536<tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
4537binary operator matches.
4538</pre></td></tr>
4539
4540
4541<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>
4542<tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
4543
4544Example matches a (matcher = binaryOperator(hasLHS()))
4545  a || b
4546</pre></td></tr>
4547
4548
4549<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>
4550<tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
4551
4552Example matches b (matcher = binaryOperator(hasRHS()))
4553  a || b
4554</pre></td></tr>
4555
4556
4557<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>
4558<tr><td colspan="4" class="doc" id="hasAnyParameter2"><pre>Matches any parameter of a function or an ObjC method declaration or a
4559block.
4560
4561Does not match the 'this' parameter of a method.
4562
4563Given
4564  class X { void f(int x, int y, int z) {} };
4565cxxMethodDecl(hasAnyParameter(hasName("y")))
4566  matches f(int x, int y, int z) {}
4567with hasAnyParameter(...)
4568  matching int y
4569
4570For ObjectiveC, given
4571  @interface I - (void) f:(int) y; @end
4572
4573the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
4574matches the declaration of method f with hasParameter
4575matching y.
4576
4577For blocks, given
4578  b = ^(int y) { printf("%d", y) };
4579
4580the matcher blockDecl(hasAnyParameter(hasName("y")))
4581matches the declaration of the block b with hasParameter
4582matching y.
4583</pre></td></tr>
4584
4585
4586<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>
4587<tr><td colspan="4" class="doc" id="hasParameter2"><pre>Matches the n'th parameter of a function or an ObjC method
4588declaration or a block.
4589
4590Given
4591  class X { void f(int x) {} };
4592cxxMethodDecl(hasParameter(0, hasType(varDecl())))
4593  matches f(int x) {}
4594with hasParameter(...)
4595  matching int x
4596
4597For ObjectiveC, given
4598  @interface I - (void) f:(int) y; @end
4599
4600the matcher objcMethodDecl(hasParameter(0, hasName("y")))
4601matches the declaration of method f with hasParameter
4602matching y.
4603</pre></td></tr>
4604
4605
4606<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>
4607<tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
4608pointee matches a given matcher.
4609
4610Given
4611  int *a;
4612  int const *b;
4613  float const *f;
4614pointerType(pointee(isConstQualified(), isInteger()))
4615  matches "int const *b"
4616
4617Usable 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;,
4618  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;
4619</pre></td></tr>
4620
4621
4622<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>
4623<tr><td colspan="4" class="doc" id="forEachArgumentWithParam1"><pre>Matches all arguments and their respective ParmVarDecl.
4624
4625Given
4626  void f(int i);
4627  int y;
4628  f(y);
4629callExpr(
4630  forEachArgumentWithParam(
4631    declRefExpr(to(varDecl(hasName("y")))),
4632    parmVarDecl(hasType(isInteger()))
4633))
4634  matches f(y);
4635with declRefExpr(...)
4636  matching int y
4637and parmVarDecl(...)
4638  matching int i
4639</pre></td></tr>
4640
4641
4642<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>
4643<tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
4644expression, or an ObjC-message-send expression.
4645
4646Given
4647  void x(int, int, int) { int y; x(1, y, 42); }
4648callExpr(hasAnyArgument(declRefExpr()))
4649  matches x(1, y, 42)
4650with hasAnyArgument(...)
4651  matching y
4652
4653For ObjectiveC, given
4654  @interface I - (void) f:(int) y; @end
4655  void foo(I *i) { [i f:12]; }
4656objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
4657  matches [i f:12]
4658</pre></td></tr>
4659
4660
4661<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>
4662<tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
4663call expression.
4664
4665Example matches y in x(y)
4666    (matcher = callExpr(hasArgument(0, declRefExpr())))
4667  void x(int) { int y; x(y); }
4668</pre></td></tr>
4669
4670
4671<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('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>
4672<tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
4673matches the given matcher.
4674
4675The associated declaration is:
4676- for type nodes, the declaration of the underlying type
4677- for CallExpr, the declaration of the callee
4678- for MemberExpr, the declaration of the referenced member
4679- for CXXConstructExpr, the declaration of the constructor
4680- for CXXNewExpr, the declaration of the operator new
4681- for ObjCIvarExpr, the declaration of the ivar
4682
4683For type nodes, hasDeclaration will generally match the declaration of the
4684sugared type. Given
4685  class X {};
4686  typedef X Y;
4687  Y y;
4688in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4689typedefDecl. A common use case is to match the underlying, desugared type.
4690This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4691  varDecl(hasType(hasUnqualifiedDesugaredType(
4692      recordType(hasDeclaration(decl())))))
4693In this matcher, the decl will match the CXXRecordDecl of class X.
4694
4695Usable 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;,
4696  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;,
4697  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;,
4698  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;,
4699  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;,
4700  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;,
4701  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
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('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>
4706<tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
4707
4708Given
4709  class A { A() : i(42), j(42) {} int i; int j; };
4710cxxConstructorDecl(forEachConstructorInitializer(
4711  forField(decl().bind("x"))
4712))
4713  will trigger two matches, binding for 'i' and 'j' respectively.
4714</pre></td></tr>
4715
4716
4717<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>
4718<tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
4719
4720Given
4721  struct Foo {
4722    Foo() : foo_(1) { }
4723    int foo_;
4724  };
4725cxxRecordDecl(has(cxxConstructorDecl(
4726  hasAnyConstructorInitializer(anything())
4727)))
4728  record matches Foo, hasAnyConstructorInitializer matches foo_(1)
4729</pre></td></tr>
4730
4731
4732<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>
4733<tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
4734
4735Given
4736  struct Foo {
4737    Foo() : foo_(1) { }
4738    int foo_;
4739  };
4740cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
4741    forField(hasName("foo_"))))))
4742  matches Foo
4743with forField matching foo_
4744</pre></td></tr>
4745
4746
4747<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>
4748<tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
4749
4750Given
4751  struct Foo {
4752    Foo() : foo_(1) { }
4753    int foo_;
4754  };
4755cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
4756    withInitializer(integerLiteral(equals(1)))))))
4757  matches Foo
4758with withInitializer matching (1)
4759</pre></td></tr>
4760
4761
4762<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>
4763<tr><td colspan="4" class="doc" id="hasObjectExpression2"><pre>Matches a member expression where the object expression is
4764matched by a given matcher.
4765
4766Given
4767  struct X { int m; };
4768  void f(X x) { x.m; m; }
4769memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
4770  matches "x.m" and "m"
4771with hasObjectExpression(...)
4772  matching "x" and the implicit object expression of "m" which has type X*.
4773</pre></td></tr>
4774
4775
4776<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>
4777<tr><td colspan="4" class="doc" id="hasBody3"><pre>Matches a 'for', 'while', 'do while' statement or a function
4778definition that has a given body.
4779
4780Given
4781  for (;;) {}
4782hasBody(compoundStmt())
4783  matches 'for (;;) {}'
4784with compoundStmt()
4785  matching '{}'
4786</pre></td></tr>
4787
4788
4789<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>
4790<tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
4791
4792Example:
4793    forStmt(hasLoopVariable(anything()))
4794matches 'int x' in
4795    for (int x : a) { }
4796</pre></td></tr>
4797
4798
4799<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>&gt;</td><td class="name" onclick="toggle('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>
4800<tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
4801
4802Example:
4803    forStmt(hasRangeInit(anything()))
4804matches 'a' in
4805    for (int x : a) { }
4806</pre></td></tr>
4807
4808
4809<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_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>
4810<tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre></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('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>
4814<tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression.
4815
4816Example matches y.x()
4817  (matcher = cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y"))))))
4818  class Y { public: void x(); };
4819  void z() { Y y; y.x(); }
4820
4821FIXME: Overload to allow directly matching types?
4822</pre></td></tr>
4823
4824
4825<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>
4826<tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
4827</pre></td></tr>
4828
4829
4830<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>
4831<tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the expression's type either matches the specified
4832matcher, or is a pointer to a type that matches the InnerMatcher.
4833</pre></td></tr>
4834
4835
4836<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>
4837<tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overridden by the given method. This matcher may
4838produce multiple matches.
4839
4840Given
4841  class A { virtual void f(); };
4842  class B : public A { void f(); };
4843  class C : public B { void f(); };
4844cxxMethodDecl(ofClass(hasName("C")),
4845              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4846  matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
4847  that B::f is not overridden by C::f).
4848
4849The check can produce multiple matches in case of multiple inheritance, e.g.
4850  class A1 { virtual void f(); };
4851  class A2 { virtual void f(); };
4852  class C : public A1, public A2 { void f(); };
4853cxxMethodDecl(ofClass(hasName("C")),
4854              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4855  matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
4856  once with "b" binding "A2::f" and "d" binding "C::f".
4857</pre></td></tr>
4858
4859
4860<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>
4861<tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
4862belongs to.
4863
4864FIXME: Generalize this for other kinds of declarations.
4865FIXME: What other kind of declarations would we need to generalize
4866this to?
4867
4868Example matches A() in the last line
4869    (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
4870        ofClass(hasName("A"))))))
4871  class A {
4872   public:
4873    A();
4874  };
4875  A a = A();
4876</pre></td></tr>
4877
4878
4879<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>
4880<tr><td colspan="4" class="doc" id="hasArraySize0"><pre>Matches array new expressions with a given array size.
4881
4882Given:
4883  MyClass *p1 = new MyClass[10];
4884cxxNewExpr(hasArraySize(intgerLiteral(equals(10))))
4885  matches the expression 'new MyClass[10]'.
4886</pre></td></tr>
4887
4888
4889<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('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>
4890<tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
4891matches the given matcher.
4892
4893The associated declaration is:
4894- for type nodes, the declaration of the underlying type
4895- for CallExpr, the declaration of the callee
4896- for MemberExpr, the declaration of the referenced member
4897- for CXXConstructExpr, the declaration of the constructor
4898- for CXXNewExpr, the declaration of the operator new
4899- for ObjCIvarExpr, the declaration of the ivar
4900
4901For type nodes, hasDeclaration will generally match the declaration of the
4902sugared type. Given
4903  class X {};
4904  typedef X Y;
4905  Y y;
4906in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4907typedefDecl. A common use case is to match the underlying, desugared type.
4908This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4909  varDecl(hasType(hasUnqualifiedDesugaredType(
4910      recordType(hasDeclaration(decl())))))
4911In this matcher, the decl will match the CXXRecordDecl of class X.
4912
4913Usable 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;,
4914  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;,
4915  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;,
4916  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;,
4917  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;,
4918  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;,
4919  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
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('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>
4924<tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
4925
4926Given:
4927  class A { void func(); };
4928  class B { void member(); };
4929
4930cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
4931A but not B.
4932</pre></td></tr>
4933
4934
4935<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>
4936<tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from
4937a class matching Base.
4938
4939Note that a class is not considered to be derived from itself.
4940
4941Example matches Y, Z, C (Base == hasName("X"))
4942  class X;
4943  class Y : public X {};  directly derived
4944  class Z : public Y {};  indirectly derived
4945  typedef X A;
4946  typedef A B;
4947  class C : public B {};  derived from a typedef of X
4948
4949In the following example, Bar matches isDerivedFrom(hasName("X")):
4950  class Foo;
4951  typedef Foo X;
4952  class Bar : public Foo {};  derived from a type that X is a typedef of
4953</pre></td></tr>
4954
4955
4956<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>
4957<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
4958match Base.
4959</pre></td></tr>
4960
4961
4962<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>
4963<tr><td colspan="4" class="doc" id="hasAnyArgument2"><pre>Matches any argument of a call expression or a constructor call
4964expression, or an ObjC-message-send expression.
4965
4966Given
4967  void x(int, int, int) { int y; x(1, y, 42); }
4968callExpr(hasAnyArgument(declRefExpr()))
4969  matches x(1, y, 42)
4970with hasAnyArgument(...)
4971  matching y
4972
4973For ObjectiveC, given
4974  @interface I - (void) f:(int) y; @end
4975  void foo(I *i) { [i f:12]; }
4976objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
4977  matches [i f:12]
4978</pre></td></tr>
4979
4980
4981<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>
4982<tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
4983given matcher.
4984
4985Example matches y.x() (matcher = callExpr(callee(
4986                                   cxxMethodDecl(hasName("x")))))
4987  class Y { public: void x(); };
4988  void z() { Y y; y.x(); }
4989</pre></td></tr>
4990
4991
4992<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>
4993<tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches.
4994
4995Given
4996  class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
4997  void f() { f(); }
4998callExpr(callee(expr()))
4999  matches this-&gt;x(), x(), y.x(), f()
5000with callee(...)
5001  matching this-&gt;x, x, y.x, f respectively
5002
5003Note: Callee cannot take the more general internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
5004because this introduces ambiguous overloads with calls to Callee taking a
5005internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
5006implemented in terms of implicit casts.
5007</pre></td></tr>
5008
5009
5010<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>
5011<tr><td colspan="4" class="doc" id="forEachArgumentWithParam0"><pre>Matches all arguments and their respective ParmVarDecl.
5012
5013Given
5014  void f(int i);
5015  int y;
5016  f(y);
5017callExpr(
5018  forEachArgumentWithParam(
5019    declRefExpr(to(varDecl(hasName("y")))),
5020    parmVarDecl(hasType(isInteger()))
5021))
5022  matches f(y);
5023with declRefExpr(...)
5024  matching int y
5025and parmVarDecl(...)
5026  matching int i
5027</pre></td></tr>
5028
5029
5030<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>
5031<tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
5032expression, or an ObjC-message-send expression.
5033
5034Given
5035  void x(int, int, int) { int y; x(1, y, 42); }
5036callExpr(hasAnyArgument(declRefExpr()))
5037  matches x(1, y, 42)
5038with hasAnyArgument(...)
5039  matching y
5040
5041For ObjectiveC, given
5042  @interface I - (void) f:(int) y; @end
5043  void foo(I *i) { [i f:12]; }
5044objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
5045  matches [i f:12]
5046</pre></td></tr>
5047
5048
5049<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>
5050<tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
5051call expression.
5052
5053Example matches y in x(y)
5054    (matcher = callExpr(hasArgument(0, declRefExpr())))
5055  void x(int) { int y; x(y); }
5056</pre></td></tr>
5057
5058
5059<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('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>
5060<tr><td colspan="4" class="doc" id="hasDeclaration14"><pre>Matches a node if the declaration associated with that node
5061matches the given matcher.
5062
5063The associated declaration is:
5064- for type nodes, the declaration of the underlying type
5065- for CallExpr, the declaration of the callee
5066- for MemberExpr, the declaration of the referenced member
5067- for CXXConstructExpr, the declaration of the constructor
5068- for CXXNewExpr, the declaration of the operator new
5069- for ObjCIvarExpr, the declaration of the ivar
5070
5071For type nodes, hasDeclaration will generally match the declaration of the
5072sugared type. Given
5073  class X {};
5074  typedef X Y;
5075  Y y;
5076in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5077typedefDecl. A common use case is to match the underlying, desugared type.
5078This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5079  varDecl(hasType(hasUnqualifiedDesugaredType(
5080      recordType(hasDeclaration(decl())))))
5081In this matcher, the decl will match the CXXRecordDecl of class X.
5082
5083Usable 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;,
5084  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;,
5085  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;,
5086  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;,
5087  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;,
5088  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;,
5089  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5090</pre></td></tr>
5091
5092
5093<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>
5094<tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
5095extension, matches the constant given in the statement.
5096
5097Given
5098  switch (1) { case 1: case 1+1: case 3 ... 4: ; }
5099caseStmt(hasCaseConstant(integerLiteral()))
5100  matches "case 1:"
5101</pre></td></tr>
5102
5103
5104<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>
5105<tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression
5106or opaque value's source expression matches the given matcher.
5107
5108Example 1: matches "a string"
5109(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
5110class URL { URL(string); };
5111URL url = "a string";
5112
5113Example 2: matches 'b' (matcher =
5114opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
5115int a = b ?: 1;
5116</pre></td></tr>
5117
5118
5119<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>
5120<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5121functionDecl that have at least one TemplateArgument matching the given
5122InnerMatcher.
5123
5124Given
5125  template&lt;typename T&gt; class A {};
5126  template&lt;&gt; class A&lt;double&gt; {};
5127  A&lt;int&gt; a;
5128
5129  template&lt;typename T&gt; f() {};
5130  void func() { f&lt;int&gt;(); };
5131
5132classTemplateSpecializationDecl(hasAnyTemplateArgument(
5133    refersToType(asString("int"))))
5134  matches the specialization A&lt;int&gt;
5135
5136functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
5137  matches the specialization f&lt;int&gt;
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('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>
5142<tr><td colspan="4" class="doc" id="hasSpecializedTemplate0"><pre>Matches the specialized template of a specialization declaration.
5143
5144Given
5145  template&lt;typename T&gt; class A {}; #1
5146  template&lt;&gt; class A&lt;int&gt; {}; #2
5147classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl()))
5148  matches '#2' with classTemplateDecl() matching the class template
5149  declaration of 'A' at #1.
5150</pre></td></tr>
5151
5152
5153<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>
5154<tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5155functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
5156
5157Given
5158  template&lt;typename T, typename U&gt; class A {};
5159  A&lt;bool, int&gt; b;
5160  A&lt;int, bool&gt; c;
5161
5162  template&lt;typename T&gt; void f() {}
5163  void func() { f&lt;int&gt;(); };
5164classTemplateSpecializationDecl(hasTemplateArgument(
5165    1, refersToType(asString("int"))))
5166  matches the specialization A&lt;bool, int&gt;
5167
5168functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
5169  matches the specialization f&lt;int&gt;
5170</pre></td></tr>
5171
5172
5173<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>
5174<tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
5175type.
5176
5177Given
5178  struct A {};
5179  A a[7];
5180  int b[7];
5181arrayType(hasElementType(builtinType()))
5182  matches "int b[7]"
5183
5184Usable 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;
5185</pre></td></tr>
5186
5187
5188<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>
5189<tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
5190a given matcher. Also matches StmtExprs that have CompoundStmt as children.
5191
5192Given
5193  { {}; 1+2; }
5194hasAnySubstatement(compoundStmt())
5195  matches '{ {}; 1+2; }'
5196with compoundStmt()
5197  matching '{}'
5198</pre></td></tr>
5199
5200
5201<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>
5202<tr><td colspan="4" class="doc" id="hasDecayedType0"><pre>Matches the decayed type, whos decayed type matches InnerMatcher
5203</pre></td></tr>
5204
5205
5206<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>
5207<tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
5208matches the given matcher.
5209
5210The associated declaration is:
5211- for type nodes, the declaration of the underlying type
5212- for CallExpr, the declaration of the callee
5213- for MemberExpr, the declaration of the referenced member
5214- for CXXConstructExpr, the declaration of the constructor
5215- for CXXNewExpr, the declaration of the operator new
5216- for ObjCIvarExpr, the declaration of the ivar
5217
5218For type nodes, hasDeclaration will generally match the declaration of the
5219sugared type. Given
5220  class X {};
5221  typedef X Y;
5222  Y y;
5223in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5224typedefDecl. A common use case is to match the underlying, desugared type.
5225This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5226  varDecl(hasType(hasUnqualifiedDesugaredType(
5227      recordType(hasDeclaration(decl())))))
5228In this matcher, the decl will match the CXXRecordDecl of class X.
5229
5230Usable 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;,
5231  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;,
5232  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;,
5233  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;,
5234  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;,
5235  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;,
5236  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5237</pre></td></tr>
5238
5239
5240<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>
5241<tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a
5242specific using shadow declaration.
5243
5244Given
5245  namespace a { void f() {} }
5246  using a::f;
5247  void g() {
5248    f();     Matches this ..
5249    a::f();  .. but not this.
5250  }
5251declRefExpr(throughUsingDecl(anything()))
5252  matches f()
5253</pre></td></tr>
5254
5255
5256<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>
5257<tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
5258specified matcher.
5259
5260Example matches x in if(x)
5261    (matcher = declRefExpr(to(varDecl(hasName("x")))))
5262  bool x;
5263  if (x) {}
5264</pre></td></tr>
5265
5266
5267<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>
5268<tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
5269
5270Note that this does not work for global declarations because the AST
5271breaks up multiple-declaration DeclStmt's into multiple single-declaration
5272DeclStmt's.
5273Example: Given non-global declarations
5274  int a, b = 0;
5275  int c;
5276  int d = 2, e;
5277declStmt(containsDeclaration(
5278      0, varDecl(hasInitializer(anything()))))
5279  matches only 'int d = 2, e;', and
5280declStmt(containsDeclaration(1, varDecl()))
5281  matches 'int a, b = 0' as well as 'int d = 2, e;'
5282  but 'int c;' is not matched.
5283</pre></td></tr>
5284
5285
5286<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>
5287<tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
5288
5289Given
5290  int a, b;
5291  int c;
5292declStmt(hasSingleDecl(anything()))
5293  matches 'int c;' but not 'int a, b;'.
5294</pre></td></tr>
5295
5296
5297<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>
5298<tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches
5299the inner matcher.
5300
5301Given
5302  int x;
5303declaratorDecl(hasTypeLoc(loc(asString("int"))))
5304  matches int x
5305</pre></td></tr>
5306
5307
5308<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>
5309<tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
5310Decl, matches InnerMatcher.
5311
5312Given
5313  namespace N {
5314    namespace M {
5315      class D {};
5316    }
5317  }
5318
5319cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
5320declaration of class D.
5321</pre></td></tr>
5322
5323
5324<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>
5325<tr><td colspan="4" class="doc" id="hasUnderlyingType0"><pre>Matches DecltypeType nodes to find out the underlying type.
5326
5327Given
5328  decltype(1) a = 1;
5329  decltype(2.0) b = 2.0;
5330decltypeType(hasUnderlyingType(isInteger()))
5331  matches the type of "a"
5332
5333Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;
5334</pre></td></tr>
5335
5336
5337<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>
5338<tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', 'do while' statement or a function
5339definition that has a given body.
5340
5341Given
5342  for (;;) {}
5343hasBody(compoundStmt())
5344  matches 'for (;;) {}'
5345with compoundStmt()
5346  matching '{}'
5347</pre></td></tr>
5348
5349
5350<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>
5351<tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
5352switch statement or conditional operator.
5353
5354Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5355  if (true) {}
5356</pre></td></tr>
5357
5358
5359<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>
5360<tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
5361matches InnerMatcher if the qualifier exists.
5362
5363Given
5364  namespace N {
5365    namespace M {
5366      class D {};
5367    }
5368  }
5369  N::M::D d;
5370
5371elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
5372matches the type of the variable declaration of d.
5373</pre></td></tr>
5374
5375
5376<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>
5377<tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
5378
5379Given
5380  namespace N {
5381    namespace M {
5382      class D {};
5383    }
5384  }
5385  N::M::D d;
5386
5387elaboratedType(namesType(recordType(
5388hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
5389declaration of d.
5390</pre></td></tr>
5391
5392
5393<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>
5394<tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
5395matches the given matcher.
5396
5397The associated declaration is:
5398- for type nodes, the declaration of the underlying type
5399- for CallExpr, the declaration of the callee
5400- for MemberExpr, the declaration of the referenced member
5401- for CXXConstructExpr, the declaration of the constructor
5402- for CXXNewExpr, the declaration of the operator new
5403- for ObjCIvarExpr, the declaration of the ivar
5404
5405For type nodes, hasDeclaration will generally match the declaration of the
5406sugared type. Given
5407  class X {};
5408  typedef X Y;
5409  Y y;
5410in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5411typedefDecl. A common use case is to match the underlying, desugared type.
5412This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5413  varDecl(hasType(hasUnqualifiedDesugaredType(
5414      recordType(hasDeclaration(decl())))))
5415In this matcher, the decl will match the CXXRecordDecl of class X.
5416
5417Usable 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;,
5418  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;,
5419  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;,
5420  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;,
5421  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;,
5422  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;,
5423  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5424</pre></td></tr>
5425
5426
5427<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>
5428<tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
5429
5430(Note: Clang's AST refers to other conversions as "casts" too, and calls
5431actual casts "explicit" casts.)
5432</pre></td></tr>
5433
5434
5435<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>
5436<tr><td colspan="4" class="doc" id="hasType4"><pre>Overloaded to match the declaration of the expression's or value
5437declaration's type.
5438
5439In case of a value declaration (for example a variable declaration),
5440this resolves one layer of indirection. For example, in the value
5441declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5442X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5443declaration of x.
5444
5445Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5446            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5447            and friend class X (matcher = friendDecl(hasType("X"))
5448 class X {};
5449 void y(X &amp;x) { x; X z; }
5450 class Y { friend class X; };
5451
5452Usable 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;
5453</pre></td></tr>
5454
5455
5456<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('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>
5457<tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
5458matcher.
5459
5460Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5461            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5462            and U (matcher = typedefDecl(hasType(asString("int")))
5463            and friend class X (matcher = friendDecl(hasType("X"))
5464 class X {};
5465 void y(X &amp;x) { x; X z; }
5466 typedef int U;
5467 class Y { friend class X; };
5468</pre></td></tr>
5469
5470
5471<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>
5472<tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
5473are stripped off.
5474
5475Parentheses and explicit casts are not discarded.
5476Given
5477  int arr[5];
5478  int a = 0;
5479  char b = 0;
5480  const int c = a;
5481  int *d = arr;
5482  long e = (long) 0l;
5483The matchers
5484   varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
5485   varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
5486would match the declarations for a, b, c, and d, but not e.
5487While
5488   varDecl(hasInitializer(integerLiteral()))
5489   varDecl(hasInitializer(declRefExpr()))
5490only match the declarations for b, c, and d.
5491</pre></td></tr>
5492
5493
5494<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>
5495<tr><td colspan="4" class="doc" id="ignoringImplicit0"><pre>Matches expressions that match InnerMatcher after any implicit AST
5496nodes are stripped off.
5497
5498Parentheses and explicit casts are not discarded.
5499Given
5500  class C {};
5501  C a = C();
5502  C b;
5503  C c = b;
5504The matchers
5505   varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr())))
5506would match the declarations for a, b, and c.
5507While
5508   varDecl(hasInitializer(cxxConstructExpr()))
5509only match the declarations for b and c.
5510</pre></td></tr>
5511
5512
5513<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>
5514<tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
5515casts are stripped off.
5516
5517Implicit and non-C Style casts are also discarded.
5518Given
5519  int a = 0;
5520  char b = (0);
5521  void* c = reinterpret_cast&lt;char*&gt;(0);
5522  char d = char(0);
5523The matcher
5524   varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
5525would match the declarations for a, b, c, and d.
5526while
5527   varDecl(hasInitializer(integerLiteral()))
5528only match the declaration for a.
5529</pre></td></tr>
5530
5531
5532<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>
5533<tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
5534parentheses are stripped off.
5535
5536Explicit casts are not discarded.
5537Given
5538  int arr[5];
5539  int a = 0;
5540  char b = (0);
5541  const int c = a;
5542  int *d = (arr);
5543  long e = ((long) 0l);
5544The matchers
5545   varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
5546   varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
5547would match the declarations for a, b, c, and d, but not e.
5548while
5549   varDecl(hasInitializer(integerLiteral()))
5550   varDecl(hasInitializer(declRefExpr()))
5551would only match the declaration for a.
5552</pre></td></tr>
5553
5554
5555<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>
5556<tr><td colspan="4" class="doc" id="hasInClassInitializer0"><pre>Matches non-static data members that have an in-class initializer.
5557
5558Given
5559  class C {
5560    int a = 2;
5561    int b = 3;
5562    int c;
5563  };
5564fieldDecl(hasInClassInitializer(integerLiteral(equals(2))))
5565  matches 'int a;' but not 'int b;'.
5566fieldDecl(hasInClassInitializer(anything()))
5567  matches 'int a;' and 'int b;' but not 'int c;'.
5568</pre></td></tr>
5569
5570
5571<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>
5572<tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', 'do while' statement or a function
5573definition that has a given body.
5574
5575Given
5576  for (;;) {}
5577hasBody(compoundStmt())
5578  matches 'for (;;) {}'
5579with compoundStmt()
5580  matching '{}'
5581</pre></td></tr>
5582
5583
5584<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>
5585<tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
5586switch statement or conditional operator.
5587
5588Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5589  if (true) {}
5590</pre></td></tr>
5591
5592
5593<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>
5594<tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
5595
5596Example:
5597    forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
5598matches '++x' in
5599    for (x; x &lt; N; ++x) { }
5600</pre></td></tr>
5601
5602
5603<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>
5604<tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
5605
5606Example:
5607    forStmt(hasLoopInit(declStmt()))
5608matches 'int x = 0' in
5609    for (int x = 0; x &lt; N; ++x) { }
5610</pre></td></tr>
5611
5612
5613<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>
5614<tr><td colspan="4" class="doc" id="hasType5"><pre>Overloaded to match the declaration of the expression's or value
5615declaration's type.
5616
5617In case of a value declaration (for example a variable declaration),
5618this resolves one layer of indirection. For example, in the value
5619declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5620X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5621declaration of x.
5622
5623Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5624            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5625            and friend class X (matcher = friendDecl(hasType("X"))
5626 class X {};
5627 void y(X &amp;x) { x; X z; }
5628 class Y { friend class X; };
5629
5630Usable 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;
5631</pre></td></tr>
5632
5633
5634<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>
5635<tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
5636matcher.
5637
5638Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5639            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5640            and U (matcher = typedefDecl(hasType(asString("int")))
5641            and friend class X (matcher = friendDecl(hasType("X"))
5642 class X {};
5643 void y(X &amp;x) { x; X z; }
5644 typedef int U;
5645 class Y { friend class X; };
5646</pre></td></tr>
5647
5648
5649<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>
5650<tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function or an ObjC method declaration or a
5651block.
5652
5653Does not match the 'this' parameter of a method.
5654
5655Given
5656  class X { void f(int x, int y, int z) {} };
5657cxxMethodDecl(hasAnyParameter(hasName("y")))
5658  matches f(int x, int y, int z) {}
5659with hasAnyParameter(...)
5660  matching int y
5661
5662For ObjectiveC, given
5663  @interface I - (void) f:(int) y; @end
5664
5665the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
5666matches the declaration of method f with hasParameter
5667matching y.
5668
5669For blocks, given
5670  b = ^(int y) { printf("%d", y) };
5671
5672the matcher blockDecl(hasAnyParameter(hasName("y")))
5673matches the declaration of the block b with hasParameter
5674matching y.
5675</pre></td></tr>
5676
5677
5678<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>
5679<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5680functionDecl that have at least one TemplateArgument matching the given
5681InnerMatcher.
5682
5683Given
5684  template&lt;typename T&gt; class A {};
5685  template&lt;&gt; class A&lt;double&gt; {};
5686  A&lt;int&gt; a;
5687
5688  template&lt;typename T&gt; f() {};
5689  void func() { f&lt;int&gt;(); };
5690
5691classTemplateSpecializationDecl(hasAnyTemplateArgument(
5692    refersToType(asString("int"))))
5693  matches the specialization A&lt;int&gt;
5694
5695functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
5696  matches the specialization f&lt;int&gt;
5697</pre></td></tr>
5698
5699
5700<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>
5701<tr><td colspan="4" class="doc" id="hasBody4"><pre>Matches a 'for', 'while', 'do while' statement or a function
5702definition that has a given body.
5703
5704Given
5705  for (;;) {}
5706hasBody(compoundStmt())
5707  matches 'for (;;) {}'
5708with compoundStmt()
5709  matching '{}'
5710</pre></td></tr>
5711
5712
5713<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>
5714<tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function or an ObjC method
5715declaration or a block.
5716
5717Given
5718  class X { void f(int x) {} };
5719cxxMethodDecl(hasParameter(0, hasType(varDecl())))
5720  matches f(int x) {}
5721with hasParameter(...)
5722  matching int x
5723
5724For ObjectiveC, given
5725  @interface I - (void) f:(int) y; @end
5726
5727the matcher objcMethodDecl(hasParameter(0, hasName("y")))
5728matches the declaration of method f with hasParameter
5729matching y.
5730</pre></td></tr>
5731
5732
5733<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>
5734<tr><td colspan="4" class="doc" id="hasTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5735functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
5736
5737Given
5738  template&lt;typename T, typename U&gt; class A {};
5739  A&lt;bool, int&gt; b;
5740  A&lt;int, bool&gt; c;
5741
5742  template&lt;typename T&gt; void f() {}
5743  void func() { f&lt;int&gt;(); };
5744classTemplateSpecializationDecl(hasTemplateArgument(
5745    1, refersToType(asString("int"))))
5746  matches the specialization A&lt;bool, int&gt;
5747
5748functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
5749  matches the specialization f&lt;int&gt;
5750</pre></td></tr>
5751
5752
5753<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>
5754<tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
5755
5756Given:
5757  class X { int f() { return 1; } };
5758cxxMethodDecl(returns(asString("int")))
5759  matches int f() { return 1; }
5760</pre></td></tr>
5761
5762
5763<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>
5764<tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
5765switch statement or conditional operator.
5766
5767Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5768  if (true) {}
5769</pre></td></tr>
5770
5771
5772<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>
5773<tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
5774
5775Given
5776  if (A* a = GetAPointer()) {}
5777hasConditionVariableStatement(...)
5778  matches 'A* a = GetAPointer()'.
5779</pre></td></tr>
5780
5781
5782<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>
5783<tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
5784
5785Examples matches the if statement
5786  (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
5787  if (false) false; else true;
5788</pre></td></tr>
5789
5790
5791<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>
5792<tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
5793
5794Examples matches the if statement
5795  (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
5796  if (false) true; else false;
5797</pre></td></tr>
5798
5799
5800<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>
5801<tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
5802matcher.
5803
5804FIXME: Unit test this matcher
5805</pre></td></tr>
5806
5807
5808<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>
5809<tr><td colspan="4" class="doc" id="hasSyntacticForm0"><pre>Matches the syntactic form of init list expressions
5810(if expression have it).
5811</pre></td></tr>
5812
5813
5814<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>
5815<tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
5816matches the given matcher.
5817
5818The associated declaration is:
5819- for type nodes, the declaration of the underlying type
5820- for CallExpr, the declaration of the callee
5821- for MemberExpr, the declaration of the referenced member
5822- for CXXConstructExpr, the declaration of the constructor
5823- for CXXNewExpr, the declaration of the operator new
5824- for ObjCIvarExpr, the declaration of the ivar
5825
5826For type nodes, hasDeclaration will generally match the declaration of the
5827sugared type. Given
5828  class X {};
5829  typedef X Y;
5830  Y y;
5831in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5832typedefDecl. A common use case is to match the underlying, desugared type.
5833This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5834  varDecl(hasType(hasUnqualifiedDesugaredType(
5835      recordType(hasDeclaration(decl())))))
5836In this matcher, the decl will match the CXXRecordDecl of class X.
5837
5838Usable 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;,
5839  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;,
5840  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;,
5841  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;,
5842  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;,
5843  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;,
5844  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5845</pre></td></tr>
5846
5847
5848<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>
5849<tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
5850matches the given matcher.
5851
5852The associated declaration is:
5853- for type nodes, the declaration of the underlying type
5854- for CallExpr, the declaration of the callee
5855- for MemberExpr, the declaration of the referenced member
5856- for CXXConstructExpr, the declaration of the constructor
5857- for CXXNewExpr, the declaration of the operator new
5858- for ObjCIvarExpr, the declaration of the ivar
5859
5860For type nodes, hasDeclaration will generally match the declaration of the
5861sugared type. Given
5862  class X {};
5863  typedef X Y;
5864  Y y;
5865in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5866typedefDecl. A common use case is to match the underlying, desugared type.
5867This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5868  varDecl(hasType(hasUnqualifiedDesugaredType(
5869      recordType(hasDeclaration(decl())))))
5870In this matcher, the decl will match the CXXRecordDecl of class X.
5871
5872Usable 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;,
5873  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;,
5874  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;,
5875  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;,
5876  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;,
5877  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;,
5878  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5879</pre></td></tr>
5880
5881
5882<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>
5883<tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
5884matches the given matcher.
5885
5886The associated declaration is:
5887- for type nodes, the declaration of the underlying type
5888- for CallExpr, the declaration of the callee
5889- for MemberExpr, the declaration of the referenced member
5890- for CXXConstructExpr, the declaration of the constructor
5891- for CXXNewExpr, the declaration of the operator new
5892- for ObjCIvarExpr, the declaration of the ivar
5893
5894For type nodes, hasDeclaration will generally match the declaration of the
5895sugared type. Given
5896  class X {};
5897  typedef X Y;
5898  Y y;
5899in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5900typedefDecl. A common use case is to match the underlying, desugared type.
5901This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5902  varDecl(hasType(hasUnqualifiedDesugaredType(
5903      recordType(hasDeclaration(decl())))))
5904In this matcher, the decl will match the CXXRecordDecl of class X.
5905
5906Usable 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;,
5907  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;,
5908  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;,
5909  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;,
5910  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;,
5911  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;,
5912  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5913</pre></td></tr>
5914
5915
5916<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>
5917<tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is
5918matched by a given matcher.
5919
5920Given
5921  struct X { int m; };
5922  void f(X x) { x.m; m; }
5923memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
5924  matches "x.m" and "m"
5925with hasObjectExpression(...)
5926  matching "x" and the implicit object expression of "m" which has type X*.
5927</pre></td></tr>
5928
5929
5930<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>
5931<tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
5932given matcher.
5933
5934Given
5935  struct { int first, second; } first, second;
5936  int i(second.first);
5937  int j(first.second);
5938memberExpr(member(hasName("first")))
5939  matches second.first
5940  but not first.second (because the member name there is "second").
5941</pre></td></tr>
5942
5943
5944<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>
5945<tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
5946pointee matches a given matcher.
5947
5948Given
5949  int *a;
5950  int const *b;
5951  float const *f;
5952pointerType(pointee(isConstQualified(), isInteger()))
5953  matches "int const *b"
5954
5955Usable 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;,
5956  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;
5957</pre></td></tr>
5958
5959
5960<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>
5961<tr><td colspan="4" class="doc" id="hasUnderlyingDecl0"><pre>Matches a NamedDecl whose underlying declaration matches the given
5962matcher.
5963
5964Given
5965  namespace N { template&lt;class T&gt; void f(T t); }
5966  template &lt;class T&gt; void g() { using N::f; f(T()); }
5967unresolvedLookupExpr(hasAnyDeclaration(
5968    namedDecl(hasUnderlyingDecl(hasName("::N::f")))))
5969  matches the use of f in g() .
5970</pre></td></tr>
5971
5972
5973<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>
5974<tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
5975
5976Given
5977  struct A { struct B { struct C {}; }; };
5978  A::B::C c;
5979nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
5980  matches "A::"
5981</pre></td></tr>
5982
5983
5984<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>
5985<tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
5986given TypeLoc.
5987
5988Given
5989  struct A { struct B { struct C {}; }; };
5990  A::B::C c;
5991nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
5992  hasDeclaration(cxxRecordDecl(hasName("A")))))))
5993  matches "A::"
5994</pre></td></tr>
5995
5996
5997<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>
5998<tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
5999
6000Given
6001  struct A { struct B { struct C {}; }; };
6002  A::B::C c;
6003nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
6004  matches "A::"
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('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>
6009<tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
6010given namespace matcher.
6011
6012Given
6013  namespace ns { struct A {}; }
6014  ns::A a;
6015nestedNameSpecifier(specifiesNamespace(hasName("ns")))
6016  matches "ns::"
6017</pre></td></tr>
6018
6019
6020<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>
6021<tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
6022given QualType matcher without qualifiers.
6023
6024Given
6025  struct A { struct B { struct C {}; }; };
6026  A::B::C c;
6027nestedNameSpecifier(specifiesType(
6028  hasDeclaration(cxxRecordDecl(hasName("A")))
6029))
6030  matches "A::"
6031</pre></td></tr>
6032
6033
6034<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>
6035<tr><td colspan="4" class="doc" id="hasAnyArgument3"><pre>Matches any argument of a call expression or a constructor call
6036expression, or an ObjC-message-send expression.
6037
6038Given
6039  void x(int, int, int) { int y; x(1, y, 42); }
6040callExpr(hasAnyArgument(declRefExpr()))
6041  matches x(1, y, 42)
6042with hasAnyArgument(...)
6043  matching y
6044
6045For ObjectiveC, given
6046  @interface I - (void) f:(int) y; @end
6047  void foo(I *i) { [i f:12]; }
6048objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
6049  matches [i f:12]
6050</pre></td></tr>
6051
6052
6053<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>
6054<tr><td colspan="4" class="doc" id="hasArgument2"><pre>Matches the n'th argument of a call expression or a constructor
6055call expression.
6056
6057Example matches y in x(y)
6058    (matcher = callExpr(hasArgument(0, declRefExpr())))
6059  void x(int) { int y; x(y); }
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('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>
6064<tr><td colspan="4" class="doc" id="hasReceiver0"><pre>Matches if the Objective-C message is sent to an instance,
6065and the inner matcher matches on that instance.
6066
6067For example the method call in
6068  NSString *x = @"hello";
6069  [x containsString:@"h"];
6070is matched by
6071objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
6072</pre></td></tr>
6073
6074
6075<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('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>
6076<tr><td colspan="4" class="doc" id="hasReceiverType0"><pre>Matches on the receiver of an ObjectiveC Message expression.
6077
6078Example
6079matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *")));
6080matches the [webView ...] message invocation.
6081  NSString *webViewJavaScript = ...
6082  UIWebView *webView = ...
6083  [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
6084</pre></td></tr>
6085
6086
6087<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>
6088<tr><td colspan="4" class="doc" id="hasAnyParameter1"><pre>Matches any parameter of a function or an ObjC method declaration or a
6089block.
6090
6091Does not match the 'this' parameter of a method.
6092
6093Given
6094  class X { void f(int x, int y, int z) {} };
6095cxxMethodDecl(hasAnyParameter(hasName("y")))
6096  matches f(int x, int y, int z) {}
6097with hasAnyParameter(...)
6098  matching int y
6099
6100For ObjectiveC, given
6101  @interface I - (void) f:(int) y; @end
6102
6103the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
6104matches the declaration of method f with hasParameter
6105matching y.
6106
6107For blocks, given
6108  b = ^(int y) { printf("%d", y) };
6109
6110the matcher blockDecl(hasAnyParameter(hasName("y")))
6111matches the declaration of the block b with hasParameter
6112matching y.
6113</pre></td></tr>
6114
6115
6116<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>
6117<tr><td colspan="4" class="doc" id="hasParameter1"><pre>Matches the n'th parameter of a function or an ObjC method
6118declaration or a block.
6119
6120Given
6121  class X { void f(int x) {} };
6122cxxMethodDecl(hasParameter(0, hasType(varDecl())))
6123  matches f(int x) {}
6124with hasParameter(...)
6125  matching int x
6126
6127For ObjectiveC, given
6128  @interface I - (void) f:(int) y; @end
6129
6130the matcher objcMethodDecl(hasParameter(0, hasName("y")))
6131matches the declaration of method f with hasParameter
6132matching y.
6133</pre></td></tr>
6134
6135
6136<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>
6137<tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre>Matches if the cast's source expression
6138or opaque value's source expression matches the given matcher.
6139
6140Example 1: matches "a string"
6141(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
6142class URL { URL(string); };
6143URL url = "a string";
6144
6145Example 2: matches 'b' (matcher =
6146opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
6147int a = b ?: 1;
6148</pre></td></tr>
6149
6150
6151<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>
6152<tr><td colspan="4" class="doc" id="hasAnyDeclaration0"><pre>Matches an OverloadExpr if any of the declarations in the set of
6153overloads matches the given matcher.
6154
6155Given
6156  template &lt;typename T&gt; void foo(T);
6157  template &lt;typename T&gt; void bar(T);
6158  template &lt;typename T&gt; void baz(T t) {
6159    foo(t);
6160    bar(t);
6161  }
6162unresolvedLookupExpr(hasAnyDeclaration(
6163    functionTemplateDecl(hasName("foo"))))
6164  matches foo in foo(t); but not bar in bar(t);
6165</pre></td></tr>
6166
6167
6168<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>
6169<tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
6170
6171Given
6172  int (*ptr_to_array)[4];
6173  int (*ptr_to_func)(int);
6174
6175varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
6176ptr_to_func but not ptr_to_array.
6177
6178Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
6179</pre></td></tr>
6180
6181
6182<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>
6183<tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
6184pointee matches a given matcher.
6185
6186Given
6187  int *a;
6188  int const *b;
6189  float const *f;
6190pointerType(pointee(isConstQualified(), isInteger()))
6191  matches "int const *b"
6192
6193Usable 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;,
6194  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;
6195</pre></td></tr>
6196
6197
6198<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>
6199<tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
6200
6201Given:
6202  typedef int &amp;int_ref;
6203  int a;
6204  int_ref b = a;
6205
6206varDecl(hasType(qualType(referenceType()))))) will not match the
6207declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
6208</pre></td></tr>
6209
6210
6211<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>
6212<tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
6213matches the given matcher.
6214
6215The associated declaration is:
6216- for type nodes, the declaration of the underlying type
6217- for CallExpr, the declaration of the callee
6218- for MemberExpr, the declaration of the referenced member
6219- for CXXConstructExpr, the declaration of the constructor
6220- for CXXNewExpr, the declaration of the operator new
6221- for ObjCIvarExpr, the declaration of the ivar
6222
6223For type nodes, hasDeclaration will generally match the declaration of the
6224sugared type. Given
6225  class X {};
6226  typedef X Y;
6227  Y y;
6228in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6229typedefDecl. A common use case is to match the underlying, desugared type.
6230This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6231  varDecl(hasType(hasUnqualifiedDesugaredType(
6232      recordType(hasDeclaration(decl())))))
6233In this matcher, the decl will match the CXXRecordDecl of class X.
6234
6235Usable 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;,
6236  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;,
6237  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;,
6238  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;,
6239  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;,
6240  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;,
6241  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6242</pre></td></tr>
6243
6244
6245<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>
6246<tr><td colspan="4" class="doc" id="ignoringParens0"><pre>Matches types that match InnerMatcher after any parens are stripped.
6247
6248Given
6249  void (*fp)(void);
6250The matcher
6251  varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
6252would match the declaration for fp.
6253</pre></td></tr>
6254
6255
6256<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>
6257<tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
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('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>
6262<tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
6263matches the specified matcher.
6264
6265Example matches y-&gt;x()
6266  (matcher = cxxMemberCallExpr(on(hasType(pointsTo
6267     cxxRecordDecl(hasName("Y")))))))
6268  class Y { public: void x(); };
6269  void z() { Y *y; y-&gt;x(); }
6270</pre></td></tr>
6271
6272
6273<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>
6274<tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
6275</pre></td></tr>
6276
6277
6278<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>
6279<tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
6280type matches the specified matcher.
6281
6282Example matches X &amp;x and const X &amp;y
6283    (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
6284  class X {
6285    void a(X b) {
6286      X &amp;x = b;
6287      const X &amp;y = b;
6288    }
6289  };
6290</pre></td></tr>
6291
6292
6293<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>
6294<tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
6295matches the given matcher.
6296
6297The associated declaration is:
6298- for type nodes, the declaration of the underlying type
6299- for CallExpr, the declaration of the callee
6300- for MemberExpr, the declaration of the referenced member
6301- for CXXConstructExpr, the declaration of the constructor
6302- for CXXNewExpr, the declaration of the operator new
6303- for ObjCIvarExpr, the declaration of the ivar
6304
6305For type nodes, hasDeclaration will generally match the declaration of the
6306sugared type. Given
6307  class X {};
6308  typedef X Y;
6309  Y y;
6310in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6311typedefDecl. A common use case is to match the underlying, desugared type.
6312This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6313  varDecl(hasType(hasUnqualifiedDesugaredType(
6314      recordType(hasDeclaration(decl())))))
6315In this matcher, the decl will match the CXXRecordDecl of class X.
6316
6317Usable 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;,
6318  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;,
6319  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;,
6320  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;,
6321  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;,
6322  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;,
6323  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6324</pre></td></tr>
6325
6326
6327<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>
6328<tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
6329pointee matches a given matcher.
6330
6331Given
6332  int *a;
6333  int const *b;
6334  float const *f;
6335pointerType(pointee(isConstQualified(), isInteger()))
6336  matches "int const *b"
6337
6338Usable 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;,
6339  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;
6340</pre></td></tr>
6341
6342
6343<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>
6344<tr><td colspan="4" class="doc" id="hasReturnValue0"><pre>Matches the return value expression of a return statement
6345
6346Given
6347  return a + b;
6348hasReturnValue(binaryOperator())
6349  matches 'return a + b'
6350with binaryOperator()
6351  matching 'a + b'
6352</pre></td></tr>
6353
6354
6355<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>
6356<tr><td colspan="4" class="doc" id="hasAnySubstatement1"><pre>Matches compound statements where at least one substatement matches
6357a given matcher. Also matches StmtExprs that have CompoundStmt as children.
6358
6359Given
6360  { {}; 1+2; }
6361hasAnySubstatement(compoundStmt())
6362  matches '{ {}; 1+2; }'
6363with compoundStmt()
6364  matching '{}'
6365</pre></td></tr>
6366
6367
6368<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>
6369<tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
6370alignof.
6371</pre></td></tr>
6372
6373
6374<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>
6375<tr><td colspan="4" class="doc" id="forFunction0"><pre>Matches declaration of the function the statement belongs to
6376
6377Given:
6378F&amp; operator=(const F&amp; o) {
6379  std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
6380  return *this;
6381}
6382returnStmt(forFunction(hasName("operator=")))
6383  matches 'return *this'
6384  but does match 'return &gt; 0'
6385</pre></td></tr>
6386
6387
6388<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>
6389<tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
6390sizeof.
6391</pre></td></tr>
6392
6393
6394<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>
6395<tr><td colspan="4" class="doc" id="hasReplacementType0"><pre>Matches template type parameter substitutions that have a replacement
6396type that matches the provided matcher.
6397
6398Given
6399  template &lt;typename T&gt;
6400  double F(T t);
6401  int i;
6402  double j = F(i);
6403
6404substTemplateTypeParmType(hasReplacementType(type())) matches int
6405</pre></td></tr>
6406
6407
6408<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>
6409<tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
6410statement. This matcher may produce multiple matches.
6411
6412Given
6413  switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
6414switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
6415  matches four times, with "c" binding each of "case 1:", "case 2:",
6416"case 3:" and "case 4:", and "s" respectively binding "switch (1)",
6417"switch (1)", "switch (2)" and "switch (2)".
6418</pre></td></tr>
6419
6420
6421<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>
6422<tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
6423switch statement or conditional operator.
6424
6425Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6426  if (true) {}
6427</pre></td></tr>
6428
6429
6430<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>
6431<tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
6432matches the given matcher.
6433
6434The associated declaration is:
6435- for type nodes, the declaration of the underlying type
6436- for CallExpr, the declaration of the callee
6437- for MemberExpr, the declaration of the referenced member
6438- for CXXConstructExpr, the declaration of the constructor
6439- for CXXNewExpr, the declaration of the operator new
6440- for ObjCIvarExpr, the declaration of the ivar
6441
6442For type nodes, hasDeclaration will generally match the declaration of the
6443sugared type. Given
6444  class X {};
6445  typedef X Y;
6446  Y y;
6447in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6448typedefDecl. A common use case is to match the underlying, desugared type.
6449This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6450  varDecl(hasType(hasUnqualifiedDesugaredType(
6451      recordType(hasDeclaration(decl())))))
6452In this matcher, the decl will match the CXXRecordDecl of class X.
6453
6454Usable 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;,
6455  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;,
6456  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;,
6457  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;,
6458  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;,
6459  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;,
6460  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6461</pre></td></tr>
6462
6463
6464<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>
6465<tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
6466
6467Given
6468  struct B { int next; };
6469  template&lt;int(B::*next_ptr)&gt; struct A {};
6470  A&lt;&amp;B::next&gt; a;
6471templateSpecializationType(hasAnyTemplateArgument(
6472  isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
6473  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
6474    B::next
6475</pre></td></tr>
6476
6477
6478<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>
6479<tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
6480declaration.
6481
6482Given
6483  struct B { int next; };
6484  template&lt;int(B::*next_ptr)&gt; struct A {};
6485  A&lt;&amp;B::next&gt; a;
6486classTemplateSpecializationDecl(hasAnyTemplateArgument(
6487    refersToDeclaration(fieldDecl(hasName("next")))))
6488  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
6489    B::next
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('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>
6494<tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that referes to an integral type.
6495
6496Given
6497  template&lt;int T&gt; struct C {};
6498  C&lt;42&gt; c;
6499classTemplateSpecializationDecl(
6500  hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
6501  matches the implicit instantiation of C in C&lt;42&gt;.
6502</pre></td></tr>
6503
6504
6505<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>
6506<tr><td colspan="4" class="doc" id="refersToTemplate0"><pre>Matches a TemplateArgument that refers to a certain template.
6507
6508Given
6509  template&lt;template &lt;typename&gt; class S&gt; class X {};
6510  template&lt;typename T&gt; class Y {};
6511  X&lt;Y&gt; xi;
6512classTemplateSpecializationDecl(hasAnyTemplateArgument(
6513    refersToTemplate(templateName())))
6514  matches the specialization X&lt;Y&gt;
6515</pre></td></tr>
6516
6517
6518<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>
6519<tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
6520
6521Given
6522  struct X {};
6523  template&lt;typename T&gt; struct A {};
6524  A&lt;X&gt; a;
6525classTemplateSpecializationDecl(hasAnyTemplateArgument(
6526    refersToType(class(hasName("X")))))
6527  matches the specialization A&lt;X&gt;
6528</pre></td></tr>
6529
6530
6531<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>
6532<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6533functionDecl that have at least one TemplateArgument matching the given
6534InnerMatcher.
6535
6536Given
6537  template&lt;typename T&gt; class A {};
6538  template&lt;&gt; class A&lt;double&gt; {};
6539  A&lt;int&gt; a;
6540
6541  template&lt;typename T&gt; f() {};
6542  void func() { f&lt;int&gt;(); };
6543
6544classTemplateSpecializationDecl(hasAnyTemplateArgument(
6545    refersToType(asString("int"))))
6546  matches the specialization A&lt;int&gt;
6547
6548functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
6549  matches the specialization f&lt;int&gt;
6550</pre></td></tr>
6551
6552
6553<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>
6554<tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
6555matches the given matcher.
6556
6557The associated declaration is:
6558- for type nodes, the declaration of the underlying type
6559- for CallExpr, the declaration of the callee
6560- for MemberExpr, the declaration of the referenced member
6561- for CXXConstructExpr, the declaration of the constructor
6562- for CXXNewExpr, the declaration of the operator new
6563- for ObjCIvarExpr, the declaration of the ivar
6564
6565For type nodes, hasDeclaration will generally match the declaration of the
6566sugared type. Given
6567  class X {};
6568  typedef X Y;
6569  Y y;
6570in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6571typedefDecl. A common use case is to match the underlying, desugared type.
6572This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6573  varDecl(hasType(hasUnqualifiedDesugaredType(
6574      recordType(hasDeclaration(decl())))))
6575In this matcher, the decl will match the CXXRecordDecl of class X.
6576
6577Usable 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;,
6578  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;,
6579  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;,
6580  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;,
6581  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;,
6582  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;,
6583  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6584</pre></td></tr>
6585
6586
6587<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>
6588<tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6589functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
6590
6591Given
6592  template&lt;typename T, typename U&gt; class A {};
6593  A&lt;bool, int&gt; b;
6594  A&lt;int, bool&gt; c;
6595
6596  template&lt;typename T&gt; void f() {}
6597  void func() { f&lt;int&gt;(); };
6598classTemplateSpecializationDecl(hasTemplateArgument(
6599    1, refersToType(asString("int"))))
6600  matches the specialization A&lt;bool, int&gt;
6601
6602functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
6603  matches the specialization f&lt;int&gt;
6604</pre></td></tr>
6605
6606
6607<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>
6608<tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
6609matches the given matcher.
6610
6611The associated declaration is:
6612- for type nodes, the declaration of the underlying type
6613- for CallExpr, the declaration of the callee
6614- for MemberExpr, the declaration of the referenced member
6615- for CXXConstructExpr, the declaration of the constructor
6616- for CXXNewExpr, the declaration of the operator new
6617- for ObjCIvarExpr, the declaration of the ivar
6618
6619For type nodes, hasDeclaration will generally match the declaration of the
6620sugared type. Given
6621  class X {};
6622  typedef X Y;
6623  Y y;
6624in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6625typedefDecl. A common use case is to match the underlying, desugared type.
6626This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6627  varDecl(hasType(hasUnqualifiedDesugaredType(
6628      recordType(hasDeclaration(decl())))))
6629In this matcher, the decl will match the CXXRecordDecl of class X.
6630
6631Usable 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;,
6632  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;,
6633  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;,
6634  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;,
6635  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;,
6636  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;,
6637  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6638</pre></td></tr>
6639
6640
6641<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>
6642<tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
6643
6644Generates results for each match.
6645
6646For example, in:
6647  class A { class B {}; class C {}; };
6648The matcher:
6649  cxxRecordDecl(hasName("::A"),
6650                findAll(cxxRecordDecl(isDefinition()).bind("m")))
6651will generate results for A, B and C.
6652
6653Usable as: Any Matcher
6654</pre></td></tr>
6655
6656
6657<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>
6658<tr><td colspan="4" class="doc" id="hasType2"><pre>Matches if the expression's or declaration's type matches a type
6659matcher.
6660
6661Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6662            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6663            and U (matcher = typedefDecl(hasType(asString("int")))
6664            and friend class X (matcher = friendDecl(hasType("X"))
6665 class X {};
6666 void y(X &amp;x) { x; X z; }
6667 typedef int U;
6668 class Y { friend class X; };
6669</pre></td></tr>
6670
6671
6672<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>
6673<tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
6674matches the given matcher.
6675
6676The associated declaration is:
6677- for type nodes, the declaration of the underlying type
6678- for CallExpr, the declaration of the callee
6679- for MemberExpr, the declaration of the referenced member
6680- for CXXConstructExpr, the declaration of the constructor
6681- for CXXNewExpr, the declaration of the operator new
6682- for ObjCIvarExpr, the declaration of the ivar
6683
6684For type nodes, hasDeclaration will generally match the declaration of the
6685sugared type. Given
6686  class X {};
6687  typedef X Y;
6688  Y y;
6689in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6690typedefDecl. A common use case is to match the underlying, desugared type.
6691This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6692  varDecl(hasType(hasUnqualifiedDesugaredType(
6693      recordType(hasDeclaration(decl())))))
6694In this matcher, the decl will match the CXXRecordDecl of class X.
6695
6696Usable 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;,
6697  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;,
6698  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;,
6699  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;,
6700  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;,
6701  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;,
6702  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6703</pre></td></tr>
6704
6705
6706<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>
6707<tr><td colspan="4" class="doc" id="hasUnqualifiedDesugaredType0"><pre>Matches if the matched type matches the unqualified desugared
6708type of the matched node.
6709
6710For example, in:
6711  class A {};
6712  using B = A;
6713The matcher type(hasUnqualifiedDesugaredType(recordType())) matches
6714both B and A.
6715</pre></td></tr>
6716
6717
6718<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>
6719<tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
6720
6721Given
6722  int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
6723unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
6724  matches sizeof(a) and alignof(c)
6725</pre></td></tr>
6726
6727
6728<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>
6729<tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
6730
6731Example matches true (matcher = hasUnaryOperand(
6732                                  cxxBoolLiteral(equals(true))))
6733  !true
6734</pre></td></tr>
6735
6736
6737<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>
6738<tr><td colspan="4" class="doc" id="hasObjectExpression1"><pre>Matches a member expression where the object expression is
6739matched by a given matcher.
6740
6741Given
6742  struct X { int m; };
6743  void f(X x) { x.m; m; }
6744memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
6745  matches "x.m" and "m"
6746with hasObjectExpression(...)
6747  matching "x" and the implicit object expression of "m" which has type X*.
6748</pre></td></tr>
6749
6750
6751<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>
6752<tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
6753matches the given matcher.
6754
6755The associated declaration is:
6756- for type nodes, the declaration of the underlying type
6757- for CallExpr, the declaration of the callee
6758- for MemberExpr, the declaration of the referenced member
6759- for CXXConstructExpr, the declaration of the constructor
6760- for CXXNewExpr, the declaration of the operator new
6761- for ObjCIvarExpr, the declaration of the ivar
6762
6763For type nodes, hasDeclaration will generally match the declaration of the
6764sugared type. Given
6765  class X {};
6766  typedef X Y;
6767  Y y;
6768in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6769typedefDecl. A common use case is to match the underlying, desugared type.
6770This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6771  varDecl(hasType(hasUnqualifiedDesugaredType(
6772      recordType(hasDeclaration(decl())))))
6773In this matcher, the decl will match the CXXRecordDecl of class X.
6774
6775Usable 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;,
6776  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;,
6777  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;,
6778  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;,
6779  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;,
6780  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;,
6781  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6782</pre></td></tr>
6783
6784
6785<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>
6786<tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
6787
6788Given
6789  namespace X { void b(); }
6790  using X::b;
6791usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
6792  matches using X::b </pre></td></tr>
6793
6794
6795<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>
6796<tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
6797matched by the given matcher.
6798
6799Given
6800  namespace X { int a; void b(); }
6801  using X::a;
6802  using X::b;
6803usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
6804  matches using X::b but not using X::a </pre></td></tr>
6805
6806
6807<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>
6808<tr><td colspan="4" class="doc" id="hasType6"><pre>Overloaded to match the declaration of the expression's or value
6809declaration's type.
6810
6811In case of a value declaration (for example a variable declaration),
6812this resolves one layer of indirection. For example, in the value
6813declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
6814X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
6815declaration of x.
6816
6817Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6818            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6819            and friend class X (matcher = friendDecl(hasType("X"))
6820 class X {};
6821 void y(X &amp;x) { x; X z; }
6822 class Y { friend class X; };
6823
6824Usable 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;
6825</pre></td></tr>
6826
6827
6828<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>
6829<tr><td colspan="4" class="doc" id="hasType3"><pre>Matches if the expression's or declaration's type matches a type
6830matcher.
6831
6832Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6833            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6834            and U (matcher = typedefDecl(hasType(asString("int")))
6835            and friend class X (matcher = friendDecl(hasType("X"))
6836 class X {};
6837 void y(X &amp;x) { x; X z; }
6838 typedef int U;
6839 class Y { friend class X; };
6840</pre></td></tr>
6841
6842
6843<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>
6844<tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
6845that matches the given matcher.
6846
6847Example matches x (matcher = varDecl(hasInitializer(callExpr())))
6848  bool y() { return true; }
6849  bool x = y();
6850</pre></td></tr>
6851
6852
6853<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>
6854<tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
6855expression.
6856
6857Given
6858  void f(int b) {
6859    int a[b];
6860  }
6861variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
6862  varDecl(hasName("b")))))))
6863  matches "int a[b]"
6864</pre></td></tr>
6865
6866
6867<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>
6868<tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', 'do while' statement or a function
6869definition that has a given body.
6870
6871Given
6872  for (;;) {}
6873hasBody(compoundStmt())
6874  matches 'for (;;) {}'
6875with compoundStmt()
6876  matching '{}'
6877</pre></td></tr>
6878
6879
6880<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>
6881<tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
6882switch statement or conditional operator.
6883
6884Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6885  if (true) {}
6886</pre></td></tr>
6887
6888
6889<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>
6890<tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
6891NestedNameSpecifier-matcher matches.
6892</pre></td></tr>
6893
6894
6895<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>
6896<tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
6897QualType-matcher matches.
6898</pre></td></tr>
6899
6900<!--END_TRAVERSAL_MATCHERS -->
6901</table>
6902
6903</div>
6904</body>
6905</html>
6906
6907
6908