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="https://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="https://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="https://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="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('blockDecl0')"><a name="blockDecl0Anchor">blockDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;...</td></tr>
128<tr><td colspan="4" class="doc" id="blockDecl0"><pre>Matches block declarations.
129
130Example matches the declaration of the nameless block printing an input
131integer.
132
133  myFunc(^(int p) {
134    printf("%d", p);
135  })
136</pre></td></tr>
137
138
139<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateDecl.html">ClassTemplateDecl</a>&gt;...</td></tr>
140<tr><td colspan="4" class="doc" id="classTemplateDecl0"><pre>Matches C++ class template declarations.
141
142Example matches Z
143  template&lt;class T&gt; class Z {};
144</pre></td></tr>
145
146
147<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('classTemplatePartialSpecializationDecl0')"><a name="classTemplatePartialSpecializationDecl0Anchor">classTemplatePartialSpecializationDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplatePartialSpecializationDecl.html">ClassTemplatePartialSpecializationDecl</a>&gt;...</td></tr>
148<tr><td colspan="4" class="doc" id="classTemplatePartialSpecializationDecl0"><pre>Matches C++ class template partial specializations.
149
150Given
151  template&lt;class T1, class T2, int I&gt;
152  class A {};
153
154  template&lt;class T, int I&gt;
155  class A&lt;T, T*, I&gt; {};
156
157  template&lt;&gt;
158  class A&lt;int, int, 1&gt; {};
159classTemplatePartialSpecializationDecl()
160  matches the specialization A&lt;T,T*,I&gt; but not A&lt;int,int,1&gt;
161</pre></td></tr>
162
163
164<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;...</td></tr>
165<tr><td colspan="4" class="doc" id="classTemplateSpecializationDecl0"><pre>Matches C++ class template specializations.
166
167Given
168  template&lt;typename T&gt; class A {};
169  template&lt;&gt; class A&lt;double&gt; {};
170  A&lt;int&gt; a;
171classTemplateSpecializationDecl()
172  matches the specializations A&lt;int&gt; and A&lt;double&gt;
173</pre></td></tr>
174
175
176<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;...</td></tr>
177<tr><td colspan="4" class="doc" id="cxxConstructorDecl0"><pre>Matches C++ constructor declarations.
178
179Example matches Foo::Foo() and Foo::Foo(int)
180  class Foo {
181   public:
182    Foo();
183    Foo(int);
184    int DoSomething();
185  };
186</pre></td></tr>
187
188
189<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXConversionDecl.html">CXXConversionDecl</a>&gt;...</td></tr>
190<tr><td colspan="4" class="doc" id="cxxConversionDecl0"><pre>Matches conversion operator declarations.
191
192Example matches the operator.
193  class X { operator int() const; };
194</pre></td></tr>
195
196
197<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXDestructorDecl.html">CXXDestructorDecl</a>&gt;...</td></tr>
198<tr><td colspan="4" class="doc" id="cxxDestructorDecl0"><pre>Matches explicit C++ destructor declarations.
199
200Example matches Foo::~Foo()
201  class Foo {
202   public:
203    virtual ~Foo();
204  };
205</pre></td></tr>
206
207
208<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;...</td></tr>
209<tr><td colspan="4" class="doc" id="cxxMethodDecl0"><pre>Matches method declarations.
210
211Example matches y
212  class X { void y(); };
213</pre></td></tr>
214
215
216<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;...</td></tr>
217<tr><td colspan="4" class="doc" id="cxxRecordDecl0"><pre>Matches C++ class declarations.
218
219Example matches X, Z
220  class X;
221  template&lt;class T&gt; class Z {};
222</pre></td></tr>
223
224
225<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;...</td></tr>
226<tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations.
227
228Examples matches X, C, and the friend declaration inside C;
229  void X();
230  class C {
231    friend X;
232  };
233</pre></td></tr>
234
235
236<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;...</td></tr>
237<tr><td colspan="4" class="doc" id="declaratorDecl0"><pre>Matches declarator declarations (field, variable, function
238and non-type template parameter declarations).
239
240Given
241  class X { int y; };
242declaratorDecl()
243  matches int y.
244</pre></td></tr>
245
246
247<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1EnumConstantDecl.html">EnumConstantDecl</a>&gt;...</td></tr>
248<tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants.
249
250Example matches A, B, C
251  enum X {
252    A, B, C
253  };
254</pre></td></tr>
255
256
257<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1EnumDecl.html">EnumDecl</a>&gt;...</td></tr>
258<tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations.
259
260Example matches X
261  enum X {
262    A, B, C
263  };
264</pre></td></tr>
265
266
267<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt;...</td></tr>
268<tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations.
269
270Given
271  class X { int m; };
272fieldDecl()
273  matches 'm'.
274</pre></td></tr>
275
276
277<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1FriendDecl.html">FriendDecl</a>&gt;...</td></tr>
278<tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations.
279
280Given
281  class X { friend void foo(); };
282friendDecl()
283  matches 'friend void foo()'.
284</pre></td></tr>
285
286
287<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;...</td></tr>
288<tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations.
289
290Example matches f
291  void f();
292</pre></td></tr>
293
294
295<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1FunctionTemplateDecl.html">FunctionTemplateDecl</a>&gt;...</td></tr>
296<tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations.
297
298Example matches f
299  template&lt;class T&gt; void f(T t) {}
300</pre></td></tr>
301
302
303<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('indirectFieldDecl0')"><a name="indirectFieldDecl0Anchor">indirectFieldDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IndirectFieldDecl.html">IndirectFieldDecl</a>&gt;...</td></tr>
304<tr><td colspan="4" class="doc" id="indirectFieldDecl0"><pre>Matches indirect field declarations.
305
306Given
307  struct X { struct { int a; }; };
308indirectFieldDecl()
309  matches 'a'.
310</pre></td></tr>
311
312
313<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1LabelDecl.html">LabelDecl</a>&gt;...</td></tr>
314<tr><td colspan="4" class="doc" id="labelDecl0"><pre>Matches a declaration of label.
315
316Given
317  goto FOO;
318  FOO: bar();
319labelDecl()
320  matches 'FOO:'
321</pre></td></tr>
322
323
324<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1LinkageSpecDecl.html">LinkageSpecDecl</a>&gt;...</td></tr>
325<tr><td colspan="4" class="doc" id="linkageSpecDecl0"><pre>Matches a declaration of a linkage specification.
326
327Given
328  extern "C" {}
329linkageSpecDecl()
330  matches "extern "C" {}"
331</pre></td></tr>
332
333
334<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;...</td></tr>
335<tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name.
336
337Example matches X, S, the anonymous union type, i, and U;
338  typedef int X;
339  struct S {
340    union {
341      int i;
342    } U;
343  };
344</pre></td></tr>
345
346
347<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NamespaceAliasDecl.html">NamespaceAliasDecl</a>&gt;...</td></tr>
348<tr><td colspan="4" class="doc" id="namespaceAliasDecl0"><pre>Matches a declaration of a namespace alias.
349
350Given
351  namespace test {}
352  namespace alias = ::test;
353namespaceAliasDecl()
354  matches "namespace alias" but not "namespace test"
355</pre></td></tr>
356
357
358<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>&gt;...</td></tr>
359<tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace.
360
361Given
362  namespace {}
363  namespace test {}
364namespaceDecl()
365  matches "namespace {}" and "namespace test {}"
366</pre></td></tr>
367
368
369<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NonTypeTemplateParmDecl.html">NonTypeTemplateParmDecl</a>&gt;...</td></tr>
370<tr><td colspan="4" class="doc" id="nonTypeTemplateParmDecl0"><pre>Matches non-type template parameter declarations.
371
372Given
373  template &lt;typename T, int N&gt; struct C {};
374nonTypeTemplateParmDecl()
375  matches 'N', but not 'T'.
376</pre></td></tr>
377
378
379<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcCategoryDecl0')"><a name="objcCategoryDecl0Anchor">objcCategoryDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCCategoryDecl.html">ObjCCategoryDecl</a>&gt;...</td></tr>
380<tr><td colspan="4" class="doc" id="objcCategoryDecl0"><pre>Matches Objective-C category declarations.
381
382Example matches Foo (Additions)
383  @interface Foo (Additions)
384  @end
385</pre></td></tr>
386
387
388<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcCategoryImplDecl0')"><a name="objcCategoryImplDecl0Anchor">objcCategoryImplDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCCategoryImplDecl.html">ObjCCategoryImplDecl</a>&gt;...</td></tr>
389<tr><td colspan="4" class="doc" id="objcCategoryImplDecl0"><pre>Matches Objective-C category definitions.
390
391Example matches Foo (Additions)
392  @implementation Foo (Additions)
393  @end
394</pre></td></tr>
395
396
397<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcImplementationDecl0')"><a name="objcImplementationDecl0Anchor">objcImplementationDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCImplementationDecl.html">ObjCImplementationDecl</a>&gt;...</td></tr>
398<tr><td colspan="4" class="doc" id="objcImplementationDecl0"><pre>Matches Objective-C implementation declarations.
399
400Example matches Foo
401  @implementation Foo
402  @end
403</pre></td></tr>
404
405
406<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;...</td></tr>
407<tr><td colspan="4" class="doc" id="objcInterfaceDecl0"><pre>Matches Objective-C interface declarations.
408
409Example matches Foo
410  @interface Foo
411  @end
412</pre></td></tr>
413
414
415<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcIvarDecl0')"><a name="objcIvarDecl0Anchor">objcIvarDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCIvarDecl.html">ObjCIvarDecl</a>&gt;...</td></tr>
416<tr><td colspan="4" class="doc" id="objcIvarDecl0"><pre>Matches Objective-C instance variable declarations.
417
418Example matches _enabled
419  @implementation Foo {
420    BOOL _enabled;
421  }
422  @end
423</pre></td></tr>
424
425
426<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcMethodDecl0')"><a name="objcMethodDecl0Anchor">objcMethodDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;...</td></tr>
427<tr><td colspan="4" class="doc" id="objcMethodDecl0"><pre>Matches Objective-C method declarations.
428
429Example matches both declaration and definition of -[Foo method]
430  @interface Foo
431  - (void)method;
432  @end
433
434  @implementation Foo
435  - (void)method {}
436  @end
437</pre></td></tr>
438
439
440<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcPropertyDecl0')"><a name="objcPropertyDecl0Anchor">objcPropertyDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;...</td></tr>
441<tr><td colspan="4" class="doc" id="objcPropertyDecl0"><pre>Matches Objective-C property declarations.
442
443Example matches enabled
444  @interface Foo
445  @property BOOL enabled;
446  @end
447</pre></td></tr>
448
449
450<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('objcProtocolDecl0')"><a name="objcProtocolDecl0Anchor">objcProtocolDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCProtocolDecl.html">ObjCProtocolDecl</a>&gt;...</td></tr>
451<tr><td colspan="4" class="doc" id="objcProtocolDecl0"><pre>Matches Objective-C protocol declarations.
452
453Example matches FooDelegate
454  @protocol FooDelegate
455  @end
456</pre></td></tr>
457
458
459<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt;...</td></tr>
460<tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations.
461
462Given
463  void f(int x);
464parmVarDecl()
465  matches int x.
466</pre></td></tr>
467
468
469<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1RecordDecl.html">RecordDecl</a>&gt;...</td></tr>
470<tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches class, struct, and union declarations.
471
472Example matches X, Z, U, and S
473  class X;
474  template&lt;class T&gt; class Z {};
475  struct S {};
476  union U {};
477</pre></td></tr>
478
479
480<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1StaticAssertDecl.html">StaticAssertDecl</a>&gt;...</td></tr>
481<tr><td colspan="4" class="doc" id="staticAssertDecl0"><pre>Matches a C++ static_assert declaration.
482
483Example:
484  staticAssertExpr()
485matches
486  static_assert(sizeof(S) == sizeof(int))
487in
488  struct S {
489    int x;
490  };
491  static_assert(sizeof(S) == sizeof(int));
492</pre></td></tr>
493
494
495<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmDecl.html">TemplateTypeParmDecl</a>&gt;...</td></tr>
496<tr><td colspan="4" class="doc" id="templateTypeParmDecl0"><pre>Matches template type parameter declarations.
497
498Given
499  template &lt;typename T, int N&gt; struct C {};
500templateTypeParmDecl()
501  matches 'T', but not 'N'.
502</pre></td></tr>
503
504
505<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TranslationUnitDecl.html">TranslationUnitDecl</a>&gt;...</td></tr>
506<tr><td colspan="4" class="doc" id="translationUnitDecl0"><pre>Matches the top declaration context.
507
508Given
509  int X;
510  namespace NS {
511  int Y;
512  }  // namespace NS
513decl(hasDeclContext(translationUnitDecl()))
514  matches "int X", but not "int Y".
515</pre></td></tr>
516
517
518<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TypeAliasDecl.html">TypeAliasDecl</a>&gt;...</td></tr>
519<tr><td colspan="4" class="doc" id="typeAliasDecl0"><pre>Matches type alias declarations.
520
521Given
522  typedef int X;
523  using Y = int;
524typeAliasDecl()
525  matches "using Y = int", but not "typedef int X"
526</pre></td></tr>
527
528
529<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('typeAliasTemplateDecl0')"><a name="typeAliasTemplateDecl0Anchor">typeAliasTemplateDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeAliasTemplateDecl.html">TypeAliasTemplateDecl</a>&gt;...</td></tr>
530<tr><td colspan="4" class="doc" id="typeAliasTemplateDecl0"><pre>Matches type alias template declarations.
531
532typeAliasTemplateDecl() matches
533  template &lt;typename T&gt;
534  using Y = X&lt;T&gt;;
535</pre></td></tr>
536
537
538<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TypedefDecl.html">TypedefDecl</a>&gt;...</td></tr>
539<tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef declarations.
540
541Given
542  typedef int X;
543  using Y = int;
544typedefDecl()
545  matches "typedef int X", but not "using Y = int"
546</pre></td></tr>
547
548
549<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;...</td></tr>
550<tr><td colspan="4" class="doc" id="typedefNameDecl0"><pre>Matches typedef name declarations.
551
552Given
553  typedef int X;
554  using Y = int;
555typedefNameDecl()
556  matches "typedef int X" and "using Y = int"
557</pre></td></tr>
558
559
560<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingTypenameDecl.html">UnresolvedUsingTypenameDecl</a>&gt;...</td></tr>
561<tr><td colspan="4" class="doc" id="unresolvedUsingTypenameDecl0"><pre>Matches unresolved using value declarations that involve the
562typename.
563
564Given
565  template &lt;typename T&gt;
566  struct Base { typedef T Foo; };
567
568  template&lt;typename T&gt;
569  struct S : private Base&lt;T&gt; {
570    using typename Base&lt;T&gt;::Foo;
571  };
572unresolvedUsingTypenameDecl()
573  matches using Base&lt;T&gt;::Foo </pre></td></tr>
574
575
576<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingValueDecl.html">UnresolvedUsingValueDecl</a>&gt;...</td></tr>
577<tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations.
578
579Given
580  template&lt;typename X&gt;
581  class C : private X {
582    using X::x;
583  };
584unresolvedUsingValueDecl()
585  matches using X::x </pre></td></tr>
586
587
588<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UsingDecl.html">UsingDecl</a>&gt;...</td></tr>
589<tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations.
590
591Given
592  namespace X { int x; }
593  using X::x;
594usingDecl()
595  matches using X::x </pre></td></tr>
596
597
598<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UsingDirectiveDecl.html">UsingDirectiveDecl</a>&gt;...</td></tr>
599<tr><td colspan="4" class="doc" id="usingDirectiveDecl0"><pre>Matches using namespace declarations.
600
601Given
602  namespace X { int x; }
603  using namespace X;
604usingDirectiveDecl()
605  matches using namespace X </pre></td></tr>
606
607
608<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;...</td></tr>
609<tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value declaration.
610
611Example matches A, B, C and F
612  enum X { A, B, C };
613  void F();
614</pre></td></tr>
615
616
617<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;...</td></tr>
618<tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations.
619
620Note: this does not match declarations of member variables, which are
621"field" declarations in Clang parlance.
622
623Example matches a
624  int a;
625</pre></td></tr>
626
627
628<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt;...</td></tr>
629<tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
630</pre></td></tr>
631
632
633<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt;...</td></tr>
634<tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers.
635
636Given
637  namespace ns {
638    struct A { static void f(); };
639    void A::f() {}
640    void g() { A::f(); }
641  }
642  ns::A a;
643nestedNameSpecifier()
644  matches "ns::" and both "A::"
645</pre></td></tr>
646
647
648<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;...</td></tr>
649<tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST.
650</pre></td></tr>
651
652
653<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;...</td></tr>
654<tr><td colspan="4" class="doc" id="addrLabelExpr0"><pre>Matches address of label statements (GNU extension).
655
656Given
657  FOO: bar();
658  void *ptr = &amp;&amp;FOO;
659  goto *bar;
660addrLabelExpr()
661  matches '&amp;&amp;FOO'
662</pre></td></tr>
663
664
665<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>&gt;...</td></tr>
666<tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions.
667
668Given
669  int i = a[1];
670arraySubscriptExpr()
671  matches "a[1]"
672</pre></td></tr>
673
674
675<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1AsmStmt.html">AsmStmt</a>&gt;...</td></tr>
676<tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements.
677
678 int i = 100;
679  __asm("mov al, 2");
680asmStmt()
681  matches '__asm("mov al, 2")'
682</pre></td></tr>
683
684
685<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1AtomicExpr.html">AtomicExpr</a>&gt;...</td></tr>
686<tr><td colspan="4" class="doc" id="atomicExpr0"><pre>Matches atomic builtins.
687Example matches __atomic_load_n(ptr, 1)
688  void foo() { int *ptr; __atomic_load_n(ptr, 1); }
689</pre></td></tr>
690
691
692<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('autoreleasePoolStmt0')"><a name="autoreleasePoolStmt0Anchor">autoreleasePoolStmt</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCAutoreleasePoolStmt.html">ObjCAutoreleasePoolStmt</a>&gt;...</td></tr>
693<tr><td colspan="4" class="doc" id="autoreleasePoolStmt0"><pre>Matches an Objective-C autorelease pool statement.
694
695Given
696  @autoreleasepool {
697    int x = 0;
698  }
699autoreleasePoolStmt(stmt()) matches the declaration of "x"
700inside the autorelease pool.
701</pre></td></tr>
702
703
704<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1BinaryConditionalOperator.html">BinaryConditionalOperator</a>&gt;...</td></tr>
705<tr><td colspan="4" class="doc" id="binaryConditionalOperator0"><pre>Matches binary conditional operator expressions (GNU extension).
706
707Example matches a ?: b
708  (a ?: b) + 42;
709</pre></td></tr>
710
711
712<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;...</td></tr>
713<tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions.
714
715Example matches a || b
716  !(a || b)
717</pre></td></tr>
718
719
720<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('blockExpr0')"><a name="blockExpr0Anchor">blockExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockExpr.html">BlockExpr</a>&gt;...</td></tr>
721<tr><td colspan="4" class="doc" id="blockExpr0"><pre>Matches a reference to a block.
722
723Example: matches "^{}":
724  void f() { ^{}(); }
725</pre></td></tr>
726
727
728<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1BreakStmt.html">BreakStmt</a>&gt;...</td></tr>
729<tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements.
730
731Given
732  while (true) { break; }
733breakStmt()
734  matches 'break'
735</pre></td></tr>
736
737
738<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CStyleCastExpr.html">CStyleCastExpr</a>&gt;...</td></tr>
739<tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression.
740
741Example: Matches (int) 2.2f in
742  int i = (int) 2.2f;
743</pre></td></tr>
744
745
746<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;...</td></tr>
747<tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions.
748
749Example matches x.y() and y()
750  X x;
751  x.y();
752  y();
753</pre></td></tr>
754
755
756<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CaseStmt.html">CaseStmt</a>&gt;...</td></tr>
757<tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements.
758
759Given
760  switch(a) { case 42: break; default: break; }
761caseStmt()
762  matches 'case 42:'.
763</pre></td></tr>
764
765
766<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CastExpr.html">CastExpr</a>&gt;...</td></tr>
767<tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST.
768
769Example: castExpr() matches each of the following:
770  (int) 3;
771  const_cast&lt;Expr *&gt;(SubExpr);
772  char c = 0;
773but does not match
774  int i = (0);
775  int k = 0;
776</pre></td></tr>
777
778
779<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;...</td></tr>
780<tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t).
781
782Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
783though.
784
785Example matches 'a', L'a'
786  char ch = 'a';
787  wchar_t chw = L'a';
788</pre></td></tr>
789
790
791<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;...</td></tr>
792<tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
793
794Example match: {1}, (1, 2)
795  int array[4] = {1};
796  vector int myvec = (vector int)(1, 2);
797</pre></td></tr>
798
799
800<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CompoundStmt.html">CompoundStmt</a>&gt;...</td></tr>
801<tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements.
802
803Example matches '{}' and '{{}}' in 'for (;;) {{}}'
804  for (;;) {{}}
805</pre></td></tr>
806
807
808<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>&gt;...</td></tr>
809<tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions.
810
811Example matches a ? b : c
812  (a ? b : c) + 42
813</pre></td></tr>
814
815
816<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('constantExpr0')"><a name="constantExpr0Anchor">constantExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ConstantExpr.html">ConstantExpr</a>&gt;...</td></tr>
817<tr><td colspan="4" class="doc" id="constantExpr0"><pre>Matches a constant expression wrapper.
818
819Example matches the constant in the case statement:
820    (matcher = constantExpr())
821  switch (a) {
822  case 37: break;
823  }
824</pre></td></tr>
825
826
827<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ContinueStmt.html">ContinueStmt</a>&gt;...</td></tr>
828<tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements.
829
830Given
831  while (true) { continue; }
832continueStmt()
833  matches 'continue'
834</pre></td></tr>
835
836
837<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CUDAKernelCallExpr.html">CUDAKernelCallExpr</a>&gt;...</td></tr>
838<tr><td colspan="4" class="doc" id="cudaKernelCallExpr0"><pre>Matches CUDA kernel call expression.
839
840Example matches,
841  kernel&lt;&lt;&lt;i,j&gt;&gt;&gt;();
842</pre></td></tr>
843
844
845<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXBindTemporaryExpr.html">CXXBindTemporaryExpr</a>&gt;...</td></tr>
846<tr><td colspan="4" class="doc" id="cxxBindTemporaryExpr0"><pre>Matches nodes where temporaries are created.
847
848Example matches FunctionTakesString(GetStringByValue())
849    (matcher = cxxBindTemporaryExpr())
850  FunctionTakesString(GetStringByValue());
851  FunctionTakesStringByPointer(GetStringPointer());
852</pre></td></tr>
853
854
855<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;...</td></tr>
856<tr><td colspan="4" class="doc" id="cxxBoolLiteral0"><pre>Matches bool literals.
857
858Example matches true
859  true
860</pre></td></tr>
861
862
863<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXCatchStmt.html">CXXCatchStmt</a>&gt;...</td></tr>
864<tr><td colspan="4" class="doc" id="cxxCatchStmt0"><pre>Matches catch statements.
865
866  try {} catch(int i) {}
867cxxCatchStmt()
868  matches 'catch(int i)'
869</pre></td></tr>
870
871
872<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXConstCastExpr.html">CXXConstCastExpr</a>&gt;...</td></tr>
873<tr><td colspan="4" class="doc" id="cxxConstCastExpr0"><pre>Matches a const_cast expression.
874
875Example: Matches const_cast&lt;int*&gt;(&amp;r) in
876  int n = 42;
877  const int &amp;r(n);
878  int* p = const_cast&lt;int*&gt;(&amp;r);
879</pre></td></tr>
880
881
882<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;...</td></tr>
883<tr><td colspan="4" class="doc" id="cxxConstructExpr0"><pre>Matches constructor call expressions (including implicit ones).
884
885Example matches string(ptr, n) and ptr within arguments of f
886    (matcher = cxxConstructExpr())
887  void f(const string &amp;a, const string &amp;b);
888  char *ptr;
889  int n;
890  f(string(ptr, n), ptr);
891</pre></td></tr>
892
893
894<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXDefaultArgExpr.html">CXXDefaultArgExpr</a>&gt;...</td></tr>
895<tr><td colspan="4" class="doc" id="cxxDefaultArgExpr0"><pre>Matches the value of a default argument at the call site.
896
897Example matches the CXXDefaultArgExpr placeholder inserted for the
898    default value of the second parameter in the call expression f(42)
899    (matcher = cxxDefaultArgExpr())
900  void f(int x, int y = 0);
901  f(42);
902</pre></td></tr>
903
904
905<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXDeleteExpr.html">CXXDeleteExpr</a>&gt;...</td></tr>
906<tr><td colspan="4" class="doc" id="cxxDeleteExpr0"><pre>Matches delete expressions.
907
908Given
909  delete X;
910cxxDeleteExpr()
911  matches 'delete X'.
912</pre></td></tr>
913
914
915<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxDependentScopeMemberExpr0')"><a name="cxxDependentScopeMemberExpr0Anchor">cxxDependentScopeMemberExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;...</td></tr>
916<tr><td colspan="4" class="doc" id="cxxDependentScopeMemberExpr0"><pre>Matches member expressions where the actual member referenced could not be
917resolved because the base expression or the member name was dependent.
918
919Given
920  template &lt;class T&gt; void f() { T t; t.g(); }
921cxxDependentScopeMemberExpr()
922  matches t.g
923</pre></td></tr>
924
925
926<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXDynamicCastExpr.html">CXXDynamicCastExpr</a>&gt;...</td></tr>
927<tr><td colspan="4" class="doc" id="cxxDynamicCastExpr0"><pre>Matches a dynamic_cast expression.
928
929Example:
930  cxxDynamicCastExpr()
931matches
932  dynamic_cast&lt;D*&gt;(&amp;b);
933in
934  struct B { virtual ~B() {} }; struct D : B {};
935  B b;
936  D* p = dynamic_cast&lt;D*&gt;(&amp;b);
937</pre></td></tr>
938
939
940<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>&gt;...</td></tr>
941<tr><td colspan="4" class="doc" id="cxxForRangeStmt0"><pre>Matches range-based for statements.
942
943cxxForRangeStmt() matches 'for (auto a : i)'
944  int i[] =  {1, 2, 3}; for (auto a : i);
945  for(int j = 0; j &lt; 5; ++j);
946</pre></td></tr>
947
948
949<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;...</td></tr>
950<tr><td colspan="4" class="doc" id="cxxFunctionalCastExpr0"><pre>Matches functional cast expressions
951
952Example: Matches Foo(bar);
953  Foo f = bar;
954  Foo g = (Foo) bar;
955  Foo h = Foo(bar);
956</pre></td></tr>
957
958
959<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>&gt;...</td></tr>
960<tr><td colspan="4" class="doc" id="cxxMemberCallExpr0"><pre>Matches member call expressions.
961
962Example matches x.y()
963  X x;
964  x.y();
965</pre></td></tr>
966
967
968<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;...</td></tr>
969<tr><td colspan="4" class="doc" id="cxxNewExpr0"><pre>Matches new expressions.
970
971Given
972  new X;
973cxxNewExpr()
974  matches 'new X'.
975</pre></td></tr>
976
977
978<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXNullPtrLiteralExpr.html">CXXNullPtrLiteralExpr</a>&gt;...</td></tr>
979<tr><td colspan="4" class="doc" id="cxxNullPtrLiteralExpr0"><pre>Matches nullptr literal.
980</pre></td></tr>
981
982
983<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;...</td></tr>
984<tr><td colspan="4" class="doc" id="cxxOperatorCallExpr0"><pre>Matches overloaded operator calls.
985
986Note that if an operator isn't overloaded, it won't match. Instead, use
987binaryOperator matcher.
988Currently it does not match operators such as new delete.
989FIXME: figure out why these do not match?
990
991Example matches both operator&lt;&lt;((o &lt;&lt; b), c) and operator&lt;&lt;(o, b)
992    (matcher = cxxOperatorCallExpr())
993  ostream &amp;operator&lt;&lt; (ostream &amp;out, int i) { };
994  ostream &amp;o; int b = 1, c = 1;
995  o &lt;&lt; b &lt;&lt; c;
996</pre></td></tr>
997
998
999<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXReinterpretCastExpr.html">CXXReinterpretCastExpr</a>&gt;...</td></tr>
1000<tr><td colspan="4" class="doc" id="cxxReinterpretCastExpr0"><pre>Matches a reinterpret_cast expression.
1001
1002Either the source expression or the destination type can be matched
1003using has(), but hasDestinationType() is more specific and can be
1004more readable.
1005
1006Example matches reinterpret_cast&lt;char*&gt;(&amp;p) in
1007  void* p = reinterpret_cast&lt;char*&gt;(&amp;p);
1008</pre></td></tr>
1009
1010
1011<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXStaticCastExpr.html">CXXStaticCastExpr</a>&gt;...</td></tr>
1012<tr><td colspan="4" class="doc" id="cxxStaticCastExpr0"><pre>Matches a C++ static_cast expression.
1013
1014See also: hasDestinationType
1015See also: reinterpretCast
1016
1017Example:
1018  cxxStaticCastExpr()
1019matches
1020  static_cast&lt;long&gt;(8)
1021in
1022  long eight(static_cast&lt;long&gt;(8));
1023</pre></td></tr>
1024
1025
1026<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxStdInitializerListExpr0')"><a name="cxxStdInitializerListExpr0Anchor">cxxStdInitializerListExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXStdInitializerListExpr.html">CXXStdInitializerListExpr</a>&gt;...</td></tr>
1027<tr><td colspan="4" class="doc" id="cxxStdInitializerListExpr0"><pre>Matches C++ initializer list expressions.
1028
1029Given
1030  std::vector&lt;int&gt; a({ 1, 2, 3 });
1031  std::vector&lt;int&gt; b = { 4, 5 };
1032  int c[] = { 6, 7 };
1033  std::pair&lt;int, int&gt; d = { 8, 9 };
1034cxxStdInitializerListExpr()
1035  matches "{ 1, 2, 3 }" and "{ 4, 5 }"
1036</pre></td></tr>
1037
1038
1039<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;...</td></tr>
1040<tr><td colspan="4" class="doc" id="cxxTemporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments
1041
1042Example: Matches Foo(bar, bar)
1043  Foo h = Foo(bar, bar);
1044</pre></td></tr>
1045
1046
1047<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXThisExpr.html">CXXThisExpr</a>&gt;...</td></tr>
1048<tr><td colspan="4" class="doc" id="cxxThisExpr0"><pre>Matches implicit and explicit this expressions.
1049
1050Example matches the implicit this expression in "return i".
1051    (matcher = cxxThisExpr())
1052struct foo {
1053  int i;
1054  int f() { return i; }
1055};
1056</pre></td></tr>
1057
1058
1059<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXThrowExpr.html">CXXThrowExpr</a>&gt;...</td></tr>
1060<tr><td colspan="4" class="doc" id="cxxThrowExpr0"><pre>Matches throw expressions.
1061
1062  try { throw 5; } catch(int i) {}
1063cxxThrowExpr()
1064  matches 'throw 5'
1065</pre></td></tr>
1066
1067
1068<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXTryStmt.html">CXXTryStmt</a>&gt;...</td></tr>
1069<tr><td colspan="4" class="doc" id="cxxTryStmt0"><pre>Matches try statements.
1070
1071  try {} catch(int i) {}
1072cxxTryStmt()
1073  matches 'try {}'
1074</pre></td></tr>
1075
1076
1077<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;...</td></tr>
1078<tr><td colspan="4" class="doc" id="cxxUnresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions.
1079
1080Example matches T(t) in return statement of f
1081    (matcher = cxxUnresolvedConstructExpr())
1082  template &lt;typename T&gt;
1083  void f(const T&amp; t) { return T(t); }
1084</pre></td></tr>
1085
1086
1087<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;...</td></tr>
1088<tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations.
1089
1090Example matches x in if (x)
1091  bool x;
1092  if (x) {}
1093</pre></td></tr>
1094
1095
1096<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>&gt;...</td></tr>
1097<tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements.
1098
1099Given
1100  int a;
1101declStmt()
1102  matches 'int a'.
1103</pre></td></tr>
1104
1105
1106<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1DefaultStmt.html">DefaultStmt</a>&gt;...</td></tr>
1107<tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements.
1108
1109Given
1110  switch(a) { case 42: break; default: break; }
1111defaultStmt()
1112  matches 'default:'.
1113</pre></td></tr>
1114
1115
1116<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1DesignatedInitExpr.html">DesignatedInitExpr</a>&gt;...</td></tr>
1117<tr><td colspan="4" class="doc" id="designatedInitExpr0"><pre>Matches C99 designated initializer expressions [C99 6.7.8].
1118
1119Example: Matches { [2].y = 1.0, [0].x = 1.0 }
1120  point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
1121</pre></td></tr>
1122
1123
1124<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1DoStmt.html">DoStmt</a>&gt;...</td></tr>
1125<tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements.
1126
1127Given
1128  do {} while (true);
1129doStmt()
1130  matches 'do {} while(true)'
1131</pre></td></tr>
1132
1133
1134<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;...</td></tr>
1135<tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions.
1136
1137Matches any cast expression written in user code, whether it be a
1138C-style cast, a functional-style cast, or a keyword cast.
1139
1140Does not match implicit conversions.
1141
1142Note: the name "explicitCast" is chosen to match Clang's terminology, as
1143Clang uses the term "cast" to apply to implicit conversions as well as to
1144actual cast expressions.
1145
1146See also: hasDestinationType.
1147
1148Example: matches all five of the casts in
1149  int((int)(reinterpret_cast&lt;int&gt;(static_cast&lt;int&gt;(const_cast&lt;int&gt;(42)))))
1150but does not match the implicit conversion in
1151  long ell = 42;
1152</pre></td></tr>
1153
1154
1155<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;...</td></tr>
1156<tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions.
1157
1158Example matches x()
1159  void f() { x(); }
1160</pre></td></tr>
1161
1162
1163<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ExprWithCleanups.html">ExprWithCleanups</a>&gt;...</td></tr>
1164<tr><td colspan="4" class="doc" id="exprWithCleanups0"><pre>Matches expressions that introduce cleanups to be run at the end
1165of the sub-expression's evaluation.
1166
1167Example matches std::string()
1168  const std::string str = std::string();
1169</pre></td></tr>
1170
1171
1172<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;...</td></tr>
1173<tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes / encodings, e.g.
11741.0, 1.0f, 1.0L and 1e10.
1175
1176Does not match implicit conversions such as
1177  float a = 10;
1178</pre></td></tr>
1179
1180
1181<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>&gt;...</td></tr>
1182<tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements.
1183
1184Example matches 'for (;;) {}'
1185  for (;;) {}
1186  int i[] =  {1, 2, 3}; for (auto a : i);
1187</pre></td></tr>
1188
1189
1190<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1GNUNullExpr.html">GNUNullExpr</a>&gt;...</td></tr>
1191<tr><td colspan="4" class="doc" id="gnuNullExpr0"><pre>Matches GNU __null expression.
1192</pre></td></tr>
1193
1194
1195<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1GotoStmt.html">GotoStmt</a>&gt;...</td></tr>
1196<tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements.
1197
1198Given
1199  goto FOO;
1200  FOO: bar();
1201gotoStmt()
1202  matches 'goto FOO'
1203</pre></td></tr>
1204
1205
1206<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;...</td></tr>
1207<tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements.
1208
1209Example matches 'if (x) {}'
1210  if (x) {}
1211</pre></td></tr>
1212
1213
1214<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('imaginaryLiteral0')"><a name="imaginaryLiteral0Anchor">imaginaryLiteral</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ImaginaryLiteral.html">ImaginaryLiteral</a>&gt;...</td></tr>
1215<tr><td colspan="4" class="doc" id="imaginaryLiteral0"><pre>Matches imaginary literals, which are based on integer and floating
1216point literals e.g.: 1i, 1.0i
1217</pre></td></tr>
1218
1219
1220<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ImplicitCastExpr.html">ImplicitCastExpr</a>&gt;...</td></tr>
1221<tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST.
1222
1223This matches many different places, including function call return value
1224eliding, as well as any type conversions.
1225</pre></td></tr>
1226
1227
1228<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ImplicitValueInitExpr.html">ImplicitValueInitExpr</a>&gt;...</td></tr>
1229<tr><td colspan="4" class="doc" id="implicitValueInitExpr0"><pre>Matches implicit initializers of init list expressions.
1230
1231Given
1232  point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
1233implicitValueInitExpr()
1234  matches "[0].y" (implicitly)
1235</pre></td></tr>
1236
1237
1238<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1InitListExpr.html">InitListExpr</a>&gt;...</td></tr>
1239<tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions.
1240
1241Given
1242  int a[] = { 1, 2 };
1243  struct B { int x, y; };
1244  B b = { 5, 6 };
1245initListExpr()
1246  matches "{ 1, 2 }" and "{ 5, 6 }"
1247</pre></td></tr>
1248
1249
1250<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;...</td></tr>
1251<tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes / encodings, e.g.
12521, 1L, 0x1 and 1U.
1253
1254Does not match character-encoded integers such as L'a'.
1255</pre></td></tr>
1256
1257
1258<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;...</td></tr>
1259<tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements.
1260
1261Given
1262  goto FOO;
1263  FOO: bar();
1264labelStmt()
1265  matches 'FOO:'
1266</pre></td></tr>
1267
1268
1269<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1LambdaExpr.html">LambdaExpr</a>&gt;...</td></tr>
1270<tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions.
1271
1272Example matches [&amp;](){return 5;}
1273  [&amp;](){return 5;}
1274</pre></td></tr>
1275
1276
1277<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1MaterializeTemporaryExpr.html">MaterializeTemporaryExpr</a>&gt;...</td></tr>
1278<tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized.
1279
1280Example: Given
1281  struct T {void func();};
1282  T f();
1283  void g(T);
1284materializeTemporaryExpr() matches 'f()' in these statements
1285  T u(f());
1286  g(f());
1287  f().func();
1288but does not match
1289  f();
1290</pre></td></tr>
1291
1292
1293<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;...</td></tr>
1294<tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions.
1295
1296Given
1297  class Y {
1298    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
1299    int a; static int b;
1300  };
1301memberExpr()
1302  matches this-&gt;x, x, y.x, a, this-&gt;b
1303</pre></td></tr>
1304
1305
1306<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NullStmt.html">NullStmt</a>&gt;...</td></tr>
1307<tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements.
1308
1309  foo();;
1310nullStmt()
1311  matches the second ';'
1312</pre></td></tr>
1313
1314
1315<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcCatchStmt0')"><a name="objcCatchStmt0Anchor">objcCatchStmt</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCAtCatchStmt.html">ObjCAtCatchStmt</a>&gt;...</td></tr>
1316<tr><td colspan="4" class="doc" id="objcCatchStmt0"><pre>Matches Objective-C @catch statements.
1317
1318Example matches @catch
1319  @try {}
1320  @catch (...) {}
1321</pre></td></tr>
1322
1323
1324<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcFinallyStmt0')"><a name="objcFinallyStmt0Anchor">objcFinallyStmt</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCAtFinallyStmt.html">ObjCAtFinallyStmt</a>&gt;...</td></tr>
1325<tr><td colspan="4" class="doc" id="objcFinallyStmt0"><pre>Matches Objective-C @finally statements.
1326
1327Example matches @finally
1328  @try {}
1329  @finally {}
1330</pre></td></tr>
1331
1332
1333<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcIvarRefExpr0')"><a name="objcIvarRefExpr0Anchor">objcIvarRefExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCIvarRefExpr.html">ObjCIvarRefExpr</a>&gt;...</td></tr>
1334<tr><td colspan="4" class="doc" id="objcIvarRefExpr0"><pre>Matches a reference to an ObjCIvar.
1335
1336Example: matches "a" in "init" method:
1337@implementation A {
1338  NSString *a;
1339}
1340- (void) init {
1341  a = @"hello";
1342}
1343</pre></td></tr>
1344
1345
1346<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;...</td></tr>
1347<tr><td colspan="4" class="doc" id="objcMessageExpr0"><pre>Matches ObjectiveC Message invocation expressions.
1348
1349The innermost message send invokes the "alloc" class method on the
1350NSString class, while the outermost message send invokes the
1351"initWithString" instance method on the object returned from
1352NSString's "alloc". This matcher should match both message sends.
1353  [[NSString alloc] initWithString:@"Hello"]
1354</pre></td></tr>
1355
1356
1357<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcThrowStmt0')"><a name="objcThrowStmt0Anchor">objcThrowStmt</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCAtThrowStmt.html">ObjCAtThrowStmt</a>&gt;...</td></tr>
1358<tr><td colspan="4" class="doc" id="objcThrowStmt0"><pre>Matches Objective-C statements.
1359
1360Example matches @throw obj;
1361</pre></td></tr>
1362
1363
1364<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcTryStmt0')"><a name="objcTryStmt0Anchor">objcTryStmt</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCAtTryStmt.html">ObjCAtTryStmt</a>&gt;...</td></tr>
1365<tr><td colspan="4" class="doc" id="objcTryStmt0"><pre>Matches Objective-C @try statements.
1366
1367Example matches @try
1368  @try {}
1369  @catch (...) {}
1370</pre></td></tr>
1371
1372
1373<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1OpaqueValueExpr.html">OpaqueValueExpr</a>&gt;...</td></tr>
1374<tr><td colspan="4" class="doc" id="opaqueValueExpr0"><pre>Matches opaque value expressions. They are used as helpers
1375to reference another expressions and can be met
1376in BinaryConditionalOperators, for example.
1377
1378Example matches 'a'
1379  (a ?: c) + 42;
1380</pre></td></tr>
1381
1382
1383<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ParenExpr.html">ParenExpr</a>&gt;...</td></tr>
1384<tr><td colspan="4" class="doc" id="parenExpr0"><pre>Matches parentheses used in expressions.
1385
1386Example matches (foo() + 1)
1387  int foo() { return 1; }
1388  int a = (foo() + 1);
1389</pre></td></tr>
1390
1391
1392<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ParenListExpr.html">ParenListExpr</a>&gt;...</td></tr>
1393<tr><td colspan="4" class="doc" id="parenListExpr0"><pre>Matches paren list expressions.
1394ParenListExprs don't have a predefined type and are used for late parsing.
1395In the final AST, they can be met in template declarations.
1396
1397Given
1398  template&lt;typename T&gt; class X {
1399    void f() {
1400      X x(*this);
1401      int a = 0, b = 1; int i = (a, b);
1402    }
1403  };
1404parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
1405has a predefined type and is a ParenExpr, not a ParenListExpr.
1406</pre></td></tr>
1407
1408
1409<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1PredefinedExpr.html">PredefinedExpr</a>&gt;...</td></tr>
1410<tr><td colspan="4" class="doc" id="predefinedExpr0"><pre>Matches predefined identifier expressions [C99 6.4.2.2].
1411
1412Example: Matches __func__
1413  printf("%s", __func__);
1414</pre></td></tr>
1415
1416
1417<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ReturnStmt.html">ReturnStmt</a>&gt;...</td></tr>
1418<tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements.
1419
1420Given
1421  return 1;
1422returnStmt()
1423  matches 'return 1'
1424</pre></td></tr>
1425
1426
1427<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;...</td></tr>
1428<tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements.
1429
1430Given
1431  { ++a; }
1432stmt()
1433  matches both the compound statement '{ ++a; }' and '++a'.
1434</pre></td></tr>
1435
1436
1437<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1StmtExpr.html">StmtExpr</a>&gt;...</td></tr>
1438<tr><td colspan="4" class="doc" id="stmtExpr0"><pre>Matches statement expression (GNU extension).
1439
1440Example match: ({ int X = 4; X; })
1441  int C = ({ int X = 4; X; });
1442</pre></td></tr>
1443
1444
1445<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1StringLiteral.html">StringLiteral</a>&gt;...</td></tr>
1446<tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
1447
1448Example matches "abcd", L"abcd"
1449  char *s = "abcd";
1450  wchar_t *ws = L"abcd";
1451</pre></td></tr>
1452
1453
1454<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1SubstNonTypeTemplateParmExpr.html">SubstNonTypeTemplateParmExpr</a>&gt;...</td></tr>
1455<tr><td colspan="4" class="doc" id="substNonTypeTemplateParmExpr0"><pre>Matches substitutions of non-type template parameters.
1456
1457Given
1458  template &lt;int N&gt;
1459  struct A { static const int n = N; };
1460  struct B : public A&lt;42&gt; {};
1461substNonTypeTemplateParmExpr()
1462  matches "N" in the right-hand side of "static const int n = N;"
1463</pre></td></tr>
1464
1465
1466<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1SwitchCase.html">SwitchCase</a>&gt;...</td></tr>
1467<tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements.
1468
1469Given
1470  switch(a) { case 42: break; default: break; }
1471switchCase()
1472  matches 'case 42:' and 'default:'.
1473</pre></td></tr>
1474
1475
1476<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1SwitchStmt.html">SwitchStmt</a>&gt;...</td></tr>
1477<tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements.
1478
1479Given
1480  switch(a) { case 42: break; default: break; }
1481switchStmt()
1482  matches 'switch(a)'.
1483</pre></td></tr>
1484
1485
1486<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;...</td></tr>
1487<tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
1488
1489Given
1490  Foo x = bar;
1491  int y = sizeof(x) + alignof(x);
1492unaryExprOrTypeTraitExpr()
1493  matches sizeof(x) and alignof(x)
1494</pre></td></tr>
1495
1496
1497<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;...</td></tr>
1498<tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions.
1499
1500Example matches !a
1501  !a || b
1502</pre></td></tr>
1503
1504
1505<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedLookupExpr.html">UnresolvedLookupExpr</a>&gt;...</td></tr>
1506<tr><td colspan="4" class="doc" id="unresolvedLookupExpr0"><pre>Matches reference to a name that can be looked up during parsing
1507but could not be resolved to a specific declaration.
1508
1509Given
1510  template&lt;typename T&gt;
1511  T foo() { T a; return a; }
1512  template&lt;typename T&gt;
1513  void bar() {
1514    foo&lt;T&gt;();
1515  }
1516unresolvedLookupExpr()
1517  matches foo&lt;T&gt;() </pre></td></tr>
1518
1519
1520<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('unresolvedMemberExpr0')"><a name="unresolvedMemberExpr0Anchor">unresolvedMemberExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedMemberExpr.html">UnresolvedMemberExpr</a>&gt;...</td></tr>
1521<tr><td colspan="4" class="doc" id="unresolvedMemberExpr0"><pre>Matches unresolved member expressions.
1522
1523Given
1524  struct X {
1525    template &lt;class T&gt; void f();
1526    void g();
1527  };
1528  template &lt;class T&gt; void h() { X x; x.f&lt;T&gt;(); x.g(); }
1529unresolvedMemberExpr()
1530  matches x.f&lt;T&gt;
1531</pre></td></tr>
1532
1533
1534<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UserDefinedLiteral.html">UserDefinedLiteral</a>&gt;...</td></tr>
1535<tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call.
1536
1537Example match: "foo"_suffix
1538</pre></td></tr>
1539
1540
1541<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1WhileStmt.html">WhileStmt</a>&gt;...</td></tr>
1542<tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements.
1543
1544Given
1545  while (true) {}
1546whileStmt()
1547  matches 'while (true) {}'.
1548</pre></td></tr>
1549
1550
1551<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;...</td></tr>
1552<tr><td colspan="4" class="doc" id="templateArgument0"><pre>Matches template arguments.
1553
1554Given
1555  template &lt;typename T&gt; struct C {};
1556  C&lt;int&gt; c;
1557templateArgument()
1558  matches 'int' in C&lt;int&gt;.
1559</pre></td></tr>
1560
1561
1562<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateName.html">TemplateName</a>&gt;</td><td class="name" onclick="toggle('templateName0')"><a name="templateName0Anchor">templateName</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateName.html">TemplateName</a>&gt;...</td></tr>
1563<tr><td colspan="4" class="doc" id="templateName0"><pre>Matches template name.
1564
1565Given
1566  template &lt;typename T&gt; class X { };
1567  X&lt;int&gt; xi;
1568templateName()
1569  matches 'X' in X&lt;int&gt;.
1570</pre></td></tr>
1571
1572
1573<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;...</td></tr>
1574<tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST.
1575</pre></td></tr>
1576
1577
1578<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;...</td></tr>
1579<tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays.
1580
1581Given
1582  int a[] = { 2, 3 };
1583  int b[4];
1584  void f() { int c[a[0]]; }
1585arrayType()
1586  matches "int a[]", "int b[4]" and "int c[a[0]]";
1587</pre></td></tr>
1588
1589
1590<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;...</td></tr>
1591<tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types.
1592
1593Given
1594  _Atomic(int) i;
1595atomicType()
1596  matches "_Atomic(int) i"
1597</pre></td></tr>
1598
1599
1600<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;...</td></tr>
1601<tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types.
1602
1603Given:
1604  auto n = 4;
1605  int v[] = { 2, 3 }
1606  for (auto i : v) { }
1607autoType()
1608  matches "auto n" and "auto i"
1609</pre></td></tr>
1610
1611
1612<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;...</td></tr>
1613<tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as
1614"void (^)(int)".
1615
1616The pointee is always required to be a FunctionType.
1617</pre></td></tr>
1618
1619
1620<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1BuiltinType.html">BuiltinType</a>&gt;...</td></tr>
1621<tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types.
1622
1623Given
1624  struct A {};
1625  A a;
1626  int b;
1627  float c;
1628  bool d;
1629builtinType()
1630  matches "int b", "float c" and "bool d"
1631</pre></td></tr>
1632
1633
1634<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;...</td></tr>
1635<tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types.
1636
1637Given
1638  _Complex float f;
1639complexType()
1640  matches "_Complex float f"
1641</pre></td></tr>
1642
1643
1644<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ConstantArrayType.html">ConstantArrayType</a>&gt;...</td></tr>
1645<tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size.
1646
1647Given
1648  void() {
1649    int a[2];
1650    int b[] = { 2, 3 };
1651    int c[b[0]];
1652  }
1653constantArrayType()
1654  matches "int a[2]"
1655</pre></td></tr>
1656
1657
1658<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1DecayedType.html">DecayedType</a>&gt;...</td></tr>
1659<tr><td colspan="4" class="doc" id="decayedType0"><pre>Matches decayed type
1660Example matches i[] in declaration of f.
1661    (matcher = valueDecl(hasType(decayedType(hasDecayedType(pointerType())))))
1662Example matches i[1].
1663    (matcher = expr(hasType(decayedType(hasDecayedType(pointerType())))))
1664  void f(int i[]) {
1665    i[1] = 0;
1666  }
1667</pre></td></tr>
1668
1669
1670<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('decltypeType0')"><a name="decltypeType0Anchor">decltypeType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;...</td></tr>
1671<tr><td colspan="4" class="doc" id="decltypeType0"><pre>Matches types nodes representing C++11 decltype(&lt;expr&gt;) types.
1672
1673Given:
1674  short i = 1;
1675  int j = 42;
1676  decltype(i + j) result = i + j;
1677decltypeType()
1678  matches "decltype(i + j)"
1679</pre></td></tr>
1680
1681
1682<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1DependentSizedArrayType.html">DependentSizedArrayType</a>&gt;...</td></tr>
1683<tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression.
1684
1685Given
1686  template&lt;typename T, int Size&gt;
1687  class array {
1688    T data[Size];
1689  };
1690dependentSizedArrayType
1691  matches "T data[Size]"
1692</pre></td></tr>
1693
1694
1695<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ElaboratedType.html">ElaboratedType</a>&gt;...</td></tr>
1696<tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a
1697qualified name.
1698
1699Given
1700  namespace N {
1701    namespace M {
1702      class D {};
1703    }
1704  }
1705  class C {};
1706
1707  class C c;
1708  N::M::D d;
1709
1710elaboratedType() matches the type of the variable declarations of both
1711c and d.
1712</pre></td></tr>
1713
1714
1715<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;...</td></tr>
1716<tr><td colspan="4" class="doc" id="enumType0"><pre>Matches enum types.
1717
1718Given
1719  enum C { Green };
1720  enum class S { Red };
1721
1722  C c;
1723  S s;
1724
1725enumType() matches the type of the variable declarations of both c and
1726s.
1727</pre></td></tr>
1728
1729
1730<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1FunctionProtoType.html">FunctionProtoType</a>&gt;...</td></tr>
1731<tr><td colspan="4" class="doc" id="functionProtoType0"><pre>Matches FunctionProtoType nodes.
1732
1733Given
1734  int (*f)(int);
1735  void g();
1736functionProtoType()
1737  matches "int (*f)(int)" and the type of "g" in C++ mode.
1738  In C mode, "g" is not matched because it does not contain a prototype.
1739</pre></td></tr>
1740
1741
1742<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1FunctionType.html">FunctionType</a>&gt;...</td></tr>
1743<tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes.
1744
1745Given
1746  int (*f)(int);
1747  void g();
1748functionType()
1749  matches "int (*f)(int)" and the type of "g".
1750</pre></td></tr>
1751
1752
1753<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1IncompleteArrayType.html">IncompleteArrayType</a>&gt;...</td></tr>
1754<tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size.
1755
1756Given
1757  int a[] = { 2, 3 };
1758  int b[42];
1759  void f(int c[]) { int d[a[0]]; };
1760incompleteArrayType()
1761  matches "int a[]" and "int c[]"
1762</pre></td></tr>
1763
1764
1765<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;...</td></tr>
1766<tr><td colspan="4" class="doc" id="injectedClassNameType0"><pre>Matches injected class name types.
1767
1768Example matches S s, but not S&lt;T&gt; s.
1769    (matcher = parmVarDecl(hasType(injectedClassNameType())))
1770  template &lt;typename T&gt; struct S {
1771    void f(S s);
1772    void g(S&lt;T&gt; s);
1773  };
1774</pre></td></tr>
1775
1776
1777<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1LValueReferenceType.html">LValueReferenceType</a>&gt;...</td></tr>
1778<tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types.
1779
1780Given:
1781  int *a;
1782  int &amp;b = *a;
1783  int &amp;&amp;c = 1;
1784  auto &amp;d = b;
1785  auto &amp;&amp;e = c;
1786  auto &amp;&amp;f = 2;
1787  int g = 5;
1788
1789lValueReferenceType() matches the types of b, d, and e. e is
1790matched since the type is deduced as int&amp; by reference collapsing rules.
1791</pre></td></tr>
1792
1793
1794<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;...</td></tr>
1795<tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types.
1796Given
1797  struct A { int i; }
1798  A::* ptr = A::i;
1799memberPointerType()
1800  matches "A::* ptr"
1801</pre></td></tr>
1802
1803
1804<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ObjCObjectPointerType.html">ObjCObjectPointerType</a>&gt;...</td></tr>
1805<tr><td colspan="4" class="doc" id="objcObjectPointerType0"><pre>Matches an Objective-C object pointer type, which is different from
1806a pointer type, despite being syntactically similar.
1807
1808Given
1809  int *a;
1810
1811  @interface Foo
1812  @end
1813  Foo *f;
1814pointerType()
1815  matches "Foo *f", but does not match "int *a".
1816</pre></td></tr>
1817
1818
1819<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;...</td></tr>
1820<tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes.
1821
1822Given
1823  int (*ptr_to_array)[4];
1824  int *array_of_ptrs[4];
1825
1826varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
1827array_of_ptrs.
1828</pre></td></tr>
1829
1830
1831<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;...</td></tr>
1832<tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types, but does not match Objective-C object pointer
1833types.
1834
1835Given
1836  int *a;
1837  int &amp;b = *a;
1838  int c = 5;
1839
1840  @interface Foo
1841  @end
1842  Foo *f;
1843pointerType()
1844  matches "int *a", but does not match "Foo *f".
1845</pre></td></tr>
1846
1847
1848<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1RValueReferenceType.html">RValueReferenceType</a>&gt;...</td></tr>
1849<tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types.
1850
1851Given:
1852  int *a;
1853  int &amp;b = *a;
1854  int &amp;&amp;c = 1;
1855  auto &amp;d = b;
1856  auto &amp;&amp;e = c;
1857  auto &amp;&amp;f = 2;
1858  int g = 5;
1859
1860rValueReferenceType() matches the types of c and f. e is not
1861matched as it is deduced to int&amp; by reference collapsing rules.
1862</pre></td></tr>
1863
1864
1865<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;...</td></tr>
1866<tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes).
1867
1868Given
1869  class C {};
1870  struct S {};
1871
1872  C c;
1873  S s;
1874
1875recordType() matches the type of the variable declarations of both c
1876and s.
1877</pre></td></tr>
1878
1879
1880<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;...</td></tr>
1881<tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types.
1882
1883Given
1884  int *a;
1885  int &amp;b = *a;
1886  int &amp;&amp;c = 1;
1887  auto &amp;d = b;
1888  auto &amp;&amp;e = c;
1889  auto &amp;&amp;f = 2;
1890  int g = 5;
1891
1892referenceType() matches the types of b, c, d, e, and f.
1893</pre></td></tr>
1894
1895
1896<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1SubstTemplateTypeParmType.html">SubstTemplateTypeParmType</a>&gt;...</td></tr>
1897<tr><td colspan="4" class="doc" id="substTemplateTypeParmType0"><pre>Matches types that represent the result of substituting a type for a
1898template type parameter.
1899
1900Given
1901  template &lt;typename T&gt;
1902  void F(T t) {
1903    int i = 1 + t;
1904  }
1905
1906substTemplateTypeParmType() matches the type of 't' but not '1'
1907</pre></td></tr>
1908
1909
1910<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('tagType0')"><a name="tagType0Anchor">tagType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;...</td></tr>
1911<tr><td colspan="4" class="doc" id="tagType0"><pre>Matches tag types (record and enum types).
1912
1913Given
1914  enum E {};
1915  class C {};
1916
1917  E e;
1918  C c;
1919
1920tagType() matches the type of the variable declarations of both e
1921and c.
1922</pre></td></tr>
1923
1924
1925<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;...</td></tr>
1926<tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types.
1927
1928Given
1929  template &lt;typename T&gt;
1930  class C { };
1931
1932  template class C&lt;int&gt;;  // A
1933  C&lt;char&gt; var;            // B
1934
1935templateSpecializationType() matches the type of the explicit
1936instantiation in A and the type of the variable declaration in B.
1937</pre></td></tr>
1938
1939
1940<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;...</td></tr>
1941<tr><td colspan="4" class="doc" id="templateTypeParmType0"><pre>Matches template type parameter types.
1942
1943Example matches T, but not int.
1944    (matcher = templateTypeParmType())
1945  template &lt;typename T&gt; void f(int i);
1946</pre></td></tr>
1947
1948
1949<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;...</td></tr>
1950<tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST.
1951</pre></td></tr>
1952
1953
1954<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;...</td></tr>
1955<tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types.
1956
1957Given
1958  typedef int X;
1959typedefType()
1960  matches "typedef int X"
1961</pre></td></tr>
1962
1963
1964<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UnaryTransformType.html">UnaryTransformType</a>&gt;...</td></tr>
1965<tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations.
1966
1967Given:
1968  typedef __underlying_type(T) type;
1969unaryTransformType()
1970  matches "__underlying_type(T)"
1971</pre></td></tr>
1972
1973
1974<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1VariableArrayType.html">VariableArrayType</a>&gt;...</td></tr>
1975<tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an
1976integer-constant-expression.
1977
1978Given
1979  void f() {
1980    int a[] = { 2, 3 }
1981    int b[42];
1982    int c[a[0]];
1983  }
1984variableArrayType()
1985  matches "int c[a[0]]"
1986</pre></td></tr>
1987
1988<!--END_DECL_MATCHERS -->
1989</table>
1990
1991<!-- ======================================================================= -->
1992<h2 id="narrowing-matchers">Narrowing Matchers</h2>
1993<!-- ======================================================================= -->
1994
1995<p>Narrowing matchers match certain attributes on the current node, thus
1996narrowing down the set of nodes of the current type to match on.</p>
1997
1998<p>There are special logical narrowing matchers (allOf, anyOf, anything and unless)
1999which allow users to create more powerful match expressions.</p>
2000
2001<table>
2002<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
2003<!-- START_NARROWING_MATCHERS -->
2004
2005<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>
2006<tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match.
2007
2008Usable as: Any Matcher
2009</pre></td></tr>
2010
2011
2012<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>
2013<tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches.
2014
2015Usable as: Any Matcher
2016</pre></td></tr>
2017
2018
2019<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr>
2020<tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node.
2021
2022Useful when another matcher requires a child matcher, but there's no
2023additional constraint. This will often be used with an explicit conversion
2024to an internal::Matcher&lt;&gt; type such as TypeMatcher.
2025
2026Example: DeclarationMatcher(anything()) matches all declarations, e.g.,
2027"int* p" and "void f()" in
2028  int* p;
2029  void f();
2030
2031Usable as: Any Matcher
2032</pre></td></tr>
2033
2034
2035<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher&lt;*&gt;</td></tr>
2036<tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match.
2037
2038Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
2039  class X {};
2040  class Y {};
2041
2042Usable as: Any Matcher
2043</pre></td></tr>
2044
2045
2046<tr><td>Matcher&lt;<a href="https://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>
2047<tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions (binary or
2048unary).
2049
2050Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
2051  !(a || b)
2052</pre></td></tr>
2053
2054
2055<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('isAssignmentOperator0')"><a name="isAssignmentOperator0Anchor">isAssignmentOperator</a></td><td></td></tr>
2056<tr><td colspan="4" class="doc" id="isAssignmentOperator0"><pre>Matches all kinds of assignment operators.
2057
2058Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2059  if (a == b)
2060    a += b;
2061
2062Example 2: matches s1 = s2
2063           (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
2064  struct S { S&amp; operator=(const S&amp;); };
2065  void x() { S s1, s2; s1 = s2; })
2066</pre></td></tr>
2067
2068
2069<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;</td><td class="name" onclick="toggle('equals5')"><a name="equals5Anchor">equals</a></td><td>bool Value</td></tr>
2070<tr><td colspan="4" class="doc" id="equals5"><pre></pre></td></tr>
2071
2072
2073<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;</td><td class="name" onclick="toggle('equals2')"><a name="equals2Anchor">equals</a></td><td>const ValueT  Value</td></tr>
2074<tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value of type ValueT.
2075
2076Given
2077  f('false, 3.14, 42);
2078characterLiteral(equals(0))
2079  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2080  match false
2081floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2082  match 3.14
2083integerLiteral(equals(42))
2084  matches 42
2085
2086Note that you cannot directly match a negative numeric literal because the
2087minus sign is not part of the literal: It is a unary operator whose operand
2088is the positive numeric literal. Instead, you must use a unaryOperator()
2089matcher to match the minus sign:
2090
2091unaryOperator(hasOperatorName("-"),
2092              hasUnaryOperand(integerLiteral(equals(13))))
2093
2094Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;,
2095           Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
2096</pre></td></tr>
2097
2098
2099<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;</td><td class="name" onclick="toggle('equals11')"><a name="equals11Anchor">equals</a></td><td>double Value</td></tr>
2100<tr><td colspan="4" class="doc" id="equals11"><pre></pre></td></tr>
2101
2102
2103<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;</td><td class="name" onclick="toggle('equals8')"><a name="equals8Anchor">equals</a></td><td>unsigned Value</td></tr>
2104<tr><td colspan="4" class="doc" id="equals8"><pre></pre></td></tr>
2105
2106
2107<tr><td>Matcher&lt;<a href="https://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>
2108<tr><td colspan="4" class="doc" id="isCatchAll0"><pre>Matches a C++ catch statement that has a catch-all handler.
2109
2110Given
2111  try {
2112    // ...
2113  } catch (int) {
2114    // ...
2115  } catch (...) {
2116    // ...
2117  }
2118cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
2119</pre></td></tr>
2120
2121
2122<tr><td>Matcher&lt;<a href="https://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>
2123<tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has
2124a specific number of arguments (including absent default arguments).
2125
2126Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2127  void f(int x, int y);
2128  f(0, 0);
2129</pre></td></tr>
2130
2131
2132<tr><td>Matcher&lt;<a href="https://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>
2133<tr><td colspan="4" class="doc" id="isListInitialization0"><pre>Matches a constructor call expression which uses list initialization.
2134</pre></td></tr>
2135
2136
2137<tr><td>Matcher&lt;<a href="https://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>
2138<tr><td colspan="4" class="doc" id="requiresZeroInitialization0"><pre>Matches a constructor call expression which requires
2139zero initialization.
2140
2141Given
2142void foo() {
2143  struct point { double x; double y; };
2144  point pt[2] = { { 1.0, 2.0 } };
2145}
2146initListExpr(has(cxxConstructExpr(requiresZeroInitialization()))
2147will match the implicit array filler for pt[1].
2148</pre></td></tr>
2149
2150
2151<tr><td>Matcher&lt;<a href="https://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>
2152<tr><td colspan="4" class="doc" id="isCopyConstructor0"><pre>Matches constructor declarations that are copy constructors.
2153
2154Given
2155  struct S {
2156    S(); // #1
2157    S(const S &amp;); // #2
2158    S(S &amp;&amp;); // #3
2159  };
2160cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3.
2161</pre></td></tr>
2162
2163
2164<tr><td>Matcher&lt;<a href="https://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>
2165<tr><td colspan="4" class="doc" id="isDefaultConstructor0"><pre>Matches constructor declarations that are default constructors.
2166
2167Given
2168  struct S {
2169    S(); // #1
2170    S(const S &amp;); // #2
2171    S(S &amp;&amp;); // #3
2172  };
2173cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3.
2174</pre></td></tr>
2175
2176
2177<tr><td>Matcher&lt;<a href="https://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>
2178<tr><td colspan="4" class="doc" id="isDelegatingConstructor0"><pre>Matches constructors that delegate to another constructor.
2179
2180Given
2181  struct S {
2182    S(); // #1
2183    S(int) {} // #2
2184    S(S &amp;&amp;) : S() {} // #3
2185  };
2186  S::S() : S(0) {} // #4
2187cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not
2188#1 or #2.
2189</pre></td></tr>
2190
2191
2192<tr><td>Matcher&lt;<a href="https://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>
2193<tr><td colspan="4" class="doc" id="isExplicit0"><pre>Matches constructor and conversion declarations that are marked with
2194the explicit keyword.
2195
2196Given
2197  struct S {
2198    S(int); // #1
2199    explicit S(double); // #2
2200    operator int(); // #3
2201    explicit operator bool(); // #4
2202  };
2203cxxConstructorDecl(isExplicit()) will match #2, but not #1.
2204cxxConversionDecl(isExplicit()) will match #4, but not #3.
2205</pre></td></tr>
2206
2207
2208<tr><td>Matcher&lt;<a href="https://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>
2209<tr><td colspan="4" class="doc" id="isMoveConstructor0"><pre>Matches constructor declarations that are move constructors.
2210
2211Given
2212  struct S {
2213    S(); // #1
2214    S(const S &amp;); // #2
2215    S(S &amp;&amp;); // #3
2216  };
2217cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2.
2218</pre></td></tr>
2219
2220
2221<tr><td>Matcher&lt;<a href="https://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>
2222<tr><td colspan="4" class="doc" id="isExplicit1"><pre>Matches constructor and conversion declarations that are marked with
2223the explicit keyword.
2224
2225Given
2226  struct S {
2227    S(int); // #1
2228    explicit S(double); // #2
2229    operator int(); // #3
2230    explicit operator bool(); // #4
2231  };
2232cxxConstructorDecl(isExplicit()) will match #2, but not #1.
2233cxxConversionDecl(isExplicit()) will match #4, but not #3.
2234</pre></td></tr>
2235
2236
2237<tr><td>Matcher&lt;<a href="https://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>
2238<tr><td colspan="4" class="doc" id="isBaseInitializer0"><pre>Matches a constructor initializer if it is initializing a base, as
2239opposed to a member.
2240
2241Given
2242  struct B {};
2243  struct D : B {
2244    int I;
2245    D(int i) : I(i) {}
2246  };
2247  struct E : B {
2248    E() : B() {}
2249  };
2250cxxConstructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
2251  will match E(), but not match D(int).
2252</pre></td></tr>
2253
2254
2255<tr><td>Matcher&lt;<a href="https://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>
2256<tr><td colspan="4" class="doc" id="isMemberInitializer0"><pre>Matches a constructor initializer if it is initializing a member, as
2257opposed to a base.
2258
2259Given
2260  struct B {};
2261  struct D : B {
2262    int I;
2263    D(int i) : I(i) {}
2264  };
2265  struct E : B {
2266    E() : B() {}
2267  };
2268cxxConstructorDecl(hasAnyConstructorInitializer(isMemberInitializer()))
2269  will match D(int), but not match E().
2270</pre></td></tr>
2271
2272
2273<tr><td>Matcher&lt;<a href="https://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>
2274<tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in
2275code (as opposed to implicitly added by the compiler).
2276
2277Given
2278  struct Foo {
2279    Foo() { }
2280    Foo(int) : foo_("A") { }
2281    string foo_;
2282  };
2283cxxConstructorDecl(hasAnyConstructorInitializer(isWritten()))
2284  will match Foo(int), but not Foo()
2285</pre></td></tr>
2286
2287
2288<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;</td><td class="name" onclick="toggle('isArrow2')"><a name="isArrow2Anchor">isArrow</a></td><td></td></tr>
2289<tr><td colspan="4" class="doc" id="isArrow2"><pre>Matches member expressions that are called with '-&gt;' as opposed
2290to '.'.
2291
2292Member calls on the implicit this pointer match as called with '-&gt;'.
2293
2294Given
2295  class Y {
2296    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
2297    template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
2298    int a;
2299    static int b;
2300  };
2301  template &lt;class T&gt;
2302  class Z {
2303    void x() { this-&gt;m; }
2304  };
2305memberExpr(isArrow())
2306  matches this-&gt;x, x, y.x, a, this-&gt;b
2307cxxDependentScopeMemberExpr(isArrow())
2308  matches this-&gt;m
2309unresolvedMemberExpr(isArrow())
2310  matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
2311</pre></td></tr>
2312
2313
2314<tr><td>Matcher&lt;<a href="https://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>
2315<tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
2316
2317Given
2318struct A {
2319  void foo() const;
2320  void bar();
2321};
2322
2323cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
2324</pre></td></tr>
2325
2326
2327<tr><td>Matcher&lt;<a href="https://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>
2328<tr><td colspan="4" class="doc" id="isCopyAssignmentOperator0"><pre>Matches if the given method declaration declares a copy assignment
2329operator.
2330
2331Given
2332struct A {
2333  A &amp;operator=(const A &amp;);
2334  A &amp;operator=(A &amp;&amp;);
2335};
2336
2337cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
2338the second one.
2339</pre></td></tr>
2340
2341
2342<tr><td>Matcher&lt;<a href="https://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>
2343<tr><td colspan="4" class="doc" id="isFinal1"><pre>Matches if the given method or class declaration is final.
2344
2345Given:
2346  class A final {};
2347
2348  struct B {
2349    virtual void f();
2350  };
2351
2352  struct C : B {
2353    void f() final;
2354  };
2355matches A and C::f, but not B, C, or B::f
2356</pre></td></tr>
2357
2358
2359<tr><td>Matcher&lt;<a href="https://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>
2360<tr><td colspan="4" class="doc" id="isMoveAssignmentOperator0"><pre>Matches if the given method declaration declares a move assignment
2361operator.
2362
2363Given
2364struct A {
2365  A &amp;operator=(const A &amp;);
2366  A &amp;operator=(A &amp;&amp;);
2367};
2368
2369cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
2370the first one.
2371</pre></td></tr>
2372
2373
2374<tr><td>Matcher&lt;<a href="https://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>
2375<tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
2376
2377Given
2378  class A {
2379   public:
2380    virtual void x();
2381  };
2382  class B : public A {
2383   public:
2384    virtual void x();
2385  };
2386  matches B::x
2387</pre></td></tr>
2388
2389
2390<tr><td>Matcher&lt;<a href="https://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>
2391<tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure.
2392
2393Given
2394  class A {
2395   public:
2396    virtual void x() = 0;
2397  };
2398  matches A::x
2399</pre></td></tr>
2400
2401
2402<tr><td>Matcher&lt;<a href="https://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>
2403<tr><td colspan="4" class="doc" id="isUserProvided0"><pre>Matches method declarations that are user-provided.
2404
2405Given
2406  struct S {
2407    S(); // #1
2408    S(const S &amp;) = default; // #2
2409    S(S &amp;&amp;) = delete; // #3
2410  };
2411cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3.
2412</pre></td></tr>
2413
2414
2415<tr><td>Matcher&lt;<a href="https://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>
2416<tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches if the given method declaration is virtual.
2417
2418Given
2419  class A {
2420   public:
2421    virtual void x();
2422  };
2423  matches A::x
2424</pre></td></tr>
2425
2426
2427<tr><td>Matcher&lt;<a href="https://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>
2428<tr><td colspan="4" class="doc" id="isVirtualAsWritten0"><pre>Matches if the given method declaration has an explicit "virtual".
2429
2430Given
2431  class A {
2432   public:
2433    virtual void x();
2434  };
2435  class B : public A {
2436   public:
2437    void x();
2438  };
2439  matches A::x but not B::x
2440</pre></td></tr>
2441
2442
2443<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('isArray0')"><a name="isArray0Anchor">isArray</a></td><td></td></tr>
2444<tr><td colspan="4" class="doc" id="isArray0"><pre>Matches array new expressions.
2445
2446Given:
2447  MyClass *p1 = new MyClass[10];
2448cxxNewExpr(isArray())
2449  matches the expression 'new MyClass[10]'.
2450</pre></td></tr>
2451
2452
2453<tr><td>Matcher&lt;<a href="https://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>
2454<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
2455
2456Matches overloaded operator names specified in strings without the
2457"operator" prefix: e.g. "&lt;&lt;".
2458
2459Given:
2460  class A { int operator*(); };
2461  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
2462  A a;
2463  a &lt;&lt; a;   // &lt;-- This matches
2464
2465cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
2466specified line and
2467cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
2468matches the declaration of A.
2469
2470Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
2471</pre></td></tr>
2472
2473
2474<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('isAssignmentOperator1')"><a name="isAssignmentOperator1Anchor">isAssignmentOperator</a></td><td></td></tr>
2475<tr><td colspan="4" class="doc" id="isAssignmentOperator1"><pre>Matches all kinds of assignment operators.
2476
2477Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2478  if (a == b)
2479    a += b;
2480
2481Example 2: matches s1 = s2
2482           (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
2483  struct S { S&amp; operator=(const S&amp;); };
2484  void x() { S s1, s2; s1 = s2; })
2485</pre></td></tr>
2486
2487
2488<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('hasDefinition0')"><a name="hasDefinition0Anchor">hasDefinition</a></td><td></td></tr>
2489<tr><td colspan="4" class="doc" id="hasDefinition0"><pre>Matches a class declaration that is defined.
2490
2491Example matches x (matcher = cxxRecordDecl(hasDefinition()))
2492class x {};
2493class y;
2494</pre></td></tr>
2495
2496
2497<tr><td>Matcher&lt;<a href="https://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>
2498<tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
2499</pre></td></tr>
2500
2501
2502<tr><td>Matcher&lt;<a href="https://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>
2503<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
2504static member variable template instantiations.
2505
2506Given
2507  template&lt;typename T&gt; void A(T t) { }
2508  template&lt;&gt; void A(int N) { }
2509functionDecl(isExplicitTemplateSpecialization())
2510  matches the specialization A&lt;int&gt;().
2511
2512Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
2513</pre></td></tr>
2514
2515
2516<tr><td>Matcher&lt;<a href="https://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>
2517<tr><td colspan="4" class="doc" id="isFinal0"><pre>Matches if the given method or class declaration is final.
2518
2519Given:
2520  class A final {};
2521
2522  struct B {
2523    virtual void f();
2524  };
2525
2526  struct C : B {
2527    void f() final;
2528  };
2529matches A and C::f, but not B, C, or B::f
2530</pre></td></tr>
2531
2532
2533<tr><td>Matcher&lt;<a href="https://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>
2534<tr><td colspan="4" class="doc" id="isLambda0"><pre>Matches the generated class of lambda expressions.
2535
2536Given:
2537  auto x = []{};
2538
2539cxxRecordDecl(isLambda()) matches the implicit class declaration of
2540decltype(x)
2541</pre></td></tr>
2542
2543
2544<tr><td>Matcher&lt;<a href="https://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>
2545<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Overloaded method as shortcut for
2546isSameOrDerivedFrom(hasName(...)).
2547</pre></td></tr>
2548
2549
2550<tr><td>Matcher&lt;<a href="https://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>
2551<tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
2552member variable template instantiations.
2553
2554Given
2555  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
2556or
2557  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
2558or
2559  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
2560cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2561  matches the template instantiation of X&lt;A&gt;.
2562
2563But given
2564  template &lt;typename T&gt;  class X {}; class A {};
2565  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
2566cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2567  does not match, as X&lt;A&gt; is an explicit template specialization.
2568
2569Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
2570</pre></td></tr>
2571
2572
2573<tr><td>Matcher&lt;<a href="https://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>
2574<tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
2575a specific number of arguments (including absent default arguments).
2576
2577Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2578  void f(int x, int y);
2579  f(0, 0);
2580</pre></td></tr>
2581
2582
2583<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('usesADL0')"><a name="usesADL0Anchor">usesADL</a></td><td></td></tr>
2584<tr><td colspan="4" class="doc" id="usesADL0"><pre>Matches call expressions which were resolved using ADL.
2585
2586Example matches y(x) but not y(42) or NS::y(x).
2587  namespace NS {
2588    struct X {};
2589    void y(X);
2590  }
2591
2592  void y(...);
2593
2594  void test() {
2595    NS::X x;
2596    y(x); // Matches
2597    NS::y(x); // Doesn't match
2598    y(42); // Doesn't match
2599    using NS::y;
2600    y(x); // Found by both unqualified lookup and ADL, doesn't match
2601   }
2602</pre></td></tr>
2603
2604
2605<tr><td>Matcher&lt;<a href="https://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>
2606<tr><td colspan="4" class="doc" id="hasCastKind0"><pre>Matches casts that has a given cast kind.
2607
2608Example: matches the implicit cast around 0
2609(matcher = castExpr(hasCastKind(CK_NullToPointer)))
2610  int *p = 0;
2611</pre></td></tr>
2612
2613
2614<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;</td><td class="name" onclick="toggle('equals4')"><a name="equals4Anchor">equals</a></td><td>bool Value</td></tr>
2615<tr><td colspan="4" class="doc" id="equals4"><pre></pre></td></tr>
2616
2617
2618<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;</td><td class="name" onclick="toggle('equals3')"><a name="equals3Anchor">equals</a></td><td>const ValueT  Value</td></tr>
2619<tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value of type ValueT.
2620
2621Given
2622  f('false, 3.14, 42);
2623characterLiteral(equals(0))
2624  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2625  match false
2626floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2627  match 3.14
2628integerLiteral(equals(42))
2629  matches 42
2630
2631Note that you cannot directly match a negative numeric literal because the
2632minus sign is not part of the literal: It is a unary operator whose operand
2633is the positive numeric literal. Instead, you must use a unaryOperator()
2634matcher to match the minus sign:
2635
2636unaryOperator(hasOperatorName("-"),
2637              hasUnaryOperand(integerLiteral(equals(13))))
2638
2639Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;,
2640           Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
2641</pre></td></tr>
2642
2643
2644<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;</td><td class="name" onclick="toggle('equals10')"><a name="equals10Anchor">equals</a></td><td>double Value</td></tr>
2645<tr><td colspan="4" class="doc" id="equals10"><pre></pre></td></tr>
2646
2647
2648<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;</td><td class="name" onclick="toggle('equals7')"><a name="equals7Anchor">equals</a></td><td>unsigned Value</td></tr>
2649<tr><td colspan="4" class="doc" id="equals7"><pre></pre></td></tr>
2650
2651
2652<tr><td>Matcher&lt;<a href="https://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>
2653<tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N.
2654
2655Given
2656  template&lt;typename T&gt; struct C {};
2657  C&lt;int&gt; c;
2658classTemplateSpecializationDecl(templateArgumentCountIs(1))
2659  matches C&lt;int&gt;.
2660</pre></td></tr>
2661
2662
2663<tr><td>Matcher&lt;<a href="https://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>
2664<tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
2665child statements.
2666
2667Example: Given
2668  { for (;;) {} }
2669compoundStmt(statementCountIs(0)))
2670  matches '{}'
2671  but does not match the outer compound statement.
2672</pre></td></tr>
2673
2674
2675<tr><td>Matcher&lt;<a href="https://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>
2676<tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches nodes that have the specified size.
2677
2678Given
2679  int a[42];
2680  int b[2 * 21];
2681  int c[41], d[43];
2682  char *s = "abcd";
2683  wchar_t *ws = L"abcd";
2684  char *w = "a";
2685constantArrayType(hasSize(42))
2686  matches "int a[42]" and "int b[2 * 21]"
2687stringLiteral(hasSize(4))
2688  matches "abcd", L"abcd"
2689</pre></td></tr>
2690
2691
2692<tr><td>Matcher&lt;<a href="https://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>
2693<tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
2694declarations.
2695
2696Example: Given
2697  int a, b;
2698  int c;
2699  int d = 2, e;
2700declCountIs(2)
2701  matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
2702</pre></td></tr>
2703
2704
2705<tr><td>Matcher&lt;<a href="https://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>
2706<tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
2707
2708Matches a node if it equals the node previously bound to ID.
2709
2710Given
2711  class X { int a; int b; };
2712cxxRecordDecl(
2713    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
2714    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
2715  matches the class X, as a and b have the same type.
2716
2717Note that when multiple matches are involved via forEach* matchers,
2718equalsBoundNodes acts as a filter.
2719For example:
2720compoundStmt(
2721    forEachDescendant(varDecl().bind("d")),
2722    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
2723will trigger a match for each combination of variable declaration
2724and reference to that variable declaration within a compound statement.
2725</pre></td></tr>
2726
2727
2728<tr><td>Matcher&lt;<a href="https://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>
2729<tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node.
2730
2731Decl has pointer identity in the AST.
2732</pre></td></tr>
2733
2734
2735<tr><td>Matcher&lt;<a href="https://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>
2736<tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute.
2737
2738Given
2739  __attribute__((device)) void f() { ... }
2740decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
2741f. If the matcher is use from clang-query, attr::Kind parameter should be
2742passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
2743</pre></td></tr>
2744
2745
2746<tr><td>Matcher&lt;<a href="https://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>
2747<tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is
2748partially matching a given regex.
2749
2750Example matches Y but not X
2751    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
2752  #include "ASTMatcher.h"
2753  class X {};
2754ASTMatcher.h:
2755  class Y {};
2756
2757Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
2758</pre></td></tr>
2759
2760
2761<tr><td>Matcher&lt;<a href="https://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>
2762<tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file.
2763
2764Example matches X but not Y
2765  (matcher = cxxRecordDecl(isExpansionInMainFile())
2766  #include &lt;Y.h&gt;
2767  class X {};
2768Y.h:
2769  class Y {};
2770
2771Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
2772</pre></td></tr>
2773
2774
2775<tr><td>Matcher&lt;<a href="https://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>
2776<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files.
2777
2778Example matches Y but not X
2779    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
2780  #include &lt;SystemHeader.h&gt;
2781  class X {};
2782SystemHeader.h:
2783  class Y {};
2784
2785Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
2786</pre></td></tr>
2787
2788
2789<tr><td>Matcher&lt;<a href="https://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>
2790<tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a declaration that has been implicitly added
2791by the compiler (eg. implicit default/copy constructors).
2792</pre></td></tr>
2793
2794
2795<tr><td>Matcher&lt;<a href="https://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>
2796<tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations.
2797
2798Given
2799  class C {
2800  public:    int a;
2801  protected: int b;
2802  private:   int c;
2803  };
2804fieldDecl(isPrivate())
2805  matches 'int c;'
2806</pre></td></tr>
2807
2808
2809<tr><td>Matcher&lt;<a href="https://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>
2810<tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations.
2811
2812Given
2813  class C {
2814  public:    int a;
2815  protected: int b;
2816  private:   int c;
2817  };
2818fieldDecl(isProtected())
2819  matches 'int b;'
2820</pre></td></tr>
2821
2822
2823<tr><td>Matcher&lt;<a href="https://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>
2824<tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations.
2825
2826Given
2827  class C {
2828  public:    int a;
2829  protected: int b;
2830  private:   int c;
2831  };
2832fieldDecl(isPublic())
2833  matches 'int a;'
2834</pre></td></tr>
2835
2836
2837<tr><td>Matcher&lt;<a href="https://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>
2838<tr><td colspan="4" class="doc" id="designatorCountIs0"><pre>Matches designated initializer expressions that contain
2839a specific number of designators.
2840
2841Example: Given
2842  point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
2843  point ptarray2[10] = { [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 };
2844designatorCountIs(2)
2845  matches '{ [2].y = 1.0, [0].x = 1.0 }',
2846  but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'.
2847</pre></td></tr>
2848
2849
2850<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumDecl.html">EnumDecl</a>&gt;</td><td class="name" onclick="toggle('isScoped0')"><a name="isScoped0Anchor">isScoped</a></td><td></td></tr>
2851<tr><td colspan="4" class="doc" id="isScoped0"><pre>Matches C++11 scoped enum declaration.
2852
2853Example matches Y (matcher = enumDecl(isScoped()))
2854enum X {};
2855enum class Y {};
2856</pre></td></tr>
2857
2858
2859<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('isInstantiationDependent0')"><a name="isInstantiationDependent0Anchor">isInstantiationDependent</a></td><td></td></tr>
2860<tr><td colspan="4" class="doc" id="isInstantiationDependent0"><pre>Matches expressions that are instantiation-dependent even if it is
2861neither type- nor value-dependent.
2862
2863In the following example, the expression sizeof(sizeof(T() + T()))
2864is instantiation-dependent (since it involves a template parameter T),
2865but is neither type- nor value-dependent, since the type of the inner
2866sizeof is known (std::size_t) and therefore the size of the outer
2867sizeof is known.
2868  template&lt;typename T&gt;
2869  void f(T x, T y) { sizeof(sizeof(T() + T()); }
2870expr(isInstantiationDependent()) matches sizeof(sizeof(T() + T())
2871</pre></td></tr>
2872
2873
2874<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('isTypeDependent0')"><a name="isTypeDependent0Anchor">isTypeDependent</a></td><td></td></tr>
2875<tr><td colspan="4" class="doc" id="isTypeDependent0"><pre>Matches expressions that are type-dependent because the template type
2876is not yet instantiated.
2877
2878For example, the expressions "x" and "x + y" are type-dependent in
2879the following code, but "y" is not type-dependent:
2880  template&lt;typename T&gt;
2881  void add(T x, int y) {
2882    x + y;
2883  }
2884expr(isTypeDependent()) matches x + y
2885</pre></td></tr>
2886
2887
2888<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('isValueDependent0')"><a name="isValueDependent0Anchor">isValueDependent</a></td><td></td></tr>
2889<tr><td colspan="4" class="doc" id="isValueDependent0"><pre>Matches expression that are value-dependent because they contain a
2890non-type template parameter.
2891
2892For example, the array bound of "Chars" in the following example is
2893value-dependent.
2894  template&lt;int Size&gt; int f() { return Size; }
2895expr(isValueDependent()) matches return Size
2896</pre></td></tr>
2897
2898
2899<tr><td>Matcher&lt;<a href="https://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>
2900<tr><td colspan="4" class="doc" id="hasBitWidth0"><pre>Matches non-static data members that are bit-fields of the specified
2901bit width.
2902
2903Given
2904  class C {
2905    int a : 2;
2906    int b : 4;
2907    int c : 2;
2908  };
2909fieldDecl(hasBitWidth(2))
2910  matches 'int a;' and 'int c;' but not 'int b;'.
2911</pre></td></tr>
2912
2913
2914<tr><td>Matcher&lt;<a href="https://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>
2915<tr><td colspan="4" class="doc" id="isBitField0"><pre>Matches non-static data members that are bit-fields.
2916
2917Given
2918  class C {
2919    int a : 2;
2920    int b;
2921  };
2922fieldDecl(isBitField())
2923  matches 'int a;' but not 'int b;'.
2924</pre></td></tr>
2925
2926
2927<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;</td><td class="name" onclick="toggle('equals1')"><a name="equals1Anchor">equals</a></td><td>const ValueT  Value</td></tr>
2928<tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value of type ValueT.
2929
2930Given
2931  f('false, 3.14, 42);
2932characterLiteral(equals(0))
2933  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2934  match false
2935floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2936  match 3.14
2937integerLiteral(equals(42))
2938  matches 42
2939
2940Note that you cannot directly match a negative numeric literal because the
2941minus sign is not part of the literal: It is a unary operator whose operand
2942is the positive numeric literal. Instead, you must use a unaryOperator()
2943matcher to match the minus sign:
2944
2945unaryOperator(hasOperatorName("-"),
2946              hasUnaryOperand(integerLiteral(equals(13))))
2947
2948Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;,
2949           Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
2950</pre></td></tr>
2951
2952
2953<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;</td><td class="name" onclick="toggle('equals12')"><a name="equals12Anchor">equals</a></td><td>double Value</td></tr>
2954<tr><td colspan="4" class="doc" id="equals12"><pre></pre></td></tr>
2955
2956
2957<tr><td>Matcher&lt;<a href="https://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>
2958<tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec0"><pre>Matches functions that have a dynamic exception specification.
2959
2960Given:
2961  void f();
2962  void g() noexcept;
2963  void h() noexcept(true);
2964  void i() noexcept(false);
2965  void j() throw();
2966  void k() throw(int);
2967  void l() throw(...);
2968functionDecl(hasDynamicExceptionSpec()) and
2969  functionProtoType(hasDynamicExceptionSpec())
2970  match the declarations of j, k, and l, but not f, g, h, or i.
2971</pre></td></tr>
2972
2973
2974<tr><td>Matcher&lt;<a href="https://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>
2975<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names.
2976
2977Matches overloaded operator names specified in strings without the
2978"operator" prefix: e.g. "&lt;&lt;".
2979
2980Given:
2981  class A { int operator*(); };
2982  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
2983  A a;
2984  a &lt;&lt; a;   // &lt;-- This matches
2985
2986cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
2987specified line and
2988cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
2989matches the declaration of A.
2990
2991Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
2992</pre></td></tr>
2993
2994
2995<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasTrailingReturn0')"><a name="hasTrailingReturn0Anchor">hasTrailingReturn</a></td><td></td></tr>
2996<tr><td colspan="4" class="doc" id="hasTrailingReturn0"><pre>Matches a function declared with a trailing return type.
2997
2998Example matches Y (matcher = functionDecl(hasTrailingReturn()))
2999int X() {}
3000auto Y() -&gt; int {}
3001</pre></td></tr>
3002
3003
3004<tr><td>Matcher&lt;<a href="https://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>
3005<tr><td colspan="4" class="doc" id="isConstexpr1"><pre>Matches constexpr variable and function declarations,
3006       and if constexpr.
3007
3008Given:
3009  constexpr int foo = 42;
3010  constexpr int bar();
3011  void baz() { if constexpr(1 &gt; 0) {} }
3012varDecl(isConstexpr())
3013  matches the declaration of foo.
3014functionDecl(isConstexpr())
3015  matches the declaration of bar.
3016ifStmt(isConstexpr())
3017  matches the if statement in baz.
3018</pre></td></tr>
3019
3020
3021<tr><td>Matcher&lt;<a href="https://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>
3022<tr><td colspan="4" class="doc" id="isDefaulted0"><pre>Matches defaulted function declarations.
3023
3024Given:
3025  class A { ~A(); };
3026  class B { ~B() = default; };
3027functionDecl(isDefaulted())
3028  matches the declaration of ~B, but not ~A.
3029</pre></td></tr>
3030
3031
3032<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isDefinition3')"><a name="isDefinition3Anchor">isDefinition</a></td><td></td></tr>
3033<tr><td colspan="4" class="doc" id="isDefinition3"><pre>Matches if a declaration has a body attached.
3034
3035Example matches A, va, fa
3036  class A {};
3037  class B;  // Doesn't match, as it has no body.
3038  int va;
3039  extern int vb;  // Doesn't match, as it doesn't define the variable.
3040  void fa() {}
3041  void fb();  // Doesn't match, as it has no body.
3042  @interface X
3043  - (void)ma; // Doesn't match, interface is declaration.
3044  @end
3045  @implementation X
3046  - (void)ma {}
3047  @end
3048
3049Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;,
3050  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3051</pre></td></tr>
3052
3053
3054<tr><td>Matcher&lt;<a href="https://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>
3055<tr><td colspan="4" class="doc" id="isDeleted0"><pre>Matches deleted function declarations.
3056
3057Given:
3058  void Func();
3059  void DeletedFunc() = delete;
3060functionDecl(isDeleted())
3061  matches the declaration of DeletedFunc, but not Func.
3062</pre></td></tr>
3063
3064
3065<tr><td>Matcher&lt;<a href="https://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>
3066<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or
3067static member variable template instantiations.
3068
3069Given
3070  template&lt;typename T&gt; void A(T t) { }
3071  template&lt;&gt; void A(int N) { }
3072functionDecl(isExplicitTemplateSpecialization())
3073  matches the specialization A&lt;int&gt;().
3074
3075Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
3076</pre></td></tr>
3077
3078
3079<tr><td>Matcher&lt;<a href="https://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>
3080<tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function or variable declarations.
3081
3082Given:
3083  extern "C" void f() {}
3084  extern "C" { void g() {} }
3085  void h() {}
3086  extern "C" int x = 1;
3087  extern "C" int y = 2;
3088  int z = 3;
3089functionDecl(isExternC())
3090  matches the declaration of f and g, but not the declaration of h.
3091varDecl(isExternC())
3092  matches the declaration of x and y, but not the declaration of z.
3093</pre></td></tr>
3094
3095
3096<tr><td>Matcher&lt;<a href="https://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>
3097<tr><td colspan="4" class="doc" id="isInline1"><pre>Matches function and namespace declarations that are marked with
3098the inline keyword.
3099
3100Given
3101  inline void f();
3102  void g();
3103  namespace n {
3104  inline namespace m {}
3105  }
3106functionDecl(isInline()) will match ::f().
3107namespaceDecl(isInline()) will match n::m.
3108</pre></td></tr>
3109
3110
3111<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isMain0')"><a name="isMain0Anchor">isMain</a></td><td></td></tr>
3112<tr><td colspan="4" class="doc" id="isMain0"><pre>Determines whether the function is "main", which is the entry point
3113into an executable program.
3114</pre></td></tr>
3115
3116
3117<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isNoReturn0')"><a name="isNoReturn0Anchor">isNoReturn</a></td><td></td></tr>
3118<tr><td colspan="4" class="doc" id="isNoReturn0"><pre>Matches FunctionDecls that have a noreturn attribute.
3119
3120Given
3121  void nope();
3122  [[noreturn]] void a();
3123  __attribute__((noreturn)) void b();
3124  struct c { [[noreturn]] c(); };
3125functionDecl(isNoReturn())
3126  matches all of those except
3127  void nope();
3128</pre></td></tr>
3129
3130
3131<tr><td>Matcher&lt;<a href="https://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>
3132<tr><td colspan="4" class="doc" id="isNoThrow0"><pre>Matches functions that have a non-throwing exception specification.
3133
3134Given:
3135  void f();
3136  void g() noexcept;
3137  void h() throw();
3138  void i() throw(int);
3139  void j() noexcept(false);
3140functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
3141  match the declarations of g, and h, but not f, i or j.
3142</pre></td></tr>
3143
3144
3145<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isStaticStorageClass0')"><a name="isStaticStorageClass0Anchor">isStaticStorageClass</a></td><td></td></tr>
3146<tr><td colspan="4" class="doc" id="isStaticStorageClass0"><pre>Matches variable/function declarations that have "static" storage
3147class specifier ("static" keyword) written in the source.
3148
3149Given:
3150  static void f() {}
3151  static int i = 0;
3152  extern int j;
3153  int k;
3154functionDecl(isStaticStorageClass())
3155  matches the function declaration f.
3156varDecl(isStaticStorageClass())
3157  matches the variable declaration i.
3158</pre></td></tr>
3159
3160
3161<tr><td>Matcher&lt;<a href="https://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>
3162<tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static
3163member variable template instantiations.
3164
3165Given
3166  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
3167or
3168  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
3169or
3170  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
3171cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3172  matches the template instantiation of X&lt;A&gt;.
3173
3174But given
3175  template &lt;typename T&gt;  class X {}; class A {};
3176  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
3177cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3178  does not match, as X&lt;A&gt; is an explicit template specialization.
3179
3180Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
3181</pre></td></tr>
3182
3183
3184<tr><td>Matcher&lt;<a href="https://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>
3185<tr><td colspan="4" class="doc" id="isVariadic0"><pre>Matches if a function declaration is variadic.
3186
3187Example matches f, but not g or h. The function i will not match, even when
3188compiled in C mode.
3189  void f(...);
3190  void g(int);
3191  template &lt;typename... Ts&gt; void h(Ts...);
3192  void i();
3193</pre></td></tr>
3194
3195
3196<tr><td>Matcher&lt;<a href="https://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>
3197<tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
3198specific parameter count.
3199
3200Given
3201  void f(int i) {}
3202  void g(int i, int j) {}
3203  void h(int i, int j);
3204  void j(int i);
3205  void k(int x, int y, int z, ...);
3206functionDecl(parameterCountIs(2))
3207  matches g and h
3208functionProtoType(parameterCountIs(2))
3209  matches g and h
3210functionProtoType(parameterCountIs(3))
3211  matches k
3212</pre></td></tr>
3213
3214
3215<tr><td>Matcher&lt;<a href="https://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>
3216<tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec1"><pre>Matches functions that have a dynamic exception specification.
3217
3218Given:
3219  void f();
3220  void g() noexcept;
3221  void h() noexcept(true);
3222  void i() noexcept(false);
3223  void j() throw();
3224  void k() throw(int);
3225  void l() throw(...);
3226functionDecl(hasDynamicExceptionSpec()) and
3227  functionProtoType(hasDynamicExceptionSpec())
3228  match the declarations of j, k, and l, but not f, g, h, or i.
3229</pre></td></tr>
3230
3231
3232<tr><td>Matcher&lt;<a href="https://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>
3233<tr><td colspan="4" class="doc" id="isNoThrow1"><pre>Matches functions that have a non-throwing exception specification.
3234
3235Given:
3236  void f();
3237  void g() noexcept;
3238  void h() throw();
3239  void i() throw(int);
3240  void j() noexcept(false);
3241functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
3242  match the declarations of g, and h, but not f, i or j.
3243</pre></td></tr>
3244
3245
3246<tr><td>Matcher&lt;<a href="https://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>
3247<tr><td colspan="4" class="doc" id="parameterCountIs1"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
3248specific parameter count.
3249
3250Given
3251  void f(int i) {}
3252  void g(int i, int j) {}
3253  void h(int i, int j);
3254  void j(int i);
3255  void k(int x, int y, int z, ...);
3256functionDecl(parameterCountIs(2))
3257  matches g and h
3258functionProtoType(parameterCountIs(2))
3259  matches g and h
3260functionProtoType(parameterCountIs(3))
3261  matches k
3262</pre></td></tr>
3263
3264
3265<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;</td><td class="name" onclick="toggle('isConstexpr2')"><a name="isConstexpr2Anchor">isConstexpr</a></td><td></td></tr>
3266<tr><td colspan="4" class="doc" id="isConstexpr2"><pre>Matches constexpr variable and function declarations,
3267       and if constexpr.
3268
3269Given:
3270  constexpr int foo = 42;
3271  constexpr int bar();
3272  void baz() { if constexpr(1 &gt; 0) {} }
3273varDecl(isConstexpr())
3274  matches the declaration of foo.
3275functionDecl(isConstexpr())
3276  matches the declaration of bar.
3277ifStmt(isConstexpr())
3278  matches the if statement in baz.
3279</pre></td></tr>
3280
3281
3282<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;</td><td class="name" onclick="toggle('equals6')"><a name="equals6Anchor">equals</a></td><td>bool Value</td></tr>
3283<tr><td colspan="4" class="doc" id="equals6"><pre></pre></td></tr>
3284
3285
3286<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;</td><td class="name" onclick="toggle('equals0')"><a name="equals0Anchor">equals</a></td><td>const ValueT  Value</td></tr>
3287<tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value of type ValueT.
3288
3289Given
3290  f('false, 3.14, 42);
3291characterLiteral(equals(0))
3292  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
3293  match false
3294floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
3295  match 3.14
3296integerLiteral(equals(42))
3297  matches 42
3298
3299Note that you cannot directly match a negative numeric literal because the
3300minus sign is not part of the literal: It is a unary operator whose operand
3301is the positive numeric literal. Instead, you must use a unaryOperator()
3302matcher to match the minus sign:
3303
3304unaryOperator(hasOperatorName("-"),
3305              hasUnaryOperand(integerLiteral(equals(13))))
3306
3307Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;,
3308           Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
3309</pre></td></tr>
3310
3311
3312<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;</td><td class="name" onclick="toggle('equals13')"><a name="equals13Anchor">equals</a></td><td>double Value</td></tr>
3313<tr><td colspan="4" class="doc" id="equals13"><pre></pre></td></tr>
3314
3315
3316<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;</td><td class="name" onclick="toggle('equals9')"><a name="equals9Anchor">equals</a></td><td>unsigned Value</td></tr>
3317<tr><td colspan="4" class="doc" id="equals9"><pre></pre></td></tr>
3318
3319
3320<tr><td>Matcher&lt;<a href="https://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>
3321<tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '-&gt;' as opposed
3322to '.'.
3323
3324Member calls on the implicit this pointer match as called with '-&gt;'.
3325
3326Given
3327  class Y {
3328    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
3329    template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
3330    int a;
3331    static int b;
3332  };
3333  template &lt;class T&gt;
3334  class Z {
3335    void x() { this-&gt;m; }
3336  };
3337memberExpr(isArrow())
3338  matches this-&gt;x, x, y.x, a, this-&gt;b
3339cxxDependentScopeMemberExpr(isArrow())
3340  matches this-&gt;m
3341unresolvedMemberExpr(isArrow())
3342  matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
3343</pre></td></tr>
3344
3345
3346<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</td><td class="name" onclick="toggle('hasExternalFormalLinkage0')"><a name="hasExternalFormalLinkage0Anchor">hasExternalFormalLinkage</a></td><td></td></tr>
3347<tr><td colspan="4" class="doc" id="hasExternalFormalLinkage0"><pre>Matches a declaration that has external formal linkage.
3348
3349Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
3350void f() {
3351  int x;
3352  static int y;
3353}
3354int z;
3355
3356Example matches f() because it has external formal linkage despite being
3357unique to the translation unit as though it has internal likage
3358(matcher = functionDecl(hasExternalFormalLinkage()))
3359
3360namespace {
3361void f() {}
3362}
3363</pre></td></tr>
3364
3365
3366<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</td><td class="name" onclick="toggle('hasName0')"><a name="hasName0Anchor">hasName</a></td><td>const std::string  Name</td></tr>
3367<tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name.
3368
3369Supports specifying enclosing namespaces or classes by prefixing the name
3370with '&lt;enclosing&gt;::'.
3371Does not match typedefs of an underlying type with the given name.
3372
3373Example matches X (Name == "X")
3374  class X;
3375
3376Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
3377  namespace a { namespace b { class X; } }
3378</pre></td></tr>
3379
3380
3381<tr><td>Matcher&lt;<a href="https://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>
3382<tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain
3383a substring matched by the given RegExp.
3384
3385Supports specifying enclosing namespaces or classes by
3386prefixing the name with '&lt;enclosing&gt;::'.  Does not match typedefs
3387of an underlying type with the given name.
3388
3389Example matches X (regexp == "::X")
3390  class X;
3391
3392Example matches X (regexp is one of "::X", "^foo::.*X", among others)
3393  namespace foo { namespace bar { class X; } }
3394</pre></td></tr>
3395
3396
3397<tr><td>Matcher&lt;<a href="https://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>
3398<tr><td colspan="4" class="doc" id="isAnonymous0"><pre>Matches anonymous namespace declarations.
3399
3400Given
3401  namespace n {
3402  namespace {} // #1
3403  }
3404namespaceDecl(isAnonymous()) will match #1 but not ::n.
3405</pre></td></tr>
3406
3407
3408<tr><td>Matcher&lt;<a href="https://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>
3409<tr><td colspan="4" class="doc" id="isInline0"><pre>Matches function and namespace declarations that are marked with
3410the inline keyword.
3411
3412Given
3413  inline void f();
3414  void g();
3415  namespace n {
3416  inline namespace m {}
3417  }
3418functionDecl(isInline()) will match ::f().
3419namespaceDecl(isInline()) will match n::m.
3420</pre></td></tr>
3421
3422
3423<tr><td>Matcher&lt;<a href="https://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>
3424<tr><td colspan="4" class="doc" id="argumentCountIs2"><pre>Checks that a call expression or a constructor call expression has
3425a specific number of arguments (including absent default arguments).
3426
3427Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3428  void f(int x, int y);
3429  f(0, 0);
3430</pre></td></tr>
3431
3432
3433<tr><td>Matcher&lt;<a href="https://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>
3434<tr><td colspan="4" class="doc" id="hasKeywordSelector0"><pre>Matches when the selector is a keyword selector
3435
3436objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
3437message expression in
3438
3439  UIWebView *webView = ...;
3440  CGRect bodyFrame = webView.frame;
3441  bodyFrame.size.height = self.bodyContentHeight;
3442  webView.frame = bodyFrame;
3443  //     ^---- matches here
3444</pre></td></tr>
3445
3446
3447<tr><td>Matcher&lt;<a href="https://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>
3448<tr><td colspan="4" class="doc" id="hasNullSelector0"><pre>Matches when the selector is the empty selector
3449
3450Matches only when the selector of the objCMessageExpr is NULL. This may
3451represent an error condition in the tree!
3452</pre></td></tr>
3453
3454
3455<tr><td>Matcher&lt;<a href="https://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>
3456<tr><td colspan="4" class="doc" id="hasSelector0"><pre>Matches when BaseName == Selector.getAsString()
3457
3458 matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:"));
3459 matches the outer message expr in the code below, but NOT the message
3460 invocation for self.bodyView.
3461    [self.bodyView loadHTMLString:html baseURL:NULL];
3462</pre></td></tr>
3463
3464
3465<tr><td>Matcher&lt;<a href="https://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>
3466<tr><td colspan="4" class="doc" id="hasUnarySelector0"><pre>Matches when the selector is a Unary Selector
3467
3468 matcher = objCMessageExpr(matchesSelector(hasUnarySelector());
3469 matches self.bodyView in the code below, but NOT the outer message
3470 invocation of "loadHTMLString:baseURL:".
3471    [self.bodyView loadHTMLString:html baseURL:NULL];
3472</pre></td></tr>
3473
3474
3475<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('isInstanceMessage0')"><a name="isInstanceMessage0Anchor">isInstanceMessage</a></td><td></td></tr>
3476<tr><td colspan="4" class="doc" id="isInstanceMessage0"><pre>Returns true when the Objective-C message is sent to an instance.
3477
3478Example
3479matcher = objcMessagaeExpr(isInstanceMessage())
3480matches
3481  NSString *x = @"hello";
3482  [x containsString:@"h"];
3483but not
3484  [NSString stringWithFormat:@"format"];
3485</pre></td></tr>
3486
3487
3488<tr><td>Matcher&lt;<a href="https://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>
3489<tr><td colspan="4" class="doc" id="matchesSelector0"><pre>Matches ObjC selectors whose name contains
3490a substring matched by the given RegExp.
3491 matcher = objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
3492 invocation for self.bodyView.
3493    [self.bodyView loadHTMLString:html baseURL:NULL];
3494</pre></td></tr>
3495
3496
3497<tr><td>Matcher&lt;<a href="https://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>
3498<tr><td colspan="4" class="doc" id="numSelectorArgs0"><pre>Matches when the selector has the specified number of arguments
3499
3500 matcher = objCMessageExpr(numSelectorArgs(0));
3501 matches self.bodyView in the code below
3502
3503 matcher = objCMessageExpr(numSelectorArgs(2));
3504 matches the invocation of "loadHTMLString:baseURL:" but not that
3505 of self.bodyView
3506    [self.bodyView loadHTMLString:html baseURL:NULL];
3507</pre></td></tr>
3508
3509
3510<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isDefinition2')"><a name="isDefinition2Anchor">isDefinition</a></td><td></td></tr>
3511<tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached.
3512
3513Example matches A, va, fa
3514  class A {};
3515  class B;  // Doesn't match, as it has no body.
3516  int va;
3517  extern int vb;  // Doesn't match, as it doesn't define the variable.
3518  void fa() {}
3519  void fb();  // Doesn't match, as it has no body.
3520  @interface X
3521  - (void)ma; // Doesn't match, interface is declaration.
3522  @end
3523  @implementation X
3524  - (void)ma {}
3525  @end
3526
3527Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;,
3528  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3529</pre></td></tr>
3530
3531
3532<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt;</td><td class="name" onclick="toggle('hasDefaultArgument0')"><a name="hasDefaultArgument0Anchor">hasDefaultArgument</a></td><td></td></tr>
3533<tr><td colspan="4" class="doc" id="hasDefaultArgument0"><pre>Matches a declaration that has default arguments.
3534
3535Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
3536void x(int val) {}
3537void y(int val = 0) {}
3538</pre></td></tr>
3539
3540
3541<tr><td>Matcher&lt;<a href="https://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>
3542<tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string.
3543
3544Given
3545  class Y { public: void x(); };
3546  void z() { Y* y; y-&gt;x(); }
3547cxxMemberCallExpr(on(hasType(asString("class Y *"))))
3548  matches y-&gt;x()
3549</pre></td></tr>
3550
3551
3552<tr><td>Matcher&lt;<a href="https://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>
3553<tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node.
3554
3555Matches a node if it equals the node previously bound to ID.
3556
3557Given
3558  class X { int a; int b; };
3559cxxRecordDecl(
3560    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3561    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3562  matches the class X, as a and b have the same type.
3563
3564Note that when multiple matches are involved via forEach* matchers,
3565equalsBoundNodes acts as a filter.
3566For example:
3567compoundStmt(
3568    forEachDescendant(varDecl().bind("d")),
3569    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3570will trigger a match for each combination of variable declaration
3571and reference to that variable declaration within a compound statement.
3572</pre></td></tr>
3573
3574
3575<tr><td>Matcher&lt;<a href="https://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>
3576<tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to
3577the node, not hidden within a typedef.
3578
3579Given
3580  typedef const int const_int;
3581  const_int i;
3582  int *const j;
3583  int *volatile k;
3584  int m;
3585varDecl(hasType(hasLocalQualifiers())) matches only j and k.
3586i is const-qualified but the qualifier is not local.
3587</pre></td></tr>
3588
3589
3590<tr><td>Matcher&lt;<a href="https://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>
3591<tr><td colspan="4" class="doc" id="isAnyCharacter0"><pre>Matches QualType nodes that are of character type.
3592
3593Given
3594  void a(char);
3595  void b(wchar_t);
3596  void c(double);
3597functionDecl(hasAnyParameter(hasType(isAnyCharacter())))
3598matches "a(char)", "b(wchar_t)", but not "c(double)".
3599</pre></td></tr>
3600
3601
3602<tr><td>Matcher&lt;<a href="https://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>
3603<tr><td colspan="4" class="doc" id="isAnyPointer0"><pre>Matches QualType nodes that are of any pointer type; this includes
3604the Objective-C object pointer type, which is different despite being
3605syntactically similar.
3606
3607Given
3608  int *i = nullptr;
3609
3610  @interface Foo
3611  @end
3612  Foo *f;
3613
3614  int j;
3615varDecl(hasType(isAnyPointer()))
3616  matches "int *i" and "Foo *f", but not "int j".
3617</pre></td></tr>
3618
3619
3620<tr><td>Matcher&lt;<a href="https://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>
3621<tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that
3622include "top-level" const.
3623
3624Given
3625  void a(int);
3626  void b(int const);
3627  void c(const int);
3628  void d(const int*);
3629  void e(int const) {};
3630functionDecl(hasAnyParameter(hasType(isConstQualified())))
3631  matches "void b(int const)", "void c(const int)" and
3632  "void e(int const) {}". It does not match d as there
3633  is no top-level const on the parameter type "const int *".
3634</pre></td></tr>
3635
3636
3637<tr><td>Matcher&lt;<a href="https://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>
3638<tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type.
3639
3640Given
3641  void a(int);
3642  void b(long);
3643  void c(double);
3644functionDecl(hasAnyParameter(hasType(isInteger())))
3645matches "a(int)", "b(long)", but not "c(double)".
3646</pre></td></tr>
3647
3648
3649<tr><td>Matcher&lt;<a href="https://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>
3650<tr><td colspan="4" class="doc" id="isSignedInteger0"><pre>Matches QualType nodes that are of signed integer type.
3651
3652Given
3653  void a(int);
3654  void b(unsigned long);
3655  void c(double);
3656functionDecl(hasAnyParameter(hasType(isSignedInteger())))
3657matches "a(int)", but not "b(unsigned long)" and "c(double)".
3658</pre></td></tr>
3659
3660
3661<tr><td>Matcher&lt;<a href="https://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>
3662<tr><td colspan="4" class="doc" id="isUnsignedInteger0"><pre>Matches QualType nodes that are of unsigned integer type.
3663
3664Given
3665  void a(int);
3666  void b(unsigned long);
3667  void c(double);
3668functionDecl(hasAnyParameter(hasType(isUnsignedInteger())))
3669matches "b(unsigned long)", but not "a(int)" and "c(double)".
3670</pre></td></tr>
3671
3672
3673<tr><td>Matcher&lt;<a href="https://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>
3674<tr><td colspan="4" class="doc" id="isVolatileQualified0"><pre>Matches QualType nodes that are volatile-qualified, i.e., that
3675include "top-level" volatile.
3676
3677Given
3678  void a(int);
3679  void b(int volatile);
3680  void c(volatile int);
3681  void d(volatile int*);
3682  void e(int volatile) {};
3683functionDecl(hasAnyParameter(hasType(isVolatileQualified())))
3684  matches "void b(int volatile)", "void c(volatile int)" and
3685  "void e(int volatile) {}". It does not match d as there
3686  is no top-level volatile on the parameter type "volatile int *".
3687</pre></td></tr>
3688
3689
3690<tr><td>Matcher&lt;<a href="https://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>
3691<tr><td colspan="4" class="doc" id="isClass0"><pre>Matches RecordDecl object that are spelled with "class."
3692
3693Example matches C, but not S or U.
3694  struct S {};
3695  class C {};
3696  union U {};
3697</pre></td></tr>
3698
3699
3700<tr><td>Matcher&lt;<a href="https://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>
3701<tr><td colspan="4" class="doc" id="isStruct0"><pre>Matches RecordDecl object that are spelled with "struct."
3702
3703Example matches S, but not C or U.
3704  struct S {};
3705  class C {};
3706  union U {};
3707</pre></td></tr>
3708
3709
3710<tr><td>Matcher&lt;<a href="https://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>
3711<tr><td colspan="4" class="doc" id="isUnion0"><pre>Matches RecordDecl object that are spelled with "union."
3712
3713Example matches U, but not C or S.
3714  struct S {};
3715  class C {};
3716  union U {};
3717</pre></td></tr>
3718
3719
3720<tr><td>Matcher&lt;<a href="https://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>
3721<tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node.
3722
3723Matches a node if it equals the node previously bound to ID.
3724
3725Given
3726  class X { int a; int b; };
3727cxxRecordDecl(
3728    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3729    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3730  matches the class X, as a and b have the same type.
3731
3732Note that when multiple matches are involved via forEach* matchers,
3733equalsBoundNodes acts as a filter.
3734For example:
3735compoundStmt(
3736    forEachDescendant(varDecl().bind("d")),
3737    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3738will trigger a match for each combination of variable declaration
3739and reference to that variable declaration within a compound statement.
3740</pre></td></tr>
3741
3742
3743<tr><td>Matcher&lt;<a href="https://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>
3744<tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node.
3745
3746Stmt has pointer identity in the AST.
3747</pre></td></tr>
3748
3749
3750<tr><td>Matcher&lt;<a href="https://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>
3751<tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches AST nodes that were expanded within files whose name is
3752partially matching a given regex.
3753
3754Example matches Y but not X
3755    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3756  #include "ASTMatcher.h"
3757  class X {};
3758ASTMatcher.h:
3759  class Y {};
3760
3761Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
3762</pre></td></tr>
3763
3764
3765<tr><td>Matcher&lt;<a href="https://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>
3766<tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches AST nodes that were expanded within the main-file.
3767
3768Example matches X but not Y
3769  (matcher = cxxRecordDecl(isExpansionInMainFile())
3770  #include &lt;Y.h&gt;
3771  class X {};
3772Y.h:
3773  class Y {};
3774
3775Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
3776</pre></td></tr>
3777
3778
3779<tr><td>Matcher&lt;<a href="https://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>
3780<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches AST nodes that were expanded within system-header-files.
3781
3782Example matches Y but not X
3783    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3784  #include &lt;SystemHeader.h&gt;
3785  class X {};
3786SystemHeader.h:
3787  class Y {};
3788
3789Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
3790</pre></td></tr>
3791
3792
3793<tr><td>Matcher&lt;<a href="https://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>
3794<tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
3795
3796Given
3797  int a[42];
3798  int b[2 * 21];
3799  int c[41], d[43];
3800  char *s = "abcd";
3801  wchar_t *ws = L"abcd";
3802  char *w = "a";
3803constantArrayType(hasSize(42))
3804  matches "int a[42]" and "int b[2 * 21]"
3805stringLiteral(hasSize(4))
3806  matches "abcd", L"abcd"
3807</pre></td></tr>
3808
3809
3810<tr><td>Matcher&lt;<a href="https://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>
3811<tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
3812
3813Example matches A, va, fa
3814  class A {};
3815  class B;  // Doesn't match, as it has no body.
3816  int va;
3817  extern int vb;  // Doesn't match, as it doesn't define the variable.
3818  void fa() {}
3819  void fb();  // Doesn't match, as it has no body.
3820  @interface X
3821  - (void)ma; // Doesn't match, interface is declaration.
3822  @end
3823  @implementation X
3824  - (void)ma {}
3825  @end
3826
3827Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;,
3828  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3829</pre></td></tr>
3830
3831
3832<tr><td>Matcher&lt;<a href="https://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>
3833<tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value.
3834
3835Note that 'Value' is a string as the template argument's value is
3836an arbitrary precision integer. 'Value' must be euqal to the canonical
3837representation of that integral value in base 10.
3838
3839Given
3840  template&lt;int T&gt; struct C {};
3841  C&lt;42&gt; c;
3842classTemplateSpecializationDecl(
3843  hasAnyTemplateArgument(equalsIntegralValue("42")))
3844  matches the implicit instantiation of C in C&lt;42&gt;.
3845</pre></td></tr>
3846
3847
3848<tr><td>Matcher&lt;<a href="https://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>
3849<tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value.
3850
3851Given
3852  template&lt;int T&gt; struct C {};
3853  C&lt;42&gt; c;
3854classTemplateSpecializationDecl(
3855  hasAnyTemplateArgument(isIntegral()))
3856  matches the implicit instantiation of C in C&lt;42&gt;
3857  with isIntegral() matching 42.
3858</pre></td></tr>
3859
3860
3861<tr><td>Matcher&lt;<a href="https://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>
3862<tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N.
3863
3864Given
3865  template&lt;typename T&gt; struct C {};
3866  C&lt;int&gt; c;
3867classTemplateSpecializationDecl(templateArgumentCountIs(1))
3868  matches C&lt;int&gt;.
3869</pre></td></tr>
3870
3871
3872<tr><td>Matcher&lt;<a href="https://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>
3873<tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is
3874partially matching a given regex.
3875
3876Example matches Y but not X
3877    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3878  #include "ASTMatcher.h"
3879  class X {};
3880ASTMatcher.h:
3881  class Y {};
3882
3883Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
3884</pre></td></tr>
3885
3886
3887<tr><td>Matcher&lt;<a href="https://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>
3888<tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file.
3889
3890Example matches X but not Y
3891  (matcher = cxxRecordDecl(isExpansionInMainFile())
3892  #include &lt;Y.h&gt;
3893  class X {};
3894Y.h:
3895  class Y {};
3896
3897Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
3898</pre></td></tr>
3899
3900
3901<tr><td>Matcher&lt;<a href="https://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>
3902<tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files.
3903
3904Example matches Y but not X
3905    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3906  #include &lt;SystemHeader.h&gt;
3907  class X {};
3908SystemHeader.h:
3909  class Y {};
3910
3911Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
3912</pre></td></tr>
3913
3914
3915<tr><td>Matcher&lt;<a href="https://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>
3916<tr><td colspan="4" class="doc" id="booleanType0"><pre>Matches type bool.
3917
3918Given
3919 struct S { bool func(); };
3920functionDecl(returns(booleanType()))
3921  matches "bool func();"
3922</pre></td></tr>
3923
3924
3925<tr><td>Matcher&lt;<a href="https://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>
3926<tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
3927
3928Matches a node if it equals the node previously bound to ID.
3929
3930Given
3931  class X { int a; int b; };
3932cxxRecordDecl(
3933    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3934    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3935  matches the class X, as a and b have the same type.
3936
3937Note that when multiple matches are involved via forEach* matchers,
3938equalsBoundNodes acts as a filter.
3939For example:
3940compoundStmt(
3941    forEachDescendant(varDecl().bind("d")),
3942    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3943will trigger a match for each combination of variable declaration
3944and reference to that variable declaration within a compound statement.
3945</pre></td></tr>
3946
3947
3948<tr><td>Matcher&lt;<a href="https://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>
3949<tr><td colspan="4" class="doc" id="equalsNode2"><pre>Matches if a node equals another node.
3950
3951Type has pointer identity in the AST.
3952</pre></td></tr>
3953
3954
3955<tr><td>Matcher&lt;<a href="https://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>
3956<tr><td colspan="4" class="doc" id="realFloatingPointType0"><pre>Matches any real floating-point type (float, double, long double).
3957
3958Given
3959  int i;
3960  float f;
3961realFloatingPointType()
3962  matches "float f" but not "int i"
3963</pre></td></tr>
3964
3965
3966<tr><td>Matcher&lt;<a href="https://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>
3967<tr><td colspan="4" class="doc" id="voidType0"><pre>Matches type void.
3968
3969Given
3970 struct S { void func(); };
3971functionDecl(returns(voidType()))
3972  matches "void func();"
3973</pre></td></tr>
3974
3975
3976<tr><td>Matcher&lt;<a href="https://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>
3977<tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
3978
3979Given
3980  int x;
3981  int s = sizeof(x) + alignof(x)
3982unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
3983  matches sizeof(x)
3984</pre></td></tr>
3985
3986
3987<tr><td>Matcher&lt;<a href="https://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>
3988<tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or
3989unary).
3990
3991Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3992  !(a || b)
3993</pre></td></tr>
3994
3995
3996<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedMemberExpr.html">UnresolvedMemberExpr</a>&gt;</td><td class="name" onclick="toggle('isArrow1')"><a name="isArrow1Anchor">isArrow</a></td><td></td></tr>
3997<tr><td colspan="4" class="doc" id="isArrow1"><pre>Matches member expressions that are called with '-&gt;' as opposed
3998to '.'.
3999
4000Member calls on the implicit this pointer match as called with '-&gt;'.
4001
4002Given
4003  class Y {
4004    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
4005    template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
4006    int a;
4007    static int b;
4008  };
4009  template &lt;class T&gt;
4010  class Z {
4011    void x() { this-&gt;m; }
4012  };
4013memberExpr(isArrow())
4014  matches this-&gt;x, x, y.x, a, this-&gt;b
4015cxxDependentScopeMemberExpr(isArrow())
4016  matches this-&gt;m
4017unresolvedMemberExpr(isArrow())
4018  matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
4019</pre></td></tr>
4020
4021
4022<tr><td>Matcher&lt;<a href="https://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>
4023<tr><td colspan="4" class="doc" id="hasAutomaticStorageDuration0"><pre>Matches a variable declaration that has automatic storage duration.
4024
4025Example matches x, but not y, z, or a.
4026(matcher = varDecl(hasAutomaticStorageDuration())
4027void f() {
4028  int x;
4029  static int y;
4030  thread_local int z;
4031}
4032int a;
4033</pre></td></tr>
4034
4035
4036<tr><td>Matcher&lt;<a href="https://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>
4037<tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
4038
4039Example matches y and z (matcher = varDecl(hasGlobalStorage())
4040void f() {
4041  int x;
4042  static int y;
4043}
4044int z;
4045</pre></td></tr>
4046
4047
4048<tr><td>Matcher&lt;<a href="https://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>
4049<tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a
4050non-static local variable.
4051
4052Example matches x (matcher = varDecl(hasLocalStorage())
4053void f() {
4054  int x;
4055  static int y;
4056}
4057int z;
4058</pre></td></tr>
4059
4060
4061<tr><td>Matcher&lt;<a href="https://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>
4062<tr><td colspan="4" class="doc" id="hasStaticStorageDuration0"><pre>Matches a variable declaration that has static storage duration.
4063It includes the variable declared at namespace scope and those declared
4064with "static" and "extern" storage class specifiers.
4065
4066void f() {
4067  int x;
4068  static int y;
4069  thread_local int z;
4070}
4071int a;
4072static int b;
4073extern int c;
4074varDecl(hasStaticStorageDuration())
4075  matches the function declaration y, a, b and c.
4076</pre></td></tr>
4077
4078
4079<tr><td>Matcher&lt;<a href="https://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>
4080<tr><td colspan="4" class="doc" id="hasThreadStorageDuration0"><pre>Matches a variable declaration that has thread storage duration.
4081
4082Example matches z, but not x, z, or a.
4083(matcher = varDecl(hasThreadStorageDuration())
4084void f() {
4085  int x;
4086  static int y;
4087  thread_local int z;
4088}
4089int a;
4090</pre></td></tr>
4091
4092
4093<tr><td>Matcher&lt;<a href="https://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>
4094<tr><td colspan="4" class="doc" id="isConstexpr0"><pre>Matches constexpr variable and function declarations,
4095       and if constexpr.
4096
4097Given:
4098  constexpr int foo = 42;
4099  constexpr int bar();
4100  void baz() { if constexpr(1 &gt; 0) {} }
4101varDecl(isConstexpr())
4102  matches the declaration of foo.
4103functionDecl(isConstexpr())
4104  matches the declaration of bar.
4105ifStmt(isConstexpr())
4106  matches the if statement in baz.
4107</pre></td></tr>
4108
4109
4110<tr><td>Matcher&lt;<a href="https://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>
4111<tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
4112
4113Example matches A, va, fa
4114  class A {};
4115  class B;  // Doesn't match, as it has no body.
4116  int va;
4117  extern int vb;  // Doesn't match, as it doesn't define the variable.
4118  void fa() {}
4119  void fb();  // Doesn't match, as it has no body.
4120  @interface X
4121  - (void)ma; // Doesn't match, interface is declaration.
4122  @end
4123  @implementation X
4124  - (void)ma {}
4125  @end
4126
4127Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;,
4128  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
4129</pre></td></tr>
4130
4131
4132<tr><td>Matcher&lt;<a href="https://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>
4133<tr><td colspan="4" class="doc" id="isExceptionVariable0"><pre>Matches a variable declaration that is an exception variable from
4134a C++ catch block, or an Objective-C statement.
4135
4136Example matches x (matcher = varDecl(isExceptionVariable())
4137void f(int y) {
4138  try {
4139  } catch (int x) {
4140  }
4141}
4142</pre></td></tr>
4143
4144
4145<tr><td>Matcher&lt;<a href="https://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>
4146<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
4147static member variable template instantiations.
4148
4149Given
4150  template&lt;typename T&gt; void A(T t) { }
4151  template&lt;&gt; void A(int N) { }
4152functionDecl(isExplicitTemplateSpecialization())
4153  matches the specialization A&lt;int&gt;().
4154
4155Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
4156</pre></td></tr>
4157
4158
4159<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isExternC1')"><a name="isExternC1Anchor">isExternC</a></td><td></td></tr>
4160<tr><td colspan="4" class="doc" id="isExternC1"><pre>Matches extern "C" function or variable declarations.
4161
4162Given:
4163  extern "C" void f() {}
4164  extern "C" { void g() {} }
4165  void h() {}
4166  extern "C" int x = 1;
4167  extern "C" int y = 2;
4168  int z = 3;
4169functionDecl(isExternC())
4170  matches the declaration of f and g, but not the declaration of h.
4171varDecl(isExternC())
4172  matches the declaration of x and y, but not the declaration of z.
4173</pre></td></tr>
4174
4175
4176<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isStaticLocal0')"><a name="isStaticLocal0Anchor">isStaticLocal</a></td><td></td></tr>
4177<tr><td colspan="4" class="doc" id="isStaticLocal0"><pre>Matches a static variable with local scope.
4178
4179Example matches y (matcher = varDecl(isStaticLocal()))
4180void f() {
4181  int x;
4182  static int y;
4183}
4184static int z;
4185</pre></td></tr>
4186
4187
4188<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isStaticStorageClass1')"><a name="isStaticStorageClass1Anchor">isStaticStorageClass</a></td><td></td></tr>
4189<tr><td colspan="4" class="doc" id="isStaticStorageClass1"><pre>Matches variable/function declarations that have "static" storage
4190class specifier ("static" keyword) written in the source.
4191
4192Given:
4193  static void f() {}
4194  static int i = 0;
4195  extern int j;
4196  int k;
4197functionDecl(isStaticStorageClass())
4198  matches the function declaration f.
4199varDecl(isStaticStorageClass())
4200  matches the variable declaration i.
4201</pre></td></tr>
4202
4203
4204<tr><td>Matcher&lt;<a href="https://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>
4205<tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
4206member variable template instantiations.
4207
4208Given
4209  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
4210or
4211  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
4212or
4213  template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
4214cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4215  matches the template instantiation of X&lt;A&gt;.
4216
4217But given
4218  template &lt;typename T&gt;  class X {}; class A {};
4219  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
4220cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4221  does not match, as X&lt;A&gt; is an explicit template specialization.
4222
4223Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
4224</pre></td></tr>
4225
4226
4227<tr><td>Matcher&lt;internal::Matcher&lt;<a href="https://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>
4228<tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
4229template instantiations.
4230
4231Given
4232  template&lt;typename T&gt; void A(T t) { T i; }
4233  A(0);
4234  A(0U);
4235functionDecl(isInstantiated())
4236  matches 'A(int) {...};' and 'A(unsigned) {...}'.
4237</pre></td></tr>
4238
4239
4240<tr><td>Matcher&lt;internal::Matcher&lt;<a href="https://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>
4241<tr><td colspan="4" class="doc" id="nullPointerConstant0"><pre>Matches expressions that resolve to a null pointer constant, such as
4242GNU's __null, C++11's nullptr, or C's NULL macro.
4243
4244Given:
4245  void *v1 = NULL;
4246  void *v2 = nullptr;
4247  void *v3 = __null; // GNU extension
4248  char *cp = (char *)0;
4249  int *ip = 0;
4250  int i = 0;
4251expr(nullPointerConstant())
4252  matches the initializer for v1, v2, v3, cp, and ip. Does not match the
4253  initializer for i.
4254</pre></td></tr>
4255
4256
4257<tr><td>Matcher&lt;internal::Matcher&lt;<a href="https://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>
4258<tr><td colspan="4" class="doc" id="hasAnyName0"><pre>Matches NamedDecl nodes that have any of the specified names.
4259
4260This matcher is only provided as a performance optimization of hasName.
4261    hasAnyName(a, b, c)
4262 is equivalent to, but faster than
4263    anyOf(hasName(a), hasName(b), hasName(c))
4264</pre></td></tr>
4265
4266
4267<tr><td>Matcher&lt;internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;&gt;</td><td class="name" onclick="toggle('hasAnySelector0')"><a name="hasAnySelector0Anchor">hasAnySelector</a></td><td>StringRef, ..., StringRef</td></tr>
4268<tr><td colspan="4" class="doc" id="hasAnySelector0"><pre>Matches when at least one of the supplied string equals to the
4269Selector.getAsString()
4270
4271 matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
4272 matches both of the expressions below:
4273    [myObj methodA:argA];
4274    [myObj methodB:argB];
4275</pre></td></tr>
4276
4277
4278<tr><td>Matcher&lt;internal::Matcher&lt;<a href="https://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>
4279<tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
4280
4281Given
4282  int j;
4283  template&lt;typename T&gt; void A(T t) { T i; j += 42;}
4284  A(0);
4285  A(0U);
4286declStmt(isInTemplateInstantiation())
4287  matches 'int i;' and 'unsigned i'.
4288unless(stmt(isInTemplateInstantiation()))
4289  will NOT match j += 42; as it's shared between the template definition and
4290  instantiation.
4291</pre></td></tr>
4292
4293<!--END_NARROWING_MATCHERS -->
4294</table>
4295
4296<!-- ======================================================================= -->
4297<h2 id="traversal-matchers">AST Traversal Matchers</h2>
4298<!-- ======================================================================= -->
4299
4300<p>Traversal matchers specify the relationship to other nodes that are
4301reachable from the current node.</p>
4302
4303<p>Note that there are special traversal matchers (has, hasDescendant, forEach and
4304forEachDescendant) which work on all nodes and allow users to write more generic
4305match expressions.</p>
4306
4307<table>
4308<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
4309<!-- START_TRAVERSAL_MATCHERS -->
4310
4311<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>
4312<tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
4313
4314Unlike anyOf, eachOf will generate a match result for each
4315matching submatcher.
4316
4317For example, in:
4318  class A { int a; int b; };
4319The matcher:
4320  cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
4321                       has(fieldDecl(hasName("b")).bind("v"))))
4322will generate two results binding "v", the first of which binds
4323the field declaration of a, the second the field declaration of
4324b.
4325
4326Usable as: Any Matcher
4327</pre></td></tr>
4328
4329
4330<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4331<tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4332provided matcher.
4333
4334Example matches X, A, A::X, B, B::C, B::C::X
4335  (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
4336  class X {};
4337  class A { class X {}; };  // Matches A, because A::X is a class of name
4338                            // X inside A.
4339  class B { class C { class X {}; }; };
4340
4341DescendantT must be an AST base type.
4342
4343As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
4344each result that matches instead of only on the first one.
4345
4346Note: Recursively combined ForEachDescendant can cause many matches:
4347  cxxRecordDecl(forEachDescendant(cxxRecordDecl(
4348    forEachDescendant(cxxRecordDecl())
4349  )))
4350will match 10 times (plus injected class name matches) on:
4351  class A { class B { class C { class D { class E {}; }; }; }; };
4352
4353Usable as: Any Matcher
4354</pre></td></tr>
4355
4356
4357<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
4358<tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
4359provided matcher.
4360
4361Example matches X, Y, Y::X, Z::Y, Z::Y::X
4362  (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
4363  class X {};
4364  class Y { class X {}; };  // Matches Y, because Y::X is a class of name X
4365                            // inside Y.
4366  class Z { class Y { class X {}; }; };  // Does not match Z.
4367
4368ChildT must be an AST base type.
4369
4370As opposed to 'has', 'forEach' will cause a match for each result that
4371matches instead of only on the first one.
4372
4373Usable as: Any Matcher
4374</pre></td></tr>
4375
4376
4377<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
4378<tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
4379matcher.
4380
4381Given
4382void f() { if (true) { int x = 42; } }
4383void g() { for (;;) { int x = 43; } }
4384expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
4385
4386Usable as: Any Matcher
4387</pre></td></tr>
4388
4389
4390<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4391<tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4392provided matcher.
4393
4394Example matches X, Y, Z
4395    (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
4396  class X {};  // Matches X, because X::X is a class of name X inside X.
4397  class Y { class X {}; };
4398  class Z { class Y { class X {}; }; };
4399
4400DescendantT must be an AST base type.
4401
4402Usable as: Any Matcher
4403</pre></td></tr>
4404
4405
4406<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
4407<tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
4408provided matcher.
4409
4410Example matches X, Y
4411  (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
4412  class X {};  // Matches X, because X::X is a class of name X inside X.
4413  class Y { class X {}; };
4414  class Z { class Y { class X {}; }; };  // Does not match Z.
4415
4416ChildT must be an AST base type.
4417
4418Usable as: Any Matcher
4419Note that has is direct matcher, so it also matches things like implicit
4420casts and paren casts. If you are matching with expr then you should
4421probably consider using ignoringParenImpCasts like:
4422has(ignoringParenImpCasts(expr())).
4423</pre></td></tr>
4424
4425
4426<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
4427<tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
4428matcher.
4429
4430Given
4431void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
4432compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
4433
4434Usable as: Any Matcher
4435</pre></td></tr>
4436
4437
4438<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4439<tr><td colspan="4" class="doc" id="hasCondition5"><pre>Matches the condition expression of an if statement, for loop,
4440switch statement or conditional operator.
4441
4442Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
4443  if (true) {}
4444</pre></td></tr>
4445
4446
4447<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4448<tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator
4449(binary or ternary).
4450
4451Example matches b
4452  condition ? a : b
4453  condition ?: b
4454</pre></td></tr>
4455
4456
4457<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4458<tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
4459
4460Example 1 (conditional ternary operator): matches a
4461  condition ? a : b
4462
4463Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
4464  condition ?: b
4465</pre></td></tr>
4466
4467
4468<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration15')"><a name="hasDeclaration15Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4469<tr><td colspan="4" class="doc" id="hasDeclaration15"><pre>Matches a node if the declaration associated with that node
4470matches the given matcher.
4471
4472The associated declaration is:
4473- for type nodes, the declaration of the underlying type
4474- for CallExpr, the declaration of the callee
4475- for MemberExpr, the declaration of the referenced member
4476- for CXXConstructExpr, the declaration of the constructor
4477- for CXXNewExpr, the declaration of the operator new
4478- for ObjCIvarExpr, the declaration of the ivar
4479
4480For type nodes, hasDeclaration will generally match the declaration of the
4481sugared type. Given
4482  class X {};
4483  typedef X Y;
4484  Y y;
4485in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4486typedefDecl. A common use case is to match the underlying, desugared type.
4487This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4488  varDecl(hasType(hasUnqualifiedDesugaredType(
4489      recordType(hasDeclaration(decl())))))
4490In this matcher, the decl will match the CXXRecordDecl of class X.
4491
4492Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
4493  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
4494  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
4495  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
4496  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
4497  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
4498  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4499</pre></td></tr>
4500
4501
4502<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4503<tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
4504
4505Given
4506  int i[5];
4507  void f() { i[1] = 42; }
4508arraySubscriptExpression(hasBase(implicitCastExpr(
4509    hasSourceExpression(declRefExpr()))))
4510  matches i[1] with the declRefExpr() matching i
4511</pre></td></tr>
4512
4513
4514<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4515<tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
4516
4517Given
4518  int i[5];
4519  void f() { i[1] = 42; }
4520arraySubscriptExpression(hasIndex(integerLiteral()))
4521  matches i[1] with the integerLiteral() matching 1
4522</pre></td></tr>
4523
4524
4525<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4526<tr><td colspan="4" class="doc" id="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
4527
4528Example matches a (matcher = binaryOperator(hasLHS()))
4529  a || b
4530</pre></td></tr>
4531
4532
4533<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4534<tr><td colspan="4" class="doc" id="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
4535
4536Example matches b (matcher = binaryOperator(hasRHS()))
4537  a || b
4538</pre></td></tr>
4539
4540
4541<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
4542<tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
4543type.
4544
4545Given
4546  struct A {};
4547  A a[7];
4548  int b[7];
4549arrayType(hasElementType(builtinType()))
4550  matches "int b[7]"
4551
4552Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
4553</pre></td></tr>
4554
4555
4556<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
4557<tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
4558
4559Given
4560  _Atomic(int) i;
4561  _Atomic(float) f;
4562atomicType(hasValueType(isInteger()))
4563 matches "_Atomic(int) i"
4564
4565Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
4566</pre></td></tr>
4567
4568
4569<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
4570<tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
4571
4572Note: There is no TypeLoc for the deduced type and thus no
4573getDeducedLoc() matcher.
4574
4575Given
4576  auto a = 1;
4577  auto b = 2.0;
4578autoType(hasDeducedType(isInteger()))
4579  matches "auto a"
4580
4581Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
4582</pre></td></tr>
4583
4584
4585<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasEitherOperand0')"><a name="hasEitherOperand0Anchor">hasEitherOperand</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;  InnerMatcher</td></tr>
4586<tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
4587binary operator matches.
4588</pre></td></tr>
4589
4590
4591<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4592<tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
4593
4594Example matches a (matcher = binaryOperator(hasLHS()))
4595  a || b
4596</pre></td></tr>
4597
4598
4599<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4600<tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
4601
4602Example matches b (matcher = binaryOperator(hasRHS()))
4603  a || b
4604</pre></td></tr>
4605
4606
4607<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyParameter2')"><a name="hasAnyParameter2Anchor">hasAnyParameter</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
4608<tr><td colspan="4" class="doc" id="hasAnyParameter2"><pre>Matches any parameter of a function or an ObjC method declaration or a
4609block.
4610
4611Does not match the 'this' parameter of a method.
4612
4613Given
4614  class X { void f(int x, int y, int z) {} };
4615cxxMethodDecl(hasAnyParameter(hasName("y")))
4616  matches f(int x, int y, int z) {}
4617with hasAnyParameter(...)
4618  matching int y
4619
4620For ObjectiveC, given
4621  @interface I - (void) f:(int) y; @end
4622
4623the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
4624matches the declaration of method f with hasParameter
4625matching y.
4626
4627For blocks, given
4628  b = ^(int y) { printf("%d", y) };
4629
4630the matcher blockDecl(hasAnyParameter(hasName("y")))
4631matches the declaration of the block b with hasParameter
4632matching y.
4633</pre></td></tr>
4634
4635
4636<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;</td><td class="name" onclick="toggle('hasParameter2')"><a name="hasParameter2Anchor">hasParameter</a></td><td>unsigned N, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
4637<tr><td colspan="4" class="doc" id="hasParameter2"><pre>Matches the n'th parameter of a function or an ObjC method
4638declaration or a block.
4639
4640Given
4641  class X { void f(int x) {} };
4642cxxMethodDecl(hasParameter(0, hasType(varDecl())))
4643  matches f(int x) {}
4644with hasParameter(...)
4645  matching int x
4646
4647For ObjectiveC, given
4648  @interface I - (void) f:(int) y; @end
4649
4650the matcher objcMethodDecl(hasParameter(0, hasName("y")))
4651matches the declaration of method f with hasParameter
4652matching y.
4653</pre></td></tr>
4654
4655
4656<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
4657<tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
4658pointee matches a given matcher.
4659
4660Given
4661  int *a;
4662  int const *b;
4663  float const *f;
4664pointerType(pointee(isConstQualified(), isInteger()))
4665  matches "int const *b"
4666
4667Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
4668  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
4669</pre></td></tr>
4670
4671
4672<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; ArgMatcher, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; ParamMatcher</td></tr>
4673<tr><td colspan="4" class="doc" id="forEachArgumentWithParam1"><pre>Matches all arguments and their respective ParmVarDecl.
4674
4675Given
4676  void f(int i);
4677  int y;
4678  f(y);
4679callExpr(
4680  forEachArgumentWithParam(
4681    declRefExpr(to(varDecl(hasName("y")))),
4682    parmVarDecl(hasType(isInteger()))
4683))
4684  matches f(y);
4685with declRefExpr(...)
4686  matching int y
4687and parmVarDecl(...)
4688  matching int i
4689</pre></td></tr>
4690
4691
4692<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4693<tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
4694expression, or an ObjC-message-send expression.
4695
4696Given
4697  void x(int, int, int) { int y; x(1, y, 42); }
4698callExpr(hasAnyArgument(declRefExpr()))
4699  matches x(1, y, 42)
4700with hasAnyArgument(...)
4701  matching y
4702
4703For ObjectiveC, given
4704  @interface I - (void) f:(int) y; @end
4705  void foo(I *i) { [i f:12]; }
4706objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
4707  matches [i f:12]
4708</pre></td></tr>
4709
4710
4711<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4712<tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
4713call expression.
4714
4715Example matches y in x(y)
4716    (matcher = callExpr(hasArgument(0, declRefExpr())))
4717  void x(int) { int y; x(y); }
4718</pre></td></tr>
4719
4720
4721<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration13')"><a name="hasDeclaration13Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4722<tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
4723matches the given matcher.
4724
4725The associated declaration is:
4726- for type nodes, the declaration of the underlying type
4727- for CallExpr, the declaration of the callee
4728- for MemberExpr, the declaration of the referenced member
4729- for CXXConstructExpr, the declaration of the constructor
4730- for CXXNewExpr, the declaration of the operator new
4731- for ObjCIvarExpr, the declaration of the ivar
4732
4733For type nodes, hasDeclaration will generally match the declaration of the
4734sugared type. Given
4735  class X {};
4736  typedef X Y;
4737  Y y;
4738in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4739typedefDecl. A common use case is to match the underlying, desugared type.
4740This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4741  varDecl(hasType(hasUnqualifiedDesugaredType(
4742      recordType(hasDeclaration(decl())))))
4743In this matcher, the decl will match the CXXRecordDecl of class X.
4744
4745Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
4746  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
4747  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
4748  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
4749  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
4750  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
4751  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4752</pre></td></tr>
4753
4754
4755<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt; InnerMatcher</td></tr>
4756<tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
4757
4758Given
4759  class A { A() : i(42), j(42) {} int i; int j; };
4760cxxConstructorDecl(forEachConstructorInitializer(
4761  forField(decl().bind("x"))
4762))
4763  will trigger two matches, binding for 'i' and 'j' respectively.
4764</pre></td></tr>
4765
4766
4767<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt; InnerMatcher</td></tr>
4768<tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
4769
4770Given
4771  struct Foo {
4772    Foo() : foo_(1) { }
4773    int foo_;
4774  };
4775cxxRecordDecl(has(cxxConstructorDecl(
4776  hasAnyConstructorInitializer(anything())
4777)))
4778  record matches Foo, hasAnyConstructorInitializer matches foo_(1)
4779</pre></td></tr>
4780
4781
4782<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt; InnerMatcher</td></tr>
4783<tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
4784
4785Given
4786  struct Foo {
4787    Foo() : foo_(1) { }
4788    int foo_;
4789  };
4790cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
4791    forField(hasName("foo_"))))))
4792  matches Foo
4793with forField matching foo_
4794</pre></td></tr>
4795
4796
4797<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4798<tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
4799
4800Given
4801  struct Foo {
4802    Foo() : foo_(1) { }
4803    int foo_;
4804  };
4805cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
4806    withInitializer(integerLiteral(equals(1)))))))
4807  matches Foo
4808with withInitializer matching (1)
4809</pre></td></tr>
4810
4811
4812<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;</td><td class="name" onclick="toggle('hasObjectExpression2')"><a name="hasObjectExpression2Anchor">hasObjectExpression</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4813<tr><td colspan="4" class="doc" id="hasObjectExpression2"><pre>Matches a member expression where the object expression is matched by a
4814given matcher. Implicit object expressions are included; that is, it matches
4815use of implicit `this`.
4816
4817Given
4818  struct X {
4819    int m;
4820    int f(X x) { x.m; return m; }
4821  };
4822memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
4823  matches `x.m`, but not `m`; however,
4824memberExpr(hasObjectExpression(hasType(pointsTo(
4825     cxxRecordDecl(hasName("X"))))))
4826  matches `m` (aka. `this-&gt;m`), but not `x.m`.
4827</pre></td></tr>
4828
4829
4830<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
4831<tr><td colspan="4" class="doc" id="hasBody3"><pre>Matches a 'for', 'while', 'do while' statement or a function
4832definition that has a given body.
4833
4834Given
4835  for (;;) {}
4836hasBody(compoundStmt())
4837  matches 'for (;;) {}'
4838with compoundStmt()
4839  matching '{}'
4840</pre></td></tr>
4841
4842
4843<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt; InnerMatcher</td></tr>
4844<tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
4845
4846Example:
4847    forStmt(hasLoopVariable(anything()))
4848matches 'int x' in
4849    for (int x : a) { }
4850</pre></td></tr>
4851
4852
4853<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4854<tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
4855
4856Example:
4857    forStmt(hasRangeInit(anything()))
4858matches 'a' in
4859    for (int x : a) { }
4860</pre></td></tr>
4861
4862
4863<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4864<tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre>Matches on the implicit object argument of a member call expression. Unlike
4865`on`, matches the argument directly without stripping away anything.
4866
4867Given
4868  class Y { public: void m(); };
4869  Y g();
4870  class X : public Y { void g(); };
4871  void z(Y y, X x) { y.m(); x.m(); x.g(); (g()).m(); }
4872cxxMemberCallExpr(onImplicitObjectArgument(hasType(
4873    cxxRecordDecl(hasName("Y")))))
4874  matches `y.m()`, `x.m()` and (g()).m(), but not `x.g()`.
4875cxxMemberCallExpr(on(callExpr()))
4876  does not match `(g()).m()`, because the parens are not ignored.
4877
4878FIXME: Overload to allow directly matching types?
4879</pre></td></tr>
4880
4881
4882<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4883<tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression, after
4884stripping off any parentheses or implicit casts.
4885
4886Given
4887  class Y { public: void m(); };
4888  Y g();
4889  class X : public Y {};
4890  void z(Y y, X x) { y.m(); (g()).m(); x.m(); }
4891cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y")))))
4892  matches `y.m()` and `(g()).m()`.
4893cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("X")))))
4894  matches `x.m()`.
4895cxxMemberCallExpr(on(callExpr()))
4896  matches `(g()).m()`.
4897
4898FIXME: Overload to allow directly matching types?
4899</pre></td></tr>
4900
4901
4902<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
4903<tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
4904</pre></td></tr>
4905
4906
4907<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
4908<tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the type of the expression's implicit object argument either
4909matches the InnerMatcher, or is a pointer to a type that matches the
4910InnerMatcher.
4911
4912Given
4913  class Y { public: void m(); };
4914  class X : public Y { void g(); };
4915  void z() { Y y; y.m(); Y *p; p-&gt;m(); X x; x.m(); x.g(); }
4916cxxMemberCallExpr(thisPointerType(hasDeclaration(
4917    cxxRecordDecl(hasName("Y")))))
4918  matches `y.m()`, `p-&gt;m()` and `x.m()`.
4919cxxMemberCallExpr(thisPointerType(hasDeclaration(
4920    cxxRecordDecl(hasName("X")))))
4921  matches `x.g()`.
4922</pre></td></tr>
4923
4924
4925<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt; InnerMatcher</td></tr>
4926<tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overridden by the given method. This matcher may
4927produce multiple matches.
4928
4929Given
4930  class A { virtual void f(); };
4931  class B : public A { void f(); };
4932  class C : public B { void f(); };
4933cxxMethodDecl(ofClass(hasName("C")),
4934              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4935  matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
4936  that B::f is not overridden by C::f).
4937
4938The check can produce multiple matches in case of multiple inheritance, e.g.
4939  class A1 { virtual void f(); };
4940  class A2 { virtual void f(); };
4941  class C : public A1, public A2 { void f(); };
4942cxxMethodDecl(ofClass(hasName("C")),
4943              forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
4944  matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
4945  once with "b" binding "A2::f" and "d" binding "C::f".
4946</pre></td></tr>
4947
4948
4949<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt; InnerMatcher</td></tr>
4950<tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
4951belongs to.
4952
4953FIXME: Generalize this for other kinds of declarations.
4954FIXME: What other kind of declarations would we need to generalize
4955this to?
4956
4957Example matches A() in the last line
4958    (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
4959        ofClass(hasName("A"))))))
4960  class A {
4961   public:
4962    A();
4963  };
4964  A a = A();
4965</pre></td></tr>
4966
4967
4968<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('hasArraySize0')"><a name="hasArraySize0Anchor">hasArraySize</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
4969<tr><td colspan="4" class="doc" id="hasArraySize0"><pre>Matches array new expressions with a given array size.
4970
4971Given:
4972  MyClass *p1 = new MyClass[10];
4973cxxNewExpr(hasArraySize(intgerLiteral(equals(10))))
4974  matches the expression 'new MyClass[10]'.
4975</pre></td></tr>
4976
4977
4978<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration12')"><a name="hasDeclaration12Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
4979<tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
4980matches the given matcher.
4981
4982The associated declaration is:
4983- for type nodes, the declaration of the underlying type
4984- for CallExpr, the declaration of the callee
4985- for MemberExpr, the declaration of the referenced member
4986- for CXXConstructExpr, the declaration of the constructor
4987- for CXXNewExpr, the declaration of the operator new
4988- for ObjCIvarExpr, the declaration of the ivar
4989
4990For type nodes, hasDeclaration will generally match the declaration of the
4991sugared type. Given
4992  class X {};
4993  typedef X Y;
4994  Y y;
4995in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4996typedefDecl. A common use case is to match the underlying, desugared type.
4997This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4998  varDecl(hasType(hasUnqualifiedDesugaredType(
4999      recordType(hasDeclaration(decl())))))
5000In this matcher, the decl will match the CXXRecordDecl of class X.
5001
5002Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5003  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5004  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5005  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5006  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5007  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5008  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5009</pre></td></tr>
5010
5011
5012<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt; InnerMatcher</td></tr>
5013<tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
5014
5015Given:
5016  class A { void func(); };
5017  class B { void member(); };
5018
5019cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
5020A but not B.
5021</pre></td></tr>
5022
5023
5024<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
5025<tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from
5026a class matching Base.
5027
5028Note that a class is not considered to be derived from itself.
5029
5030Example matches Y, Z, C (Base == hasName("X"))
5031  class X;
5032  class Y : public X {};  // directly derived
5033  class Z : public Y {};  // indirectly derived
5034  typedef X A;
5035  typedef A B;
5036  class C : public B {};  // derived from a typedef of X
5037
5038In the following example, Bar matches isDerivedFrom(hasName("X")):
5039  class Foo;
5040  typedef Foo X;
5041  class Bar : public Foo {};  // derived from a type that X is a typedef of
5042</pre></td></tr>
5043
5044
5045<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
5046<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
5047match Base.
5048</pre></td></tr>
5049
5050
5051<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyArgument2')"><a name="hasAnyArgument2Anchor">hasAnyArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5052<tr><td colspan="4" class="doc" id="hasAnyArgument2"><pre>Matches any argument of a call expression or a constructor call
5053expression, or an ObjC-message-send expression.
5054
5055Given
5056  void x(int, int, int) { int y; x(1, y, 42); }
5057callExpr(hasAnyArgument(declRefExpr()))
5058  matches x(1, y, 42)
5059with hasAnyArgument(...)
5060  matching y
5061
5062For ObjectiveC, given
5063  @interface I - (void) f:(int) y; @end
5064  void foo(I *i) { [i f:12]; }
5065objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
5066  matches [i f:12]
5067</pre></td></tr>
5068
5069
5070<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5071<tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
5072given matcher.
5073
5074Example matches y.x() (matcher = callExpr(callee(
5075                                   cxxMethodDecl(hasName("x")))))
5076  class Y { public: void x(); };
5077  void z() { Y y; y.x(); }
5078</pre></td></tr>
5079
5080
5081<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5082<tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches.
5083
5084Given
5085  class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
5086  void f() { f(); }
5087callExpr(callee(expr()))
5088  matches this-&gt;x(), x(), y.x(), f()
5089with callee(...)
5090  matching this-&gt;x, x, y.x, f respectively
5091
5092Note: Callee cannot take the more general internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
5093because this introduces ambiguous overloads with calls to Callee taking a
5094internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
5095implemented in terms of implicit casts.
5096</pre></td></tr>
5097
5098
5099<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; ArgMatcher, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; ParamMatcher</td></tr>
5100<tr><td colspan="4" class="doc" id="forEachArgumentWithParam0"><pre>Matches all arguments and their respective ParmVarDecl.
5101
5102Given
5103  void f(int i);
5104  int y;
5105  f(y);
5106callExpr(
5107  forEachArgumentWithParam(
5108    declRefExpr(to(varDecl(hasName("y")))),
5109    parmVarDecl(hasType(isInteger()))
5110))
5111  matches f(y);
5112with declRefExpr(...)
5113  matching int y
5114and parmVarDecl(...)
5115  matching int i
5116</pre></td></tr>
5117
5118
5119<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5120<tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
5121expression, or an ObjC-message-send expression.
5122
5123Given
5124  void x(int, int, int) { int y; x(1, y, 42); }
5125callExpr(hasAnyArgument(declRefExpr()))
5126  matches x(1, y, 42)
5127with hasAnyArgument(...)
5128  matching y
5129
5130For ObjectiveC, given
5131  @interface I - (void) f:(int) y; @end
5132  void foo(I *i) { [i f:12]; }
5133objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
5134  matches [i f:12]
5135</pre></td></tr>
5136
5137
5138<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5139<tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
5140call expression.
5141
5142Example matches y in x(y)
5143    (matcher = callExpr(hasArgument(0, declRefExpr())))
5144  void x(int) { int y; x(y); }
5145</pre></td></tr>
5146
5147
5148<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration14')"><a name="hasDeclaration14Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5149<tr><td colspan="4" class="doc" id="hasDeclaration14"><pre>Matches a node if the declaration associated with that node
5150matches the given matcher.
5151
5152The associated declaration is:
5153- for type nodes, the declaration of the underlying type
5154- for CallExpr, the declaration of the callee
5155- for MemberExpr, the declaration of the referenced member
5156- for CXXConstructExpr, the declaration of the constructor
5157- for CXXNewExpr, the declaration of the operator new
5158- for ObjCIvarExpr, the declaration of the ivar
5159
5160For type nodes, hasDeclaration will generally match the declaration of the
5161sugared type. Given
5162  class X {};
5163  typedef X Y;
5164  Y y;
5165in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5166typedefDecl. A common use case is to match the underlying, desugared type.
5167This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5168  varDecl(hasType(hasUnqualifiedDesugaredType(
5169      recordType(hasDeclaration(decl())))))
5170In this matcher, the decl will match the CXXRecordDecl of class X.
5171
5172Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5173  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5174  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5175  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5176  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5177  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5178  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5179</pre></td></tr>
5180
5181
5182<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5183<tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
5184extension, matches the constant given in the statement.
5185
5186Given
5187  switch (1) { case 1: case 1+1: case 3 ... 4: ; }
5188caseStmt(hasCaseConstant(integerLiteral()))
5189  matches "case 1:"
5190</pre></td></tr>
5191
5192
5193<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5194<tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression
5195or opaque value's source expression matches the given matcher.
5196
5197Example 1: matches "a string"
5198(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
5199class URL { URL(string); };
5200URL url = "a string";
5201
5202Example 2: matches 'b' (matcher =
5203opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
5204int a = b ?: 1;
5205</pre></td></tr>
5206
5207
5208<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
5209<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5210functionDecl that have at least one TemplateArgument matching the given
5211InnerMatcher.
5212
5213Given
5214  template&lt;typename T&gt; class A {};
5215  template&lt;&gt; class A&lt;double&gt; {};
5216  A&lt;int&gt; a;
5217
5218  template&lt;typename T&gt; f() {};
5219  void func() { f&lt;int&gt;(); };
5220
5221classTemplateSpecializationDecl(hasAnyTemplateArgument(
5222    refersToType(asString("int"))))
5223  matches the specialization A&lt;int&gt;
5224
5225functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
5226  matches the specialization f&lt;int&gt;
5227</pre></td></tr>
5228
5229
5230<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('hasSpecializedTemplate0')"><a name="hasSpecializedTemplate0Anchor">hasSpecializedTemplate</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateDecl.html">ClassTemplateDecl</a>&gt; InnerMatcher</td></tr>
5231<tr><td colspan="4" class="doc" id="hasSpecializedTemplate0"><pre>Matches the specialized template of a specialization declaration.
5232
5233Given
5234  template&lt;typename T&gt; class A {}; #1
5235  template&lt;&gt; class A&lt;int&gt; {}; #2
5236classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl()))
5237  matches '#2' with classTemplateDecl() matching the class template
5238  declaration of 'A' at #1.
5239</pre></td></tr>
5240
5241
5242<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
5243<tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5244functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
5245
5246Given
5247  template&lt;typename T, typename U&gt; class A {};
5248  A&lt;bool, int&gt; b;
5249  A&lt;int, bool&gt; c;
5250
5251  template&lt;typename T&gt; void f() {}
5252  void func() { f&lt;int&gt;(); };
5253classTemplateSpecializationDecl(hasTemplateArgument(
5254    1, refersToType(asString("int"))))
5255  matches the specialization A&lt;bool, int&gt;
5256
5257functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
5258  matches the specialization f&lt;int&gt;
5259</pre></td></tr>
5260
5261
5262<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
5263<tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
5264type.
5265
5266Given
5267  struct A {};
5268  A a[7];
5269  int b[7];
5270arrayType(hasElementType(builtinType()))
5271  matches "int b[7]"
5272
5273Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
5274</pre></td></tr>
5275
5276
5277<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5278<tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
5279a given matcher. Also matches StmtExprs that have CompoundStmt as children.
5280
5281Given
5282  { {}; 1+2; }
5283hasAnySubstatement(compoundStmt())
5284  matches '{ {}; 1+2; }'
5285with compoundStmt()
5286  matching '{}'
5287</pre></td></tr>
5288
5289
5290<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerType</td></tr>
5291<tr><td colspan="4" class="doc" id="hasDecayedType0"><pre>Matches the decayed type, whos decayed type matches InnerMatcher
5292</pre></td></tr>
5293
5294
5295<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration11')"><a name="hasDeclaration11Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5296<tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
5297matches the given matcher.
5298
5299The associated declaration is:
5300- for type nodes, the declaration of the underlying type
5301- for CallExpr, the declaration of the callee
5302- for MemberExpr, the declaration of the referenced member
5303- for CXXConstructExpr, the declaration of the constructor
5304- for CXXNewExpr, the declaration of the operator new
5305- for ObjCIvarExpr, the declaration of the ivar
5306
5307For type nodes, hasDeclaration will generally match the declaration of the
5308sugared type. Given
5309  class X {};
5310  typedef X Y;
5311  Y y;
5312in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5313typedefDecl. A common use case is to match the underlying, desugared type.
5314This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5315  varDecl(hasType(hasUnqualifiedDesugaredType(
5316      recordType(hasDeclaration(decl())))))
5317In this matcher, the decl will match the CXXRecordDecl of class X.
5318
5319Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5320  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5321  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5322  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5323  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5324  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5325  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5326</pre></td></tr>
5327
5328
5329<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>&gt; InnerMatcher</td></tr>
5330<tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a
5331specific using shadow declaration.
5332
5333Given
5334  namespace a { void f() {} }
5335  using a::f;
5336  void g() {
5337    f();     // Matches this ..
5338    a::f();  // .. but not this.
5339  }
5340declRefExpr(throughUsingDecl(anything()))
5341  matches f()
5342</pre></td></tr>
5343
5344
5345<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5346<tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
5347specified matcher.
5348
5349Example matches x in if(x)
5350    (matcher = declRefExpr(to(varDecl(hasName("x")))))
5351  bool x;
5352  if (x) {}
5353</pre></td></tr>
5354
5355
5356<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5357<tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
5358
5359Note that this does not work for global declarations because the AST
5360breaks up multiple-declaration DeclStmt's into multiple single-declaration
5361DeclStmt's.
5362Example: Given non-global declarations
5363  int a, b = 0;
5364  int c;
5365  int d = 2, e;
5366declStmt(containsDeclaration(
5367      0, varDecl(hasInitializer(anything()))))
5368  matches only 'int d = 2, e;', and
5369declStmt(containsDeclaration(1, varDecl()))
5370  matches 'int a, b = 0' as well as 'int d = 2, e;'
5371  but 'int c;' is not matched.
5372</pre></td></tr>
5373
5374
5375<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5376<tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
5377
5378Given
5379  int a, b;
5380  int c;
5381declStmt(hasSingleDecl(anything()))
5382  matches 'int c;' but not 'int a, b;'.
5383</pre></td></tr>
5384
5385
5386<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
5387<tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches
5388the inner matcher.
5389
5390Given
5391  int x;
5392declaratorDecl(hasTypeLoc(loc(asString("int"))))
5393  matches int x
5394</pre></td></tr>
5395
5396
5397<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5398<tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
5399Decl, matches InnerMatcher.
5400
5401Given
5402  namespace N {
5403    namespace M {
5404      class D {};
5405    }
5406  }
5407
5408cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
5409declaration of class D.
5410</pre></td></tr>
5411
5412
5413<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;</td><td class="name" onclick="toggle('hasUnderlyingType0')"><a name="hasUnderlyingType0Anchor">hasUnderlyingType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
5414<tr><td colspan="4" class="doc" id="hasUnderlyingType0"><pre>Matches DecltypeType nodes to find out the underlying type.
5415
5416Given
5417  decltype(1) a = 1;
5418  decltype(2.0) b = 2.0;
5419decltypeType(hasUnderlyingType(isInteger()))
5420  matches the type of "a"
5421
5422Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;
5423</pre></td></tr>
5424
5425
5426<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5427<tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', 'do while' statement or a function
5428definition that has a given body.
5429
5430Given
5431  for (;;) {}
5432hasBody(compoundStmt())
5433  matches 'for (;;) {}'
5434with compoundStmt()
5435  matching '{}'
5436</pre></td></tr>
5437
5438
5439<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5440<tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
5441switch statement or conditional operator.
5442
5443Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5444  if (true) {}
5445</pre></td></tr>
5446
5447
5448<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt; InnerMatcher</td></tr>
5449<tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
5450matches InnerMatcher if the qualifier exists.
5451
5452Given
5453  namespace N {
5454    namespace M {
5455      class D {};
5456    }
5457  }
5458  N::M::D d;
5459
5460elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
5461matches the type of the variable declaration of d.
5462</pre></td></tr>
5463
5464
5465<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
5466<tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
5467
5468Given
5469  namespace N {
5470    namespace M {
5471      class D {};
5472    }
5473  }
5474  N::M::D d;
5475
5476elaboratedType(namesType(recordType(
5477hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
5478declaration of d.
5479</pre></td></tr>
5480
5481
5482<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration10')"><a name="hasDeclaration10Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5483<tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
5484matches the given matcher.
5485
5486The associated declaration is:
5487- for type nodes, the declaration of the underlying type
5488- for CallExpr, the declaration of the callee
5489- for MemberExpr, the declaration of the referenced member
5490- for CXXConstructExpr, the declaration of the constructor
5491- for CXXNewExpr, the declaration of the operator new
5492- for ObjCIvarExpr, the declaration of the ivar
5493
5494For type nodes, hasDeclaration will generally match the declaration of the
5495sugared type. Given
5496  class X {};
5497  typedef X Y;
5498  Y y;
5499in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5500typedefDecl. A common use case is to match the underlying, desugared type.
5501This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5502  varDecl(hasType(hasUnqualifiedDesugaredType(
5503      recordType(hasDeclaration(decl())))))
5504In this matcher, the decl will match the CXXRecordDecl of class X.
5505
5506Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5507  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5508  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5509  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5510  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5511  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5512  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5513</pre></td></tr>
5514
5515
5516<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
5517<tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
5518
5519(Note: Clang's AST refers to other conversions as "casts" too, and calls
5520actual casts "explicit" casts.)
5521</pre></td></tr>
5522
5523
5524<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('hasType4')"><a name="hasType4Anchor">hasType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5525<tr><td colspan="4" class="doc" id="hasType4"><pre>Overloaded to match the declaration of the expression's or value
5526declaration's type.
5527
5528In case of a value declaration (for example a variable declaration),
5529this resolves one layer of indirection. For example, in the value
5530declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5531X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5532declaration of x.
5533
5534Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5535            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5536            and friend class X (matcher = friendDecl(hasType("X"))
5537 class X {};
5538 void y(X &amp;x) { x; X z; }
5539 class Y { friend class X; };
5540
5541Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;
5542</pre></td></tr>
5543
5544
5545<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
5546<tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
5547matcher.
5548
5549Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5550            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5551            and U (matcher = typedefDecl(hasType(asString("int")))
5552            and friend class X (matcher = friendDecl(hasType("X"))
5553 class X {};
5554 void y(X &amp;x) { x; X z; }
5555 typedef int U;
5556 class Y { friend class X; };
5557</pre></td></tr>
5558
5559
5560<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5561<tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
5562are stripped off.
5563
5564Parentheses and explicit casts are not discarded.
5565Given
5566  int arr[5];
5567  int a = 0;
5568  char b = 0;
5569  const int c = a;
5570  int *d = arr;
5571  long e = (long) 0l;
5572The matchers
5573   varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
5574   varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
5575would match the declarations for a, b, c, and d, but not e.
5576While
5577   varDecl(hasInitializer(integerLiteral()))
5578   varDecl(hasInitializer(declRefExpr()))
5579only match the declarations for b, c, and d.
5580</pre></td></tr>
5581
5582
5583<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('ignoringImplicit0')"><a name="ignoringImplicit0Anchor">ignoringImplicit</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5584<tr><td colspan="4" class="doc" id="ignoringImplicit0"><pre>Matches expressions that match InnerMatcher after any implicit AST
5585nodes are stripped off.
5586
5587Parentheses and explicit casts are not discarded.
5588Given
5589  class C {};
5590  C a = C();
5591  C b;
5592  C c = b;
5593The matchers
5594   varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr())))
5595would match the declarations for a, b, and c.
5596While
5597   varDecl(hasInitializer(cxxConstructExpr()))
5598only match the declarations for b and c.
5599</pre></td></tr>
5600
5601
5602<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5603<tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
5604casts are stripped off.
5605
5606Implicit and non-C Style casts are also discarded.
5607Given
5608  int a = 0;
5609  char b = (0);
5610  void* c = reinterpret_cast&lt;char*&gt;(0);
5611  char d = char(0);
5612The matcher
5613   varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
5614would match the declarations for a, b, c, and d.
5615while
5616   varDecl(hasInitializer(integerLiteral()))
5617only match the declaration for a.
5618</pre></td></tr>
5619
5620
5621<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5622<tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
5623parentheses are stripped off.
5624
5625Explicit casts are not discarded.
5626Given
5627  int arr[5];
5628  int a = 0;
5629  char b = (0);
5630  const int c = a;
5631  int *d = (arr);
5632  long e = ((long) 0l);
5633The matchers
5634   varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
5635   varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
5636would match the declarations for a, b, c, and d, but not e.
5637while
5638   varDecl(hasInitializer(integerLiteral()))
5639   varDecl(hasInitializer(declRefExpr()))
5640would only match the declaration for a.
5641</pre></td></tr>
5642
5643
5644<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('ignoringParens1')"><a name="ignoringParens1Anchor">ignoringParens</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5645<tr><td colspan="4" class="doc" id="ignoringParens1"><pre>Overload ignoringParens for Expr.
5646
5647Given
5648  const char* str = ("my-string");
5649The matcher
5650  implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral())))
5651would match the implicit cast resulting from the assignment.
5652</pre></td></tr>
5653
5654
5655<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt;</td><td class="name" onclick="toggle('hasInClassInitializer0')"><a name="hasInClassInitializer0Anchor">hasInClassInitializer</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5656<tr><td colspan="4" class="doc" id="hasInClassInitializer0"><pre>Matches non-static data members that have an in-class initializer.
5657
5658Given
5659  class C {
5660    int a = 2;
5661    int b = 3;
5662    int c;
5663  };
5664fieldDecl(hasInClassInitializer(integerLiteral(equals(2))))
5665  matches 'int a;' but not 'int b;'.
5666fieldDecl(hasInClassInitializer(anything()))
5667  matches 'int a;' and 'int b;' but not 'int c;'.
5668</pre></td></tr>
5669
5670
5671<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5672<tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', 'do while' statement or a function
5673definition that has a given body.
5674
5675Given
5676  for (;;) {}
5677hasBody(compoundStmt())
5678  matches 'for (;;) {}'
5679with compoundStmt()
5680  matching '{}'
5681</pre></td></tr>
5682
5683
5684<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5685<tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
5686switch statement or conditional operator.
5687
5688Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5689  if (true) {}
5690</pre></td></tr>
5691
5692
5693<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5694<tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
5695
5696Example:
5697    forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
5698matches '++x' in
5699    for (x; x &lt; N; ++x) { }
5700</pre></td></tr>
5701
5702
5703<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5704<tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
5705
5706Example:
5707    forStmt(hasLoopInit(declStmt()))
5708matches 'int x = 0' in
5709    for (int x = 0; x &lt; N; ++x) { }
5710</pre></td></tr>
5711
5712
5713<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FriendDecl.html">FriendDecl</a>&gt;</td><td class="name" onclick="toggle('hasType5')"><a name="hasType5Anchor">hasType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5714<tr><td colspan="4" class="doc" id="hasType5"><pre>Overloaded to match the declaration of the expression's or value
5715declaration's type.
5716
5717In case of a value declaration (for example a variable declaration),
5718this resolves one layer of indirection. For example, in the value
5719declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5720X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5721declaration of x.
5722
5723Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5724            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5725            and friend class X (matcher = friendDecl(hasType("X"))
5726 class X {};
5727 void y(X &amp;x) { x; X z; }
5728 class Y { friend class X; };
5729
5730Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;
5731</pre></td></tr>
5732
5733
5734<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FriendDecl.html">FriendDecl</a>&gt;</td><td class="name" onclick="toggle('hasType1')"><a name="hasType1Anchor">hasType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
5735<tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
5736matcher.
5737
5738Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5739            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5740            and U (matcher = typedefDecl(hasType(asString("int")))
5741            and friend class X (matcher = friendDecl(hasType("X"))
5742 class X {};
5743 void y(X &amp;x) { x; X z; }
5744 typedef int U;
5745 class Y { friend class X; };
5746</pre></td></tr>
5747
5748
5749<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
5750<tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function or an ObjC method declaration or a
5751block.
5752
5753Does not match the 'this' parameter of a method.
5754
5755Given
5756  class X { void f(int x, int y, int z) {} };
5757cxxMethodDecl(hasAnyParameter(hasName("y")))
5758  matches f(int x, int y, int z) {}
5759with hasAnyParameter(...)
5760  matching int y
5761
5762For ObjectiveC, given
5763  @interface I - (void) f:(int) y; @end
5764
5765the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
5766matches the declaration of method f with hasParameter
5767matching y.
5768
5769For blocks, given
5770  b = ^(int y) { printf("%d", y) };
5771
5772the matcher blockDecl(hasAnyParameter(hasName("y")))
5773matches the declaration of the block b with hasParameter
5774matching y.
5775</pre></td></tr>
5776
5777
5778<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgument2')"><a name="hasAnyTemplateArgument2Anchor">hasAnyTemplateArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
5779<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5780functionDecl that have at least one TemplateArgument matching the given
5781InnerMatcher.
5782
5783Given
5784  template&lt;typename T&gt; class A {};
5785  template&lt;&gt; class A&lt;double&gt; {};
5786  A&lt;int&gt; a;
5787
5788  template&lt;typename T&gt; f() {};
5789  void func() { f&lt;int&gt;(); };
5790
5791classTemplateSpecializationDecl(hasAnyTemplateArgument(
5792    refersToType(asString("int"))))
5793  matches the specialization A&lt;int&gt;
5794
5795functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
5796  matches the specialization f&lt;int&gt;
5797</pre></td></tr>
5798
5799
5800<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5801<tr><td colspan="4" class="doc" id="hasBody4"><pre>Matches a 'for', 'while', 'do while' statement or a function
5802definition that has a given body.
5803
5804Given
5805  for (;;) {}
5806hasBody(compoundStmt())
5807  matches 'for (;;) {}'
5808with compoundStmt()
5809  matching '{}'
5810</pre></td></tr>
5811
5812
5813<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
5814<tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function or an ObjC method
5815declaration or a block.
5816
5817Given
5818  class X { void f(int x) {} };
5819cxxMethodDecl(hasParameter(0, hasType(varDecl())))
5820  matches f(int x) {}
5821with hasParameter(...)
5822  matching int x
5823
5824For ObjectiveC, given
5825  @interface I - (void) f:(int) y; @end
5826
5827the matcher objcMethodDecl(hasParameter(0, hasName("y")))
5828matches the declaration of method f with hasParameter
5829matching y.
5830</pre></td></tr>
5831
5832
5833<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgument2')"><a name="hasTemplateArgument2Anchor">hasTemplateArgument</a></td><td>unsigned N, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
5834<tr><td colspan="4" class="doc" id="hasTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5835functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
5836
5837Given
5838  template&lt;typename T, typename U&gt; class A {};
5839  A&lt;bool, int&gt; b;
5840  A&lt;int, bool&gt; c;
5841
5842  template&lt;typename T&gt; void f() {}
5843  void func() { f&lt;int&gt;(); };
5844classTemplateSpecializationDecl(hasTemplateArgument(
5845    1, refersToType(asString("int"))))
5846  matches the specialization A&lt;bool, int&gt;
5847
5848functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
5849  matches the specialization f&lt;int&gt;
5850</pre></td></tr>
5851
5852
5853<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
5854<tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
5855
5856Given:
5857  class X { int f() { return 1; } };
5858cxxMethodDecl(returns(asString("int")))
5859  matches int f() { return 1; }
5860</pre></td></tr>
5861
5862
5863<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5864<tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
5865switch statement or conditional operator.
5866
5867Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5868  if (true) {}
5869</pre></td></tr>
5870
5871
5872<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>&gt; InnerMatcher</td></tr>
5873<tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
5874
5875Given
5876  if (A* a = GetAPointer()) {}
5877hasConditionVariableStatement(...)
5878  matches 'A* a = GetAPointer()'.
5879</pre></td></tr>
5880
5881
5882<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5883<tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
5884
5885Examples matches the if statement
5886  (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
5887  if (false) false; else true;
5888</pre></td></tr>
5889
5890
5891<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5892<tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
5893
5894Examples matches the if statement
5895  (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
5896  if (false) true; else false;
5897</pre></td></tr>
5898
5899
5900<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
5901<tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
5902matcher.
5903
5904FIXME: Unit test this matcher
5905</pre></td></tr>
5906
5907
5908<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InitListExpr.html">InitListExpr</a>&gt;</td><td class="name" onclick="toggle('hasInit0')"><a name="hasInit0Anchor">hasInit</a></td><td>unsigned N, ast_matchers::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5909<tr><td colspan="4" class="doc" id="hasInit0"><pre>Matches the n'th item of an initializer list expression.
5910
5911Example matches y.
5912    (matcher = initListExpr(hasInit(0, expr())))
5913  int x{y}.
5914</pre></td></tr>
5915
5916
5917<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5918<tr><td colspan="4" class="doc" id="hasSyntacticForm0"><pre>Matches the syntactic form of init list expressions
5919(if expression have it).
5920</pre></td></tr>
5921
5922
5923<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration9')"><a name="hasDeclaration9Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5924<tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
5925matches the given matcher.
5926
5927The associated declaration is:
5928- for type nodes, the declaration of the underlying type
5929- for CallExpr, the declaration of the callee
5930- for MemberExpr, the declaration of the referenced member
5931- for CXXConstructExpr, the declaration of the constructor
5932- for CXXNewExpr, the declaration of the operator new
5933- for ObjCIvarExpr, the declaration of the ivar
5934
5935For type nodes, hasDeclaration will generally match the declaration of the
5936sugared type. Given
5937  class X {};
5938  typedef X Y;
5939  Y y;
5940in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5941typedefDecl. A common use case is to match the underlying, desugared type.
5942This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5943  varDecl(hasType(hasUnqualifiedDesugaredType(
5944      recordType(hasDeclaration(decl())))))
5945In this matcher, the decl will match the CXXRecordDecl of class X.
5946
5947Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5948  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5949  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5950  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5951  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5952  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5953  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5954</pre></td></tr>
5955
5956
5957<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration8')"><a name="hasDeclaration8Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5958<tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
5959matches the given matcher.
5960
5961The associated declaration is:
5962- for type nodes, the declaration of the underlying type
5963- for CallExpr, the declaration of the callee
5964- for MemberExpr, the declaration of the referenced member
5965- for CXXConstructExpr, the declaration of the constructor
5966- for CXXNewExpr, the declaration of the operator new
5967- for ObjCIvarExpr, the declaration of the ivar
5968
5969For type nodes, hasDeclaration will generally match the declaration of the
5970sugared type. Given
5971  class X {};
5972  typedef X Y;
5973  Y y;
5974in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5975typedefDecl. A common use case is to match the underlying, desugared type.
5976This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5977  varDecl(hasType(hasUnqualifiedDesugaredType(
5978      recordType(hasDeclaration(decl())))))
5979In this matcher, the decl will match the CXXRecordDecl of class X.
5980
5981Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
5982  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
5983  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
5984  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
5985  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
5986  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
5987  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5988</pre></td></tr>
5989
5990
5991<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration7')"><a name="hasDeclaration7Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
5992<tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
5993matches the given matcher.
5994
5995The associated declaration is:
5996- for type nodes, the declaration of the underlying type
5997- for CallExpr, the declaration of the callee
5998- for MemberExpr, the declaration of the referenced member
5999- for CXXConstructExpr, the declaration of the constructor
6000- for CXXNewExpr, the declaration of the operator new
6001- for ObjCIvarExpr, the declaration of the ivar
6002
6003For type nodes, hasDeclaration will generally match the declaration of the
6004sugared type. Given
6005  class X {};
6006  typedef X Y;
6007  Y y;
6008in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6009typedefDecl. A common use case is to match the underlying, desugared type.
6010This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6011  varDecl(hasType(hasUnqualifiedDesugaredType(
6012      recordType(hasDeclaration(decl())))))
6013In this matcher, the decl will match the CXXRecordDecl of class X.
6014
6015Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6016  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6017  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6018  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6019  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6020  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6021  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6022</pre></td></tr>
6023
6024
6025<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6026<tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is matched by a
6027given matcher. Implicit object expressions are included; that is, it matches
6028use of implicit `this`.
6029
6030Given
6031  struct X {
6032    int m;
6033    int f(X x) { x.m; return m; }
6034  };
6035memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
6036  matches `x.m`, but not `m`; however,
6037memberExpr(hasObjectExpression(hasType(pointsTo(
6038     cxxRecordDecl(hasName("X"))))))
6039  matches `m` (aka. `this-&gt;m`), but not `x.m`.
6040</pre></td></tr>
6041
6042
6043<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt; InnerMatcher</td></tr>
6044<tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
6045given matcher.
6046
6047Given
6048  struct { int first, second; } first, second;
6049  int i(second.first);
6050  int j(first.second);
6051memberExpr(member(hasName("first")))
6052  matches second.first
6053  but not first.second (because the member name there is "second").
6054</pre></td></tr>
6055
6056
6057<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
6058<tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
6059pointee matches a given matcher.
6060
6061Given
6062  int *a;
6063  int const *b;
6064  float const *f;
6065pointerType(pointee(isConstQualified(), isInteger()))
6066  matches "int const *b"
6067
6068Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
6069  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
6070</pre></td></tr>
6071
6072
6073<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</td><td class="name" onclick="toggle('hasUnderlyingDecl0')"><a name="hasUnderlyingDecl0Anchor">hasUnderlyingDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; InnerMatcher</td></tr>
6074<tr><td colspan="4" class="doc" id="hasUnderlyingDecl0"><pre>Matches a NamedDecl whose underlying declaration matches the given
6075matcher.
6076
6077Given
6078  namespace N { template&lt;class T&gt; void f(T t); }
6079  template &lt;class T&gt; void g() { using N::f; f(T()); }
6080unresolvedLookupExpr(hasAnyDeclaration(
6081    namedDecl(hasUnderlyingDecl(hasName("::N::f")))))
6082  matches the use of f in g() .
6083</pre></td></tr>
6084
6085
6086<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt; InnerMatcher</td></tr>
6087<tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
6088
6089Given
6090  struct A { struct B { struct C {}; }; };
6091  A::B::C c;
6092nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
6093  matches "A::"
6094</pre></td></tr>
6095
6096
6097<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; InnerMatcher</td></tr>
6098<tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
6099given TypeLoc.
6100
6101Given
6102  struct A { struct B { struct C {}; }; };
6103  A::B::C c;
6104nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
6105  hasDeclaration(cxxRecordDecl(hasName("A")))))))
6106  matches "A::"
6107</pre></td></tr>
6108
6109
6110<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt; InnerMatcher</td></tr>
6111<tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
6112
6113Given
6114  struct A { struct B { struct C {}; }; };
6115  A::B::C c;
6116nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
6117  matches "A::"
6118</pre></td></tr>
6119
6120
6121<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>&gt; InnerMatcher</td></tr>
6122<tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
6123given namespace matcher.
6124
6125Given
6126  namespace ns { struct A {}; }
6127  ns::A a;
6128nestedNameSpecifier(specifiesNamespace(hasName("ns")))
6129  matches "ns::"
6130</pre></td></tr>
6131
6132
6133<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6134<tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
6135given QualType matcher without qualifiers.
6136
6137Given
6138  struct A { struct B { struct C {}; }; };
6139  A::B::C c;
6140nestedNameSpecifier(specifiesType(
6141  hasDeclaration(cxxRecordDecl(hasName("A")))
6142))
6143  matches "A::"
6144</pre></td></tr>
6145
6146
6147<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyArgument3')"><a name="hasAnyArgument3Anchor">hasAnyArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6148<tr><td colspan="4" class="doc" id="hasAnyArgument3"><pre>Matches any argument of a call expression or a constructor call
6149expression, or an ObjC-message-send expression.
6150
6151Given
6152  void x(int, int, int) { int y; x(1, y, 42); }
6153callExpr(hasAnyArgument(declRefExpr()))
6154  matches x(1, y, 42)
6155with hasAnyArgument(...)
6156  matching y
6157
6158For ObjectiveC, given
6159  @interface I - (void) f:(int) y; @end
6160  void foo(I *i) { [i f:12]; }
6161objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
6162  matches [i f:12]
6163</pre></td></tr>
6164
6165
6166<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6167<tr><td colspan="4" class="doc" id="hasArgument2"><pre>Matches the n'th argument of a call expression or a constructor
6168call expression.
6169
6170Example matches y in x(y)
6171    (matcher = callExpr(hasArgument(0, declRefExpr())))
6172  void x(int) { int y; x(y); }
6173</pre></td></tr>
6174
6175
6176<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasReceiver0')"><a name="hasReceiver0Anchor">hasReceiver</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6177<tr><td colspan="4" class="doc" id="hasReceiver0"><pre>Matches if the Objective-C message is sent to an instance,
6178and the inner matcher matches on that instance.
6179
6180For example the method call in
6181  NSString *x = @"hello";
6182  [x containsString:@"h"];
6183is matched by
6184objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
6185</pre></td></tr>
6186
6187
6188<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6189<tr><td colspan="4" class="doc" id="hasReceiverType0"><pre>Matches on the receiver of an ObjectiveC Message expression.
6190
6191Example
6192matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *")));
6193matches the [webView ...] message invocation.
6194  NSString *webViewJavaScript = ...
6195  UIWebView *webView = ...
6196  [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
6197</pre></td></tr>
6198
6199
6200<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyParameter1')"><a name="hasAnyParameter1Anchor">hasAnyParameter</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
6201<tr><td colspan="4" class="doc" id="hasAnyParameter1"><pre>Matches any parameter of a function or an ObjC method declaration or a
6202block.
6203
6204Does not match the 'this' parameter of a method.
6205
6206Given
6207  class X { void f(int x, int y, int z) {} };
6208cxxMethodDecl(hasAnyParameter(hasName("y")))
6209  matches f(int x, int y, int z) {}
6210with hasAnyParameter(...)
6211  matching int y
6212
6213For ObjectiveC, given
6214  @interface I - (void) f:(int) y; @end
6215
6216the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
6217matches the declaration of method f with hasParameter
6218matching y.
6219
6220For blocks, given
6221  b = ^(int y) { printf("%d", y) };
6222
6223the matcher blockDecl(hasAnyParameter(hasName("y")))
6224matches the declaration of the block b with hasParameter
6225matching y.
6226</pre></td></tr>
6227
6228
6229<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;</td><td class="name" onclick="toggle('hasParameter1')"><a name="hasParameter1Anchor">hasParameter</a></td><td>unsigned N, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
6230<tr><td colspan="4" class="doc" id="hasParameter1"><pre>Matches the n'th parameter of a function or an ObjC method
6231declaration or a block.
6232
6233Given
6234  class X { void f(int x) {} };
6235cxxMethodDecl(hasParameter(0, hasType(varDecl())))
6236  matches f(int x) {}
6237with hasParameter(...)
6238  matching int x
6239
6240For ObjectiveC, given
6241  @interface I - (void) f:(int) y; @end
6242
6243the matcher objcMethodDecl(hasParameter(0, hasName("y")))
6244matches the declaration of method f with hasParameter
6245matching y.
6246</pre></td></tr>
6247
6248
6249<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6250<tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre>Matches if the cast's source expression
6251or opaque value's source expression matches the given matcher.
6252
6253Example 1: matches "a string"
6254(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
6255class URL { URL(string); };
6256URL url = "a string";
6257
6258Example 2: matches 'b' (matcher =
6259opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
6260int a = b ?: 1;
6261</pre></td></tr>
6262
6263
6264<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OverloadExpr.html">OverloadExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyDeclaration0')"><a name="hasAnyDeclaration0Anchor">hasAnyDeclaration</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6265<tr><td colspan="4" class="doc" id="hasAnyDeclaration0"><pre>Matches an OverloadExpr if any of the declarations in the set of
6266overloads matches the given matcher.
6267
6268Given
6269  template &lt;typename T&gt; void foo(T);
6270  template &lt;typename T&gt; void bar(T);
6271  template &lt;typename T&gt; void baz(T t) {
6272    foo(t);
6273    bar(t);
6274  }
6275unresolvedLookupExpr(hasAnyDeclaration(
6276    functionTemplateDecl(hasName("foo"))))
6277  matches foo in foo(t); but not bar in bar(t);
6278</pre></td></tr>
6279
6280
6281<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
6282<tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
6283
6284Given
6285  int (*ptr_to_array)[4];
6286  int (*ptr_to_func)(int);
6287
6288varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
6289ptr_to_func but not ptr_to_array.
6290
6291Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
6292</pre></td></tr>
6293
6294
6295<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
6296<tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
6297pointee matches a given matcher.
6298
6299Given
6300  int *a;
6301  int const *b;
6302  float const *f;
6303pointerType(pointee(isConstQualified(), isInteger()))
6304  matches "int const *b"
6305
6306Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
6307  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
6308</pre></td></tr>
6309
6310
6311<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6312<tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
6313
6314Given:
6315  typedef int &amp;int_ref;
6316  int a;
6317  int_ref b = a;
6318
6319varDecl(hasType(qualType(referenceType()))))) will not match the
6320declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
6321</pre></td></tr>
6322
6323
6324<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration6')"><a name="hasDeclaration6Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6325<tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
6326matches the given matcher.
6327
6328The associated declaration is:
6329- for type nodes, the declaration of the underlying type
6330- for CallExpr, the declaration of the callee
6331- for MemberExpr, the declaration of the referenced member
6332- for CXXConstructExpr, the declaration of the constructor
6333- for CXXNewExpr, the declaration of the operator new
6334- for ObjCIvarExpr, the declaration of the ivar
6335
6336For type nodes, hasDeclaration will generally match the declaration of the
6337sugared type. Given
6338  class X {};
6339  typedef X Y;
6340  Y y;
6341in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6342typedefDecl. A common use case is to match the underlying, desugared type.
6343This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6344  varDecl(hasType(hasUnqualifiedDesugaredType(
6345      recordType(hasDeclaration(decl())))))
6346In this matcher, the decl will match the CXXRecordDecl of class X.
6347
6348Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6349  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6350  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6351  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6352  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6353  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6354  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6355</pre></td></tr>
6356
6357
6358<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6359<tr><td colspan="4" class="doc" id="ignoringParens0"><pre>Matches types that match InnerMatcher after any parens are stripped.
6360
6361Given
6362  void (*fp)(void);
6363The matcher
6364  varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
6365would match the declaration for fp.
6366</pre></td></tr>
6367
6368
6369<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6370<tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
6371</pre></td></tr>
6372
6373
6374<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6375<tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
6376matches the specified matcher.
6377
6378Example matches y-&gt;x()
6379  (matcher = cxxMemberCallExpr(on(hasType(pointsTo
6380     cxxRecordDecl(hasName("Y")))))))
6381  class Y { public: void x(); };
6382  void z() { Y *y; y-&gt;x(); }
6383</pre></td></tr>
6384
6385
6386<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6387<tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
6388</pre></td></tr>
6389
6390
6391<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6392<tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
6393type matches the specified matcher.
6394
6395Example matches X &amp;x and const X &amp;y
6396    (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
6397  class X {
6398    void a(X b) {
6399      X &amp;x = b;
6400      const X &amp;y = b;
6401    }
6402  };
6403</pre></td></tr>
6404
6405
6406<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration5')"><a name="hasDeclaration5Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6407<tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
6408matches the given matcher.
6409
6410The associated declaration is:
6411- for type nodes, the declaration of the underlying type
6412- for CallExpr, the declaration of the callee
6413- for MemberExpr, the declaration of the referenced member
6414- for CXXConstructExpr, the declaration of the constructor
6415- for CXXNewExpr, the declaration of the operator new
6416- for ObjCIvarExpr, the declaration of the ivar
6417
6418For type nodes, hasDeclaration will generally match the declaration of the
6419sugared type. Given
6420  class X {};
6421  typedef X Y;
6422  Y y;
6423in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6424typedefDecl. A common use case is to match the underlying, desugared type.
6425This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6426  varDecl(hasType(hasUnqualifiedDesugaredType(
6427      recordType(hasDeclaration(decl())))))
6428In this matcher, the decl will match the CXXRecordDecl of class X.
6429
6430Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6431  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6432  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6433  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6434  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6435  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6436  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6437</pre></td></tr>
6438
6439
6440<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
6441<tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
6442pointee matches a given matcher.
6443
6444Given
6445  int *a;
6446  int const *b;
6447  float const *f;
6448pointerType(pointee(isConstQualified(), isInteger()))
6449  matches "int const *b"
6450
6451Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
6452  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
6453</pre></td></tr>
6454
6455
6456<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6457<tr><td colspan="4" class="doc" id="hasReturnValue0"><pre>Matches the return value expression of a return statement
6458
6459Given
6460  return a + b;
6461hasReturnValue(binaryOperator())
6462  matches 'return a + b'
6463with binaryOperator()
6464  matching 'a + b'
6465</pre></td></tr>
6466
6467
6468<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
6469<tr><td colspan="4" class="doc" id="hasAnySubstatement1"><pre>Matches compound statements where at least one substatement matches
6470a given matcher. Also matches StmtExprs that have CompoundStmt as children.
6471
6472Given
6473  { {}; 1+2; }
6474hasAnySubstatement(compoundStmt())
6475  matches '{ {}; 1+2; }'
6476with compoundStmt()
6477  matching '{}'
6478</pre></td></tr>
6479
6480
6481<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('alignOfExpr0')"><a name="alignOfExpr0Anchor">alignOfExpr</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;  InnerMatcher</td></tr>
6482<tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
6483alignof.
6484</pre></td></tr>
6485
6486
6487<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt; InnerMatcher</td></tr>
6488<tr><td colspan="4" class="doc" id="forFunction0"><pre>Matches declaration of the function the statement belongs to
6489
6490Given:
6491F&amp; operator=(const F&amp; o) {
6492  std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
6493  return *this;
6494}
6495returnStmt(forFunction(hasName("operator=")))
6496  matches 'return *this'
6497  but does match 'return &gt; 0'
6498</pre></td></tr>
6499
6500
6501<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('sizeOfExpr0')"><a name="sizeOfExpr0Anchor">sizeOfExpr</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;  InnerMatcher</td></tr>
6502<tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
6503sizeof.
6504</pre></td></tr>
6505
6506
6507<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1SubstTemplateTypeParmType.html">SubstTemplateTypeParmType</a>&gt;</td><td class="name" onclick="toggle('hasReplacementType0')"><a name="hasReplacementType0Anchor">hasReplacementType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
6508<tr><td colspan="4" class="doc" id="hasReplacementType0"><pre>Matches template type parameter substitutions that have a replacement
6509type that matches the provided matcher.
6510
6511Given
6512  template &lt;typename T&gt;
6513  double F(T t);
6514  int i;
6515  double j = F(i);
6516
6517substTemplateTypeParmType(hasReplacementType(type())) matches int
6518</pre></td></tr>
6519
6520
6521<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1SwitchCase.html">SwitchCase</a>&gt; InnerMatcher</td></tr>
6522<tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
6523statement. This matcher may produce multiple matches.
6524
6525Given
6526  switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
6527switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
6528  matches four times, with "c" binding each of "case 1:", "case 2:",
6529"case 3:" and "case 4:", and "s" respectively binding "switch (1)",
6530"switch (1)", "switch (2)" and "switch (2)".
6531</pre></td></tr>
6532
6533
6534<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6535<tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
6536switch statement or conditional operator.
6537
6538Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6539  if (true) {}
6540</pre></td></tr>
6541
6542
6543<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration4')"><a name="hasDeclaration4Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6544<tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
6545matches the given matcher.
6546
6547The associated declaration is:
6548- for type nodes, the declaration of the underlying type
6549- for CallExpr, the declaration of the callee
6550- for MemberExpr, the declaration of the referenced member
6551- for CXXConstructExpr, the declaration of the constructor
6552- for CXXNewExpr, the declaration of the operator new
6553- for ObjCIvarExpr, the declaration of the ivar
6554
6555For type nodes, hasDeclaration will generally match the declaration of the
6556sugared type. Given
6557  class X {};
6558  typedef X Y;
6559  Y y;
6560in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6561typedefDecl. A common use case is to match the underlying, desugared type.
6562This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6563  varDecl(hasType(hasUnqualifiedDesugaredType(
6564      recordType(hasDeclaration(decl())))))
6565In this matcher, the decl will match the CXXRecordDecl of class X.
6566
6567Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6568  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6569  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6570  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6571  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6572  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6573  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6574</pre></td></tr>
6575
6576
6577<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6578<tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
6579
6580Given
6581  struct B { int next; };
6582  template&lt;int(B::*next_ptr)&gt; struct A {};
6583  A&lt;&amp;B::next&gt; a;
6584templateSpecializationType(hasAnyTemplateArgument(
6585  isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
6586  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
6587    B::next
6588</pre></td></tr>
6589
6590
6591<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6592<tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
6593declaration.
6594
6595Given
6596  struct B { int next; };
6597  template&lt;int(B::*next_ptr)&gt; struct A {};
6598  A&lt;&amp;B::next&gt; a;
6599classTemplateSpecializationDecl(hasAnyTemplateArgument(
6600    refersToDeclaration(fieldDecl(hasName("next")))))
6601  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
6602    B::next
6603</pre></td></tr>
6604
6605
6606<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6607<tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that referes to an integral type.
6608
6609Given
6610  template&lt;int T&gt; struct C {};
6611  C&lt;42&gt; c;
6612classTemplateSpecializationDecl(
6613  hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
6614  matches the implicit instantiation of C in C&lt;42&gt;.
6615</pre></td></tr>
6616
6617
6618<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt;</td><td class="name" onclick="toggle('refersToTemplate0')"><a name="refersToTemplate0Anchor">refersToTemplate</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateName.html">TemplateName</a>&gt; InnerMatcher</td></tr>
6619<tr><td colspan="4" class="doc" id="refersToTemplate0"><pre>Matches a TemplateArgument that refers to a certain template.
6620
6621Given
6622  template&lt;template &lt;typename&gt; class S&gt; class X {};
6623  template&lt;typename T&gt; class Y {};
6624  X&lt;Y&gt; xi;
6625classTemplateSpecializationDecl(hasAnyTemplateArgument(
6626    refersToTemplate(templateName())))
6627  matches the specialization X&lt;Y&gt;
6628</pre></td></tr>
6629
6630
6631<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6632<tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
6633
6634Given
6635  struct X {};
6636  template&lt;typename T&gt; struct A {};
6637  A&lt;X&gt; a;
6638classTemplateSpecializationDecl(hasAnyTemplateArgument(
6639    refersToType(class(hasName("X")))))
6640  matches the specialization A&lt;X&gt;
6641</pre></td></tr>
6642
6643
6644<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
6645<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6646functionDecl that have at least one TemplateArgument matching the given
6647InnerMatcher.
6648
6649Given
6650  template&lt;typename T&gt; class A {};
6651  template&lt;&gt; class A&lt;double&gt; {};
6652  A&lt;int&gt; a;
6653
6654  template&lt;typename T&gt; f() {};
6655  void func() { f&lt;int&gt;(); };
6656
6657classTemplateSpecializationDecl(hasAnyTemplateArgument(
6658    refersToType(asString("int"))))
6659  matches the specialization A&lt;int&gt;
6660
6661functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
6662  matches the specialization f&lt;int&gt;
6663</pre></td></tr>
6664
6665
6666<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration3')"><a name="hasDeclaration3Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6667<tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
6668matches the given matcher.
6669
6670The associated declaration is:
6671- for type nodes, the declaration of the underlying type
6672- for CallExpr, the declaration of the callee
6673- for MemberExpr, the declaration of the referenced member
6674- for CXXConstructExpr, the declaration of the constructor
6675- for CXXNewExpr, the declaration of the operator new
6676- for ObjCIvarExpr, the declaration of the ivar
6677
6678For type nodes, hasDeclaration will generally match the declaration of the
6679sugared type. Given
6680  class X {};
6681  typedef X Y;
6682  Y y;
6683in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6684typedefDecl. A common use case is to match the underlying, desugared type.
6685This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6686  varDecl(hasType(hasUnqualifiedDesugaredType(
6687      recordType(hasDeclaration(decl())))))
6688In this matcher, the decl will match the CXXRecordDecl of class X.
6689
6690Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6691  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6692  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6693  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6694  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6695  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6696  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6697</pre></td></tr>
6698
6699
6700<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
6701<tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6702functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
6703
6704Given
6705  template&lt;typename T, typename U&gt; class A {};
6706  A&lt;bool, int&gt; b;
6707  A&lt;int, bool&gt; c;
6708
6709  template&lt;typename T&gt; void f() {}
6710  void func() { f&lt;int&gt;(); };
6711classTemplateSpecializationDecl(hasTemplateArgument(
6712    1, refersToType(asString("int"))))
6713  matches the specialization A&lt;bool, int&gt;
6714
6715functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
6716  matches the specialization f&lt;int&gt;
6717</pre></td></tr>
6718
6719
6720<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration2')"><a name="hasDeclaration2Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6721<tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
6722matches the given matcher.
6723
6724The associated declaration is:
6725- for type nodes, the declaration of the underlying type
6726- for CallExpr, the declaration of the callee
6727- for MemberExpr, the declaration of the referenced member
6728- for CXXConstructExpr, the declaration of the constructor
6729- for CXXNewExpr, the declaration of the operator new
6730- for ObjCIvarExpr, the declaration of the ivar
6731
6732For type nodes, hasDeclaration will generally match the declaration of the
6733sugared type. Given
6734  class X {};
6735  typedef X Y;
6736  Y y;
6737in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6738typedefDecl. A common use case is to match the underlying, desugared type.
6739This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6740  varDecl(hasType(hasUnqualifiedDesugaredType(
6741      recordType(hasDeclaration(decl())))))
6742In this matcher, the decl will match the CXXRecordDecl of class X.
6743
6744Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6745  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6746  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6747  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6748  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6749  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6750  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6751</pre></td></tr>
6752
6753
6754<tr><td>Matcher&lt;T&gt;</td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>const Matcher&lt;T&gt;  Matcher</td></tr>
6755<tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
6756
6757Generates results for each match.
6758
6759For example, in:
6760  class A { class B {}; class C {}; };
6761The matcher:
6762  cxxRecordDecl(hasName("::A"),
6763                findAll(cxxRecordDecl(isDefinition()).bind("m")))
6764will generate results for A, B and C.
6765
6766Usable as: Any Matcher
6767</pre></td></tr>
6768
6769
6770<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;</td><td class="name" onclick="toggle('hasType2')"><a name="hasType2Anchor">hasType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6771<tr><td colspan="4" class="doc" id="hasType2"><pre>Matches if the expression's or declaration's type matches a type
6772matcher.
6773
6774Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6775            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6776            and U (matcher = typedefDecl(hasType(asString("int")))
6777            and friend class X (matcher = friendDecl(hasType("X"))
6778 class X {};
6779 void y(X &amp;x) { x; X z; }
6780 typedef int U;
6781 class Y { friend class X; };
6782</pre></td></tr>
6783
6784
6785<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration1')"><a name="hasDeclaration1Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6786<tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
6787matches the given matcher.
6788
6789The associated declaration is:
6790- for type nodes, the declaration of the underlying type
6791- for CallExpr, the declaration of the callee
6792- for MemberExpr, the declaration of the referenced member
6793- for CXXConstructExpr, the declaration of the constructor
6794- for CXXNewExpr, the declaration of the operator new
6795- for ObjCIvarExpr, the declaration of the ivar
6796
6797For type nodes, hasDeclaration will generally match the declaration of the
6798sugared type. Given
6799  class X {};
6800  typedef X Y;
6801  Y y;
6802in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6803typedefDecl. A common use case is to match the underlying, desugared type.
6804This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6805  varDecl(hasType(hasUnqualifiedDesugaredType(
6806      recordType(hasDeclaration(decl())))))
6807In this matcher, the decl will match the CXXRecordDecl of class X.
6808
6809Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6810  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6811  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6812  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6813  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6814  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6815  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6816</pre></td></tr>
6817
6818
6819<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('hasUnqualifiedDesugaredType0')"><a name="hasUnqualifiedDesugaredType0Anchor">hasUnqualifiedDesugaredType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt; InnerMatcher</td></tr>
6820<tr><td colspan="4" class="doc" id="hasUnqualifiedDesugaredType0"><pre>Matches if the matched type matches the unqualified desugared
6821type of the matched node.
6822
6823For example, in:
6824  class A {};
6825  using B = A;
6826The matcher type(hasUnqualifiedDesugaredType(recordType())) matches
6827both B and A.
6828</pre></td></tr>
6829
6830
6831<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6832<tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
6833
6834Given
6835  int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
6836unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
6837  matches sizeof(a) and alignof(c)
6838</pre></td></tr>
6839
6840
6841<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6842<tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
6843
6844Example matches true (matcher = hasUnaryOperand(
6845                                  cxxBoolLiteral(equals(true))))
6846  !true
6847</pre></td></tr>
6848
6849
6850<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedMemberExpr.html">UnresolvedMemberExpr</a>&gt;</td><td class="name" onclick="toggle('hasObjectExpression1')"><a name="hasObjectExpression1Anchor">hasObjectExpression</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6851<tr><td colspan="4" class="doc" id="hasObjectExpression1"><pre>Matches a member expression where the object expression is matched by a
6852given matcher. Implicit object expressions are included; that is, it matches
6853use of implicit `this`.
6854
6855Given
6856  struct X {
6857    int m;
6858    int f(X x) { x.m; return m; }
6859  };
6860memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
6861  matches `x.m`, but not `m`; however,
6862memberExpr(hasObjectExpression(hasType(pointsTo(
6863     cxxRecordDecl(hasName("X"))))))
6864  matches `m` (aka. `this-&gt;m`), but not `x.m`.
6865</pre></td></tr>
6866
6867
6868<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration0')"><a name="hasDeclaration0Anchor">hasDeclaration</a></td><td>const Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
6869<tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
6870matches the given matcher.
6871
6872The associated declaration is:
6873- for type nodes, the declaration of the underlying type
6874- for CallExpr, the declaration of the callee
6875- for MemberExpr, the declaration of the referenced member
6876- for CXXConstructExpr, the declaration of the constructor
6877- for CXXNewExpr, the declaration of the operator new
6878- for ObjCIvarExpr, the declaration of the ivar
6879
6880For type nodes, hasDeclaration will generally match the declaration of the
6881sugared type. Given
6882  class X {};
6883  typedef X Y;
6884  Y y;
6885in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6886typedefDecl. A common use case is to match the underlying, desugared type.
6887This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6888  varDecl(hasType(hasUnqualifiedDesugaredType(
6889      recordType(hasDeclaration(decl())))))
6890In this matcher, the decl will match the CXXRecordDecl of class X.
6891
6892Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;,
6893  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;,
6894  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;,
6895  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;,
6896  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;,
6897  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;,
6898  Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6899</pre></td></tr>
6900
6901
6902<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>&gt; InnerMatcher</td></tr>
6903<tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
6904
6905Given
6906  namespace X { void b(); }
6907  using X::b;
6908usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
6909  matches using X::b </pre></td></tr>
6910
6911
6912<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; InnerMatcher</td></tr>
6913<tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
6914matched by the given matcher.
6915
6916Given
6917  namespace X { int a; void b(); }
6918  using X::a;
6919  using X::b;
6920usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
6921  matches using X::b but not using X::a </pre></td></tr>
6922
6923
6924<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;</td><td class="name" onclick="toggle('hasType6')"><a name="hasType6Anchor">hasType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6925<tr><td colspan="4" class="doc" id="hasType6"><pre>Overloaded to match the declaration of the expression's or value
6926declaration's type.
6927
6928In case of a value declaration (for example a variable declaration),
6929this resolves one layer of indirection. For example, in the value
6930declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
6931X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
6932declaration of x.
6933
6934Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6935            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6936            and friend class X (matcher = friendDecl(hasType("X"))
6937 class X {};
6938 void y(X &amp;x) { x; X z; }
6939 class Y { friend class X; };
6940
6941Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;
6942</pre></td></tr>
6943
6944
6945<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;</td><td class="name" onclick="toggle('hasType3')"><a name="hasType3Anchor">hasType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6946<tr><td colspan="4" class="doc" id="hasType3"><pre>Matches if the expression's or declaration's type matches a type
6947matcher.
6948
6949Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6950            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6951            and U (matcher = typedefDecl(hasType(asString("int")))
6952            and friend class X (matcher = friendDecl(hasType("X"))
6953 class X {};
6954 void y(X &amp;x) { x; X z; }
6955 typedef int U;
6956 class Y { friend class X; };
6957</pre></td></tr>
6958
6959
6960<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6961<tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
6962that matches the given matcher.
6963
6964Example matches x (matcher = varDecl(hasInitializer(callExpr())))
6965  bool y() { return true; }
6966  bool x = y();
6967</pre></td></tr>
6968
6969
6970<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6971<tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
6972expression.
6973
6974Given
6975  void f(int b) {
6976    int a[b];
6977  }
6978variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
6979  varDecl(hasName("b")))))))
6980  matches "int a[b]"
6981</pre></td></tr>
6982
6983
6984<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
6985<tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', 'do while' statement or a function
6986definition that has a given body.
6987
6988Given
6989  for (;;) {}
6990hasBody(compoundStmt())
6991  matches 'for (;;) {}'
6992with compoundStmt()
6993  matching '{}'
6994</pre></td></tr>
6995
6996
6997<tr><td>Matcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6998<tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
6999switch statement or conditional operator.
7000
7001Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
7002  if (true) {}
7003</pre></td></tr>
7004
7005
7006<tr><td>Matcher&lt;internal::BindableMatcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt; InnerMatcher</td></tr>
7007<tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
7008NestedNameSpecifier-matcher matches.
7009</pre></td></tr>
7010
7011
7012<tr><td>Matcher&lt;internal::BindableMatcher&lt;<a href="https://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="https://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
7013<tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
7014QualType-matcher matches.
7015</pre></td></tr>
7016
7017<!--END_TRAVERSAL_MATCHERS -->
7018</table>
7019
7020</div>
7021</body>
7022</html>
7023
7024
7025