• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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('classTemplateDecl0')"><a name="classTemplateDecl0Anchor">classTemplateDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateDecl.html">ClassTemplateDecl</a>&gt;...</td></tr>
128<tr><td colspan="4" class="doc" id="classTemplateDecl0"><pre>Matches C++ class template declarations.
129
130Example matches Z
131  template&lt;class T&gt; class Z {};
132</pre></td></tr>
133
134
135<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('classTemplateSpecializationDecl0')"><a name="classTemplateSpecializationDecl0Anchor">classTemplateSpecializationDecl</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;...</td></tr>
136<tr><td colspan="4" class="doc" id="classTemplateSpecializationDecl0"><pre>Matches C++ class template specializations.
137
138Given
139  template&lt;typename T&gt; class A {};
140  template&lt;&gt; class A&lt;double&gt; {};
141  A&lt;int&gt; a;
142classTemplateSpecializationDecl()
143  matches the specializations A&lt;int&gt; and A&lt;double&gt;
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('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>
148<tr><td colspan="4" class="doc" id="cxxConstructorDecl0"><pre>Matches C++ constructor declarations.
149
150Example matches Foo::Foo() and Foo::Foo(int)
151  class Foo {
152   public:
153    Foo();
154    Foo(int);
155    int DoSomething();
156  };
157</pre></td></tr>
158
159
160<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
161<tr><td colspan="4" class="doc" id="cxxConversionDecl0"><pre>Matches conversion operator declarations.
162
163Example matches the operator.
164  class X { operator int() const; };
165</pre></td></tr>
166
167
168<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>
169<tr><td colspan="4" class="doc" id="cxxDestructorDecl0"><pre>Matches explicit C++ destructor declarations.
170
171Example matches Foo::~Foo()
172  class Foo {
173   public:
174    virtual ~Foo();
175  };
176</pre></td></tr>
177
178
179<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>
180<tr><td colspan="4" class="doc" id="cxxMethodDecl0"><pre>Matches method declarations.
181
182Example matches y
183  class X { void y(); };
184</pre></td></tr>
185
186
187<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>
188<tr><td colspan="4" class="doc" id="cxxRecordDecl0"><pre>Matches C++ class declarations.
189
190Example matches X, Z
191  class X;
192  template&lt;class T&gt; class Z {};
193</pre></td></tr>
194
195
196<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>
197<tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations.
198
199Examples matches X, C, and the friend declaration inside C;
200  void X();
201  class C {
202    friend X;
203  };
204</pre></td></tr>
205
206
207<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>
208<tr><td colspan="4" class="doc" id="declaratorDecl0"><pre>Matches declarator declarations (field, variable, function
209and non-type template parameter declarations).
210
211Given
212  class X { int y; };
213declaratorDecl()
214  matches int y.
215</pre></td></tr>
216
217
218<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>
219<tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants.
220
221Example matches A, B, C
222  enum X {
223    A, B, C
224  };
225</pre></td></tr>
226
227
228<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>
229<tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations.
230
231Example matches X
232  enum X {
233    A, B, C
234  };
235</pre></td></tr>
236
237
238<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>
239<tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations.
240
241Given
242  class X { int m; };
243fieldDecl()
244  matches 'm'.
245</pre></td></tr>
246
247
248<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>
249<tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations.
250
251Given
252  class X { friend void foo(); };
253friendDecl()
254  matches 'friend void foo()'.
255</pre></td></tr>
256
257
258<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>
259<tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations.
260
261Example matches f
262  void f();
263</pre></td></tr>
264
265
266<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>
267<tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations.
268
269Example matches f
270  template&lt;class T&gt; void f(T t) {}
271</pre></td></tr>
272
273
274<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>
275<tr><td colspan="4" class="doc" id="labelDecl0"><pre>Matches a declaration of label.
276
277Given
278  goto FOO;
279  FOO: bar();
280labelDecl()
281  matches 'FOO:'
282</pre></td></tr>
283
284
285<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>
286<tr><td colspan="4" class="doc" id="linkageSpecDecl0"><pre>Matches a declaration of a linkage specification.
287
288Given
289  extern "C" {}
290linkageSpecDecl()
291  matches "extern "C" {}"
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('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>
296<tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name.
297
298Example matches X, S, the anonymous union type, i, and U;
299  typedef int X;
300  struct S {
301    union {
302      int i;
303    } U;
304  };
305</pre></td></tr>
306
307
308<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>
309<tr><td colspan="4" class="doc" id="namespaceAliasDecl0"><pre>Matches a declaration of a namespace alias.
310
311Given
312  namespace test {}
313  namespace alias = ::test;
314namespaceAliasDecl()
315  matches "namespace alias" but not "namespace test"
316</pre></td></tr>
317
318
319<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>
320<tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace.
321
322Given
323  namespace {}
324  namespace test {}
325namespaceDecl()
326  matches "namespace {}" and "namespace test {}"
327</pre></td></tr>
328
329
330<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>
331<tr><td colspan="4" class="doc" id="nonTypeTemplateParmDecl0"><pre>Matches non-type template parameter declarations.
332
333Given
334  template &lt;typename T, int N&gt; struct C {};
335nonTypeTemplateParmDecl()
336  matches 'N', but not 'T'.
337</pre></td></tr>
338
339
340<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>
341<tr><td colspan="4" class="doc" id="objcInterfaceDecl0"><pre>Matches Objective-C interface declarations.
342
343Example matches Foo
344  @interface Foo
345  @end
346</pre></td></tr>
347
348
349<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>
350<tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations.
351
352Given
353  void f(int x);
354parmVarDecl()
355  matches int x.
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('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>
360<tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches class, struct, and union declarations.
361
362Example matches X, Z, U, and S
363  class X;
364  template&lt;class T&gt; class Z {};
365  struct S {};
366  union U {};
367</pre></td></tr>
368
369
370<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
371<tr><td colspan="4" class="doc" id="staticAssertDecl0"><pre>Matches a C++ static_assert declaration.
372
373Example:
374  staticAssertExpr()
375matches
376  static_assert(sizeof(S) == sizeof(int))
377in
378  struct S {
379    int x;
380  };
381  static_assert(sizeof(S) == sizeof(int));
382</pre></td></tr>
383
384
385<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>
386<tr><td colspan="4" class="doc" id="templateTypeParmDecl0"><pre>Matches template type parameter declarations.
387
388Given
389  template &lt;typename T, int N&gt; struct C {};
390templateTypeParmDecl()
391  matches 'T', but not 'N'.
392</pre></td></tr>
393
394
395<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>
396<tr><td colspan="4" class="doc" id="translationUnitDecl0"><pre>Matches the top declaration context.
397
398Given
399  int X;
400  namespace NS {
401  int Y;
402  }  namespace NS
403decl(hasDeclContext(translationUnitDecl()))
404  matches "int X", but not "int Y".
405</pre></td></tr>
406
407
408<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>
409<tr><td colspan="4" class="doc" id="typeAliasDecl0"><pre>Matches type alias declarations.
410
411Given
412  typedef int X;
413  using Y = int;
414typeAliasDecl()
415  matches "using Y = int", but not "typedef int X"
416</pre></td></tr>
417
418
419<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>
420<tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef declarations.
421
422Given
423  typedef int X;
424  using Y = int;
425typedefDecl()
426  matches "typedef int X", but not "using Y = int"
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('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>
431<tr><td colspan="4" class="doc" id="typedefNameDecl0"><pre>Matches typedef name declarations.
432
433Given
434  typedef int X;
435  using Y = int;
436typedefNameDecl()
437  matches "typedef int X" and "using Y = int"
438</pre></td></tr>
439
440
441<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>
442<tr><td colspan="4" class="doc" id="unresolvedUsingTypenameDecl0"><pre>Matches unresolved using value declarations that involve the
443typename.
444
445Given
446  template &lt;typename T&gt;
447  struct Base { typedef T Foo; };
448
449  template&lt;typename T&gt;
450  struct S : private Base&lt;T&gt; {
451    using typename Base&lt;T&gt;::Foo;
452  };
453unresolvedUsingTypenameDecl()
454  matches using Base&lt;T&gt;::Foo </pre></td></tr>
455
456
457<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>
458<tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations.
459
460Given
461  template&lt;typename X&gt;
462  class C : private X {
463    using X::x;
464  };
465unresolvedUsingValueDecl()
466  matches using X::x </pre></td></tr>
467
468
469<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>
470<tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations.
471
472Given
473  namespace X { int x; }
474  using X::x;
475usingDecl()
476  matches using X::x </pre></td></tr>
477
478
479<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>
480<tr><td colspan="4" class="doc" id="usingDirectiveDecl0"><pre>Matches using namespace declarations.
481
482Given
483  namespace X { int x; }
484  using namespace X;
485usingDirectiveDecl()
486  matches using namespace X </pre></td></tr>
487
488
489<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>
490<tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value declaration.
491
492Example matches A, B, C and F
493  enum X { A, B, C };
494  void F();
495</pre></td></tr>
496
497
498<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>
499<tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations.
500
501Note: this does not match declarations of member variables, which are
502"field" declarations in Clang parlance.
503
504Example matches a
505  int a;
506</pre></td></tr>
507
508
509<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>
510<tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
511</pre></td></tr>
512
513
514<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>
515<tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers.
516
517Given
518  namespace ns {
519    struct A { static void f(); };
520    void A::f() {}
521    void g() { A::f(); }
522  }
523  ns::A a;
524nestedNameSpecifier()
525  matches "ns::" and both "A::"
526</pre></td></tr>
527
528
529<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>
530<tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST.
531</pre></td></tr>
532
533
534<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>
535<tr><td colspan="4" class="doc" id="addrLabelExpr0"><pre>Matches address of label statements (GNU extension).
536
537Given
538  FOO: bar();
539  void *ptr = &amp;&amp;FOO;
540  goto *bar;
541addrLabelExpr()
542  matches '&amp;&amp;FOO'
543</pre></td></tr>
544
545
546<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
547<tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions.
548
549Given
550  int i = a[1];
551arraySubscriptExpr()
552  matches "a[1]"
553</pre></td></tr>
554
555
556<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
557<tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements.
558
559 int i = 100;
560  __asm("mov al, 2");
561asmStmt()
562  matches '__asm("mov al, 2")'
563</pre></td></tr>
564
565
566<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>
567<tr><td colspan="4" class="doc" id="atomicExpr0"><pre>Matches atomic builtins.
568Example matches __atomic_load_n(ptr, 1)
569  void foo() { int *ptr; __atomic_load_n(ptr, 1); }
570</pre></td></tr>
571
572
573<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>
574<tr><td colspan="4" class="doc" id="binaryConditionalOperator0"><pre>Matches binary conditional operator expressions (GNU extension).
575
576Example matches a ?: b
577  (a ?: b) + 42;
578</pre></td></tr>
579
580
581<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>
582<tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions.
583
584Example matches a || b
585  !(a || b)
586</pre></td></tr>
587
588
589<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>
590<tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements.
591
592Given
593  while (true) { break; }
594breakStmt()
595  matches 'break'
596</pre></td></tr>
597
598
599<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>
600<tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression.
601
602Example: Matches (int*) 2.2f in
603  int i = (int) 2.2f;
604</pre></td></tr>
605
606
607<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>
608<tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions.
609
610Example matches x.y() and y()
611  X x;
612  x.y();
613  y();
614</pre></td></tr>
615
616
617<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>
618<tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements.
619
620Given
621  switch(a) { case 42: break; default: break; }
622caseStmt()
623  matches 'case 42: break;'.
624</pre></td></tr>
625
626
627<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>
628<tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST.
629
630Example: castExpr() matches each of the following:
631  (int) 3;
632  const_cast&lt;Expr *&gt;(SubExpr);
633  char c = 0;
634but does not match
635  int i = (0);
636  int k = 0;
637</pre></td></tr>
638
639
640<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>
641<tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t).
642
643Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
644though.
645
646Example matches 'a', L'a'
647  char ch = 'a';
648  wchar_t chw = L'a';
649</pre></td></tr>
650
651
652<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
653<tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
654
655Example match: {1}, (1, 2)
656  int array[4] = {1};
657  vector int myvec = (vector int)(1, 2);
658</pre></td></tr>
659
660
661<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>
662<tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements.
663
664Example matches '{}' and '{{}}'in 'for (;;) {{}}'
665  for (;;) {{}}
666</pre></td></tr>
667
668
669<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>
670<tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions.
671
672Example matches a ? b : c
673  (a ? b : c) + 42
674</pre></td></tr>
675
676
677<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
678<tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements.
679
680Given
681  while (true) { continue; }
682continueStmt()
683  matches 'continue'
684</pre></td></tr>
685
686
687<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>
688<tr><td colspan="4" class="doc" id="cudaKernelCallExpr0"><pre>Matches CUDA kernel call expression.
689
690Example matches,
691  kernel&lt;&lt;&lt;i,j&gt;&gt;&gt;();
692</pre></td></tr>
693
694
695<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>
696<tr><td colspan="4" class="doc" id="cxxBindTemporaryExpr0"><pre>Matches nodes where temporaries are created.
697
698Example matches FunctionTakesString(GetStringByValue())
699    (matcher = cxxBindTemporaryExpr())
700  FunctionTakesString(GetStringByValue());
701  FunctionTakesStringByPointer(GetStringPointer());
702</pre></td></tr>
703
704
705<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>
706<tr><td colspan="4" class="doc" id="cxxBoolLiteral0"><pre>Matches bool literals.
707
708Example matches true
709  true
710</pre></td></tr>
711
712
713<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>
714<tr><td colspan="4" class="doc" id="cxxCatchStmt0"><pre>Matches catch statements.
715
716  try {} catch(int i) {}
717cxxCatchStmt()
718  matches 'catch(int i)'
719</pre></td></tr>
720
721
722<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>
723<tr><td colspan="4" class="doc" id="cxxConstCastExpr0"><pre>Matches a const_cast expression.
724
725Example: Matches const_cast&lt;int*&gt;(&amp;r) in
726  int n = 42;
727  const int &amp;r(n);
728  int* p = const_cast&lt;int*&gt;(&amp;r);
729</pre></td></tr>
730
731
732<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>
733<tr><td colspan="4" class="doc" id="cxxConstructExpr0"><pre>Matches constructor call expressions (including implicit ones).
734
735Example matches string(ptr, n) and ptr within arguments of f
736    (matcher = cxxConstructExpr())
737  void f(const string &amp;a, const string &amp;b);
738  char *ptr;
739  int n;
740  f(string(ptr, n), ptr);
741</pre></td></tr>
742
743
744<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
745<tr><td colspan="4" class="doc" id="cxxDefaultArgExpr0"><pre>Matches the value of a default argument at the call site.
746
747Example matches the CXXDefaultArgExpr placeholder inserted for the
748    default value of the second parameter in the call expression f(42)
749    (matcher = cxxDefaultArgExpr())
750  void f(int x, int y = 0);
751  f(42);
752</pre></td></tr>
753
754
755<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>
756<tr><td colspan="4" class="doc" id="cxxDeleteExpr0"><pre>Matches delete expressions.
757
758Given
759  delete X;
760cxxDeleteExpr()
761  matches 'delete X'.
762</pre></td></tr>
763
764
765<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
766<tr><td colspan="4" class="doc" id="cxxDynamicCastExpr0"><pre>Matches a dynamic_cast expression.
767
768Example:
769  cxxDynamicCastExpr()
770matches
771  dynamic_cast&lt;D*&gt;(&amp;b);
772in
773  struct B { virtual ~B() {} }; struct D : B {};
774  B b;
775  D* p = dynamic_cast&lt;D*&gt;(&amp;b);
776</pre></td></tr>
777
778
779<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>
780<tr><td colspan="4" class="doc" id="cxxForRangeStmt0"><pre>Matches range-based for statements.
781
782cxxForRangeStmt() matches 'for (auto a : i)'
783  int i[] =  {1, 2, 3}; for (auto a : i);
784  for(int j = 0; j &lt; 5; ++j);
785</pre></td></tr>
786
787
788<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>
789<tr><td colspan="4" class="doc" id="cxxFunctionalCastExpr0"><pre>Matches functional cast expressions
790
791Example: Matches Foo(bar);
792  Foo f = bar;
793  Foo g = (Foo) bar;
794  Foo h = Foo(bar);
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('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>
799<tr><td colspan="4" class="doc" id="cxxMemberCallExpr0"><pre>Matches member call expressions.
800
801Example matches x.y()
802  X x;
803  x.y();
804</pre></td></tr>
805
806
807<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>
808<tr><td colspan="4" class="doc" id="cxxNewExpr0"><pre>Matches new expressions.
809
810Given
811  new X;
812cxxNewExpr()
813  matches 'new X'.
814</pre></td></tr>
815
816
817<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
818<tr><td colspan="4" class="doc" id="cxxNullPtrLiteralExpr0"><pre>Matches nullptr literal.
819</pre></td></tr>
820
821
822<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>
823<tr><td colspan="4" class="doc" id="cxxOperatorCallExpr0"><pre>Matches overloaded operator calls.
824
825Note that if an operator isn't overloaded, it won't match. Instead, use
826binaryOperator matcher.
827Currently it does not match operators such as new delete.
828FIXME: figure out why these do not match?
829
830Example matches both operator&lt;&lt;((o &lt;&lt; b), c) and operator&lt;&lt;(o, b)
831    (matcher = cxxOperatorCallExpr())
832  ostream &amp;operator&lt;&lt; (ostream &amp;out, int i) { };
833  ostream &amp;o; int b = 1, c = 1;
834  o &lt;&lt; b &lt;&lt; c;
835</pre></td></tr>
836
837
838<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>
839<tr><td colspan="4" class="doc" id="cxxReinterpretCastExpr0"><pre>Matches a reinterpret_cast expression.
840
841Either the source expression or the destination type can be matched
842using has(), but hasDestinationType() is more specific and can be
843more readable.
844
845Example matches reinterpret_cast&lt;char*&gt;(&amp;p) in
846  void* p = reinterpret_cast&lt;char*&gt;(&amp;p);
847</pre></td></tr>
848
849
850<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>
851<tr><td colspan="4" class="doc" id="cxxStaticCastExpr0"><pre>Matches a C++ static_cast expression.
852
853See also: hasDestinationType
854See also: reinterpretCast
855
856Example:
857  cxxStaticCastExpr()
858matches
859  static_cast&lt;long&gt;(8)
860in
861  long eight(static_cast&lt;long&gt;(8));
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('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>
866<tr><td colspan="4" class="doc" id="cxxTemporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments
867
868Example: Matches Foo(bar, bar)
869  Foo h = Foo(bar, bar);
870</pre></td></tr>
871
872
873<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>
874<tr><td colspan="4" class="doc" id="cxxThisExpr0"><pre>Matches implicit and explicit this expressions.
875
876Example matches the implicit this expression in "return i".
877    (matcher = cxxThisExpr())
878struct foo {
879  int i;
880  int f() { return i; }
881};
882</pre></td></tr>
883
884
885<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>
886<tr><td colspan="4" class="doc" id="cxxThrowExpr0"><pre>Matches throw expressions.
887
888  try { throw 5; } catch(int i) {}
889cxxThrowExpr()
890  matches 'throw 5'
891</pre></td></tr>
892
893
894<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
895<tr><td colspan="4" class="doc" id="cxxTryStmt0"><pre>Matches try statements.
896
897  try {} catch(int i) {}
898cxxTryStmt()
899  matches 'try {}'
900</pre></td></tr>
901
902
903<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
904<tr><td colspan="4" class="doc" id="cxxUnresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions.
905
906Example matches T(t) in return statement of f
907    (matcher = cxxUnresolvedConstructExpr())
908  template &lt;typename T&gt;
909  void f(const T&amp; t) { return T(t); }
910</pre></td></tr>
911
912
913<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
914<tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations.
915
916Example matches x in if (x)
917  bool x;
918  if (x) {}
919</pre></td></tr>
920
921
922<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
923<tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements.
924
925Given
926  int a;
927declStmt()
928  matches 'int a'.
929</pre></td></tr>
930
931
932<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
933<tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements.
934
935Given
936  switch(a) { case 42: break; default: break; }
937defaultStmt()
938  matches 'default: break;'.
939</pre></td></tr>
940
941
942<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>
943<tr><td colspan="4" class="doc" id="designatedInitExpr0"><pre>Matches C99 designated initializer expressions [C99 6.7.8].
944
945Example: Matches { [2].y = 1.0, [0].x = 1.0 }
946  point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
947</pre></td></tr>
948
949
950<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>
951<tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements.
952
953Given
954  do {} while (true);
955doStmt()
956  matches 'do {} while(true)'
957</pre></td></tr>
958
959
960<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>
961<tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions.
962
963Matches any cast expression written in user code, whether it be a
964C-style cast, a functional-style cast, or a keyword cast.
965
966Does not match implicit conversions.
967
968Note: the name "explicitCast" is chosen to match Clang's terminology, as
969Clang uses the term "cast" to apply to implicit conversions as well as to
970actual cast expressions.
971
972See also: hasDestinationType.
973
974Example: matches all five of the casts in
975  int((int)(reinterpret_cast&lt;int&gt;(static_cast&lt;int&gt;(const_cast&lt;int&gt;(42)))))
976but does not match the implicit conversion in
977  long ell = 42;
978</pre></td></tr>
979
980
981<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>
982<tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions.
983
984Example matches x()
985  void f() { x(); }
986</pre></td></tr>
987
988
989<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>
990<tr><td colspan="4" class="doc" id="exprWithCleanups0"><pre>Matches expressions that introduce cleanups to be run at the end
991of the sub-expression's evaluation.
992
993Example matches std::string()
994  const std::string str = std::string();
995</pre></td></tr>
996
997
998<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>
999<tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes encodings, e.g.
10001.0, 1.0f, 1.0L and 1e10.
1001
1002Does not match implicit conversions such as
1003  float a = 10;
1004</pre></td></tr>
1005
1006
1007<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1008<tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements.
1009
1010Example matches 'for (;;) {}'
1011  for (;;) {}
1012  int i[] =  {1, 2, 3}; for (auto a : i);
1013</pre></td></tr>
1014
1015
1016<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>
1017<tr><td colspan="4" class="doc" id="gnuNullExpr0"><pre>Matches GNU __null expression.
1018</pre></td></tr>
1019
1020
1021<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>
1022<tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements.
1023
1024Given
1025  goto FOO;
1026  FOO: bar();
1027gotoStmt()
1028  matches 'goto FOO'
1029</pre></td></tr>
1030
1031
1032<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1033<tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements.
1034
1035Example matches 'if (x) {}'
1036  if (x) {}
1037</pre></td></tr>
1038
1039
1040<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>
1041<tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST.
1042
1043This matches many different places, including function call return value
1044eliding, as well as any type conversions.
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('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>
1049<tr><td colspan="4" class="doc" id="implicitValueInitExpr0"><pre>Matches implicit initializers of init list expressions.
1050
1051Given
1052  point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
1053implicitValueInitExpr()
1054  matches "[0].y" (implicitly)
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('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>
1059<tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions.
1060
1061Given
1062  int a[] = { 1, 2 };
1063  struct B { int x, y; };
1064  B b = { 5, 6 };
1065initListExpr()
1066  matches "{ 1, 2 }" and "{ 5, 6 }"
1067</pre></td></tr>
1068
1069
1070<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1071<tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes encodings, e.g.
10721, 1L, 0x1 and 1U.
1073
1074Does not match character-encoded integers such as L'a'.
1075</pre></td></tr>
1076
1077
1078<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1079<tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements.
1080
1081Given
1082  goto FOO;
1083  FOO: bar();
1084labelStmt()
1085  matches 'FOO:'
1086</pre></td></tr>
1087
1088
1089<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>
1090<tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions.
1091
1092Example matches [&amp;](){return 5;}
1093  [&amp;](){return 5;}
1094</pre></td></tr>
1095
1096
1097<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>
1098<tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized.
1099
1100Example: Given
1101  struct T {void func()};
1102  T f();
1103  void g(T);
1104materializeTemporaryExpr() matches 'f()' in these statements
1105  T u(f());
1106  g(f());
1107but does not match
1108  f();
1109  f().func();
1110</pre></td></tr>
1111
1112
1113<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>
1114<tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions.
1115
1116Given
1117  class Y {
1118    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
1119    int a; static int b;
1120  };
1121memberExpr()
1122  matches this-&gt;x, x, y.x, a, this-&gt;b
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('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>
1127<tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements.
1128
1129  foo();;
1130nullStmt()
1131  matches the second ';'
1132</pre></td></tr>
1133
1134
1135<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1136<tr><td colspan="4" class="doc" id="objcMessageExpr0"><pre>Matches ObjectiveC Message invocation expressions.
1137
1138The innermost message send invokes the "alloc" class method on the
1139NSString class, while the outermost message send invokes the
1140"initWithString" instance method on the object returned from
1141NSString's "alloc". This matcher should match both message sends.
1142  [[NSString alloc] initWithString:@"Hello"]
1143</pre></td></tr>
1144
1145
1146<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>
1147<tr><td colspan="4" class="doc" id="opaqueValueExpr0"><pre>Matches opaque value expressions. They are used as helpers
1148to reference another expressions and can be met
1149in BinaryConditionalOperators, for example.
1150
1151Example matches 'a'
1152  (a ?: c) + 42;
1153</pre></td></tr>
1154
1155
1156<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>
1157<tr><td colspan="4" class="doc" id="parenExpr0"><pre>Matches parentheses used in expressions.
1158
1159Example matches (foo() + 1)
1160  int foo() { return 1; }
1161  int a = (foo() + 1);
1162</pre></td></tr>
1163
1164
1165<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>
1166<tr><td colspan="4" class="doc" id="parenListExpr0"><pre>Matches paren list expressions.
1167ParenListExprs don't have a predefined type and are used for late parsing.
1168In the final AST, they can be met in template declarations.
1169
1170Given
1171  template&lt;typename T&gt; class X {
1172    void f() {
1173      X x(*this);
1174      int a = 0, b = 1; int i = (a, b);
1175    }
1176  };
1177parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
1178has a predefined type and is a ParenExpr, not a ParenListExpr.
1179</pre></td></tr>
1180
1181
1182<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>
1183<tr><td colspan="4" class="doc" id="predefinedExpr0"><pre>Matches predefined identifier expressions [C99 6.4.2.2].
1184
1185Example: Matches __func__
1186  printf("%s", __func__);
1187</pre></td></tr>
1188
1189
1190<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>
1191<tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements.
1192
1193Given
1194  return 1;
1195returnStmt()
1196  matches 'return 1'
1197</pre></td></tr>
1198
1199
1200<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>
1201<tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements.
1202
1203Given
1204  { ++a; }
1205stmt()
1206  matches both the compound statement '{ ++a; }' and '++a'.
1207</pre></td></tr>
1208
1209
1210<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>
1211<tr><td colspan="4" class="doc" id="stmtExpr0"><pre>Matches statement expression (GNU extension).
1212
1213Example match: ({ int X = 4; X; })
1214  int C = ({ int X = 4; X; });
1215</pre></td></tr>
1216
1217
1218<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>
1219<tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
1220
1221Example matches "abcd", L"abcd"
1222  char *s = "abcd";
1223  wchar_t *ws = L"abcd";
1224</pre></td></tr>
1225
1226
1227<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>
1228<tr><td colspan="4" class="doc" id="substNonTypeTemplateParmExpr0"><pre>Matches substitutions of non-type template parameters.
1229
1230Given
1231  template &lt;int N&gt;
1232  struct A { static const int n = N; };
1233  struct B : public A&lt;42&gt; {};
1234substNonTypeTemplateParmExpr()
1235  matches "N" in the right-hand side of "static const int n = N;"
1236</pre></td></tr>
1237
1238
1239<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>
1240<tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements.
1241
1242Given
1243  switch(a) { case 42: break; default: break; }
1244switchCase()
1245  matches 'case 42: break;' and 'default: break;'.
1246</pre></td></tr>
1247
1248
1249<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>
1250<tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements.
1251
1252Given
1253  switch(a) { case 42: break; default: break; }
1254switchStmt()
1255  matches 'switch(a)'.
1256</pre></td></tr>
1257
1258
1259<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>
1260<tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
1261
1262Given
1263  Foo x = bar;
1264  int y = sizeof(x) + alignof(x);
1265unaryExprOrTypeTraitExpr()
1266  matches sizeof(x) and alignof(x)
1267</pre></td></tr>
1268
1269
1270<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>
1271<tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions.
1272
1273Example matches !a
1274  !a || b
1275</pre></td></tr>
1276
1277
1278<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>
1279<tr><td colspan="4" class="doc" id="unresolvedLookupExpr0"><pre>Matches reference to a name that can be looked up during parsing
1280but could not be resolved to a specific declaration.
1281
1282Given
1283  template&lt;typename T&gt;
1284  T foo() { T a; return a; }
1285  template&lt;typename T&gt;
1286  void bar() {
1287    foo&lt;T&gt;();
1288  }
1289unresolvedLookupExpr()
1290  matches foo&lt;T&gt;() </pre></td></tr>
1291
1292
1293<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>
1294<tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call.
1295
1296Example match: "foo"_suffix
1297</pre></td></tr>
1298
1299
1300<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>
1301<tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements.
1302
1303Given
1304  while (true) {}
1305whileStmt()
1306  matches 'while (true) {}'.
1307</pre></td></tr>
1308
1309
1310<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>
1311<tr><td colspan="4" class="doc" id="templateArgument0"><pre>Matches template arguments.
1312
1313Given
1314  template &lt;typename T&gt; struct C {};
1315  C&lt;int&gt; c;
1316templateArgument()
1317  matches 'int' in C&lt;int&gt;.
1318</pre></td></tr>
1319
1320
1321<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>
1322<tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST.
1323</pre></td></tr>
1324
1325
1326<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>
1327<tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays.
1328
1329Given
1330  int a[] = { 2, 3 };
1331  int b[4];
1332  void f() { int c[a[0]]; }
1333arrayType()
1334  matches "int a[]", "int b[4]" and "int c[a[0]]";
1335</pre></td></tr>
1336
1337
1338<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>
1339<tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types.
1340
1341Given
1342  _Atomic(int) i;
1343atomicType()
1344  matches "_Atomic(int) i"
1345</pre></td></tr>
1346
1347
1348<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>
1349<tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types.
1350
1351Given:
1352  auto n = 4;
1353  int v[] = { 2, 3 }
1354  for (auto i : v) { }
1355autoType()
1356  matches "auto n" and "auto i"
1357</pre></td></tr>
1358
1359
1360<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>
1361<tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as
1362"void (^)(int)".
1363
1364The pointee is always required to be a FunctionType.
1365</pre></td></tr>
1366
1367
1368<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>
1369<tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types.
1370
1371Given
1372  struct A {};
1373  A a;
1374  int b;
1375  float c;
1376  bool d;
1377builtinType()
1378  matches "int b", "float c" and "bool d"
1379</pre></td></tr>
1380
1381
1382<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>
1383<tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types.
1384
1385Given
1386  _Complex float f;
1387complexType()
1388  matches "_Complex float f"
1389</pre></td></tr>
1390
1391
1392<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>
1393<tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size.
1394
1395Given
1396  void() {
1397    int a[2];
1398    int b[] = { 2, 3 };
1399    int c[b[0]];
1400  }
1401constantArrayType()
1402  matches "int a[2]"
1403</pre></td></tr>
1404
1405
1406<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>
1407<tr><td colspan="4" class="doc" id="decayedType0"><pre>Matches decayed type
1408Example matches i[] in declaration of f.
1409    (matcher = valueDecl(hasType(decayedType(hasDecayedType(pointerType())))))
1410Example matches i[1].
1411    (matcher = expr(hasType(decayedType(hasDecayedType(pointerType())))))
1412  void f(int i[]) {
1413    i[1] = 0;
1414  }
1415</pre></td></tr>
1416
1417
1418<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>
1419<tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression.
1420
1421Given
1422  template&lt;typename T, int Size&gt;
1423  class array {
1424    T data[Size];
1425  };
1426dependentSizedArrayType
1427  matches "T data[Size]"
1428</pre></td></tr>
1429
1430
1431<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>
1432<tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a
1433qualified name.
1434
1435Given
1436  namespace N {
1437    namespace M {
1438      class D {};
1439    }
1440  }
1441  class C {};
1442
1443  class C c;
1444  N::M::D d;
1445
1446elaboratedType() matches the type of the variable declarations of both
1447c and d.
1448</pre></td></tr>
1449
1450
1451<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>
1452<tr><td colspan="4" class="doc" id="enumType0"><pre>Matches enum types.
1453
1454Given
1455  enum C { Green };
1456  enum class S { Red };
1457
1458  C c;
1459  S s;
1460
1461enumType() matches the type of the variable declarations of both c and
1462s.
1463</pre></td></tr>
1464
1465
1466<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>
1467<tr><td colspan="4" class="doc" id="functionProtoType0"><pre>Matches FunctionProtoType nodes.
1468
1469Given
1470  int (*f)(int);
1471  void g();
1472functionProtoType()
1473  matches "int (*f)(int)" and the type of "g" in C++ mode.
1474  In C mode, "g" is not matched because it does not contain a prototype.
1475</pre></td></tr>
1476
1477
1478<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>
1479<tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes.
1480
1481Given
1482  int (*f)(int);
1483  void g();
1484functionType()
1485  matches "int (*f)(int)" and the type of "g".
1486</pre></td></tr>
1487
1488
1489<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>
1490<tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size.
1491
1492Given
1493  int a[] = { 2, 3 };
1494  int b[42];
1495  void f(int c[]) { int d[a[0]]; };
1496incompleteArrayType()
1497  matches "int a[]" and "int c[]"
1498</pre></td></tr>
1499
1500
1501<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>
1502<tr><td colspan="4" class="doc" id="injectedClassNameType0"><pre>Matches injected class name types.
1503
1504Example matches S s, but not S&lt;T&gt; s.
1505    (matcher = parmVarDecl(hasType(injectedClassNameType())))
1506  template &lt;typename T&gt; struct S {
1507    void f(S s);
1508    void g(S&lt;T&gt; s);
1509  };
1510</pre></td></tr>
1511
1512
1513<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>
1514<tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types.
1515
1516Given:
1517  int *a;
1518  int &amp;b = *a;
1519  int &amp;&amp;c = 1;
1520  auto &amp;d = b;
1521  auto &amp;&amp;e = c;
1522  auto &amp;&amp;f = 2;
1523  int g = 5;
1524
1525lValueReferenceType() matches the types of b, d, and e. e is
1526matched since the type is deduced as int&amp; by reference collapsing rules.
1527</pre></td></tr>
1528
1529
1530<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>
1531<tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types.
1532Given
1533  struct A { int i; }
1534  A::* ptr = A::i;
1535memberPointerType()
1536  matches "A::* ptr"
1537</pre></td></tr>
1538
1539
1540<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>
1541<tr><td colspan="4" class="doc" id="objcObjectPointerType0"><pre>Matches an Objective-C object pointer type, which is different from
1542a pointer type, despite being syntactically similar.
1543
1544Given
1545  int *a;
1546
1547  @interface Foo
1548  @end
1549  Foo *f;
1550pointerType()
1551  matches "Foo *f", but does not match "int *a".
1552</pre></td></tr>
1553
1554
1555<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>
1556<tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes.
1557
1558Given
1559  int (*ptr_to_array)[4];
1560  int *array_of_ptrs[4];
1561
1562varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
1563array_of_ptrs.
1564</pre></td></tr>
1565
1566
1567<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>
1568<tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types, but does not match Objective-C object pointer
1569types.
1570
1571Given
1572  int *a;
1573  int &amp;b = *a;
1574  int c = 5;
1575
1576  @interface Foo
1577  @end
1578  Foo *f;
1579pointerType()
1580  matches "int *a", but does not match "Foo *f".
1581</pre></td></tr>
1582
1583
1584<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>
1585<tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types.
1586
1587Given:
1588  int *a;
1589  int &amp;b = *a;
1590  int &amp;&amp;c = 1;
1591  auto &amp;d = b;
1592  auto &amp;&amp;e = c;
1593  auto &amp;&amp;f = 2;
1594  int g = 5;
1595
1596rValueReferenceType() matches the types of c and f. e is not
1597matched as it is deduced to int&amp; by reference collapsing rules.
1598</pre></td></tr>
1599
1600
1601<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>
1602<tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes).
1603
1604Given
1605  class C {};
1606  struct S {};
1607
1608  C c;
1609  S s;
1610
1611recordType() matches the type of the variable declarations of both c
1612and s.
1613</pre></td></tr>
1614
1615
1616<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>
1617<tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types.
1618
1619Given
1620  int *a;
1621  int &amp;b = *a;
1622  int &amp;&amp;c = 1;
1623  auto &amp;d = b;
1624  auto &amp;&amp;e = c;
1625  auto &amp;&amp;f = 2;
1626  int g = 5;
1627
1628referenceType() matches the types of b, c, d, e, and f.
1629</pre></td></tr>
1630
1631
1632<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>
1633<tr><td colspan="4" class="doc" id="substTemplateTypeParmType0"><pre>Matches types that represent the result of substituting a type for a
1634template type parameter.
1635
1636Given
1637  template &lt;typename T&gt;
1638  void F(T t) {
1639    int i = 1 + t;
1640  }
1641
1642substTemplateTypeParmType() matches the type of 't' but not '1'
1643</pre></td></tr>
1644
1645
1646<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>
1647<tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types.
1648
1649Given
1650  template &lt;typename T&gt;
1651  class C { };
1652
1653  template class C&lt;int&gt;;  A
1654  C&lt;char&gt; var;            B
1655
1656templateSpecializationType() matches the type of the explicit
1657instantiation in A and the type of the variable declaration in B.
1658</pre></td></tr>
1659
1660
1661<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>
1662<tr><td colspan="4" class="doc" id="templateTypeParmType0"><pre>Matches template type parameter types.
1663
1664Example matches T, but not int.
1665    (matcher = templateTypeParmType())
1666  template &lt;typename T&gt; void f(int i);
1667</pre></td></tr>
1668
1669
1670<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>
1671<tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST.
1672</pre></td></tr>
1673
1674
1675<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>
1676<tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types.
1677
1678Given
1679  typedef int X;
1680typedefType()
1681  matches "typedef int X"
1682</pre></td></tr>
1683
1684
1685<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>
1686<tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations.
1687
1688Given:
1689  typedef __underlying_type(T) type;
1690unaryTransformType()
1691  matches "__underlying_type(T)"
1692</pre></td></tr>
1693
1694
1695<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>
1696<tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an
1697integer-constant-expression.
1698
1699Given
1700  void f() {
1701    int a[] = { 2, 3 }
1702    int b[42];
1703    int c[a[0]];
1704  }
1705variableArrayType()
1706  matches "int c[a[0]]"
1707</pre></td></tr>
1708
1709<!--END_DECL_MATCHERS -->
1710</table>
1711
1712<!-- ======================================================================= -->
1713<h2 id="narrowing-matchers">Narrowing Matchers</h2>
1714<!-- ======================================================================= -->
1715
1716<p>Narrowing matchers match certain attributes on the current node, thus
1717narrowing down the set of nodes of the current type to match on.</p>
1718
1719<p>There are special logical narrowing matchers (allOf, anyOf, anything and unless)
1720which allow users to create more powerful match expressions.</p>
1721
1722<table>
1723<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
1724<!-- START_NARROWING_MATCHERS -->
1725
1726<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>
1727<tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match.
1728
1729Usable as: Any Matcher
1730</pre></td></tr>
1731
1732
1733<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>
1734<tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches.
1735
1736Usable as: Any Matcher
1737</pre></td></tr>
1738
1739
1740<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr>
1741<tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node.
1742
1743Useful when another matcher requires a child matcher, but there's no
1744additional constraint. This will often be used with an explicit conversion
1745to an internal::Matcher&lt;&gt; type such as TypeMatcher.
1746
1747Example: DeclarationMatcher(anything()) matches all declarations, e.g.,
1748"int* p" and "void f()" in
1749  int* p;
1750  void f();
1751
1752Usable as: Any Matcher
1753</pre></td></tr>
1754
1755
1756<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher&lt;*&gt;</td></tr>
1757<tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match.
1758
1759Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
1760  class X {};
1761  class Y {};
1762
1763Usable as: Any Matcher
1764</pre></td></tr>
1765
1766
1767<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>
1768<tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions (binary or
1769unary).
1770
1771Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
1772  !(a || b)
1773</pre></td></tr>
1774
1775
1776<tr><td>Matcher&lt;CXXBoolLiteral&gt;</td><td class="name" onclick="toggle('equals2')"><a name="equals2Anchor">equals</a></td><td>ValueT  Value</td></tr>
1777<tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value.
1778
1779Example matches true (matcher = cxxBoolLiteral(equals(true)))
1780  true
1781
1782Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
1783           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;
1784</pre></td></tr>
1785
1786
1787<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>
1788<tr><td colspan="4" class="doc" id="isCatchAll0"><pre>Matches a C++ catch statement that has a catch-all handler.
1789
1790Given
1791  try {
1792    ...
1793  } catch (int) {
1794    ...
1795  } catch (...) {
1796    ...
1797  }
1798endcode
1799cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
1800</pre></td></tr>
1801
1802
1803<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>
1804<tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has
1805a specific number of arguments (including absent default arguments).
1806
1807Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
1808  void f(int x, int y);
1809  f(0, 0);
1810</pre></td></tr>
1811
1812
1813<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>
1814<tr><td colspan="4" class="doc" id="isListInitialization0"><pre>Matches a constructor call expression which uses list initialization.
1815</pre></td></tr>
1816
1817
1818<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>
1819<tr><td colspan="4" class="doc" id="requiresZeroInitialization0"><pre>Matches a constructor call expression which requires
1820zero initialization.
1821
1822Given
1823void foo() {
1824  struct point { double x; double y; };
1825  point pt[2] = { { 1.0, 2.0 } };
1826}
1827initListExpr(has(cxxConstructExpr(requiresZeroInitialization()))
1828will match the implicit array filler for pt[1].
1829</pre></td></tr>
1830
1831
1832<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>
1833<tr><td colspan="4" class="doc" id="isCopyConstructor0"><pre>Matches constructor declarations that are copy constructors.
1834
1835Given
1836  struct S {
1837    S(); #1
1838    S(const S &amp;); #2
1839    S(S &amp;&amp;); #3
1840  };
1841cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3.
1842</pre></td></tr>
1843
1844
1845<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>
1846<tr><td colspan="4" class="doc" id="isDefaultConstructor0"><pre>Matches constructor declarations that are default constructors.
1847
1848Given
1849  struct S {
1850    S(); #1
1851    S(const S &amp;); #2
1852    S(S &amp;&amp;); #3
1853  };
1854cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3.
1855</pre></td></tr>
1856
1857
1858<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>
1859<tr><td colspan="4" class="doc" id="isDelegatingConstructor0"><pre>Matches constructors that delegate to another constructor.
1860
1861Given
1862  struct S {
1863    S(); #1
1864    S(int) {} #2
1865    S(S &amp;&amp;) : S() {} #3
1866  };
1867  S::S() : S(0) {} #4
1868cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not
1869#1 or #2.
1870</pre></td></tr>
1871
1872
1873<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>
1874<tr><td colspan="4" class="doc" id="isExplicit0"><pre>Matches constructor and conversion declarations that are marked with
1875the explicit keyword.
1876
1877Given
1878  struct S {
1879    S(int); #1
1880    explicit S(double); #2
1881    operator int(); #3
1882    explicit operator bool(); #4
1883  };
1884cxxConstructorDecl(isExplicit()) will match #2, but not #1.
1885cxxConversionDecl(isExplicit()) will match #4, but not #3.
1886</pre></td></tr>
1887
1888
1889<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>
1890<tr><td colspan="4" class="doc" id="isMoveConstructor0"><pre>Matches constructor declarations that are move constructors.
1891
1892Given
1893  struct S {
1894    S(); #1
1895    S(const S &amp;); #2
1896    S(S &amp;&amp;); #3
1897  };
1898cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2.
1899</pre></td></tr>
1900
1901
1902<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>
1903<tr><td colspan="4" class="doc" id="isExplicit1"><pre>Matches constructor and conversion declarations that are marked with
1904the explicit keyword.
1905
1906Given
1907  struct S {
1908    S(int); #1
1909    explicit S(double); #2
1910    operator int(); #3
1911    explicit operator bool(); #4
1912  };
1913cxxConstructorDecl(isExplicit()) will match #2, but not #1.
1914cxxConversionDecl(isExplicit()) will match #4, but not #3.
1915</pre></td></tr>
1916
1917
1918<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>
1919<tr><td colspan="4" class="doc" id="isBaseInitializer0"><pre>Matches a constructor initializer if it is initializing a base, as
1920opposed to a member.
1921
1922Given
1923  struct B {};
1924  struct D : B {
1925    int I;
1926    D(int i) : I(i) {}
1927  };
1928  struct E : B {
1929    E() : B() {}
1930  };
1931cxxConstructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
1932  will match E(), but not match D(int).
1933</pre></td></tr>
1934
1935
1936<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>
1937<tr><td colspan="4" class="doc" id="isMemberInitializer0"><pre>Matches a constructor initializer if it is initializing a member, as
1938opposed to a base.
1939
1940Given
1941  struct B {};
1942  struct D : B {
1943    int I;
1944    D(int i) : I(i) {}
1945  };
1946  struct E : B {
1947    E() : B() {}
1948  };
1949cxxConstructorDecl(hasAnyConstructorInitializer(isMemberInitializer()))
1950  will match D(int), but not match E().
1951</pre></td></tr>
1952
1953
1954<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>
1955<tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in
1956code (as opposed to implicitly added by the compiler).
1957
1958Given
1959  struct Foo {
1960    Foo() { }
1961    Foo(int) : foo_("A") { }
1962    string foo_;
1963  };
1964cxxConstructorDecl(hasAnyConstructorInitializer(isWritten()))
1965  will match Foo(int), but not Foo()
1966</pre></td></tr>
1967
1968
1969<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>
1970<tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
1971
1972Given
1973struct A {
1974  void foo() const;
1975  void bar();
1976};
1977
1978cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
1979</pre></td></tr>
1980
1981
1982<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>
1983<tr><td colspan="4" class="doc" id="isCopyAssignmentOperator0"><pre>Matches if the given method declaration declares a copy assignment
1984operator.
1985
1986Given
1987struct A {
1988  A &amp;operator=(const A &amp;);
1989  A &amp;operator=(A &amp;&amp;);
1990};
1991
1992cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
1993the second one.
1994</pre></td></tr>
1995
1996
1997<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>
1998<tr><td colspan="4" class="doc" id="isFinal1"><pre>Matches if the given method or class declaration is final.
1999
2000Given:
2001  class A final {};
2002
2003  struct B {
2004    virtual void f();
2005  };
2006
2007  struct C : B {
2008    void f() final;
2009  };
2010matches A and C::f, but not B, C, or B::f
2011</pre></td></tr>
2012
2013
2014<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>
2015<tr><td colspan="4" class="doc" id="isMoveAssignmentOperator0"><pre>Matches if the given method declaration declares a move assignment
2016operator.
2017
2018Given
2019struct A {
2020  A &amp;operator=(const A &amp;);
2021  A &amp;operator=(A &amp;&amp;);
2022};
2023
2024cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
2025the first one.
2026</pre></td></tr>
2027
2028
2029<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>
2030<tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
2031
2032Given
2033  class A {
2034   public:
2035    virtual void x();
2036  };
2037  class B : public A {
2038   public:
2039    virtual void x();
2040  };
2041  matches B::x
2042</pre></td></tr>
2043
2044
2045<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>
2046<tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure.
2047
2048Given
2049  class A {
2050   public:
2051    virtual void x() = 0;
2052  };
2053  matches A::x
2054</pre></td></tr>
2055
2056
2057<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>
2058<tr><td colspan="4" class="doc" id="isUserProvided0"><pre>Matches method declarations that are user-provided.
2059
2060Given
2061  struct S {
2062    S(); #1
2063    S(const S &amp;) = default; #2
2064    S(S &amp;&amp;) = delete; #3
2065  };
2066cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3.
2067</pre></td></tr>
2068
2069
2070<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>
2071<tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches if the given method declaration is virtual.
2072
2073Given
2074  class A {
2075   public:
2076    virtual void x();
2077  };
2078  matches A::x
2079</pre></td></tr>
2080
2081
2082<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>
2083<tr><td colspan="4" class="doc" id="isVirtualAsWritten0"><pre>Matches if the given method declaration has an explicit "virtual".
2084
2085Given
2086  class A {
2087   public:
2088    virtual void x();
2089  };
2090  class B : public A {
2091   public:
2092    void x();
2093  };
2094  matches A::x but not B::x
2095</pre></td></tr>
2096
2097
2098<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>
2099<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
2100
2101Matches overloaded operator names specified in strings without the
2102"operator" prefix: e.g. "&lt;&lt;".
2103
2104Given:
2105  class A { int operator*(); };
2106  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
2107  A a;
2108  a &lt;&lt; a;   &lt;-- This matches
2109
2110cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
2111specified line and
2112cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
2113matches the declaration of A.
2114
2115Usable 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;
2116</pre></td></tr>
2117
2118
2119<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>
2120<tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
2121</pre></td></tr>
2122
2123
2124<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>
2125<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
2126static member variable template instantiations.
2127
2128Given
2129  template&lt;typename T&gt; void A(T t) { }
2130  template&lt;&gt; void A(int N) { }
2131functionDecl(isExplicitTemplateSpecialization())
2132  matches the specialization A&lt;int&gt;().
2133
2134Usable 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;
2135</pre></td></tr>
2136
2137
2138<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>
2139<tr><td colspan="4" class="doc" id="isFinal0"><pre>Matches if the given method or class declaration is final.
2140
2141Given:
2142  class A final {};
2143
2144  struct B {
2145    virtual void f();
2146  };
2147
2148  struct C : B {
2149    void f() final;
2150  };
2151matches A and C::f, but not B, C, or B::f
2152</pre></td></tr>
2153
2154
2155<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>
2156<tr><td colspan="4" class="doc" id="isLambda0"><pre>Matches the generated class of lambda expressions.
2157
2158Given:
2159  auto x = []{};
2160
2161cxxRecordDecl(isLambda()) matches the implicit class declaration of
2162decltype(x)
2163</pre></td></tr>
2164
2165
2166<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>
2167<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Overloaded method as shortcut for
2168isSameOrDerivedFrom(hasName(...)).
2169</pre></td></tr>
2170
2171
2172<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>
2173<tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
2174member variable template instantiations.
2175
2176Given
2177  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
2178or
2179  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
2180cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2181  matches the template instantiation of X&lt;A&gt;.
2182
2183But given
2184  template &lt;typename T&gt;  class X {}; class A {};
2185  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
2186cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2187  does not match, as X&lt;A&gt; is an explicit template specialization.
2188
2189Usable 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;
2190</pre></td></tr>
2191
2192
2193<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>
2194<tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
2195a specific number of arguments (including absent default arguments).
2196
2197Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2198  void f(int x, int y);
2199  f(0, 0);
2200</pre></td></tr>
2201
2202
2203<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>
2204<tr><td colspan="4" class="doc" id="hasCastKind0"><pre>Matches casts that has a given cast kind.
2205
2206Example: matches the implicit cast around 0
2207(matcher = castExpr(hasCastKind(CK_NullToPointer)))
2208  int *p = 0;
2209</pre></td></tr>
2210
2211
2212<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;</td><td class="name" onclick="toggle('equals3')"><a name="equals3Anchor">equals</a></td><td>ValueT  Value</td></tr>
2213<tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value.
2214
2215Example matches true (matcher = cxxBoolLiteral(equals(true)))
2216  true
2217
2218Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
2219           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;
2220</pre></td></tr>
2221
2222
2223<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>
2224<tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N.
2225
2226Given
2227  template&lt;typename T&gt; struct C {};
2228  C&lt;int&gt; c;
2229classTemplateSpecializationDecl(templateArgumentCountIs(1))
2230  matches C&lt;int&gt;.
2231</pre></td></tr>
2232
2233
2234<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>
2235<tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
2236child statements.
2237
2238Example: Given
2239  { for (;;) {} }
2240compoundStmt(statementCountIs(0)))
2241  matches '{}'
2242  but does not match the outer compound statement.
2243</pre></td></tr>
2244
2245
2246<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>
2247<tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches nodes that have the specified size.
2248
2249Given
2250  int a[42];
2251  int b[2 * 21];
2252  int c[41], d[43];
2253  char *s = "abcd";
2254  wchar_t *ws = L"abcd";
2255  char *w = "a";
2256constantArrayType(hasSize(42))
2257  matches "int a[42]" and "int b[2 * 21]"
2258stringLiteral(hasSize(4))
2259  matches "abcd", L"abcd"
2260</pre></td></tr>
2261
2262
2263<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>
2264<tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
2265declarations.
2266
2267Example: Given
2268  int a, b;
2269  int c;
2270  int d = 2, e;
2271declCountIs(2)
2272  matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
2273</pre></td></tr>
2274
2275
2276<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>
2277<tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
2278
2279Matches a node if it equals the node previously bound to ID.
2280
2281Given
2282  class X { int a; int b; };
2283cxxRecordDecl(
2284    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
2285    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
2286  matches the class X, as a and b have the same type.
2287
2288Note that when multiple matches are involved via forEach* matchers,
2289equalsBoundNodes acts as a filter.
2290For example:
2291compoundStmt(
2292    forEachDescendant(varDecl().bind("d")),
2293    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
2294will trigger a match for each combination of variable declaration
2295and reference to that variable declaration within a compound statement.
2296</pre></td></tr>
2297
2298
2299<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>
2300<tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node.
2301
2302Decl has pointer identity in the AST.
2303</pre></td></tr>
2304
2305
2306<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>
2307<tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute.
2308
2309Given
2310  __attribute__((device)) void f() { ... }
2311decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
2312f. If the matcher is use from clang-query, attr::Kind parameter should be
2313passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
2314</pre></td></tr>
2315
2316
2317<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>
2318<tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is
2319partially matching a given regex.
2320
2321Example matches Y but not X
2322    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
2323  #include "ASTMatcher.h"
2324  class X {};
2325ASTMatcher.h:
2326  class Y {};
2327
2328Usable 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;
2329</pre></td></tr>
2330
2331
2332<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>
2333<tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file.
2334
2335Example matches X but not Y
2336  (matcher = cxxRecordDecl(isExpansionInMainFile())
2337  #include &lt;Y.h&gt;
2338  class X {};
2339Y.h:
2340  class Y {};
2341
2342Usable 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;
2343</pre></td></tr>
2344
2345
2346<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>
2347<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files.
2348
2349Example matches Y but not X
2350    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
2351  #include &lt;SystemHeader.h&gt;
2352  class X {};
2353SystemHeader.h:
2354  class Y {};
2355
2356Usable 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;
2357</pre></td></tr>
2358
2359
2360<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>
2361<tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a declaration that has been implicitly added
2362by the compiler (eg. implicit defaultcopy constructors).
2363</pre></td></tr>
2364
2365
2366<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>
2367<tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations.
2368
2369Given
2370  class C {
2371  public:    int a;
2372  protected: int b;
2373  private:   int c;
2374  };
2375fieldDecl(isPrivate())
2376  matches 'int c;'
2377</pre></td></tr>
2378
2379
2380<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>
2381<tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations.
2382
2383Given
2384  class C {
2385  public:    int a;
2386  protected: int b;
2387  private:   int c;
2388  };
2389fieldDecl(isProtected())
2390  matches 'int b;'
2391</pre></td></tr>
2392
2393
2394<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>
2395<tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations.
2396
2397Given
2398  class C {
2399  public:    int a;
2400  protected: int b;
2401  private:   int c;
2402  };
2403fieldDecl(isPublic())
2404  matches 'int a;'
2405</pre></td></tr>
2406
2407
2408<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>
2409<tr><td colspan="4" class="doc" id="designatorCountIs0"><pre>Matches designated initializer expressions that contain
2410a specific number of designators.
2411
2412Example: Given
2413  point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
2414  point ptarray2[10] = { [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 };
2415designatorCountIs(2)
2416  matches '{ [2].y = 1.0, [0].x = 1.0 }',
2417  but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'.
2418</pre></td></tr>
2419
2420
2421<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>
2422<tr><td colspan="4" class="doc" id="hasBitWidth0"><pre>Matches non-static data members that are bit-fields.
2423
2424Given
2425  class C {
2426    int a : 2;
2427    int b : 4;
2428    int c : 2;
2429  };
2430fieldDecl(isBitField())
2431  matches 'int a;' and 'int c;' but not 'int b;'.
2432</pre></td></tr>
2433
2434
2435<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>
2436<tr><td colspan="4" class="doc" id="isBitField0"><pre>Matches non-static data members that are bit-fields.
2437
2438Given
2439  class C {
2440    int a : 2;
2441    int b;
2442  };
2443fieldDecl(isBitField())
2444  matches 'int a;' but not 'int b;'.
2445</pre></td></tr>
2446
2447
2448<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;</td><td class="name" onclick="toggle('equals1')"><a name="equals1Anchor">equals</a></td><td>ValueT  Value</td></tr>
2449<tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value.
2450
2451Example matches true (matcher = cxxBoolLiteral(equals(true)))
2452  true
2453
2454Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
2455           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;
2456</pre></td></tr>
2457
2458
2459<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>
2460<tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec0"><pre>Matches functions that have a dynamic exception specification.
2461
2462Given:
2463  void f();
2464  void g() noexcept;
2465  void h() noexcept(true);
2466  void i() noexcept(false);
2467  void j() throw();
2468  void k() throw(int);
2469  void l() throw(...);
2470functionDecl(hasDynamicExceptionSpec()) and
2471  functionProtoType(hasDynamicExceptionSpec())
2472  match the declarations of j, k, and l, but not f, g, h, or i.
2473</pre></td></tr>
2474
2475
2476<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>
2477<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names.
2478
2479Matches overloaded operator names specified in strings without the
2480"operator" prefix: e.g. "&lt;&lt;".
2481
2482Given:
2483  class A { int operator*(); };
2484  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
2485  A a;
2486  a &lt;&lt; a;   &lt;-- This matches
2487
2488cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
2489specified line and
2490cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
2491matches the declaration of A.
2492
2493Usable 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;
2494</pre></td></tr>
2495
2496
2497<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>
2498<tr><td colspan="4" class="doc" id="isConstexpr1"><pre>Matches constexpr variable and function declarations.
2499
2500Given:
2501  constexpr int foo = 42;
2502  constexpr int bar();
2503varDecl(isConstexpr())
2504  matches the declaration of foo.
2505functionDecl(isConstexpr())
2506  matches the declaration of bar.
2507</pre></td></tr>
2508
2509
2510<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>
2511<tr><td colspan="4" class="doc" id="isDefaulted0"><pre>Matches defaulted function declarations.
2512
2513Given:
2514  class A { ~A(); };
2515  class B { ~B() = default; };
2516functionDecl(isDefaulted())
2517  matches the declaration of ~B, but not ~A.
2518</pre></td></tr>
2519
2520
2521<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isDefinition2')"><a name="isDefinition2Anchor">isDefinition</a></td><td></td></tr>
2522<tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached.
2523
2524Example matches A, va, fa
2525  class A {};
2526  class B;  Doesn't match, as it has no body.
2527  int va;
2528  extern int vb;  Doesn't match, as it doesn't define the variable.
2529  void fa() {}
2530  void fb();  Doesn't match, as it has no body.
2531
2532Usable 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;
2533</pre></td></tr>
2534
2535
2536<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>
2537<tr><td colspan="4" class="doc" id="isDeleted0"><pre>Matches deleted function declarations.
2538
2539Given:
2540  void Func();
2541  void DeletedFunc() = delete;
2542functionDecl(isDeleted())
2543  matches the declaration of DeletedFunc, but not Func.
2544</pre></td></tr>
2545
2546
2547<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>
2548<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or
2549static member variable template instantiations.
2550
2551Given
2552  template&lt;typename T&gt; void A(T t) { }
2553  template&lt;&gt; void A(int N) { }
2554functionDecl(isExplicitTemplateSpecialization())
2555  matches the specialization A&lt;int&gt;().
2556
2557Usable 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;
2558</pre></td></tr>
2559
2560
2561<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>
2562<tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function declarations.
2563
2564Given:
2565  extern "C" void f() {}
2566  extern "C" { void g() {} }
2567  void h() {}
2568functionDecl(isExternC())
2569  matches the declaration of f and g, but not the declaration h
2570</pre></td></tr>
2571
2572
2573<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>
2574<tr><td colspan="4" class="doc" id="isInline1"><pre>Matches function and namespace declarations that are marked with
2575the inline keyword.
2576
2577Given
2578  inline void f();
2579  void g();
2580  namespace n {
2581  inline namespace m {}
2582  }
2583functionDecl(isInline()) will match ::f().
2584namespaceDecl(isInline()) will match n::m.
2585</pre></td></tr>
2586
2587
2588<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>
2589<tr><td colspan="4" class="doc" id="isNoThrow0"><pre>Matches functions that have a non-throwing exception specification.
2590
2591Given:
2592  void f();
2593  void g() noexcept;
2594  void h() throw();
2595  void i() throw(int);
2596  void j() noexcept(false);
2597functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
2598  match the declarations of g, and h, but not f, i or j.
2599</pre></td></tr>
2600
2601
2602<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>
2603<tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static
2604member variable template instantiations.
2605
2606Given
2607  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
2608or
2609  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
2610cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2611  matches the template instantiation of X&lt;A&gt;.
2612
2613But given
2614  template &lt;typename T&gt;  class X {}; class A {};
2615  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
2616cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2617  does not match, as X&lt;A&gt; is an explicit template specialization.
2618
2619Usable 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;
2620</pre></td></tr>
2621
2622
2623<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>
2624<tr><td colspan="4" class="doc" id="isVariadic0"><pre>Matches if a function declaration is variadic.
2625
2626Example matches f, but not g or h. The function i will not match, even when
2627compiled in C mode.
2628  void f(...);
2629  void g(int);
2630  template &lt;typename... Ts&gt; void h(Ts...);
2631  void i();
2632</pre></td></tr>
2633
2634
2635<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>
2636<tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
2637specific parameter count.
2638
2639Given
2640  void f(int i) {}
2641  void g(int i, int j) {}
2642  void h(int i, int j);
2643  void j(int i);
2644  void k(int x, int y, int z, ...);
2645functionDecl(parameterCountIs(2))
2646  matches void g(int i, int j) {}
2647functionProtoType(parameterCountIs(2))
2648  matches void h(int i, int j)
2649functionProtoType(parameterCountIs(3))
2650  matches void k(int x, int y, int z, ...);
2651</pre></td></tr>
2652
2653
2654<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>
2655<tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec1"><pre>Matches functions that have a dynamic exception specification.
2656
2657Given:
2658  void f();
2659  void g() noexcept;
2660  void h() noexcept(true);
2661  void i() noexcept(false);
2662  void j() throw();
2663  void k() throw(int);
2664  void l() throw(...);
2665functionDecl(hasDynamicExceptionSpec()) and
2666  functionProtoType(hasDynamicExceptionSpec())
2667  match the declarations of j, k, and l, but not f, g, h, or i.
2668</pre></td></tr>
2669
2670
2671<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>
2672<tr><td colspan="4" class="doc" id="isNoThrow1"><pre>Matches functions that have a non-throwing exception specification.
2673
2674Given:
2675  void f();
2676  void g() noexcept;
2677  void h() throw();
2678  void i() throw(int);
2679  void j() noexcept(false);
2680functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
2681  match the declarations of g, and h, but not f, i or j.
2682</pre></td></tr>
2683
2684
2685<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>
2686<tr><td colspan="4" class="doc" id="parameterCountIs1"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
2687specific parameter count.
2688
2689Given
2690  void f(int i) {}
2691  void g(int i, int j) {}
2692  void h(int i, int j);
2693  void j(int i);
2694  void k(int x, int y, int z, ...);
2695functionDecl(parameterCountIs(2))
2696  matches void g(int i, int j) {}
2697functionProtoType(parameterCountIs(2))
2698  matches void h(int i, int j)
2699functionProtoType(parameterCountIs(3))
2700  matches void k(int x, int y, int z, ...);
2701</pre></td></tr>
2702
2703
2704<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;</td><td class="name" onclick="toggle('equals0')"><a name="equals0Anchor">equals</a></td><td>ValueT  Value</td></tr>
2705<tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value.
2706
2707Example matches true (matcher = cxxBoolLiteral(equals(true)))
2708  true
2709
2710Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
2711           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;
2712</pre></td></tr>
2713
2714
2715<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>
2716<tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '-&gt;' as opposed
2717to '.'.
2718
2719Member calls on the implicit this pointer match as called with '-&gt;'.
2720
2721Given
2722  class Y {
2723    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
2724    int a;
2725    static int b;
2726  };
2727memberExpr(isArrow())
2728  matches this-&gt;x, x, y.x, a, this-&gt;b
2729</pre></td></tr>
2730
2731
2732<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</td><td class="name" onclick="toggle('hasName0')"><a name="hasName0Anchor">hasName</a></td><td>std::string  Name</td></tr>
2733<tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name.
2734
2735Supports specifying enclosing namespaces or classes by prefixing the name
2736with '&lt;enclosing&gt;::'.
2737Does not match typedefs of an underlying type with the given name.
2738
2739Example matches X (Name == "X")
2740  class X;
2741
2742Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
2743  namespace a { namespace b { class X; } }
2744</pre></td></tr>
2745
2746
2747<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>
2748<tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain
2749a substring matched by the given RegExp.
2750
2751Supports specifying enclosing namespaces or classes by
2752prefixing the name with '&lt;enclosing&gt;::'.  Does not match typedefs
2753of an underlying type with the given name.
2754
2755Example matches X (regexp == "::X")
2756  class X;
2757
2758Example matches X (regexp is one of "::X", "^foo::.*X", among others)
2759  namespace foo { namespace bar { class X; } }
2760</pre></td></tr>
2761
2762
2763<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>
2764<tr><td colspan="4" class="doc" id="isAnonymous0"><pre>Matches anonymous namespace declarations.
2765
2766Given
2767  namespace n {
2768  namespace {} #1
2769  }
2770namespaceDecl(isAnonymous()) will match #1 but not ::n.
2771</pre></td></tr>
2772
2773
2774<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>
2775<tr><td colspan="4" class="doc" id="isInline0"><pre>Matches function and namespace declarations that are marked with
2776the inline keyword.
2777
2778Given
2779  inline void f();
2780  void g();
2781  namespace n {
2782  inline namespace m {}
2783  }
2784functionDecl(isInline()) will match ::f().
2785namespaceDecl(isInline()) will match n::m.
2786</pre></td></tr>
2787
2788
2789<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>
2790<tr><td colspan="4" class="doc" id="argumentCountIs2"><pre>Checks that a call expression or a constructor call expression has
2791a specific number of arguments (including absent default arguments).
2792
2793Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2794  void f(int x, int y);
2795  f(0, 0);
2796</pre></td></tr>
2797
2798
2799<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>
2800<tr><td colspan="4" class="doc" id="hasKeywordSelector0"><pre>Matches when the selector is a keyword selector
2801
2802objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
2803message expression in
2804
2805  UIWebView *webView = ...;
2806  CGRect bodyFrame = webView.frame;
2807  bodyFrame.size.height = self.bodyContentHeight;
2808  webView.frame = bodyFrame;
2809      ^---- matches here
2810</pre></td></tr>
2811
2812
2813<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>
2814<tr><td colspan="4" class="doc" id="hasNullSelector0"><pre>Matches when the selector is the empty selector
2815
2816Matches only when the selector of the objCMessageExpr is NULL. This may
2817represent an error condition in the tree!
2818</pre></td></tr>
2819
2820
2821<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>
2822<tr><td colspan="4" class="doc" id="hasSelector0"><pre>Matches when BaseName == Selector.getAsString()
2823
2824 matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:"));
2825 matches the outer message expr in the code below, but NOT the message
2826 invocation for self.bodyView.
2827    [self.bodyView loadHTMLString:html baseURL:NULL];
2828</pre></td></tr>
2829
2830
2831<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>
2832<tr><td colspan="4" class="doc" id="hasUnarySelector0"><pre>Matches when the selector is a Unary Selector
2833
2834 matcher = objCMessageExpr(matchesSelector(hasUnarySelector());
2835 matches self.bodyView in the code below, but NOT the outer message
2836 invocation of "loadHTMLString:baseURL:".
2837    [self.bodyView loadHTMLString:html baseURL:NULL];
2838</pre></td></tr>
2839
2840
2841<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>
2842<tr><td colspan="4" class="doc" id="matchesSelector0"><pre>Matches ObjC selectors whose name contains
2843a substring matched by the given RegExp.
2844 matcher = objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
2845 invocation for self.bodyView.
2846    [self.bodyView loadHTMLString:html baseURL:NULL];
2847</pre></td></tr>
2848
2849
2850<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>
2851<tr><td colspan="4" class="doc" id="numSelectorArgs0"><pre>Matches when the selector has the specified number of arguments
2852
2853 matcher = objCMessageExpr(numSelectorArgs(0));
2854 matches self.bodyView in the code below
2855
2856 matcher = objCMessageExpr(numSelectorArgs(2));
2857 matches the invocation of "loadHTMLString:baseURL:" but not that
2858 of self.bodyView
2859    [self.bodyView loadHTMLString:html baseURL:NULL];
2860</pre></td></tr>
2861
2862
2863<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>
2864<tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string.
2865
2866Given
2867  class Y { public: void x(); };
2868  void z() { Y* y; y-&gt;x(); }
2869cxxMemberCallExpr(on(hasType(asString("class Y *"))))
2870  matches y-&gt;x()
2871</pre></td></tr>
2872
2873
2874<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>
2875<tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node.
2876
2877Matches a node if it equals the node previously bound to ID.
2878
2879Given
2880  class X { int a; int b; };
2881cxxRecordDecl(
2882    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
2883    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
2884  matches the class X, as a and b have the same type.
2885
2886Note that when multiple matches are involved via forEach* matchers,
2887equalsBoundNodes acts as a filter.
2888For example:
2889compoundStmt(
2890    forEachDescendant(varDecl().bind("d")),
2891    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
2892will trigger a match for each combination of variable declaration
2893and reference to that variable declaration within a compound statement.
2894</pre></td></tr>
2895
2896
2897<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>
2898<tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to
2899the node, not hidden within a typedef.
2900
2901Given
2902  typedef const int const_int;
2903  const_int i;
2904  int *const j;
2905  int *volatile k;
2906  int m;
2907varDecl(hasType(hasLocalQualifiers())) matches only j and k.
2908i is const-qualified but the qualifier is not local.
2909</pre></td></tr>
2910
2911
2912<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>
2913<tr><td colspan="4" class="doc" id="isAnyCharacter0"><pre>Matches QualType nodes that are of character type.
2914
2915Given
2916  void a(char);
2917  void b(wchar_t);
2918  void c(double);
2919functionDecl(hasAnyParameter(hasType(isAnyCharacter())))
2920matches "a(char)", "b(wchar_t)", but not "c(double)".
2921</pre></td></tr>
2922
2923
2924<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>
2925<tr><td colspan="4" class="doc" id="isAnyPointer0"><pre>Matches QualType nodes that are of any pointer type; this includes
2926the Objective-C object pointer type, which is different despite being
2927syntactically similar.
2928
2929Given
2930  int *i = nullptr;
2931
2932  @interface Foo
2933  @end
2934  Foo *f;
2935
2936  int j;
2937varDecl(hasType(isAnyPointer()))
2938  matches "int *i" and "Foo *f", but not "int j".
2939</pre></td></tr>
2940
2941
2942<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>
2943<tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that
2944include "top-level" const.
2945
2946Given
2947  void a(int);
2948  void b(int const);
2949  void c(const int);
2950  void d(const int*);
2951  void e(int const) {};
2952functionDecl(hasAnyParameter(hasType(isConstQualified())))
2953  matches "void b(int const)", "void c(const int)" and
2954  "void e(int const) {}". It does not match d as there
2955  is no top-level const on the parameter type "const int *".
2956</pre></td></tr>
2957
2958
2959<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>
2960<tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type.
2961
2962Given
2963  void a(int);
2964  void b(long);
2965  void c(double);
2966functionDecl(hasAnyParameter(hasType(isInteger())))
2967matches "a(int)", "b(long)", but not "c(double)".
2968</pre></td></tr>
2969
2970
2971<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>
2972<tr><td colspan="4" class="doc" id="isSignedInteger0"><pre>Matches QualType nodes that are of signed integer type.
2973
2974Given
2975  void a(int);
2976  void b(unsigned long);
2977  void c(double);
2978functionDecl(hasAnyParameter(hasType(isInteger())))
2979matches "a(int)", but not "b(unsigned long)" and "c(double)".
2980</pre></td></tr>
2981
2982
2983<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>
2984<tr><td colspan="4" class="doc" id="isUnsignedInteger0"><pre>Matches QualType nodes that are of unsigned integer type.
2985
2986Given
2987  void a(int);
2988  void b(unsigned long);
2989  void c(double);
2990functionDecl(hasAnyParameter(hasType(isInteger())))
2991matches "b(unsigned long)", but not "a(int)" and "c(double)".
2992</pre></td></tr>
2993
2994
2995<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>
2996<tr><td colspan="4" class="doc" id="isVolatileQualified0"><pre>Matches QualType nodes that are volatile-qualified, i.e., that
2997include "top-level" volatile.
2998
2999Given
3000  void a(int);
3001  void b(int volatile);
3002  void c(volatile int);
3003  void d(volatile int*);
3004  void e(int volatile) {};
3005functionDecl(hasAnyParameter(hasType(isVolatileQualified())))
3006  matches "void b(int volatile)", "void c(volatile int)" and
3007  "void e(int volatile) {}". It does not match d as there
3008  is no top-level volatile on the parameter type "volatile int *".
3009</pre></td></tr>
3010
3011
3012<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>
3013<tr><td colspan="4" class="doc" id="isClass0"><pre>Matches RecordDecl object that are spelled with "class."
3014
3015Example matches C, but not S or U.
3016  struct S {};
3017  class C {};
3018  union U {};
3019</pre></td></tr>
3020
3021
3022<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>
3023<tr><td colspan="4" class="doc" id="isStruct0"><pre>Matches RecordDecl object that are spelled with "struct."
3024
3025Example matches S, but not C or U.
3026  struct S {};
3027  class C {};
3028  union U {};
3029</pre></td></tr>
3030
3031
3032<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>
3033<tr><td colspan="4" class="doc" id="isUnion0"><pre>Matches RecordDecl object that are spelled with "union."
3034
3035Example matches U, but not C or S.
3036  struct S {};
3037  class C {};
3038  union U {};
3039</pre></td></tr>
3040
3041
3042<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>
3043<tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node.
3044
3045Matches a node if it equals the node previously bound to ID.
3046
3047Given
3048  class X { int a; int b; };
3049cxxRecordDecl(
3050    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3051    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3052  matches the class X, as a and b have the same type.
3053
3054Note that when multiple matches are involved via forEach* matchers,
3055equalsBoundNodes acts as a filter.
3056For example:
3057compoundStmt(
3058    forEachDescendant(varDecl().bind("d")),
3059    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3060will trigger a match for each combination of variable declaration
3061and reference to that variable declaration within a compound statement.
3062</pre></td></tr>
3063
3064
3065<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>
3066<tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node.
3067
3068Stmt has pointer identity in the AST.
3069</pre></td></tr>
3070
3071
3072<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>
3073<tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches AST nodes that were expanded within files whose name is
3074partially matching a given regex.
3075
3076Example matches Y but not X
3077    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3078  #include "ASTMatcher.h"
3079  class X {};
3080ASTMatcher.h:
3081  class Y {};
3082
3083Usable 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;
3084</pre></td></tr>
3085
3086
3087<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>
3088<tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches AST nodes that were expanded within the main-file.
3089
3090Example matches X but not Y
3091  (matcher = cxxRecordDecl(isExpansionInMainFile())
3092  #include &lt;Y.h&gt;
3093  class X {};
3094Y.h:
3095  class Y {};
3096
3097Usable 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;
3098</pre></td></tr>
3099
3100
3101<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>
3102<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches AST nodes that were expanded within system-header-files.
3103
3104Example matches Y but not X
3105    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3106  #include &lt;SystemHeader.h&gt;
3107  class X {};
3108SystemHeader.h:
3109  class Y {};
3110
3111Usable 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;
3112</pre></td></tr>
3113
3114
3115<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>
3116<tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
3117
3118Given
3119  int a[42];
3120  int b[2 * 21];
3121  int c[41], d[43];
3122  char *s = "abcd";
3123  wchar_t *ws = L"abcd";
3124  char *w = "a";
3125constantArrayType(hasSize(42))
3126  matches "int a[42]" and "int b[2 * 21]"
3127stringLiteral(hasSize(4))
3128  matches "abcd", L"abcd"
3129</pre></td></tr>
3130
3131
3132<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>
3133<tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
3134
3135Example matches A, va, fa
3136  class A {};
3137  class B;  Doesn't match, as it has no body.
3138  int va;
3139  extern int vb;  Doesn't match, as it doesn't define the variable.
3140  void fa() {}
3141  void fb();  Doesn't match, as it has no body.
3142
3143Usable 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;
3144</pre></td></tr>
3145
3146
3147<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>
3148<tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value.
3149
3150Note that 'Value' is a string as the template argument's value is
3151an arbitrary precision integer. 'Value' must be euqal to the canonical
3152representation of that integral value in base 10.
3153
3154Given
3155  template&lt;int T&gt; struct A {};
3156  C&lt;42&gt; c;
3157classTemplateSpecializationDecl(
3158  hasAnyTemplateArgument(equalsIntegralValue("42")))
3159  matches the implicit instantiation of C in C&lt;42&gt;.
3160</pre></td></tr>
3161
3162
3163<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>
3164<tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value.
3165
3166Given
3167  template&lt;int T&gt; struct A {};
3168  C&lt;42&gt; c;
3169classTemplateSpecializationDecl(
3170  hasAnyTemplateArgument(isIntegral()))
3171  matches the implicit instantiation of C in C&lt;42&gt;
3172  with isIntegral() matching 42.
3173</pre></td></tr>
3174
3175
3176<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>
3177<tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N.
3178
3179Given
3180  template&lt;typename T&gt; struct C {};
3181  C&lt;int&gt; c;
3182classTemplateSpecializationDecl(templateArgumentCountIs(1))
3183  matches C&lt;int&gt;.
3184</pre></td></tr>
3185
3186
3187<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>
3188<tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is
3189partially matching a given regex.
3190
3191Example matches Y but not X
3192    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3193  #include "ASTMatcher.h"
3194  class X {};
3195ASTMatcher.h:
3196  class Y {};
3197
3198Usable 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;
3199</pre></td></tr>
3200
3201
3202<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>
3203<tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file.
3204
3205Example matches X but not Y
3206  (matcher = cxxRecordDecl(isExpansionInMainFile())
3207  #include &lt;Y.h&gt;
3208  class X {};
3209Y.h:
3210  class Y {};
3211
3212Usable 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;
3213</pre></td></tr>
3214
3215
3216<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>
3217<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files.
3218
3219Example matches Y but not X
3220    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3221  #include &lt;SystemHeader.h&gt;
3222  class X {};
3223SystemHeader.h:
3224  class Y {};
3225
3226Usable 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;
3227</pre></td></tr>
3228
3229
3230<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>
3231<tr><td colspan="4" class="doc" id="booleanType0"><pre>Matches type bool.
3232
3233Given
3234 struct S { bool func(); };
3235functionDecl(returns(booleanType()))
3236  matches "bool func();"
3237</pre></td></tr>
3238
3239
3240<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>
3241<tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
3242
3243Matches a node if it equals the node previously bound to ID.
3244
3245Given
3246  class X { int a; int b; };
3247cxxRecordDecl(
3248    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3249    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3250  matches the class X, as a and b have the same type.
3251
3252Note that when multiple matches are involved via forEach* matchers,
3253equalsBoundNodes acts as a filter.
3254For example:
3255compoundStmt(
3256    forEachDescendant(varDecl().bind("d")),
3257    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3258will trigger a match for each combination of variable declaration
3259and reference to that variable declaration within a compound statement.
3260</pre></td></tr>
3261
3262
3263<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>
3264<tr><td colspan="4" class="doc" id="equalsNode2"><pre>Matches if a node equals another node.
3265
3266Type has pointer identity in the AST.
3267</pre></td></tr>
3268
3269
3270<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>
3271<tr><td colspan="4" class="doc" id="realFloatingPointType0"><pre>Matches any real floating-point type (float, double, long double).
3272
3273Given
3274  int i;
3275  float f;
3276realFloatingPointType()
3277  matches "float f" but not "int i"
3278</pre></td></tr>
3279
3280
3281<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>
3282<tr><td colspan="4" class="doc" id="voidType0"><pre>Matches type void.
3283
3284Given
3285 struct S { void func(); };
3286functionDecl(returns(voidType()))
3287  matches "void func();"
3288</pre></td></tr>
3289
3290
3291<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>
3292<tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
3293
3294Given
3295  int x;
3296  int s = sizeof(x) + alignof(x)
3297unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
3298  matches sizeof(x)
3299</pre></td></tr>
3300
3301
3302<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>
3303<tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or
3304unary).
3305
3306Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3307  !(a || b)
3308</pre></td></tr>
3309
3310
3311<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>
3312<tr><td colspan="4" class="doc" id="hasAutomaticStorageDuration0"><pre>Matches a variable declaration that has automatic storage duration.
3313
3314Example matches x, but not y, z, or a.
3315(matcher = varDecl(hasAutomaticStorageDuration())
3316void f() {
3317  int x;
3318  static int y;
3319  thread_local int z;
3320}
3321int a;
3322</pre></td></tr>
3323
3324
3325<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>
3326<tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
3327
3328Example matches y and z (matcher = varDecl(hasGlobalStorage())
3329void f() {
3330  int x;
3331  static int y;
3332}
3333int z;
3334</pre></td></tr>
3335
3336
3337<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>
3338<tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a
3339non-static local variable.
3340
3341Example matches x (matcher = varDecl(hasLocalStorage())
3342void f() {
3343  int x;
3344  static int y;
3345}
3346int z;
3347</pre></td></tr>
3348
3349
3350<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>
3351<tr><td colspan="4" class="doc" id="hasStaticStorageDuration0"><pre>Matches a variable declaration that has static storage duration.
3352
3353Example matches y and a, but not x or z.
3354(matcher = varDecl(hasStaticStorageDuration())
3355void f() {
3356  int x;
3357  static int y;
3358  thread_local int z;
3359}
3360int a;
3361</pre></td></tr>
3362
3363
3364<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>
3365<tr><td colspan="4" class="doc" id="hasThreadStorageDuration0"><pre>Matches a variable declaration that has thread storage duration.
3366
3367Example matches z, but not x, z, or a.
3368(matcher = varDecl(hasThreadStorageDuration())
3369void f() {
3370  int x;
3371  static int y;
3372  thread_local int z;
3373}
3374int a;
3375</pre></td></tr>
3376
3377
3378<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>
3379<tr><td colspan="4" class="doc" id="isConstexpr0"><pre>Matches constexpr variable and function declarations.
3380
3381Given:
3382  constexpr int foo = 42;
3383  constexpr int bar();
3384varDecl(isConstexpr())
3385  matches the declaration of foo.
3386functionDecl(isConstexpr())
3387  matches the declaration of bar.
3388</pre></td></tr>
3389
3390
3391<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>
3392<tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
3393
3394Example matches A, va, fa
3395  class A {};
3396  class B;  Doesn't match, as it has no body.
3397  int va;
3398  extern int vb;  Doesn't match, as it doesn't define the variable.
3399  void fa() {}
3400  void fb();  Doesn't match, as it has no body.
3401
3402Usable 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;
3403</pre></td></tr>
3404
3405
3406<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>
3407<tr><td colspan="4" class="doc" id="isExceptionVariable0"><pre>Matches a variable declaration that is an exception variable from
3408a C++ catch block, or an Objective-C statement.
3409
3410Example matches x (matcher = varDecl(isExceptionVariable())
3411void f(int y) {
3412  try {
3413  } catch (int x) {
3414  }
3415}
3416</pre></td></tr>
3417
3418
3419<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>
3420<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
3421static member variable template instantiations.
3422
3423Given
3424  template&lt;typename T&gt; void A(T t) { }
3425  template&lt;&gt; void A(int N) { }
3426functionDecl(isExplicitTemplateSpecialization())
3427  matches the specialization A&lt;int&gt;().
3428
3429Usable 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;
3430</pre></td></tr>
3431
3432
3433<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>
3434<tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
3435member variable template instantiations.
3436
3437Given
3438  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
3439or
3440  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
3441cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3442  matches the template instantiation of X&lt;A&gt;.
3443
3444But given
3445  template &lt;typename T&gt;  class X {}; class A {};
3446  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
3447cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3448  does not match, as X&lt;A&gt; is an explicit template specialization.
3449
3450Usable 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;
3451</pre></td></tr>
3452
3453
3454<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>
3455<tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
3456template instantiations.
3457
3458Given
3459  template&lt;typename T&gt; void A(T t) { T i; }
3460  A(0);
3461  A(0U);
3462functionDecl(isInstantiated())
3463  matches 'A(int) {...};' and 'A(unsigned) {...}'.
3464</pre></td></tr>
3465
3466
3467<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>
3468<tr><td colspan="4" class="doc" id="nullPointerConstant0"><pre>Matches expressions that resolve to a null pointer constant, such as
3469GNU's __null, C++11's nullptr, or C's NULL macro.
3470
3471Given:
3472  void *v1 = NULL;
3473  void *v2 = nullptr;
3474  void *v3 = __null; GNU extension
3475  char *cp = (char *)0;
3476  int *ip = 0;
3477  int i = 0;
3478expr(nullPointerConstant())
3479  matches the initializer for v1, v2, v3, cp, and ip. Does not match the
3480  initializer for i.
3481</pre></td></tr>
3482
3483
3484<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>
3485<tr><td colspan="4" class="doc" id="hasAnyName0"><pre>Matches NamedDecl nodes that have any of the specified names.
3486
3487This matcher is only provided as a performance optimization of hasName.
3488    hasAnyName(a, b, c)
3489 is equivalent to, but faster than
3490    anyOf(hasName(a), hasName(b), hasName(c))
3491</pre></td></tr>
3492
3493
3494<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>
3495<tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
3496
3497Given
3498  int j;
3499  template&lt;typename T&gt; void A(T t) { T i; j += 42;}
3500  A(0);
3501  A(0U);
3502declStmt(isInTemplateInstantiation())
3503  matches 'int i;' and 'unsigned i'.
3504unless(stmt(isInTemplateInstantiation()))
3505  will NOT match j += 42; as it's shared between the template definition and
3506  instantiation.
3507</pre></td></tr>
3508
3509<!--END_NARROWING_MATCHERS -->
3510</table>
3511
3512<!-- ======================================================================= -->
3513<h2 id="traversal-matchers">AST Traversal Matchers</h2>
3514<!-- ======================================================================= -->
3515
3516<p>Traversal matchers specify the relationship to other nodes that are
3517reachable from the current node.</p>
3518
3519<p>Note that there are special traversal matchers (has, hasDescendant, forEach and
3520forEachDescendant) which work on all nodes and allow users to write more generic
3521match expressions.</p>
3522
3523<table>
3524<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
3525<!-- START_TRAVERSAL_MATCHERS -->
3526
3527<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>
3528<tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
3529
3530Unlike anyOf, eachOf will generate a match result for each
3531matching submatcher.
3532
3533For example, in:
3534  class A { int a; int b; };
3535The matcher:
3536  cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
3537                       has(fieldDecl(hasName("b")).bind("v"))))
3538will generate two results binding "v", the first of which binds
3539the field declaration of a, the second the field declaration of
3540b.
3541
3542Usable as: Any Matcher
3543</pre></td></tr>
3544
3545
3546<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
3547<tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
3548provided matcher.
3549
3550Example matches X, A, B, C
3551  (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
3552  class X {};  Matches X, because X::X is a class of name X inside X.
3553  class A { class X {}; };
3554  class B { class C { class X {}; }; };
3555
3556DescendantT must be an AST base type.
3557
3558As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
3559each result that matches instead of only on the first one.
3560
3561Note: Recursively combined ForEachDescendant can cause many matches:
3562  cxxRecordDecl(forEachDescendant(cxxRecordDecl(
3563    forEachDescendant(cxxRecordDecl())
3564  )))
3565will match 10 times (plus injected class name matches) on:
3566  class A { class B { class C { class D { class E {}; }; }; }; };
3567
3568Usable as: Any Matcher
3569</pre></td></tr>
3570
3571
3572<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
3573<tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
3574provided matcher.
3575
3576Example matches X, Y
3577  (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
3578  class X {};  Matches X, because X::X is a class of name X inside X.
3579  class Y { class X {}; };
3580  class Z { class Y { class X {}; }; };  Does not match Z.
3581
3582ChildT must be an AST base type.
3583
3584As opposed to 'has', 'forEach' will cause a match for each result that
3585matches instead of only on the first one.
3586
3587Usable as: Any Matcher
3588</pre></td></tr>
3589
3590
3591<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
3592<tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
3593matcher.
3594
3595Given
3596void f() { if (true) { int x = 42; } }
3597void g() { for (;;) { int x = 43; } }
3598expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
3599
3600Usable as: Any Matcher
3601</pre></td></tr>
3602
3603
3604<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
3605<tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
3606provided matcher.
3607
3608Example matches X, Y, Z
3609    (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
3610  class X {};  Matches X, because X::X is a class of name X inside X.
3611  class Y { class X {}; };
3612  class Z { class Y { class X {}; }; };
3613
3614DescendantT must be an AST base type.
3615
3616Usable as: Any Matcher
3617</pre></td></tr>
3618
3619
3620<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
3621<tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
3622provided matcher.
3623
3624Example matches X, Y
3625  (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
3626  class X {};  Matches X, because X::X is a class of name X inside X.
3627  class Y { class X {}; };
3628  class Z { class Y { class X {}; }; };  Does not match Z.
3629
3630ChildT must be an AST base type.
3631
3632Usable as: Any Matcher
3633Note that has is direct matcher, so it also matches things like implicit
3634casts and paren casts. If you are matching with expr then you should
3635probably consider using ignoringParenImpCasts like:
3636has(ignoringParenImpCasts(expr())).
3637</pre></td></tr>
3638
3639
3640<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
3641<tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
3642matcher.
3643
3644Given
3645void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
3646compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
3647
3648Usable as: Any Matcher
3649</pre></td></tr>
3650
3651
3652<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>
3653<tr><td colspan="4" class="doc" id="hasCondition5"><pre>Matches the condition expression of an if statement, for loop,
3654switch statement or conditional operator.
3655
3656Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
3657  if (true) {}
3658</pre></td></tr>
3659
3660
3661<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>
3662<tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator
3663(binary or ternary).
3664
3665Example matches b
3666  condition ? a : b
3667  condition ?: b
3668</pre></td></tr>
3669
3670
3671<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>
3672<tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
3673
3674Example 1 (conditional ternary operator): matches a
3675  condition ? a : b
3676
3677Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
3678  condition ?: b
3679</pre></td></tr>
3680
3681
3682<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration8')"><a name="hasDeclaration8Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3683<tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
3684matches the given matcher.
3685
3686The associated declaration is:
3687- for type nodes, the declaration of the underlying type
3688- for CallExpr, the declaration of the callee
3689- for MemberExpr, the declaration of the referenced member
3690- for CXXConstructExpr, the declaration of the constructor
3691
3692Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3693function. e.g. various subtypes of clang::Type and various expressions.
3694
3695Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3696  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3697  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
3698  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3699  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3700  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3701</pre></td></tr>
3702
3703
3704<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>
3705<tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
3706
3707Given
3708  int i[5];
3709  void f() { i[1] = 42; }
3710arraySubscriptExpression(hasBase(implicitCastExpr(
3711    hasSourceExpression(declRefExpr()))))
3712  matches i[1] with the declRefExpr() matching i
3713</pre></td></tr>
3714
3715
3716<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>
3717<tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
3718
3719Given
3720  int i[5];
3721  void f() { i[1] = 42; }
3722arraySubscriptExpression(hasIndex(integerLiteral()))
3723  matches i[1] with the integerLiteral() matching 1
3724</pre></td></tr>
3725
3726
3727<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>
3728<tr><td colspan="4" class="doc" id="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
3729
3730Example matches a (matcher = binaryOperator(hasLHS()))
3731  a || b
3732</pre></td></tr>
3733
3734
3735<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>
3736<tr><td colspan="4" class="doc" id="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
3737
3738Example matches b (matcher = binaryOperator(hasRHS()))
3739  a || b
3740</pre></td></tr>
3741
3742
3743<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayTypeLoc.html">ArrayTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasElementTypeLoc0')"><a name="hasElementTypeLoc0Anchor">hasElementTypeLoc</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
3744<tr><td colspan="4" class="doc" id="hasElementTypeLoc0"><pre>Matches arrays and C99 complex types that have a specific element
3745type.
3746
3747Given
3748  struct A {};
3749  A a[7];
3750  int b[7];
3751arrayType(hasElementType(builtinType()))
3752  matches "int b[7]"
3753
3754Usable 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;
3755</pre></td></tr>
3756
3757
3758<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>
3759<tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
3760type.
3761
3762Given
3763  struct A {};
3764  A a[7];
3765  int b[7];
3766arrayType(hasElementType(builtinType()))
3767  matches "int b[7]"
3768
3769Usable 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;
3770</pre></td></tr>
3771
3772
3773<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicTypeLoc.html">AtomicTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasValueTypeLoc0')"><a name="hasValueTypeLoc0Anchor">hasValueTypeLoc</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
3774<tr><td colspan="4" class="doc" id="hasValueTypeLoc0"><pre>Matches atomic types with a specific value type.
3775
3776Given
3777  _Atomic(int) i;
3778  _Atomic(float) f;
3779atomicType(hasValueType(isInteger()))
3780 matches "_Atomic(int) i"
3781
3782Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
3783</pre></td></tr>
3784
3785
3786<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>
3787<tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
3788
3789Given
3790  _Atomic(int) i;
3791  _Atomic(float) f;
3792atomicType(hasValueType(isInteger()))
3793 matches "_Atomic(int) i"
3794
3795Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
3796</pre></td></tr>
3797
3798
3799<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>
3800<tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
3801
3802Note: There is no TypeLoc for the deduced type and thus no
3803getDeducedLoc() matcher.
3804
3805Given
3806  auto a = 1;
3807  auto b = 2.0;
3808autoType(hasDeducedType(isInteger()))
3809  matches "auto a"
3810
3811Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
3812</pre></td></tr>
3813
3814
3815<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasEitherOperand0')"><a name="hasEitherOperand0Anchor">hasEitherOperand</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;  InnerMatcher</td></tr>
3816<tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
3817binary operator matches.
3818</pre></td></tr>
3819
3820
3821<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>
3822<tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
3823
3824Example matches a (matcher = binaryOperator(hasLHS()))
3825  a || b
3826</pre></td></tr>
3827
3828
3829<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>
3830<tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
3831
3832Example matches b (matcher = binaryOperator(hasRHS()))
3833  a || b
3834</pre></td></tr>
3835
3836
3837<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerTypeLoc.html">BlockPointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc0')"><a name="pointeeLoc0Anchor">pointeeLoc</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
3838<tr><td colspan="4" class="doc" id="pointeeLoc0"><pre>Narrows PointerType (and similar) matchers to those where the
3839pointee matches a given matcher.
3840
3841Given
3842  int *a;
3843  int const *b;
3844  float const *f;
3845pointerType(pointee(isConstQualified(), isInteger()))
3846  matches "int const *b"
3847
3848Usable 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;,
3849  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;
3850</pre></td></tr>
3851
3852
3853<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>
3854<tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
3855pointee matches a given matcher.
3856
3857Given
3858  int *a;
3859  int const *b;
3860  float const *f;
3861pointerType(pointee(isConstQualified(), isInteger()))
3862  matches "int const *b"
3863
3864Usable 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;,
3865  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;
3866</pre></td></tr>
3867
3868
3869<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>
3870<tr><td colspan="4" class="doc" id="forEachArgumentWithParam1"><pre>Matches all arguments and their respective ParmVarDecl.
3871
3872Given
3873  void f(int i);
3874  int y;
3875  f(y);
3876callExpr(
3877  forEachArgumentWithParam(
3878    declRefExpr(to(varDecl(hasName("y")))),
3879    parmVarDecl(hasType(isInteger()))
3880))
3881  matches f(y);
3882with declRefExpr(...)
3883  matching int y
3884and parmVarDecl(...)
3885  matching int i
3886</pre></td></tr>
3887
3888
3889<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>
3890<tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
3891expression.
3892
3893Given
3894  void x(int, int, int) { int y; x(1, y, 42); }
3895callExpr(hasAnyArgument(declRefExpr()))
3896  matches x(1, y, 42)
3897with hasAnyArgument(...)
3898  matching y
3899</pre></td></tr>
3900
3901
3902<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>
3903<tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
3904call expression.
3905
3906Example matches y in x(y)
3907    (matcher = callExpr(hasArgument(0, declRefExpr())))
3908  void x(int) { int y; x(y); }
3909</pre></td></tr>
3910
3911
3912<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>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3913<tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
3914matches the given matcher.
3915
3916The associated declaration is:
3917- for type nodes, the declaration of the underlying type
3918- for CallExpr, the declaration of the callee
3919- for MemberExpr, the declaration of the referenced member
3920- for CXXConstructExpr, the declaration of the constructor
3921
3922Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3923function. e.g. various subtypes of clang::Type and various expressions.
3924
3925Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3926  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3927  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
3928  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3929  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3930  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3931</pre></td></tr>
3932
3933
3934<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>
3935<tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
3936
3937Given
3938  class A { A() : i(42), j(42) {} int i; int j; };
3939cxxConstructorDecl(forEachConstructorInitializer(
3940  forField(decl().bind("x"))
3941))
3942  will trigger two matches, binding for 'i' and 'j' respectively.
3943</pre></td></tr>
3944
3945
3946<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>
3947<tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
3948
3949Given
3950  struct Foo {
3951    Foo() : foo_(1) { }
3952    int foo_;
3953  };
3954cxxRecordDecl(has(cxxConstructorDecl(
3955  hasAnyConstructorInitializer(anything())
3956)))
3957  record matches Foo, hasAnyConstructorInitializer matches foo_(1)
3958</pre></td></tr>
3959
3960
3961<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>
3962<tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
3963
3964Given
3965  struct Foo {
3966    Foo() : foo_(1) { }
3967    int foo_;
3968  };
3969cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
3970    forField(hasName("foo_"))))))
3971  matches Foo
3972with forField matching foo_
3973</pre></td></tr>
3974
3975
3976<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>
3977<tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
3978
3979Given
3980  struct Foo {
3981    Foo() : foo_(1) { }
3982    int foo_;
3983  };
3984cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
3985    withInitializer(integerLiteral(equals(1)))))))
3986  matches Foo
3987with withInitializer matching (1)
3988</pre></td></tr>
3989
3990
3991<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>
3992<tr><td colspan="4" class="doc" id="hasBody3"><pre>Matches a 'for', 'while', 'do while' statement or a function
3993definition that has a given body.
3994
3995Given
3996  for (;;) {}
3997hasBody(compoundStmt())
3998  matches 'for (;;) {}'
3999with compoundStmt()
4000  matching '{}'
4001</pre></td></tr>
4002
4003
4004<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>
4005<tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
4006
4007Example:
4008    forStmt(hasLoopVariable(anything()))
4009matches 'int x' in
4010    for (int x : a) { }
4011</pre></td></tr>
4012
4013
4014<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>
4015<tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
4016
4017Example:
4018    forStmt(hasRangeInit(anything()))
4019matches 'a' in
4020    for (int x : a) { }
4021</pre></td></tr>
4022
4023
4024<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>
4025<tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre></pre></td></tr>
4026
4027
4028<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>
4029<tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression.
4030
4031Example matches y.x()
4032  (matcher = cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y"))))))
4033  class Y { public: void x(); };
4034  void z() { Y y; y.x(); }",
4035
4036FIXME: Overload to allow directly matching types?
4037</pre></td></tr>
4038
4039
4040<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>
4041<tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
4042</pre></td></tr>
4043
4044
4045<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>
4046<tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the expression's type either matches the specified
4047matcher, or is a pointer to a type that matches the InnerMatcher.
4048</pre></td></tr>
4049
4050
4051<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>
4052<tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overriden by the given method. This matcher may
4053produce multiple matches.
4054
4055Given
4056  class A { virtual void f(); };
4057  class B : public A { void f(); };
4058  class C : public B { void f(); };
4059cxxMethodDecl(ofClass(hasName("C")),
4060              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4061  matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
4062  that B::f is not overridden by C::f).
4063
4064The check can produce multiple matches in case of multiple inheritance, e.g.
4065  class A1 { virtual void f(); };
4066  class A2 { virtual void f(); };
4067  class C : public A1, public A2 { void f(); };
4068cxxMethodDecl(ofClass(hasName("C")),
4069              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4070  matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
4071  once with "b" binding "A2::f" and "d" binding "C::f".
4072</pre></td></tr>
4073
4074
4075<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>
4076<tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
4077belongs to.
4078
4079FIXME: Generalize this for other kinds of declarations.
4080FIXME: What other kind of declarations would we need to generalize
4081this to?
4082
4083Example matches A() in the last line
4084    (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
4085        ofClass(hasName("A"))))))
4086  class A {
4087   public:
4088    A();
4089  };
4090  A a = A();
4091</pre></td></tr>
4092
4093
4094<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>
4095<tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
4096
4097Given:
4098  class A { void func(); };
4099  class B { void member(); };
4100
4101cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
4102A but not B.
4103</pre></td></tr>
4104
4105
4106<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>
4107<tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from
4108a class matching Base.
4109
4110Note that a class is not considered to be derived from itself.
4111
4112Example matches Y, Z, C (Base == hasName("X"))
4113  class X;
4114  class Y : public X {};  directly derived
4115  class Z : public Y {};  indirectly derived
4116  typedef X A;
4117  typedef A B;
4118  class C : public B {};  derived from a typedef of X
4119
4120In the following example, Bar matches isDerivedFrom(hasName("X")):
4121  class Foo;
4122  typedef Foo X;
4123  class Bar : public Foo {};  derived from a type that X is a typedef of
4124</pre></td></tr>
4125
4126
4127<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>
4128<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
4129match Base.
4130</pre></td></tr>
4131
4132
4133<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>
4134<tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
4135given matcher.
4136
4137Example matches y.x() (matcher = callExpr(callee(
4138                                   cxxMethodDecl(hasName("x")))))
4139  class Y { public: void x(); };
4140  void z() { Y y; y.x(); }
4141</pre></td></tr>
4142
4143
4144<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>
4145<tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches.
4146
4147Given
4148  class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
4149  void f() { f(); }
4150callExpr(callee(expr()))
4151  matches this-&gt;x(), x(), y.x(), f()
4152with callee(...)
4153  matching this-&gt;x, x, y.x, f respectively
4154
4155Note: Callee cannot take the more general internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
4156because this introduces ambiguous overloads with calls to Callee taking a
4157internal::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
4158implemented in terms of implicit casts.
4159</pre></td></tr>
4160
4161
4162<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>
4163<tr><td colspan="4" class="doc" id="forEachArgumentWithParam0"><pre>Matches all arguments and their respective ParmVarDecl.
4164
4165Given
4166  void f(int i);
4167  int y;
4168  f(y);
4169callExpr(
4170  forEachArgumentWithParam(
4171    declRefExpr(to(varDecl(hasName("y")))),
4172    parmVarDecl(hasType(isInteger()))
4173))
4174  matches f(y);
4175with declRefExpr(...)
4176  matching int y
4177and parmVarDecl(...)
4178  matching int i
4179</pre></td></tr>
4180
4181
4182<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>
4183<tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
4184expression.
4185
4186Given
4187  void x(int, int, int) { int y; x(1, y, 42); }
4188callExpr(hasAnyArgument(declRefExpr()))
4189  matches x(1, y, 42)
4190with hasAnyArgument(...)
4191  matching y
4192</pre></td></tr>
4193
4194
4195<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>
4196<tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
4197call expression.
4198
4199Example matches y in x(y)
4200    (matcher = callExpr(hasArgument(0, declRefExpr())))
4201  void x(int) { int y; x(y); }
4202</pre></td></tr>
4203
4204
4205<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>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4206<tr><td colspan="4" class="doc" id="hasDeclaration14"><pre>Matches a node if the declaration associated with that node
4207matches the given matcher.
4208
4209The associated declaration is:
4210- for type nodes, the declaration of the underlying type
4211- for CallExpr, the declaration of the callee
4212- for MemberExpr, the declaration of the referenced member
4213- for CXXConstructExpr, the declaration of the constructor
4214
4215Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
4216function. e.g. various subtypes of clang::Type and various expressions.
4217
4218Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
4219  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
4220  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
4221  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
4222  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
4223  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4224</pre></td></tr>
4225
4226
4227<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>
4228<tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
4229extension, matches the constant given in the statement.
4230
4231Given
4232  switch (1) { case 1: case 1+1: case 3 ... 4: ; }
4233caseStmt(hasCaseConstant(integerLiteral()))
4234  matches "case 1:"
4235</pre></td></tr>
4236
4237
4238<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>
4239<tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre></pre></td></tr>
4240
4241
4242<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>
4243<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations that have at least one
4244TemplateArgument matching the given InnerMatcher.
4245
4246Given
4247  template&lt;typename T&gt; class A {};
4248  template&lt;&gt; class A&lt;double&gt; {};
4249  A&lt;int&gt; a;
4250classTemplateSpecializationDecl(hasAnyTemplateArgument(
4251    refersToType(asString("int"))))
4252  matches the specialization A&lt;int&gt;
4253</pre></td></tr>
4254
4255
4256<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>
4257<tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations where the n'th TemplateArgument
4258matches the given InnerMatcher.
4259
4260Given
4261  template&lt;typename T, typename U&gt; class A {};
4262  A&lt;bool, int&gt; b;
4263  A&lt;int, bool&gt; c;
4264classTemplateSpecializationDecl(hasTemplateArgument(
4265    1, refersToType(asString("int"))))
4266  matches the specialization A&lt;bool, int&gt;
4267</pre></td></tr>
4268
4269
4270<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexTypeLoc.html">ComplexTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasElementTypeLoc1')"><a name="hasElementTypeLoc1Anchor">hasElementTypeLoc</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
4271<tr><td colspan="4" class="doc" id="hasElementTypeLoc1"><pre>Matches arrays and C99 complex types that have a specific element
4272type.
4273
4274Given
4275  struct A {};
4276  A a[7];
4277  int b[7];
4278arrayType(hasElementType(builtinType()))
4279  matches "int b[7]"
4280
4281Usable 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;
4282</pre></td></tr>
4283
4284
4285<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>
4286<tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
4287type.
4288
4289Given
4290  struct A {};
4291  A a[7];
4292  int b[7];
4293arrayType(hasElementType(builtinType()))
4294  matches "int b[7]"
4295
4296Usable 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;
4297</pre></td></tr>
4298
4299
4300<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>
4301<tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
4302a given matcher. Also matches StmtExprs that have CompoundStmt as children.
4303
4304Given
4305  { {}; 1+2; }
4306hasAnySubstatement(compoundStmt())
4307  matches '{ {}; 1+2; }'
4308with compoundStmt()
4309  matching '{}'
4310</pre></td></tr>
4311
4312
4313<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>
4314<tr><td colspan="4" class="doc" id="hasDecayedType0"><pre>Matches the decayed type, whos decayed type matches InnerMatcher
4315</pre></td></tr>
4316
4317
4318<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration12')"><a name="hasDeclaration12Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4319<tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
4320matches the given matcher.
4321
4322The associated declaration is:
4323- for type nodes, the declaration of the underlying type
4324- for CallExpr, the declaration of the callee
4325- for MemberExpr, the declaration of the referenced member
4326- for CXXConstructExpr, the declaration of the constructor
4327
4328Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
4329function. e.g. various subtypes of clang::Type and various expressions.
4330
4331Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
4332  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
4333  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
4334  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
4335  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
4336  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4337</pre></td></tr>
4338
4339
4340<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>
4341<tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a
4342specific using shadow declaration.
4343
4344Given
4345  namespace a { void f() {} }
4346  using a::f;
4347  void g() {
4348    f();     Matches this ..
4349    a::f();  .. but not this.
4350  }
4351declRefExpr(throughUsingDecl(anything()))
4352  matches f()
4353</pre></td></tr>
4354
4355
4356<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>
4357<tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
4358specified matcher.
4359
4360Example matches x in if(x)
4361    (matcher = declRefExpr(to(varDecl(hasName("x")))))
4362  bool x;
4363  if (x) {}
4364</pre></td></tr>
4365
4366
4367<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>
4368<tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
4369
4370Note that this does not work for global declarations because the AST
4371breaks up multiple-declaration DeclStmt's into multiple single-declaration
4372DeclStmt's.
4373Example: Given non-global declarations
4374  int a, b = 0;
4375  int c;
4376  int d = 2, e;
4377declStmt(containsDeclaration(
4378      0, varDecl(hasInitializer(anything()))))
4379  matches only 'int d = 2, e;', and
4380declStmt(containsDeclaration(1, varDecl()))
4381  matches 'int a, b = 0' as well as 'int d = 2, e;'
4382  but 'int c;' is not matched.
4383</pre></td></tr>
4384
4385
4386<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>
4387<tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
4388
4389Given
4390  int a, b;
4391  int c;
4392declStmt(hasSingleDecl(anything()))
4393  matches 'int c;' but not 'int a, b;'.
4394</pre></td></tr>
4395
4396
4397<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>
4398<tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches
4399the inner matcher.
4400
4401Given
4402  int x;
4403declaratorDecl(hasTypeLoc(loc(asString("int"))))
4404  matches int x
4405</pre></td></tr>
4406
4407
4408<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>
4409<tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
4410Decl, matches InnerMatcher.
4411
4412Given
4413  namespace N {
4414    namespace M {
4415      class D {};
4416    }
4417  }
4418
4419cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
4420declaration of class D.
4421</pre></td></tr>
4422
4423
4424<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>
4425<tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', 'do while' statement or a function
4426definition that has a given body.
4427
4428Given
4429  for (;;) {}
4430hasBody(compoundStmt())
4431  matches 'for (;;) {}'
4432with compoundStmt()
4433  matching '{}'
4434</pre></td></tr>
4435
4436
4437<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>
4438<tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
4439switch statement or conditional operator.
4440
4441Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
4442  if (true) {}
4443</pre></td></tr>
4444
4445
4446<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>
4447<tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
4448matches InnerMatcher if the qualifier exists.
4449
4450Given
4451  namespace N {
4452    namespace M {
4453      class D {};
4454    }
4455  }
4456  N::M::D d;
4457
4458elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
4459matches the type of the variable declaration of d.
4460</pre></td></tr>
4461
4462
4463<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>
4464<tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
4465
4466Given
4467  namespace N {
4468    namespace M {
4469      class D {};
4470    }
4471  }
4472  N::M::D d;
4473
4474elaboratedType(namesType(recordType(
4475hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
4476declaration of d.
4477</pre></td></tr>
4478
4479
4480<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration11')"><a name="hasDeclaration11Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4481<tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
4482matches the given matcher.
4483
4484The associated declaration is:
4485- for type nodes, the declaration of the underlying type
4486- for CallExpr, the declaration of the callee
4487- for MemberExpr, the declaration of the referenced member
4488- for CXXConstructExpr, the declaration of the constructor
4489
4490Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
4491function. e.g. various subtypes of clang::Type and various expressions.
4492
4493Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
4494  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
4495  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
4496  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
4497  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
4498  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4499</pre></td></tr>
4500
4501
4502<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>
4503<tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
4504
4505(Note: Clang's AST refers to other conversions as "casts" too, and calls
4506actual casts "explicit" casts.)
4507</pre></td></tr>
4508
4509
4510<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('hasType3')"><a name="hasType3Anchor">hasType</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
4511<tr><td colspan="4" class="doc" id="hasType3"><pre>Overloaded to match the declaration of the expression's or value
4512declaration's type.
4513
4514In case of a value declaration (for example a variable declaration),
4515this resolves one layer of indirection. For example, in the value
4516declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
4517X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
4518declaration of x.
4519
4520Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
4521            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
4522 class X {};
4523 void y(X &amp;x) { x; X z; }
4524
4525Usable 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;
4526</pre></td></tr>
4527
4528
4529<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>
4530<tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
4531matcher.
4532
4533Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
4534            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
4535            and U (matcher = typedefDecl(hasType(asString("int")))
4536 class X {};
4537 void y(X &amp;x) { x; X z; }
4538 typedef int U;
4539</pre></td></tr>
4540
4541
4542<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>
4543<tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
4544are stripped off.
4545
4546Parentheses and explicit casts are not discarded.
4547Given
4548  int arr[5];
4549  int a = 0;
4550  char b = 0;
4551  const int c = a;
4552  int *d = arr;
4553  long e = (long) 0l;
4554The matchers
4555   varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
4556   varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
4557would match the declarations for a, b, c, and d, but not e.
4558While
4559   varDecl(hasInitializer(integerLiteral()))
4560   varDecl(hasInitializer(declRefExpr()))
4561only match the declarations for b, c, and d.
4562</pre></td></tr>
4563
4564
4565<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>ast_matchers::Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4566<tr><td colspan="4" class="doc" id="ignoringImplicit0"><pre>Matches expressions that match InnerMatcher after any implicit AST
4567nodes are stripped off.
4568
4569Parentheses and explicit casts are not discarded.
4570Given
4571  class C {};
4572  C a = C();
4573  C b;
4574  C c = b;
4575The matchers
4576   varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr())))
4577would match the declarations for a, b, and c.
4578While
4579   varDecl(hasInitializer(cxxConstructExpr()))
4580only match the declarations for b and c.
4581</pre></td></tr>
4582
4583
4584<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>
4585<tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
4586casts are stripped off.
4587
4588Implicit and non-C Style casts are also discarded.
4589Given
4590  int a = 0;
4591  char b = (0);
4592  void* c = reinterpret_cast&lt;char*&gt;(0);
4593  char d = char(0);
4594The matcher
4595   varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
4596would match the declarations for a, b, c, and d.
4597while
4598   varDecl(hasInitializer(integerLiteral()))
4599only match the declaration for a.
4600</pre></td></tr>
4601
4602
4603<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>
4604<tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
4605parentheses are stripped off.
4606
4607Explicit casts are not discarded.
4608Given
4609  int arr[5];
4610  int a = 0;
4611  char b = (0);
4612  const int c = a;
4613  int *d = (arr);
4614  long e = ((long) 0l);
4615The matchers
4616   varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
4617   varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
4618would match the declarations for a, b, c, and d, but not e.
4619while
4620   varDecl(hasInitializer(integerLiteral()))
4621   varDecl(hasInitializer(declRefExpr()))
4622would only match the declaration for a.
4623</pre></td></tr>
4624
4625
4626<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>
4627<tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', 'do while' statement or a function
4628definition that has a given body.
4629
4630Given
4631  for (;;) {}
4632hasBody(compoundStmt())
4633  matches 'for (;;) {}'
4634with compoundStmt()
4635  matching '{}'
4636</pre></td></tr>
4637
4638
4639<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>
4640<tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
4641switch statement or conditional operator.
4642
4643Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
4644  if (true) {}
4645</pre></td></tr>
4646
4647
4648<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>
4649<tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
4650
4651Example:
4652    forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
4653matches '++x' in
4654    for (x; x &lt; N; ++x) { }
4655</pre></td></tr>
4656
4657
4658<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>
4659<tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
4660
4661Example:
4662    forStmt(hasLoopInit(declStmt()))
4663matches 'int x = 0' in
4664    for (int x = 0; x &lt; N; ++x) { }
4665</pre></td></tr>
4666
4667
4668<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>
4669<tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function declaration.
4670
4671Does not match the 'this' parameter of a method.
4672
4673Given
4674  class X { void f(int x, int y, int z) {} };
4675cxxMethodDecl(hasAnyParameter(hasName("y")))
4676  matches f(int x, int y, int z) {}
4677with hasAnyParameter(...)
4678  matching int y
4679</pre></td></tr>
4680
4681
4682<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>
4683<tr><td colspan="4" class="doc" id="hasBody4"><pre>Matches a 'for', 'while', 'do while' statement or a function
4684definition that has a given body.
4685
4686Given
4687  for (;;) {}
4688hasBody(compoundStmt())
4689  matches 'for (;;) {}'
4690with compoundStmt()
4691  matching '{}'
4692</pre></td></tr>
4693
4694
4695<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>
4696<tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function declaration.
4697
4698Given
4699  class X { void f(int x) {} };
4700cxxMethodDecl(hasParameter(0, hasType(varDecl())))
4701  matches f(int x) {}
4702with hasParameter(...)
4703  matching int x
4704</pre></td></tr>
4705
4706
4707<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>
4708<tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
4709
4710Given:
4711  class X { int f() { return 1; } };
4712cxxMethodDecl(returns(asString("int")))
4713  matches int f() { return 1; }
4714</pre></td></tr>
4715
4716
4717<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>
4718<tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
4719switch statement or conditional operator.
4720
4721Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
4722  if (true) {}
4723</pre></td></tr>
4724
4725
4726<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>
4727<tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
4728
4729Given
4730  if (A* a = GetAPointer()) {}
4731hasConditionVariableStatement(...)
4732  matches 'A* a = GetAPointer()'.
4733</pre></td></tr>
4734
4735
4736<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>
4737<tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
4738
4739Examples matches the if statement
4740  (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
4741  if (false) false; else true;
4742</pre></td></tr>
4743
4744
4745<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>
4746<tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
4747
4748Examples matches the if statement
4749  (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
4750  if (false) true; else false;
4751</pre></td></tr>
4752
4753
4754<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>
4755<tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
4756matcher.
4757
4758FIXME: Unit test this matcher
4759</pre></td></tr>
4760
4761
4762<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>
4763<tr><td colspan="4" class="doc" id="hasSyntacticForm0"><pre>Matches the syntactic form of init list expressions
4764(if expression have it).
4765</pre></td></tr>
4766
4767
4768<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration10')"><a name="hasDeclaration10Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4769<tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
4770matches the given matcher.
4771
4772The associated declaration is:
4773- for type nodes, the declaration of the underlying type
4774- for CallExpr, the declaration of the callee
4775- for MemberExpr, the declaration of the referenced member
4776- for CXXConstructExpr, the declaration of the constructor
4777
4778Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
4779function. e.g. various subtypes of clang::Type and various expressions.
4780
4781Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
4782  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
4783  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
4784  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
4785  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
4786  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4787</pre></td></tr>
4788
4789
4790<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration9')"><a name="hasDeclaration9Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4791<tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
4792matches the given matcher.
4793
4794The associated declaration is:
4795- for type nodes, the declaration of the underlying type
4796- for CallExpr, the declaration of the callee
4797- for MemberExpr, the declaration of the referenced member
4798- for CXXConstructExpr, the declaration of the constructor
4799
4800Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
4801function. e.g. various subtypes of clang::Type and various expressions.
4802
4803Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
4804  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
4805  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
4806  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
4807  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
4808  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4809</pre></td></tr>
4810
4811
4812<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration7')"><a name="hasDeclaration7Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4813<tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
4814matches the given matcher.
4815
4816The associated declaration is:
4817- for type nodes, the declaration of the underlying type
4818- for CallExpr, the declaration of the callee
4819- for MemberExpr, the declaration of the referenced member
4820- for CXXConstructExpr, the declaration of the constructor
4821
4822Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
4823function. e.g. various subtypes of clang::Type and various expressions.
4824
4825Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
4826  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
4827  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
4828  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
4829  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
4830  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4831</pre></td></tr>
4832
4833
4834<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>
4835<tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is
4836matched by a given matcher.
4837
4838Given
4839  struct X { int m; };
4840  void f(X x) { x.m; m; }
4841memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))))
4842  matches "x.m" and "m"
4843with hasObjectExpression(...)
4844  matching "x" and the implicit object expression of "m" which has type X*.
4845</pre></td></tr>
4846
4847
4848<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>
4849<tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
4850given matcher.
4851
4852Given
4853  struct { int first, second; } first, second;
4854  int i(second.first);
4855  int j(first.second);
4856memberExpr(member(hasName("first")))
4857  matches second.first
4858  but not first.second (because the member name there is "second").
4859</pre></td></tr>
4860
4861
4862<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerTypeLoc.html">MemberPointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc1')"><a name="pointeeLoc1Anchor">pointeeLoc</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
4863<tr><td colspan="4" class="doc" id="pointeeLoc1"><pre>Narrows PointerType (and similar) matchers to those where the
4864pointee matches a given matcher.
4865
4866Given
4867  int *a;
4868  int const *b;
4869  float const *f;
4870pointerType(pointee(isConstQualified(), isInteger()))
4871  matches "int const *b"
4872
4873Usable 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;,
4874  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;
4875</pre></td></tr>
4876
4877
4878<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>
4879<tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
4880pointee matches a given matcher.
4881
4882Given
4883  int *a;
4884  int const *b;
4885  float const *f;
4886pointerType(pointee(isConstQualified(), isInteger()))
4887  matches "int const *b"
4888
4889Usable 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;,
4890  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;
4891</pre></td></tr>
4892
4893
4894<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>
4895<tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
4896
4897Given
4898  struct A { struct B { struct C {}; }; };
4899  A::B::C c;
4900nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
4901  matches "A::"
4902</pre></td></tr>
4903
4904
4905<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>
4906<tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
4907given TypeLoc.
4908
4909Given
4910  struct A { struct B { struct C {}; }; };
4911  A::B::C c;
4912nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
4913  hasDeclaration(cxxRecordDecl(hasName("A")))))))
4914  matches "A::"
4915</pre></td></tr>
4916
4917
4918<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>
4919<tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
4920
4921Given
4922  struct A { struct B { struct C {}; }; };
4923  A::B::C c;
4924nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
4925  matches "A::"
4926</pre></td></tr>
4927
4928
4929<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>
4930<tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
4931given namespace matcher.
4932
4933Given
4934  namespace ns { struct A {}; }
4935  ns::A a;
4936nestedNameSpecifier(specifiesNamespace(hasName("ns")))
4937  matches "ns::"
4938</pre></td></tr>
4939
4940
4941<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>
4942<tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
4943given QualType matcher without qualifiers.
4944
4945Given
4946  struct A { struct B { struct C {}; }; };
4947  A::B::C c;
4948nestedNameSpecifier(specifiesType(
4949  hasDeclaration(cxxRecordDecl(hasName("A")))
4950))
4951  matches "A::"
4952</pre></td></tr>
4953
4954
4955<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>
4956<tr><td colspan="4" class="doc" id="hasArgument2"><pre>Matches the n'th argument of a call expression or a constructor
4957call expression.
4958
4959Example matches y in x(y)
4960    (matcher = callExpr(hasArgument(0, declRefExpr())))
4961  void x(int) { int y; x(y); }
4962</pre></td></tr>
4963
4964
4965<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>
4966<tr><td colspan="4" class="doc" id="hasReceiverType0"><pre>Matches on the receiver of an ObjectiveC Message expression.
4967
4968Example
4969matcher = objCMessageExpr(hasRecieverType(asString("UIWebView *")));
4970matches the [webView ...] message invocation.
4971  NSString *webViewJavaScript = ...
4972  UIWebView *webView = ...
4973  [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
4974</pre></td></tr>
4975
4976
4977<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>
4978<tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre></pre></td></tr>
4979
4980
4981<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>
4982<tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
4983
4984Given
4985  int (*ptr_to_array)[4];
4986  int (*ptr_to_func)(int);
4987
4988varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
4989ptr_to_func but not ptr_to_array.
4990
4991Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
4992</pre></td></tr>
4993
4994
4995<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerTypeLoc.html">PointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc2')"><a name="pointeeLoc2Anchor">pointeeLoc</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
4996<tr><td colspan="4" class="doc" id="pointeeLoc2"><pre>Narrows PointerType (and similar) matchers to those where the
4997pointee matches a given matcher.
4998
4999Given
5000  int *a;
5001  int const *b;
5002  float const *f;
5003pointerType(pointee(isConstQualified(), isInteger()))
5004  matches "int const *b"
5005
5006Usable 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;,
5007  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;
5008</pre></td></tr>
5009
5010
5011<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>
5012<tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
5013pointee matches a given matcher.
5014
5015Given
5016  int *a;
5017  int const *b;
5018  float const *f;
5019pointerType(pointee(isConstQualified(), isInteger()))
5020  matches "int const *b"
5021
5022Usable 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;,
5023  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;
5024</pre></td></tr>
5025
5026
5027<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>
5028<tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
5029
5030Given:
5031  typedef int &amp;int_ref;
5032  int a;
5033  int_ref b = a;
5034
5035varDecl(hasType(qualType(referenceType()))))) will not match the
5036declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
5037</pre></td></tr>
5038
5039
5040<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration6')"><a name="hasDeclaration6Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5041<tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
5042matches the given matcher.
5043
5044The associated declaration is:
5045- for type nodes, the declaration of the underlying type
5046- for CallExpr, the declaration of the callee
5047- for MemberExpr, the declaration of the referenced member
5048- for CXXConstructExpr, the declaration of the constructor
5049
5050Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
5051function. e.g. various subtypes of clang::Type and various expressions.
5052
5053Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
5054  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
5055  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
5056  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
5057  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
5058  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5059</pre></td></tr>
5060
5061
5062<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>
5063<tr><td colspan="4" class="doc" id="ignoringParens0"><pre>Matches types that match InnerMatcher after any parens are stripped.
5064
5065Given
5066  void (*fp)(void);
5067The matcher
5068  varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
5069would match the declaration for fp.
5070</pre></td></tr>
5071
5072
5073<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>
5074<tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
5075</pre></td></tr>
5076
5077
5078<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>
5079<tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
5080matches the specified matcher.
5081
5082Example matches y-&gt;x()
5083  (matcher = cxxMemberCallExpr(on(hasType(pointsTo
5084     cxxRecordDecl(hasName("Y")))))))
5085  class Y { public: void x(); };
5086  void z() { Y *y; y-&gt;x(); }
5087</pre></td></tr>
5088
5089
5090<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>
5091<tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
5092</pre></td></tr>
5093
5094
5095<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>
5096<tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
5097type matches the specified matcher.
5098
5099Example matches X &amp;x and const X &amp;y
5100    (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
5101  class X {
5102    void a(X b) {
5103      X &amp;x = b;
5104      const X &amp;y = b;
5105    }
5106  };
5107</pre></td></tr>
5108
5109
5110<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration5')"><a name="hasDeclaration5Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5111<tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
5112matches the given matcher.
5113
5114The associated declaration is:
5115- for type nodes, the declaration of the underlying type
5116- for CallExpr, the declaration of the callee
5117- for MemberExpr, the declaration of the referenced member
5118- for CXXConstructExpr, the declaration of the constructor
5119
5120Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
5121function. e.g. various subtypes of clang::Type and various expressions.
5122
5123Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
5124  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
5125  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
5126  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
5127  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
5128  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5129</pre></td></tr>
5130
5131
5132<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceTypeLoc.html">ReferenceTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc3')"><a name="pointeeLoc3Anchor">pointeeLoc</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
5133<tr><td colspan="4" class="doc" id="pointeeLoc3"><pre>Narrows PointerType (and similar) matchers to those where the
5134pointee matches a given matcher.
5135
5136Given
5137  int *a;
5138  int const *b;
5139  float const *f;
5140pointerType(pointee(isConstQualified(), isInteger()))
5141  matches "int const *b"
5142
5143Usable 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;,
5144  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;
5145</pre></td></tr>
5146
5147
5148<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>
5149<tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
5150pointee matches a given matcher.
5151
5152Given
5153  int *a;
5154  int const *b;
5155  float const *f;
5156pointerType(pointee(isConstQualified(), isInteger()))
5157  matches "int const *b"
5158
5159Usable 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;,
5160  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;
5161</pre></td></tr>
5162
5163
5164<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>
5165<tr><td colspan="4" class="doc" id="hasReturnValue0"><pre>Matches the return value expression of a return statement
5166
5167Given
5168  return a + b;
5169hasReturnValue(binaryOperator())
5170  matches 'return a + b'
5171with binaryOperator()
5172  matching 'a + b'
5173</pre></td></tr>
5174
5175
5176<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>
5177<tr><td colspan="4" class="doc" id="hasAnySubstatement1"><pre>Matches compound statements where at least one substatement matches
5178a given matcher. Also matches StmtExprs that have CompoundStmt as children.
5179
5180Given
5181  { {}; 1+2; }
5182hasAnySubstatement(compoundStmt())
5183  matches '{ {}; 1+2; }'
5184with compoundStmt()
5185  matching '{}'
5186</pre></td></tr>
5187
5188
5189<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('alignOfExpr0')"><a name="alignOfExpr0Anchor">alignOfExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;  InnerMatcher</td></tr>
5190<tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
5191alignof.
5192</pre></td></tr>
5193
5194
5195<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>
5196<tr><td colspan="4" class="doc" id="forFunction0"><pre>Matches declaration of the function the statemenet belongs to
5197
5198Given:
5199F&amp; operator=(const F&amp; o) {
5200  std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
5201  return *this;
5202}
5203returnStmt(forFunction(hasName("operator=")))
5204  matches 'return *this'
5205  but does match 'return &gt; 0'
5206</pre></td></tr>
5207
5208
5209<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('sizeOfExpr0')"><a name="sizeOfExpr0Anchor">sizeOfExpr</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;  InnerMatcher</td></tr>
5210<tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
5211sizeof.
5212</pre></td></tr>
5213
5214
5215<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>
5216<tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
5217statement. This matcher may produce multiple matches.
5218
5219Given
5220  switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
5221switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
5222  matches four times, with "c" binding each of "case 1:", "case 2:",
5223"case 3:" and "case 4:", and "s" respectively binding "switch (1)",
5224"switch (1)", "switch (2)" and "switch (2)".
5225</pre></td></tr>
5226
5227
5228<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>
5229<tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
5230switch statement or conditional operator.
5231
5232Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5233  if (true) {}
5234</pre></td></tr>
5235
5236
5237<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration4')"><a name="hasDeclaration4Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5238<tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
5239matches the given matcher.
5240
5241The associated declaration is:
5242- for type nodes, the declaration of the underlying type
5243- for CallExpr, the declaration of the callee
5244- for MemberExpr, the declaration of the referenced member
5245- for CXXConstructExpr, the declaration of the constructor
5246
5247Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
5248function. e.g. various subtypes of clang::Type and various expressions.
5249
5250Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
5251  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
5252  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
5253  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
5254  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
5255  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5256</pre></td></tr>
5257
5258
5259<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>
5260<tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
5261
5262Given
5263  template&lt;typename T&gt; struct A {};
5264  struct B { B* next; };
5265  A&lt;&amp;B::next&gt; a;
5266templateSpecializationType(hasAnyTemplateArgument(
5267  isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
5268  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
5269    B::next
5270</pre></td></tr>
5271
5272
5273<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>
5274<tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
5275declaration.
5276
5277Given
5278  template&lt;typename T&gt; struct A {};
5279  struct B { B* next; };
5280  A&lt;&amp;B::next&gt; a;
5281classTemplateSpecializationDecl(hasAnyTemplateArgument(
5282    refersToDeclaration(fieldDecl(hasName("next"))))
5283  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
5284    B::next
5285</pre></td></tr>
5286
5287
5288<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>
5289<tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that referes to an integral type.
5290
5291Given
5292  template&lt;int T&gt; struct A {};
5293  C&lt;42&gt; c;
5294classTemplateSpecializationDecl(
5295  hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
5296  matches the implicit instantiation of C in C&lt;42&gt;.
5297</pre></td></tr>
5298
5299
5300<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>
5301<tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
5302
5303Given
5304  struct X {};
5305  template&lt;typename T&gt; struct A {};
5306  A&lt;X&gt; a;
5307classTemplateSpecializationDecl(hasAnyTemplateArgument(
5308    refersToType(class(hasName("X")))))
5309  matches the specialization A&lt;X&gt;
5310</pre></td></tr>
5311
5312
5313<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>
5314<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations that have at least one
5315TemplateArgument matching the given InnerMatcher.
5316
5317Given
5318  template&lt;typename T&gt; class A {};
5319  template&lt;&gt; class A&lt;double&gt; {};
5320  A&lt;int&gt; a;
5321classTemplateSpecializationDecl(hasAnyTemplateArgument(
5322    refersToType(asString("int"))))
5323  matches the specialization A&lt;int&gt;
5324</pre></td></tr>
5325
5326
5327<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration3')"><a name="hasDeclaration3Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5328<tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
5329matches the given matcher.
5330
5331The associated declaration is:
5332- for type nodes, the declaration of the underlying type
5333- for CallExpr, the declaration of the callee
5334- for MemberExpr, the declaration of the referenced member
5335- for CXXConstructExpr, the declaration of the constructor
5336
5337Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
5338function. e.g. various subtypes of clang::Type and various expressions.
5339
5340Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
5341  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
5342  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
5343  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
5344  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
5345  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5346</pre></td></tr>
5347
5348
5349<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>
5350<tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations where the n'th TemplateArgument
5351matches the given InnerMatcher.
5352
5353Given
5354  template&lt;typename T, typename U&gt; class A {};
5355  A&lt;bool, int&gt; b;
5356  A&lt;int, bool&gt; c;
5357classTemplateSpecializationDecl(hasTemplateArgument(
5358    1, refersToType(asString("int"))))
5359  matches the specialization A&lt;bool, int&gt;
5360</pre></td></tr>
5361
5362
5363<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration2')"><a name="hasDeclaration2Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5364<tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
5365matches the given matcher.
5366
5367The associated declaration is:
5368- for type nodes, the declaration of the underlying type
5369- for CallExpr, the declaration of the callee
5370- for MemberExpr, the declaration of the referenced member
5371- for CXXConstructExpr, the declaration of the constructor
5372
5373Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
5374function. e.g. various subtypes of clang::Type and various expressions.
5375
5376Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
5377  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
5378  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
5379  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
5380  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
5381  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5382</pre></td></tr>
5383
5384
5385<tr><td>Matcher&lt;T&gt;</td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>Matcher&lt;T&gt;  Matcher</td></tr>
5386<tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
5387
5388Generates results for each match.
5389
5390For example, in:
5391  class A { class B {}; class C {}; };
5392The matcher:
5393  cxxRecordDecl(hasName("::A"),
5394                findAll(cxxRecordDecl(isDefinition()).bind("m")))
5395will generate results for A, B and C.
5396
5397Usable as: Any Matcher
5398</pre></td></tr>
5399
5400
5401<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</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>
5402<tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
5403matcher.
5404
5405Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5406            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5407            and U (matcher = typedefDecl(hasType(asString("int")))
5408 class X {};
5409 void y(X &amp;x) { x; X z; }
5410 typedef int U;
5411</pre></td></tr>
5412
5413
5414<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration1')"><a name="hasDeclaration1Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5415<tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
5416matches the given matcher.
5417
5418The associated declaration is:
5419- for type nodes, the declaration of the underlying type
5420- for CallExpr, the declaration of the callee
5421- for MemberExpr, the declaration of the referenced member
5422- for CXXConstructExpr, the declaration of the constructor
5423
5424Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
5425function. e.g. various subtypes of clang::Type and various expressions.
5426
5427Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
5428  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
5429  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
5430  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
5431  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
5432  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5433</pre></td></tr>
5434
5435
5436<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>
5437<tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
5438
5439Given
5440  int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
5441unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
5442  matches sizeof(a) and alignof(c)
5443</pre></td></tr>
5444
5445
5446<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>
5447<tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
5448
5449Example matches true (matcher = hasUnaryOperand(
5450                                  cxxBoolLiteral(equals(true))))
5451  !true
5452</pre></td></tr>
5453
5454
5455<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration0')"><a name="hasDeclaration0Anchor">hasDeclaration</a></td><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5456<tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
5457matches the given matcher.
5458
5459The associated declaration is:
5460- for type nodes, the declaration of the underlying type
5461- for CallExpr, the declaration of the callee
5462- for MemberExpr, the declaration of the referenced member
5463- for CXXConstructExpr, the declaration of the constructor
5464
5465Also usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
5466function. e.g. various subtypes of clang::Type and various expressions.
5467
5468Usable as: Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
5469  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
5470  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;,
5471  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;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
5472  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
5473  Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5474</pre></td></tr>
5475
5476
5477<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>
5478<tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
5479
5480Given
5481  namespace X { void b(); }
5482  using X::b;
5483usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
5484  matches using X::b </pre></td></tr>
5485
5486
5487<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>
5488<tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
5489matched by the given matcher.
5490
5491Given
5492  namespace X { int a; void b(); }
5493  using X::a;
5494  using X::b;
5495usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
5496  matches using X::b but not using X::a </pre></td></tr>
5497
5498
5499<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</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>
5500<tr><td colspan="4" class="doc" id="hasType4"><pre>Overloaded to match the declaration of the expression's or value
5501declaration's type.
5502
5503In case of a value declaration (for example a variable declaration),
5504this resolves one layer of indirection. For example, in the value
5505declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5506X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5507declaration of x.
5508
5509Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5510            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5511 class X {};
5512 void y(X &amp;x) { x; X z; }
5513
5514Usable 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;
5515</pre></td></tr>
5516
5517
5518<tr><td>Matcher&lt;<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</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>
5519<tr><td colspan="4" class="doc" id="hasType2"><pre>Matches if the expression's or declaration's type matches a type
5520matcher.
5521
5522Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5523            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5524            and U (matcher = typedefDecl(hasType(asString("int")))
5525 class X {};
5526 void y(X &amp;x) { x; X z; }
5527 typedef int U;
5528</pre></td></tr>
5529
5530
5531<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>
5532<tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
5533that matches the given matcher.
5534
5535Example matches x (matcher = varDecl(hasInitializer(callExpr())))
5536  bool y() { return true; }
5537  bool x = y();
5538</pre></td></tr>
5539
5540
5541<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>
5542<tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
5543expression.
5544
5545Given
5546  void f(int b) {
5547    int a[b];
5548  }
5549variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
5550  varDecl(hasName("b")))))))
5551  matches "int a[b]"
5552</pre></td></tr>
5553
5554
5555<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>
5556<tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', 'do while' statement or a function
5557definition that has a given body.
5558
5559Given
5560  for (;;) {}
5561hasBody(compoundStmt())
5562  matches 'for (;;) {}'
5563with compoundStmt()
5564  matching '{}'
5565</pre></td></tr>
5566
5567
5568<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>
5569<tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
5570switch statement or conditional operator.
5571
5572Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5573  if (true) {}
5574</pre></td></tr>
5575
5576
5577<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>
5578<tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
5579NestedNameSpecifier-matcher matches.
5580</pre></td></tr>
5581
5582
5583<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>
5584<tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
5585QualType-matcher matches.
5586</pre></td></tr>
5587
5588<!--END_TRAVERSAL_MATCHERS -->
5589</table>
5590
5591</div>
5592</body>
5593</html>
5594
5595
5596