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