[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / clang / docs / LibASTMatchersReference.html
blob5bb181b04d3a15d3478db4a0c6477c05cf9625bd
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">
9 td {
10 padding: .33em;
12 td.doc {
13 display: none;
14 border-bottom: 1px solid black;
16 td.name:hover {
17 color: blue;
18 cursor: pointer;
20 </style>
21 <script type="text/javascript">
22 function 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';
30 </script>
31 </head>
32 <body onLoad="toggle(location.hash.substring(1, location.hash.length - 6))">
34 <!--#include virtual="../menu.html.incl"-->
36 <div id="content">
38 <h1>AST Matcher Reference</h1>
40 <p>This document shows all currently implemented matchers. The matchers are grouped
41 by category and node type they match. You can click on matcher names to show the
42 matcher's source documentation.</p>
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>
52 <p>Within each category the matchers are ordered by node type they match on.
53 Note that if a matcher can match multiple node types, it will it will appear
54 multiple times. This means that by searching for Matcher&lt;Stmt&gt; you can
55 find all matchers that can be used to match on Stmt nodes.</p>
57 <p>The exception to that rule are matchers that can match on any node. Those
58 are marked with a * and are listed in the beginning of each category.</p>
60 <p>Note that the categorization of matchers is a great help when you combine
61 them into matcher expressions. You will usually want to form matcher expressions
62 that read like english sentences by alternating between node matchers and
63 narrowing or traversal matchers, like this:
64 <pre>
65 recordDecl(hasDescendant(
66 ifStmt(hasTrueExpression(
67 expr(hasDescendant(
68 ifStmt()))))))
69 </pre>
70 </p>
72 <!-- ======================================================================= -->
73 <h2 id="decl-matchers">Node Matchers</h2>
74 <!-- ======================================================================= -->
76 <p>Node matchers are at the core of matcher expressions - they specify the type
77 of node that is expected. Every match expression starts with a node matcher,
78 which can then be further refined with a narrowing or traversal matcher. All
79 traversal matchers take node matchers as their arguments.</p>
81 <p>For convenience, all node matchers take an arbitrary number of arguments
82 and implicitly act as allOf matchers.</p>
84 <p>Node matchers are the only matchers that support the bind("id") call to
85 bind the matched node to the given string, to be later retrieved from the
86 match callback.</p>
88 <p>It is important to remember that the arguments to node matchers are
89 predicates on the same node, just with additional information about the type.
90 This is often useful to make matcher expression more readable by inlining bind
91 calls 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.
95 recordDecl(decl().bind("id"), hasName("::MyClass"))
96 </pre>
97 </p>
99 <table>
100 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
101 <!-- START_DECL_MATCHERS -->
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.
106 Examples matches i(42).
107 class C {
108 C() : i(42) {}
109 int i;
111 </pre></td></tr>
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.
117 Given
118 class C {
119 public:
120 int a;
122 accessSpecDecl()
123 matches 'public:'
124 </pre></td></tr>
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.
130 Example matches the declaration of the nameless block printing an input
131 integer.
133 myFunc(^(int p) {
134 printf("%d", p);
136 </pre></td></tr>
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.
142 Example matches Z
143 template&lt;class T&gt; class Z {};
144 </pre></td></tr>
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.
150 Given
151 template&lt;class T1, class T2, int I&gt;
152 class A {};
154 template&lt;class T, int I&gt;
155 class A&lt;T, T*, I&gt; {};
157 template&lt;&gt;
158 class A&lt;int, int, 1&gt; {};
159 classTemplatePartialSpecializationDecl()
160 matches the specialization A&lt;T,T*,I&gt; but not A&lt;int,int,1&gt;
161 </pre></td></tr>
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.
167 Given
168 template&lt;typename T&gt; class A {};
169 template&lt;&gt; class A&lt;double&gt; {};
170 A&lt;int&gt; a;
171 classTemplateSpecializationDecl()
172 matches the specializations A&lt;int&gt; and A&lt;double&gt;
173 </pre></td></tr>
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.
179 Example matches Foo::Foo() and Foo::Foo(int)
180 class Foo {
181 public:
182 Foo();
183 Foo(int);
184 int DoSomething();
186 </pre></td></tr>
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.
192 Example matches the operator.
193 class X { operator int() const; };
194 </pre></td></tr>
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('cxxDeductionGuideDecl0')"><a name="cxxDeductionGuideDecl0Anchor">cxxDeductionGuideDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDeductionGuideDecl.html">CXXDeductionGuideDecl</a>&gt;...</td></tr>
198 <tr><td colspan="4" class="doc" id="cxxDeductionGuideDecl0"><pre>Matches user-defined and implicitly generated deduction guide.
200 Example matches the deduction guide.
201 template&lt;typename T&gt;
202 class X { X(int) };
203 X(int) -&gt; X&lt;int&gt;;
204 </pre></td></tr>
207 <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>
208 <tr><td colspan="4" class="doc" id="cxxDestructorDecl0"><pre>Matches explicit C++ destructor declarations.
210 Example matches Foo::~Foo()
211 class Foo {
212 public:
213 virtual ~Foo();
215 </pre></td></tr>
218 <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>
219 <tr><td colspan="4" class="doc" id="cxxMethodDecl0"><pre>Matches method declarations.
221 Example matches y
222 class X { void y(); };
223 </pre></td></tr>
226 <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>
227 <tr><td colspan="4" class="doc" id="cxxRecordDecl0"><pre>Matches C++ class declarations.
229 Example matches X, Z
230 class X;
231 template&lt;class T&gt; class Z {};
232 </pre></td></tr>
235 <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>
236 <tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations.
238 Examples matches X, C, and the friend declaration inside C;
239 void X();
240 class C {
241 friend X;
243 </pre></td></tr>
246 <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>
247 <tr><td colspan="4" class="doc" id="declaratorDecl0"><pre>Matches declarator declarations (field, variable, function
248 and non-type template parameter declarations).
250 Given
251 class X { int y; };
252 declaratorDecl()
253 matches int y.
254 </pre></td></tr>
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('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>
258 <tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants.
260 Example matches A, B, C
261 enum X {
262 A, B, C
264 </pre></td></tr>
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('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>
268 <tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations.
270 Example matches X
271 enum X {
272 A, B, C
274 </pre></td></tr>
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('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>
278 <tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations.
280 Given
281 class X { int m; };
282 fieldDecl()
283 matches 'm'.
284 </pre></td></tr>
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('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>
288 <tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations.
290 Given
291 class X { friend void foo(); };
292 friendDecl()
293 matches 'friend void foo()'.
294 </pre></td></tr>
297 <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>
298 <tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations.
300 Example matches f
301 void f();
302 </pre></td></tr>
305 <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>
306 <tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations.
308 Example matches f
309 template&lt;class T&gt; void f(T t) {}
310 </pre></td></tr>
313 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('indirectFieldDecl0')"><a name="indirectFieldDecl0Anchor">indirectFieldDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IndirectFieldDecl.html">IndirectFieldDecl</a>&gt;...</td></tr>
314 <tr><td colspan="4" class="doc" id="indirectFieldDecl0"><pre>Matches indirect field declarations.
316 Given
317 struct X { struct { int a; }; };
318 indirectFieldDecl()
319 matches 'a'.
320 </pre></td></tr>
323 <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>
324 <tr><td colspan="4" class="doc" id="labelDecl0"><pre>Matches a declaration of label.
326 Given
327 goto FOO;
328 FOO: bar();
329 labelDecl()
330 matches 'FOO:'
331 </pre></td></tr>
334 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
335 <tr><td colspan="4" class="doc" id="linkageSpecDecl0"><pre>Matches a declaration of a linkage specification.
337 Given
338 extern "C" {}
339 linkageSpecDecl()
340 matches "extern "C" {}"
341 </pre></td></tr>
344 <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>
345 <tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name.
347 Example matches X, S, the anonymous union type, i, and U;
348 typedef int X;
349 struct S {
350 union {
351 int i;
352 } U;
354 </pre></td></tr>
357 <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>
358 <tr><td colspan="4" class="doc" id="namespaceAliasDecl0"><pre>Matches a declaration of a namespace alias.
360 Given
361 namespace test {}
362 namespace alias = ::test;
363 namespaceAliasDecl()
364 matches "namespace alias" but not "namespace test"
365 </pre></td></tr>
368 <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>
369 <tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace.
371 Given
372 namespace {}
373 namespace test {}
374 namespaceDecl()
375 matches "namespace {}" and "namespace test {}"
376 </pre></td></tr>
379 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
380 <tr><td colspan="4" class="doc" id="nonTypeTemplateParmDecl0"><pre>Matches non-type template parameter declarations.
382 Given
383 template &lt;typename T, int N&gt; struct C {};
384 nonTypeTemplateParmDecl()
385 matches 'N', but not 'T'.
386 </pre></td></tr>
389 <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>
390 <tr><td colspan="4" class="doc" id="objcCategoryDecl0"><pre>Matches Objective-C category declarations.
392 Example matches Foo (Additions)
393 @interface Foo (Additions)
394 @end
395 </pre></td></tr>
398 <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>
399 <tr><td colspan="4" class="doc" id="objcCategoryImplDecl0"><pre>Matches Objective-C category definitions.
401 Example matches Foo (Additions)
402 @implementation Foo (Additions)
403 @end
404 </pre></td></tr>
407 <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>
408 <tr><td colspan="4" class="doc" id="objcImplementationDecl0"><pre>Matches Objective-C implementation declarations.
410 Example matches Foo
411 @implementation Foo
412 @end
413 </pre></td></tr>
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('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>
417 <tr><td colspan="4" class="doc" id="objcInterfaceDecl0"><pre>Matches Objective-C interface declarations.
419 Example matches Foo
420 @interface Foo
421 @end
422 </pre></td></tr>
425 <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>
426 <tr><td colspan="4" class="doc" id="objcIvarDecl0"><pre>Matches Objective-C instance variable declarations.
428 Example matches _enabled
429 @implementation Foo {
430 BOOL _enabled;
432 @end
433 </pre></td></tr>
436 <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>
437 <tr><td colspan="4" class="doc" id="objcMethodDecl0"><pre>Matches Objective-C method declarations.
439 Example matches both declaration and definition of -[Foo method]
440 @interface Foo
441 - (void)method;
442 @end
444 @implementation Foo
445 - (void)method {}
446 @end
447 </pre></td></tr>
450 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
451 <tr><td colspan="4" class="doc" id="objcPropertyDecl0"><pre>Matches Objective-C property declarations.
453 Example matches enabled
454 @interface Foo
455 @property BOOL enabled;
456 @end
457 </pre></td></tr>
460 <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>
461 <tr><td colspan="4" class="doc" id="objcProtocolDecl0"><pre>Matches Objective-C protocol declarations.
463 Example matches FooDelegate
464 @protocol FooDelegate
465 @end
466 </pre></td></tr>
469 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
470 <tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations.
472 Given
473 void f(int x);
474 parmVarDecl()
475 matches int x.
476 </pre></td></tr>
479 <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>
480 <tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches class, struct, and union declarations.
482 Example matches X, Z, U, and S
483 class X;
484 template&lt;class T&gt; class Z {};
485 struct S {};
486 union U {};
487 </pre></td></tr>
490 <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>
491 <tr><td colspan="4" class="doc" id="staticAssertDecl0"><pre>Matches a C++ static_assert declaration.
493 Example:
494 staticAssertExpr()
495 matches
496 static_assert(sizeof(S) == sizeof(int))
498 struct S {
499 int x;
501 static_assert(sizeof(S) == sizeof(int));
502 </pre></td></tr>
505 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
506 <tr><td colspan="4" class="doc" id="templateTypeParmDecl0"><pre>Matches template type parameter declarations.
508 Given
509 template &lt;typename T, int N&gt; struct C {};
510 templateTypeParmDecl()
511 matches 'T', but not 'N'.
512 </pre></td></tr>
515 <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>
516 <tr><td colspan="4" class="doc" id="translationUnitDecl0"><pre>Matches the top declaration context.
518 Given
519 int X;
520 namespace NS {
521 int Y;
522 } // namespace NS
523 decl(hasDeclContext(translationUnitDecl()))
524 matches "int X", but not "int Y".
525 </pre></td></tr>
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('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>
529 <tr><td colspan="4" class="doc" id="typeAliasDecl0"><pre>Matches type alias declarations.
531 Given
532 typedef int X;
533 using Y = int;
534 typeAliasDecl()
535 matches "using Y = int", but not "typedef int X"
536 </pre></td></tr>
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('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>
540 <tr><td colspan="4" class="doc" id="typeAliasTemplateDecl0"><pre>Matches type alias template declarations.
542 typeAliasTemplateDecl() matches
543 template &lt;typename T&gt;
544 using Y = X&lt;T&gt;;
545 </pre></td></tr>
548 <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>
549 <tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef declarations.
551 Given
552 typedef int X;
553 using Y = int;
554 typedefDecl()
555 matches "typedef int X", but not "using Y = int"
556 </pre></td></tr>
559 <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>
560 <tr><td colspan="4" class="doc" id="typedefNameDecl0"><pre>Matches typedef name declarations.
562 Given
563 typedef int X;
564 using Y = int;
565 typedefNameDecl()
566 matches "typedef int X" and "using Y = int"
567 </pre></td></tr>
570 <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>
571 <tr><td colspan="4" class="doc" id="unresolvedUsingTypenameDecl0"><pre>Matches unresolved using value declarations that involve the
572 typename.
574 Given
575 template &lt;typename T&gt;
576 struct Base { typedef T Foo; };
578 template&lt;typename T&gt;
579 struct S : private Base&lt;T&gt; {
580 using typename Base&lt;T&gt;::Foo;
582 unresolvedUsingTypenameDecl()
583 matches using Base&lt;T&gt;::Foo </pre></td></tr>
586 <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>
587 <tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations.
589 Given
590 template&lt;typename X&gt;
591 class C : private X {
592 using X::x;
594 unresolvedUsingValueDecl()
595 matches using X::x </pre></td></tr>
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('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>
599 <tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations.
601 Given
602 namespace X { int x; }
603 using X::x;
604 usingDecl()
605 matches using X::x </pre></td></tr>
608 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
609 <tr><td colspan="4" class="doc" id="usingDirectiveDecl0"><pre>Matches using namespace declarations.
611 Given
612 namespace X { int x; }
613 using namespace X;
614 usingDirectiveDecl()
615 matches using namespace X </pre></td></tr>
618 <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>
619 <tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value declaration.
621 Example matches A, B, C and F
622 enum X { A, B, C };
623 void F();
624 </pre></td></tr>
627 <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>
628 <tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations.
630 Note: this does not match declarations of member variables, which are
631 "field" declarations in Clang parlance.
633 Example matches a
634 int a;
635 </pre></td></tr>
638 <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>
639 <tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
640 </pre></td></tr>
643 <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>
644 <tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers.
646 Given
647 namespace ns {
648 struct A { static void f(); };
649 void A::f() {}
650 void g() { A::f(); }
652 ns::A a;
653 nestedNameSpecifier()
654 matches "ns::" and both "A::"
655 </pre></td></tr>
658 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPClause.html">OMPClause</a>&gt;</td><td class="name" onclick="toggle('ompDefaultClause0')"><a name="ompDefaultClause0Anchor">ompDefaultClause</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPDefaultClause.html">OMPDefaultClause</a>&gt;...</td></tr>
659 <tr><td colspan="4" class="doc" id="ompDefaultClause0"><pre>Matches OpenMP ``default`` clause.
661 Given
663 #pragma omp parallel default(none)
664 #pragma omp parallel default(shared)
665 #pragma omp parallel
667 ``ompDefaultClause()`` matches ``default(none)`` and ``default(shared)``.
668 </pre></td></tr>
671 <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>
672 <tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST.
673 </pre></td></tr>
676 <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>
677 <tr><td colspan="4" class="doc" id="addrLabelExpr0"><pre>Matches address of label statements (GNU extension).
679 Given
680 FOO: bar();
681 void *ptr = &amp;&amp;FOO;
682 goto *bar;
683 addrLabelExpr()
684 matches '&amp;&amp;FOO'
685 </pre></td></tr>
688 <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>
689 <tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions.
691 Given
692 int i = a[1];
693 arraySubscriptExpr()
694 matches "a[1]"
695 </pre></td></tr>
698 <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>
699 <tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements.
701 int i = 100;
702 __asm("mov al, 2");
703 asmStmt()
704 matches '__asm("mov al, 2")'
705 </pre></td></tr>
708 <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>
709 <tr><td colspan="4" class="doc" id="atomicExpr0"><pre>Matches atomic builtins.
710 Example matches __atomic_load_n(ptr, 1)
711 void foo() { int *ptr; __atomic_load_n(ptr, 1); }
712 </pre></td></tr>
715 <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>
716 <tr><td colspan="4" class="doc" id="autoreleasePoolStmt0"><pre>Matches an Objective-C autorelease pool statement.
718 Given
719 @autoreleasepool {
720 int x = 0;
722 autoreleasePoolStmt(stmt()) matches the declaration of "x"
723 inside the autorelease pool.
724 </pre></td></tr>
727 <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>
728 <tr><td colspan="4" class="doc" id="binaryConditionalOperator0"><pre>Matches binary conditional operator expressions (GNU extension).
730 Example matches a ?: b
731 (a ?: b) + 42;
732 </pre></td></tr>
735 <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>
736 <tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions.
738 Example matches a || b
739 !(a || b)
740 </pre></td></tr>
743 <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>
744 <tr><td colspan="4" class="doc" id="blockExpr0"><pre>Matches a reference to a block.
746 Example: matches "^{}":
747 void f() { ^{}(); }
748 </pre></td></tr>
751 <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>
752 <tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements.
754 Given
755 while (true) { break; }
756 breakStmt()
757 matches 'break'
758 </pre></td></tr>
761 <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>
762 <tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression.
764 Example: Matches (int) 2.2f in
765 int i = (int) 2.2f;
766 </pre></td></tr>
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('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>
770 <tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions.
772 Example matches x.y() and y()
773 X x;
774 x.y();
775 y();
776 </pre></td></tr>
779 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
780 <tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements.
782 Given
783 switch(a) { case 42: break; default: break; }
784 caseStmt()
785 matches 'case 42:'.
786 </pre></td></tr>
789 <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>
790 <tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST.
792 Example: castExpr() matches each of the following:
793 (int) 3;
794 const_cast&lt;Expr *&gt;(SubExpr);
795 char c = 0;
796 but does not match
797 int i = (0);
798 int k = 0;
799 </pre></td></tr>
802 <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>
803 <tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t).
805 Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
806 though.
808 Example matches 'a', L'a'
809 char ch = 'a';
810 wchar_t chw = L'a';
811 </pre></td></tr>
814 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('chooseExpr0')"><a name="chooseExpr0Anchor">chooseExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ChooseExpr.html">ChooseExpr</a>&gt;...</td></tr>
815 <tr><td colspan="4" class="doc" id="chooseExpr0"><pre>Matches GNU __builtin_choose_expr.
816 </pre></td></tr>
819 <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>
820 <tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
822 Example match: {1}, (1, 2)
823 int array[4] = {1};
824 vector int myvec = (vector int)(1, 2);
825 </pre></td></tr>
828 <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>
829 <tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements.
831 Example matches '{}' and '{{}}' in 'for (;;) {{}}'
832 for (;;) {{}}
833 </pre></td></tr>
836 <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>
837 <tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions.
839 Example matches a ? b : c
840 (a ? b : c) + 42
841 </pre></td></tr>
844 <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>
845 <tr><td colspan="4" class="doc" id="constantExpr0"><pre>Matches a constant expression wrapper.
847 Example matches the constant in the case statement:
848 (matcher = constantExpr())
849 switch (a) {
850 case 37: break;
852 </pre></td></tr>
855 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
856 <tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements.
858 Given
859 while (true) { continue; }
860 continueStmt()
861 matches 'continue'
862 </pre></td></tr>
865 <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>
866 <tr><td colspan="4" class="doc" id="cudaKernelCallExpr0"><pre>Matches CUDA kernel call expression.
868 Example matches,
869 kernel&lt;&lt;&lt;i,j&gt;&gt;&gt;();
870 </pre></td></tr>
873 <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>
874 <tr><td colspan="4" class="doc" id="cxxBindTemporaryExpr0"><pre>Matches nodes where temporaries are created.
876 Example matches FunctionTakesString(GetStringByValue())
877 (matcher = cxxBindTemporaryExpr())
878 FunctionTakesString(GetStringByValue());
879 FunctionTakesStringByPointer(GetStringPointer());
880 </pre></td></tr>
883 <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>
884 <tr><td colspan="4" class="doc" id="cxxBoolLiteral0"><pre>Matches bool literals.
886 Example matches true
887 true
888 </pre></td></tr>
891 <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>
892 <tr><td colspan="4" class="doc" id="cxxCatchStmt0"><pre>Matches catch statements.
894 try {} catch(int i) {}
895 cxxCatchStmt()
896 matches 'catch(int i)'
897 </pre></td></tr>
900 <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>
901 <tr><td colspan="4" class="doc" id="cxxConstCastExpr0"><pre>Matches a const_cast expression.
903 Example: Matches const_cast&lt;int*&gt;(&amp;r) in
904 int n = 42;
905 const int &amp;r(n);
906 int* p = const_cast&lt;int*&gt;(&amp;r);
907 </pre></td></tr>
910 <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>
911 <tr><td colspan="4" class="doc" id="cxxConstructExpr0"><pre>Matches constructor call expressions (including implicit ones).
913 Example matches string(ptr, n) and ptr within arguments of f
914 (matcher = cxxConstructExpr())
915 void f(const string &amp;a, const string &amp;b);
916 char *ptr;
917 int n;
918 f(string(ptr, n), ptr);
919 </pre></td></tr>
922 <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>
923 <tr><td colspan="4" class="doc" id="cxxDefaultArgExpr0"><pre>Matches the value of a default argument at the call site.
925 Example matches the CXXDefaultArgExpr placeholder inserted for the
926 default value of the second parameter in the call expression f(42)
927 (matcher = cxxDefaultArgExpr())
928 void f(int x, int y = 0);
929 f(42);
930 </pre></td></tr>
933 <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>
934 <tr><td colspan="4" class="doc" id="cxxDeleteExpr0"><pre>Matches delete expressions.
936 Given
937 delete X;
938 cxxDeleteExpr()
939 matches 'delete X'.
940 </pre></td></tr>
943 <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>
944 <tr><td colspan="4" class="doc" id="cxxDependentScopeMemberExpr0"><pre>Matches member expressions where the actual member referenced could not be
945 resolved because the base expression or the member name was dependent.
947 Given
948 template &lt;class T&gt; void f() { T t; t.g(); }
949 cxxDependentScopeMemberExpr()
950 matches t.g
951 </pre></td></tr>
954 <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>
955 <tr><td colspan="4" class="doc" id="cxxDynamicCastExpr0"><pre>Matches a dynamic_cast expression.
957 Example:
958 cxxDynamicCastExpr()
959 matches
960 dynamic_cast&lt;D*&gt;(&amp;b);
962 struct B { virtual ~B() {} }; struct D : B {};
963 B b;
964 D* p = dynamic_cast&lt;D*&gt;(&amp;b);
965 </pre></td></tr>
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('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>
969 <tr><td colspan="4" class="doc" id="cxxForRangeStmt0"><pre>Matches range-based for statements.
971 cxxForRangeStmt() matches 'for (auto a : i)'
972 int i[] = {1, 2, 3}; for (auto a : i);
973 for(int j = 0; j &lt; 5; ++j);
974 </pre></td></tr>
977 <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>
978 <tr><td colspan="4" class="doc" id="cxxFunctionalCastExpr0"><pre>Matches functional cast expressions
980 Example: Matches Foo(bar);
981 Foo f = bar;
982 Foo g = (Foo) bar;
983 Foo h = Foo(bar);
984 </pre></td></tr>
987 <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>
988 <tr><td colspan="4" class="doc" id="cxxMemberCallExpr0"><pre>Matches member call expressions.
990 Example matches x.y()
991 X x;
992 x.y();
993 </pre></td></tr>
996 <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>
997 <tr><td colspan="4" class="doc" id="cxxNewExpr0"><pre>Matches new expressions.
999 Given
1000 new X;
1001 cxxNewExpr()
1002 matches 'new X'.
1003 </pre></td></tr>
1006 <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>
1007 <tr><td colspan="4" class="doc" id="cxxNullPtrLiteralExpr0"><pre>Matches nullptr literal.
1008 </pre></td></tr>
1011 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1012 <tr><td colspan="4" class="doc" id="cxxOperatorCallExpr0"><pre>Matches overloaded operator calls.
1014 Note that if an operator isn't overloaded, it won't match. Instead, use
1015 binaryOperator matcher.
1016 Currently it does not match operators such as new delete.
1017 FIXME: figure out why these do not match?
1019 Example matches both operator&lt;&lt;((o &lt;&lt; b), c) and operator&lt;&lt;(o, b)
1020 (matcher = cxxOperatorCallExpr())
1021 ostream &amp;operator&lt;&lt; (ostream &amp;out, int i) { };
1022 ostream &amp;o; int b = 1, c = 1;
1023 o &lt;&lt; b &lt;&lt; c;
1024 </pre></td></tr>
1027 <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>
1028 <tr><td colspan="4" class="doc" id="cxxReinterpretCastExpr0"><pre>Matches a reinterpret_cast expression.
1030 Either the source expression or the destination type can be matched
1031 using has(), but hasDestinationType() is more specific and can be
1032 more readable.
1034 Example matches reinterpret_cast&lt;char*&gt;(&amp;p) in
1035 void* p = reinterpret_cast&lt;char*&gt;(&amp;p);
1036 </pre></td></tr>
1039 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1040 <tr><td colspan="4" class="doc" id="cxxStaticCastExpr0"><pre>Matches a C++ static_cast expression.
1042 See also: hasDestinationType
1043 See also: reinterpretCast
1045 Example:
1046 cxxStaticCastExpr()
1047 matches
1048 static_cast&lt;long&gt;(8)
1050 long eight(static_cast&lt;long&gt;(8));
1051 </pre></td></tr>
1054 <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>
1055 <tr><td colspan="4" class="doc" id="cxxStdInitializerListExpr0"><pre>Matches C++ initializer list expressions.
1057 Given
1058 std::vector&lt;int&gt; a({ 1, 2, 3 });
1059 std::vector&lt;int&gt; b = { 4, 5 };
1060 int c[] = { 6, 7 };
1061 std::pair&lt;int, int&gt; d = { 8, 9 };
1062 cxxStdInitializerListExpr()
1063 matches "{ 1, 2, 3 }" and "{ 4, 5 }"
1064 </pre></td></tr>
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('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>
1068 <tr><td colspan="4" class="doc" id="cxxTemporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments
1070 Example: Matches Foo(bar, bar)
1071 Foo h = Foo(bar, bar);
1072 </pre></td></tr>
1075 <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>
1076 <tr><td colspan="4" class="doc" id="cxxThisExpr0"><pre>Matches implicit and explicit this expressions.
1078 Example matches the implicit this expression in "return i".
1079 (matcher = cxxThisExpr())
1080 struct foo {
1081 int i;
1082 int f() { return i; }
1084 </pre></td></tr>
1087 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1088 <tr><td colspan="4" class="doc" id="cxxThrowExpr0"><pre>Matches throw expressions.
1090 try { throw 5; } catch(int i) {}
1091 cxxThrowExpr()
1092 matches 'throw 5'
1093 </pre></td></tr>
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('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>
1097 <tr><td colspan="4" class="doc" id="cxxTryStmt0"><pre>Matches try statements.
1099 try {} catch(int i) {}
1100 cxxTryStmt()
1101 matches 'try {}'
1102 </pre></td></tr>
1105 <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>
1106 <tr><td colspan="4" class="doc" id="cxxUnresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions.
1108 Example matches T(t) in return statement of f
1109 (matcher = cxxUnresolvedConstructExpr())
1110 template &lt;typename T&gt;
1111 void f(const T&amp; t) { return T(t); }
1112 </pre></td></tr>
1115 <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>
1116 <tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations.
1118 Example matches x in if (x)
1119 bool x;
1120 if (x) {}
1121 </pre></td></tr>
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('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>
1125 <tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements.
1127 Given
1128 int a;
1129 declStmt()
1130 matches 'int a'.
1131 </pre></td></tr>
1134 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1135 <tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements.
1137 Given
1138 switch(a) { case 42: break; default: break; }
1139 defaultStmt()
1140 matches 'default:'.
1141 </pre></td></tr>
1144 <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>
1145 <tr><td colspan="4" class="doc" id="designatedInitExpr0"><pre>Matches C99 designated initializer expressions [C99 6.7.8].
1147 Example: Matches { [2].y = 1.0, [0].x = 1.0 }
1148 point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
1149 </pre></td></tr>
1152 <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>
1153 <tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements.
1155 Given
1156 do {} while (true);
1157 doStmt()
1158 matches 'do {} while(true)'
1159 </pre></td></tr>
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('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>
1163 <tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions.
1165 Matches any cast expression written in user code, whether it be a
1166 C-style cast, a functional-style cast, or a keyword cast.
1168 Does not match implicit conversions.
1170 Note: the name "explicitCast" is chosen to match Clang's terminology, as
1171 Clang uses the term "cast" to apply to implicit conversions as well as to
1172 actual cast expressions.
1174 See also: hasDestinationType.
1176 Example: matches all five of the casts in
1177 int((int)(reinterpret_cast&lt;int&gt;(static_cast&lt;int&gt;(const_cast&lt;int&gt;(42)))))
1178 but does not match the implicit conversion in
1179 long ell = 42;
1180 </pre></td></tr>
1183 <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>
1184 <tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions.
1186 Example matches x()
1187 void f() { x(); }
1188 </pre></td></tr>
1191 <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>
1192 <tr><td colspan="4" class="doc" id="exprWithCleanups0"><pre>Matches expressions that introduce cleanups to be run at the end
1193 of the sub-expression's evaluation.
1195 Example matches std::string()
1196 const std::string str = std::string();
1197 </pre></td></tr>
1200 <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>
1201 <tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes / encodings, e.g.
1202 1.0, 1.0f, 1.0L and 1e10.
1204 Does not match implicit conversions such as
1205 float a = 10;
1206 </pre></td></tr>
1209 <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>
1210 <tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements.
1212 Example matches 'for (;;) {}'
1213 for (;;) {}
1214 int i[] = {1, 2, 3}; for (auto a : i);
1215 </pre></td></tr>
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('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>
1219 <tr><td colspan="4" class="doc" id="gnuNullExpr0"><pre>Matches GNU __null expression.
1220 </pre></td></tr>
1223 <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>
1224 <tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements.
1226 Given
1227 goto FOO;
1228 FOO: bar();
1229 gotoStmt()
1230 matches 'goto FOO'
1231 </pre></td></tr>
1234 <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>
1235 <tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements.
1237 Example matches 'if (x) {}'
1238 if (x) {}
1239 </pre></td></tr>
1242 <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>
1243 <tr><td colspan="4" class="doc" id="imaginaryLiteral0"><pre>Matches imaginary literals, which are based on integer and floating
1244 point literals e.g.: 1i, 1.0i
1245 </pre></td></tr>
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('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>
1249 <tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST.
1251 This matches many different places, including function call return value
1252 eliding, as well as any type conversions.
1253 </pre></td></tr>
1256 <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>
1257 <tr><td colspan="4" class="doc" id="implicitValueInitExpr0"><pre>Matches implicit initializers of init list expressions.
1259 Given
1260 point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
1261 implicitValueInitExpr()
1262 matches "[0].y" (implicitly)
1263 </pre></td></tr>
1266 <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>
1267 <tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions.
1269 Given
1270 int a[] = { 1, 2 };
1271 struct B { int x, y; };
1272 B b = { 5, 6 };
1273 initListExpr()
1274 matches "{ 1, 2 }" and "{ 5, 6 }"
1275 </pre></td></tr>
1278 <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>
1279 <tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes / encodings, e.g.
1280 1, 1L, 0x1 and 1U.
1282 Does not match character-encoded integers such as L'a'.
1283 </pre></td></tr>
1286 <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>
1287 <tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements.
1289 Given
1290 goto FOO;
1291 FOO: bar();
1292 labelStmt()
1293 matches 'FOO:'
1294 </pre></td></tr>
1297 <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>
1298 <tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions.
1300 Example matches [&amp;](){return 5;}
1301 [&amp;](){return 5;}
1302 </pre></td></tr>
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('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>
1306 <tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized.
1308 Example: Given
1309 struct T {void func();};
1310 T f();
1311 void g(T);
1312 materializeTemporaryExpr() matches 'f()' in these statements
1313 T u(f());
1314 g(f());
1315 f().func();
1316 but does not match
1317 f();
1318 </pre></td></tr>
1321 <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>
1322 <tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions.
1324 Given
1325 class Y {
1326 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
1327 int a; static int b;
1329 memberExpr()
1330 matches this-&gt;x, x, y.x, a, this-&gt;b
1331 </pre></td></tr>
1334 <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>
1335 <tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements.
1337 foo();;
1338 nullStmt()
1339 matches the second ';'
1340 </pre></td></tr>
1343 <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>
1344 <tr><td colspan="4" class="doc" id="objcCatchStmt0"><pre>Matches Objective-C @catch statements.
1346 Example matches @catch
1347 @try {}
1348 @catch (...) {}
1349 </pre></td></tr>
1352 <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>
1353 <tr><td colspan="4" class="doc" id="objcFinallyStmt0"><pre>Matches Objective-C @finally statements.
1355 Example matches @finally
1356 @try {}
1357 @finally {}
1358 </pre></td></tr>
1361 <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>
1362 <tr><td colspan="4" class="doc" id="objcIvarRefExpr0"><pre>Matches a reference to an ObjCIvar.
1364 Example: matches "a" in "init" method:
1365 @implementation A {
1366 NSString *a;
1368 - (void) init {
1369 a = @"hello";
1371 </pre></td></tr>
1374 <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>
1375 <tr><td colspan="4" class="doc" id="objcMessageExpr0"><pre>Matches ObjectiveC Message invocation expressions.
1377 The innermost message send invokes the "alloc" class method on the
1378 NSString class, while the outermost message send invokes the
1379 "initWithString" instance method on the object returned from
1380 NSString's "alloc". This matcher should match both message sends.
1381 [[NSString alloc] initWithString:@"Hello"]
1382 </pre></td></tr>
1385 <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>
1386 <tr><td colspan="4" class="doc" id="objcThrowStmt0"><pre>Matches Objective-C statements.
1388 Example matches @throw obj;
1389 </pre></td></tr>
1392 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1393 <tr><td colspan="4" class="doc" id="objcTryStmt0"><pre>Matches Objective-C @try statements.
1395 Example matches @try
1396 @try {}
1397 @catch (...) {}
1398 </pre></td></tr>
1401 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('ompExecutableDirective0')"><a name="ompExecutableDirective0Anchor">ompExecutableDirective</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPExecutableDirective.html">OMPExecutableDirective</a>&gt;...</td></tr>
1402 <tr><td colspan="4" class="doc" id="ompExecutableDirective0"><pre>Matches any ``#pragma omp`` executable directive.
1404 Given
1406 #pragma omp parallel
1407 #pragma omp parallel default(none)
1408 #pragma omp taskyield
1410 ``ompExecutableDirective()`` matches ``omp parallel``,
1411 ``omp parallel default(none)`` and ``omp taskyield``.
1412 </pre></td></tr>
1415 <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>
1416 <tr><td colspan="4" class="doc" id="opaqueValueExpr0"><pre>Matches opaque value expressions. They are used as helpers
1417 to reference another expressions and can be met
1418 in BinaryConditionalOperators, for example.
1420 Example matches 'a'
1421 (a ?: c) + 42;
1422 </pre></td></tr>
1425 <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>
1426 <tr><td colspan="4" class="doc" id="parenExpr0"><pre>Matches parentheses used in expressions.
1428 Example matches (foo() + 1)
1429 int foo() { return 1; }
1430 int a = (foo() + 1);
1431 </pre></td></tr>
1434 <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>
1435 <tr><td colspan="4" class="doc" id="parenListExpr0"><pre>Matches paren list expressions.
1436 ParenListExprs don't have a predefined type and are used for late parsing.
1437 In the final AST, they can be met in template declarations.
1439 Given
1440 template&lt;typename T&gt; class X {
1441 void f() {
1442 X x(*this);
1443 int a = 0, b = 1; int i = (a, b);
1446 parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
1447 has a predefined type and is a ParenExpr, not a ParenListExpr.
1448 </pre></td></tr>
1451 <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>
1452 <tr><td colspan="4" class="doc" id="predefinedExpr0"><pre>Matches predefined identifier expressions [C99 6.4.2.2].
1454 Example: Matches __func__
1455 printf("%s", __func__);
1456 </pre></td></tr>
1459 <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>
1460 <tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements.
1462 Given
1463 return 1;
1464 returnStmt()
1465 matches 'return 1'
1466 </pre></td></tr>
1469 <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>
1470 <tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements.
1472 Given
1473 { ++a; }
1474 stmt()
1475 matches both the compound statement '{ ++a; }' and '++a'.
1476 </pre></td></tr>
1479 <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>
1480 <tr><td colspan="4" class="doc" id="stmtExpr0"><pre>Matches statement expression (GNU extension).
1482 Example match: ({ int X = 4; X; })
1483 int C = ({ int X = 4; X; });
1484 </pre></td></tr>
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('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>
1488 <tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
1490 Example matches "abcd", L"abcd"
1491 char *s = "abcd";
1492 wchar_t *ws = L"abcd";
1493 </pre></td></tr>
1496 <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>
1497 <tr><td colspan="4" class="doc" id="substNonTypeTemplateParmExpr0"><pre>Matches substitutions of non-type template parameters.
1499 Given
1500 template &lt;int N&gt;
1501 struct A { static const int n = N; };
1502 struct B : public A&lt;42&gt; {};
1503 substNonTypeTemplateParmExpr()
1504 matches "N" in the right-hand side of "static const int n = N;"
1505 </pre></td></tr>
1508 <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>
1509 <tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements.
1511 Given
1512 switch(a) { case 42: break; default: break; }
1513 switchCase()
1514 matches 'case 42:' and 'default:'.
1515 </pre></td></tr>
1518 <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>
1519 <tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements.
1521 Given
1522 switch(a) { case 42: break; default: break; }
1523 switchStmt()
1524 matches 'switch(a)'.
1525 </pre></td></tr>
1528 <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>
1529 <tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
1531 Given
1532 Foo x = bar;
1533 int y = sizeof(x) + alignof(x);
1534 unaryExprOrTypeTraitExpr()
1535 matches sizeof(x) and alignof(x)
1536 </pre></td></tr>
1539 <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>
1540 <tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions.
1542 Example matches !a
1543 !a || b
1544 </pre></td></tr>
1547 <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>
1548 <tr><td colspan="4" class="doc" id="unresolvedLookupExpr0"><pre>Matches reference to a name that can be looked up during parsing
1549 but could not be resolved to a specific declaration.
1551 Given
1552 template&lt;typename T&gt;
1553 T foo() { T a; return a; }
1554 template&lt;typename T&gt;
1555 void bar() {
1556 foo&lt;T&gt;();
1558 unresolvedLookupExpr()
1559 matches foo&lt;T&gt;() </pre></td></tr>
1562 <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>
1563 <tr><td colspan="4" class="doc" id="unresolvedMemberExpr0"><pre>Matches unresolved member expressions.
1565 Given
1566 struct X {
1567 template &lt;class T&gt; void f();
1568 void g();
1570 template &lt;class T&gt; void h() { X x; x.f&lt;T&gt;(); x.g(); }
1571 unresolvedMemberExpr()
1572 matches x.f&lt;T&gt;
1573 </pre></td></tr>
1576 <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>
1577 <tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call.
1579 Example match: "foo"_suffix
1580 </pre></td></tr>
1583 <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>
1584 <tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements.
1586 Given
1587 while (true) {}
1588 whileStmt()
1589 matches 'while (true) {}'.
1590 </pre></td></tr>
1593 <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>
1594 <tr><td colspan="4" class="doc" id="templateArgument0"><pre>Matches template arguments.
1596 Given
1597 template &lt;typename T&gt; struct C {};
1598 C&lt;int&gt; c;
1599 templateArgument()
1600 matches 'int' in C&lt;int&gt;.
1601 </pre></td></tr>
1604 <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>
1605 <tr><td colspan="4" class="doc" id="templateName0"><pre>Matches template name.
1607 Given
1608 template &lt;typename T&gt; class X { };
1609 X&lt;int&gt; xi;
1610 templateName()
1611 matches 'X' in X&lt;int&gt;.
1612 </pre></td></tr>
1615 <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>
1616 <tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST.
1617 </pre></td></tr>
1620 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('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>
1621 <tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays.
1623 Given
1624 int a[] = { 2, 3 };
1625 int b[4];
1626 void f() { int c[a[0]]; }
1627 arrayType()
1628 matches "int a[]", "int b[4]" and "int c[a[0]]";
1629 </pre></td></tr>
1632 <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>
1633 <tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types.
1635 Given
1636 _Atomic(int) i;
1637 atomicType()
1638 matches "_Atomic(int) i"
1639 </pre></td></tr>
1642 <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>
1643 <tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types.
1645 Given:
1646 auto n = 4;
1647 int v[] = { 2, 3 }
1648 for (auto i : v) { }
1649 autoType()
1650 matches "auto n" and "auto i"
1651 </pre></td></tr>
1654 <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>
1655 <tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as
1656 "void (^)(int)".
1658 The pointee is always required to be a FunctionType.
1659 </pre></td></tr>
1662 <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>
1663 <tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types.
1665 Given
1666 struct A {};
1667 A a;
1668 int b;
1669 float c;
1670 bool d;
1671 builtinType()
1672 matches "int b", "float c" and "bool d"
1673 </pre></td></tr>
1676 <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>
1677 <tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types.
1679 Given
1680 _Complex float f;
1681 complexType()
1682 matches "_Complex float f"
1683 </pre></td></tr>
1686 <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>
1687 <tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size.
1689 Given
1690 void() {
1691 int a[2];
1692 int b[] = { 2, 3 };
1693 int c[b[0]];
1695 constantArrayType()
1696 matches "int a[2]"
1697 </pre></td></tr>
1700 <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>
1701 <tr><td colspan="4" class="doc" id="decayedType0"><pre>Matches decayed type
1702 Example matches i[] in declaration of f.
1703 (matcher = valueDecl(hasType(decayedType(hasDecayedType(pointerType())))))
1704 Example matches i[1].
1705 (matcher = expr(hasType(decayedType(hasDecayedType(pointerType())))))
1706 void f(int i[]) {
1707 i[1] = 0;
1709 </pre></td></tr>
1712 <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>
1713 <tr><td colspan="4" class="doc" id="decltypeType0"><pre>Matches types nodes representing C++11 decltype(&lt;expr&gt;) types.
1715 Given:
1716 short i = 1;
1717 int j = 42;
1718 decltype(i + j) result = i + j;
1719 decltypeType()
1720 matches "decltype(i + j)"
1721 </pre></td></tr>
1724 <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>
1725 <tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression.
1727 Given
1728 template&lt;typename T, int Size&gt;
1729 class array {
1730 T data[Size];
1732 dependentSizedArrayType
1733 matches "T data[Size]"
1734 </pre></td></tr>
1737 <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>
1738 <tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a
1739 qualified name.
1741 Given
1742 namespace N {
1743 namespace M {
1744 class D {};
1747 class C {};
1749 class C c;
1750 N::M::D d;
1752 elaboratedType() matches the type of the variable declarations of both
1753 c and d.
1754 </pre></td></tr>
1757 <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>
1758 <tr><td colspan="4" class="doc" id="enumType0"><pre>Matches enum types.
1760 Given
1761 enum C { Green };
1762 enum class S { Red };
1764 C c;
1765 S s;
1767 enumType() matches the type of the variable declarations of both c and
1769 </pre></td></tr>
1772 <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>
1773 <tr><td colspan="4" class="doc" id="functionProtoType0"><pre>Matches FunctionProtoType nodes.
1775 Given
1776 int (*f)(int);
1777 void g();
1778 functionProtoType()
1779 matches "int (*f)(int)" and the type of "g" in C++ mode.
1780 In C mode, "g" is not matched because it does not contain a prototype.
1781 </pre></td></tr>
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('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>
1785 <tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes.
1787 Given
1788 int (*f)(int);
1789 void g();
1790 functionType()
1791 matches "int (*f)(int)" and the type of "g".
1792 </pre></td></tr>
1795 <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>
1796 <tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size.
1798 Given
1799 int a[] = { 2, 3 };
1800 int b[42];
1801 void f(int c[]) { int d[a[0]]; };
1802 incompleteArrayType()
1803 matches "int a[]" and "int c[]"
1804 </pre></td></tr>
1807 <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>
1808 <tr><td colspan="4" class="doc" id="injectedClassNameType0"><pre>Matches injected class name types.
1810 Example matches S s, but not S&lt;T&gt; s.
1811 (matcher = parmVarDecl(hasType(injectedClassNameType())))
1812 template &lt;typename T&gt; struct S {
1813 void f(S s);
1814 void g(S&lt;T&gt; s);
1816 </pre></td></tr>
1819 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('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>
1820 <tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types.
1822 Given:
1823 int *a;
1824 int &amp;b = *a;
1825 int &amp;&amp;c = 1;
1826 auto &amp;d = b;
1827 auto &amp;&amp;e = c;
1828 auto &amp;&amp;f = 2;
1829 int g = 5;
1831 lValueReferenceType() matches the types of b, d, and e. e is
1832 matched since the type is deduced as int&amp; by reference collapsing rules.
1833 </pre></td></tr>
1836 <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>
1837 <tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types.
1838 Given
1839 struct A { int i; }
1840 A::* ptr = A::i;
1841 memberPointerType()
1842 matches "A::* ptr"
1843 </pre></td></tr>
1846 <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>
1847 <tr><td colspan="4" class="doc" id="objcObjectPointerType0"><pre>Matches an Objective-C object pointer type, which is different from
1848 a pointer type, despite being syntactically similar.
1850 Given
1851 int *a;
1853 @interface Foo
1854 @end
1855 Foo *f;
1856 pointerType()
1857 matches "Foo *f", but does not match "int *a".
1858 </pre></td></tr>
1861 <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>
1862 <tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes.
1864 Given
1865 int (*ptr_to_array)[4];
1866 int *array_of_ptrs[4];
1868 varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
1869 array_of_ptrs.
1870 </pre></td></tr>
1873 <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>
1874 <tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types, but does not match Objective-C object pointer
1875 types.
1877 Given
1878 int *a;
1879 int &amp;b = *a;
1880 int c = 5;
1882 @interface Foo
1883 @end
1884 Foo *f;
1885 pointerType()
1886 matches "int *a", but does not match "Foo *f".
1887 </pre></td></tr>
1890 <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>
1891 <tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types.
1893 Given:
1894 int *a;
1895 int &amp;b = *a;
1896 int &amp;&amp;c = 1;
1897 auto &amp;d = b;
1898 auto &amp;&amp;e = c;
1899 auto &amp;&amp;f = 2;
1900 int g = 5;
1902 rValueReferenceType() matches the types of c and f. e is not
1903 matched as it is deduced to int&amp; by reference collapsing rules.
1904 </pre></td></tr>
1907 <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>
1908 <tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes).
1910 Given
1911 class C {};
1912 struct S {};
1914 C c;
1915 S s;
1917 recordType() matches the type of the variable declarations of both c
1918 and s.
1919 </pre></td></tr>
1922 <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>
1923 <tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types.
1925 Given
1926 int *a;
1927 int &amp;b = *a;
1928 int &amp;&amp;c = 1;
1929 auto &amp;d = b;
1930 auto &amp;&amp;e = c;
1931 auto &amp;&amp;f = 2;
1932 int g = 5;
1934 referenceType() matches the types of b, c, d, e, and f.
1935 </pre></td></tr>
1938 <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>
1939 <tr><td colspan="4" class="doc" id="substTemplateTypeParmType0"><pre>Matches types that represent the result of substituting a type for a
1940 template type parameter.
1942 Given
1943 template &lt;typename T&gt;
1944 void F(T t) {
1945 int i = 1 + t;
1948 substTemplateTypeParmType() matches the type of 't' but not '1'
1949 </pre></td></tr>
1952 <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>
1953 <tr><td colspan="4" class="doc" id="tagType0"><pre>Matches tag types (record and enum types).
1955 Given
1956 enum E {};
1957 class C {};
1959 E e;
1960 C c;
1962 tagType() matches the type of the variable declarations of both e
1963 and c.
1964 </pre></td></tr>
1967 <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>
1968 <tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types.
1970 Given
1971 template &lt;typename T&gt;
1972 class C { };
1974 template class C&lt;int&gt;; // A
1975 C&lt;char&gt; var; // B
1977 templateSpecializationType() matches the type of the explicit
1978 instantiation in A and the type of the variable declaration in B.
1979 </pre></td></tr>
1982 <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>
1983 <tr><td colspan="4" class="doc" id="templateTypeParmType0"><pre>Matches template type parameter types.
1985 Example matches T, but not int.
1986 (matcher = templateTypeParmType())
1987 template &lt;typename T&gt; void f(int i);
1988 </pre></td></tr>
1991 <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>
1992 <tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST.
1993 </pre></td></tr>
1996 <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>
1997 <tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types.
1999 Given
2000 typedef int X;
2001 typedefType()
2002 matches "typedef int X"
2003 </pre></td></tr>
2006 <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>
2007 <tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations.
2009 Given:
2010 typedef __underlying_type(T) type;
2011 unaryTransformType()
2012 matches "__underlying_type(T)"
2013 </pre></td></tr>
2016 <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>
2017 <tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an
2018 integer-constant-expression.
2020 Given
2021 void f() {
2022 int a[] = { 2, 3 }
2023 int b[42];
2024 int c[a[0]];
2026 variableArrayType()
2027 matches "int c[a[0]]"
2028 </pre></td></tr>
2030 <!--END_DECL_MATCHERS -->
2031 </table>
2033 <!-- ======================================================================= -->
2034 <h2 id="narrowing-matchers">Narrowing Matchers</h2>
2035 <!-- ======================================================================= -->
2037 <p>Narrowing matchers match certain attributes on the current node, thus
2038 narrowing down the set of nodes of the current type to match on.</p>
2040 <p>There are special logical narrowing matchers (allOf, anyOf, anything and unless)
2041 which allow users to create more powerful match expressions.</p>
2043 <table>
2044 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
2045 <!-- START_NARROWING_MATCHERS -->
2047 <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>
2048 <tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match.
2050 Usable as: Any Matcher
2051 </pre></td></tr>
2054 <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>
2055 <tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches.
2057 Usable as: Any Matcher
2058 </pre></td></tr>
2061 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr>
2062 <tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node.
2064 Useful when another matcher requires a child matcher, but there's no
2065 additional constraint. This will often be used with an explicit conversion
2066 to an internal::Matcher&lt;&gt; type such as TypeMatcher.
2068 Example: DeclarationMatcher(anything()) matches all declarations, e.g.,
2069 "int* p" and "void f()" in
2070 int* p;
2071 void f();
2073 Usable as: Any Matcher
2074 </pre></td></tr>
2077 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher&lt;*&gt;</td></tr>
2078 <tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match.
2080 Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
2081 class X {};
2082 class Y {};
2084 Usable as: Any Matcher
2085 </pre></td></tr>
2088 <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>
2089 <tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions (binary or
2090 unary).
2092 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
2093 !(a || b)
2094 </pre></td></tr>
2097 <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>
2098 <tr><td colspan="4" class="doc" id="isAssignmentOperator0"><pre>Matches all kinds of assignment operators.
2100 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2101 if (a == b)
2102 a += b;
2104 Example 2: matches s1 = s2
2105 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
2106 struct S { S&amp; operator=(const S&amp;); };
2107 void x() { S s1, s2; s1 = s2; })
2108 </pre></td></tr>
2111 <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>
2112 <tr><td colspan="4" class="doc" id="equals5"><pre></pre></td></tr>
2115 <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>
2116 <tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value of type ValueT.
2118 Given
2119 f('false, 3.14, 42);
2120 characterLiteral(equals(0))
2121 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2122 match false
2123 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2124 match 3.14
2125 integerLiteral(equals(42))
2126 matches 42
2128 Note that you cannot directly match a negative numeric literal because the
2129 minus sign is not part of the literal: It is a unary operator whose operand
2130 is the positive numeric literal. Instead, you must use a unaryOperator()
2131 matcher to match the minus sign:
2133 unaryOperator(hasOperatorName("-"),
2134 hasUnaryOperand(integerLiteral(equals(13))))
2136 Usable 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;,
2137 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;
2138 </pre></td></tr>
2141 <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>
2142 <tr><td colspan="4" class="doc" id="equals11"><pre></pre></td></tr>
2145 <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>
2146 <tr><td colspan="4" class="doc" id="equals8"><pre></pre></td></tr>
2149 <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>
2150 <tr><td colspan="4" class="doc" id="isCatchAll0"><pre>Matches a C++ catch statement that has a catch-all handler.
2152 Given
2153 try {
2154 // ...
2155 } catch (int) {
2156 // ...
2157 } catch (...) {
2158 // ...
2160 cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
2161 </pre></td></tr>
2164 <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>
2165 <tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has
2166 a specific number of arguments (including absent default arguments).
2168 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2169 void f(int x, int y);
2170 f(0, 0);
2171 </pre></td></tr>
2174 <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>
2175 <tr><td colspan="4" class="doc" id="isListInitialization0"><pre>Matches a constructor call expression which uses list initialization.
2176 </pre></td></tr>
2179 <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>
2180 <tr><td colspan="4" class="doc" id="requiresZeroInitialization0"><pre>Matches a constructor call expression which requires
2181 zero initialization.
2183 Given
2184 void foo() {
2185 struct point { double x; double y; };
2186 point pt[2] = { { 1.0, 2.0 } };
2188 initListExpr(has(cxxConstructExpr(requiresZeroInitialization()))
2189 will match the implicit array filler for pt[1].
2190 </pre></td></tr>
2193 <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>
2194 <tr><td colspan="4" class="doc" id="isCopyConstructor0"><pre>Matches constructor declarations that are copy constructors.
2196 Given
2197 struct S {
2198 S(); // #1
2199 S(const S &amp;); // #2
2200 S(S &amp;&amp;); // #3
2202 cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3.
2203 </pre></td></tr>
2206 <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>
2207 <tr><td colspan="4" class="doc" id="isDefaultConstructor0"><pre>Matches constructor declarations that are default constructors.
2209 Given
2210 struct S {
2211 S(); // #1
2212 S(const S &amp;); // #2
2213 S(S &amp;&amp;); // #3
2215 cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3.
2216 </pre></td></tr>
2219 <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>
2220 <tr><td colspan="4" class="doc" id="isDelegatingConstructor0"><pre>Matches constructors that delegate to another constructor.
2222 Given
2223 struct S {
2224 S(); // #1
2225 S(int) {} // #2
2226 S(S &amp;&amp;) : S() {} // #3
2228 S::S() : S(0) {} // #4
2229 cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not
2230 #1 or #2.
2231 </pre></td></tr>
2234 <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>
2235 <tr><td colspan="4" class="doc" id="isExplicit0"><pre>Matches constructor, conversion function, and deduction guide declarations
2236 that have an explicit specifier if this explicit specifier is resolved to
2237 true.
2239 Given
2240 template&lt;bool b&gt;
2241 struct S {
2242 S(int); // #1
2243 explicit S(double); // #2
2244 operator int(); // #3
2245 explicit operator bool(); // #4
2246 explicit(false) S(bool) // # 7
2247 explicit(true) S(char) // # 8
2248 explicit(b) S(S) // # 9
2250 S(int) -&gt; S&lt;true&gt; // #5
2251 explicit S(double) -&gt; S&lt;false&gt; // #6
2252 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
2253 cxxConversionDecl(isExplicit()) will match #4, but not #3.
2254 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
2255 </pre></td></tr>
2258 <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>
2259 <tr><td colspan="4" class="doc" id="isMoveConstructor0"><pre>Matches constructor declarations that are move constructors.
2261 Given
2262 struct S {
2263 S(); // #1
2264 S(const S &amp;); // #2
2265 S(S &amp;&amp;); // #3
2267 cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2.
2268 </pre></td></tr>
2271 <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>
2272 <tr><td colspan="4" class="doc" id="isExplicit1"><pre>Matches constructor, conversion function, and deduction guide declarations
2273 that have an explicit specifier if this explicit specifier is resolved to
2274 true.
2276 Given
2277 template&lt;bool b&gt;
2278 struct S {
2279 S(int); // #1
2280 explicit S(double); // #2
2281 operator int(); // #3
2282 explicit operator bool(); // #4
2283 explicit(false) S(bool) // # 7
2284 explicit(true) S(char) // # 8
2285 explicit(b) S(S) // # 9
2287 S(int) -&gt; S&lt;true&gt; // #5
2288 explicit S(double) -&gt; S&lt;false&gt; // #6
2289 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
2290 cxxConversionDecl(isExplicit()) will match #4, but not #3.
2291 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
2292 </pre></td></tr>
2295 <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>
2296 <tr><td colspan="4" class="doc" id="isBaseInitializer0"><pre>Matches a constructor initializer if it is initializing a base, as
2297 opposed to a member.
2299 Given
2300 struct B {};
2301 struct D : B {
2302 int I;
2303 D(int i) : I(i) {}
2305 struct E : B {
2306 E() : B() {}
2308 cxxConstructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
2309 will match E(), but not match D(int).
2310 </pre></td></tr>
2313 <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>
2314 <tr><td colspan="4" class="doc" id="isMemberInitializer0"><pre>Matches a constructor initializer if it is initializing a member, as
2315 opposed to a base.
2317 Given
2318 struct B {};
2319 struct D : B {
2320 int I;
2321 D(int i) : I(i) {}
2323 struct E : B {
2324 E() : B() {}
2326 cxxConstructorDecl(hasAnyConstructorInitializer(isMemberInitializer()))
2327 will match D(int), but not match E().
2328 </pre></td></tr>
2331 <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>
2332 <tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in
2333 code (as opposed to implicitly added by the compiler).
2335 Given
2336 struct Foo {
2337 Foo() { }
2338 Foo(int) : foo_("A") { }
2339 string foo_;
2341 cxxConstructorDecl(hasAnyConstructorInitializer(isWritten()))
2342 will match Foo(int), but not Foo()
2343 </pre></td></tr>
2346 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDeductionGuideDecl.html">CXXDeductionGuideDecl</a>&gt;</td><td class="name" onclick="toggle('isExplicit2')"><a name="isExplicit2Anchor">isExplicit</a></td><td></td></tr>
2347 <tr><td colspan="4" class="doc" id="isExplicit2"><pre>Matches constructor, conversion function, and deduction guide declarations
2348 that have an explicit specifier if this explicit specifier is resolved to
2349 true.
2351 Given
2352 template&lt;bool b&gt;
2353 struct S {
2354 S(int); // #1
2355 explicit S(double); // #2
2356 operator int(); // #3
2357 explicit operator bool(); // #4
2358 explicit(false) S(bool) // # 7
2359 explicit(true) S(char) // # 8
2360 explicit(b) S(S) // # 9
2362 S(int) -&gt; S&lt;true&gt; // #5
2363 explicit S(double) -&gt; S&lt;false&gt; // #6
2364 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
2365 cxxConversionDecl(isExplicit()) will match #4, but not #3.
2366 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
2367 </pre></td></tr>
2370 <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>
2371 <tr><td colspan="4" class="doc" id="isArrow2"><pre>Matches member expressions that are called with '-&gt;' as opposed
2372 to '.'.
2374 Member calls on the implicit this pointer match as called with '-&gt;'.
2376 Given
2377 class Y {
2378 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
2379 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
2380 int a;
2381 static int b;
2383 template &lt;class T&gt;
2384 class Z {
2385 void x() { this-&gt;m; }
2387 memberExpr(isArrow())
2388 matches this-&gt;x, x, y.x, a, this-&gt;b
2389 cxxDependentScopeMemberExpr(isArrow())
2390 matches this-&gt;m
2391 unresolvedMemberExpr(isArrow())
2392 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
2393 </pre></td></tr>
2396 <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>
2397 <tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
2399 Given
2400 struct A {
2401 void foo() const;
2402 void bar();
2405 cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
2406 </pre></td></tr>
2409 <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>
2410 <tr><td colspan="4" class="doc" id="isCopyAssignmentOperator0"><pre>Matches if the given method declaration declares a copy assignment
2411 operator.
2413 Given
2414 struct A {
2415 A &amp;operator=(const A &amp;);
2416 A &amp;operator=(A &amp;&amp;);
2419 cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
2420 the second one.
2421 </pre></td></tr>
2424 <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>
2425 <tr><td colspan="4" class="doc" id="isFinal1"><pre>Matches if the given method or class declaration is final.
2427 Given:
2428 class A final {};
2430 struct B {
2431 virtual void f();
2434 struct C : B {
2435 void f() final;
2437 matches A and C::f, but not B, C, or B::f
2438 </pre></td></tr>
2441 <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>
2442 <tr><td colspan="4" class="doc" id="isMoveAssignmentOperator0"><pre>Matches if the given method declaration declares a move assignment
2443 operator.
2445 Given
2446 struct A {
2447 A &amp;operator=(const A &amp;);
2448 A &amp;operator=(A &amp;&amp;);
2451 cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
2452 the first one.
2453 </pre></td></tr>
2456 <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>
2457 <tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
2459 Given
2460 class A {
2461 public:
2462 virtual void x();
2464 class B : public A {
2465 public:
2466 virtual void x();
2468 matches B::x
2469 </pre></td></tr>
2472 <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>
2473 <tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure.
2475 Given
2476 class A {
2477 public:
2478 virtual void x() = 0;
2480 matches A::x
2481 </pre></td></tr>
2484 <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>
2485 <tr><td colspan="4" class="doc" id="isUserProvided0"><pre>Matches method declarations that are user-provided.
2487 Given
2488 struct S {
2489 S(); // #1
2490 S(const S &amp;) = default; // #2
2491 S(S &amp;&amp;) = delete; // #3
2493 cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3.
2494 </pre></td></tr>
2497 <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>
2498 <tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches if the given method declaration is virtual.
2500 Given
2501 class A {
2502 public:
2503 virtual void x();
2505 matches A::x
2506 </pre></td></tr>
2509 <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>
2510 <tr><td colspan="4" class="doc" id="isVirtualAsWritten0"><pre>Matches if the given method declaration has an explicit "virtual".
2512 Given
2513 class A {
2514 public:
2515 virtual void x();
2517 class B : public A {
2518 public:
2519 void x();
2521 matches A::x but not B::x
2522 </pre></td></tr>
2525 <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>
2526 <tr><td colspan="4" class="doc" id="isArray0"><pre>Matches array new expressions.
2528 Given:
2529 MyClass *p1 = new MyClass[10];
2530 cxxNewExpr(isArray())
2531 matches the expression 'new MyClass[10]'.
2532 </pre></td></tr>
2535 <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>
2536 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
2538 Matches overloaded operator names specified in strings without the
2539 "operator" prefix: e.g. "&lt;&lt;".
2541 Given:
2542 class A { int operator*(); };
2543 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
2544 A a;
2545 a &lt;&lt; a; // &lt;-- This matches
2547 cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
2548 specified line and
2549 cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
2550 matches the declaration of A.
2552 Usable 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;
2553 </pre></td></tr>
2556 <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>
2557 <tr><td colspan="4" class="doc" id="isAssignmentOperator1"><pre>Matches all kinds of assignment operators.
2559 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2560 if (a == b)
2561 a += b;
2563 Example 2: matches s1 = s2
2564 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
2565 struct S { S&amp; operator=(const S&amp;); };
2566 void x() { S s1, s2; s1 = s2; })
2567 </pre></td></tr>
2570 <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>
2571 <tr><td colspan="4" class="doc" id="hasDefinition0"><pre>Matches a class declaration that is defined.
2573 Example matches x (matcher = cxxRecordDecl(hasDefinition()))
2574 class x {};
2575 class y;
2576 </pre></td></tr>
2579 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isDerivedFrom2')"><a name="isDerivedFrom2Anchor">isDerivedFrom</a></td><td>std::string BaseName</td></tr>
2580 <tr><td colspan="4" class="doc" id="isDerivedFrom2"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
2581 </pre></td></tr>
2584 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isDirectlyDerivedFrom2')"><a name="isDirectlyDerivedFrom2Anchor">isDirectlyDerivedFrom</a></td><td>std::string BaseName</td></tr>
2585 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom2"><pre>Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
2586 </pre></td></tr>
2589 <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>
2590 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
2591 static member variable template instantiations.
2593 Given
2594 template&lt;typename T&gt; void A(T t) { }
2595 template&lt;&gt; void A(int N) { }
2596 functionDecl(isExplicitTemplateSpecialization())
2597 matches the specialization A&lt;int&gt;().
2599 Usable 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;
2600 </pre></td></tr>
2603 <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>
2604 <tr><td colspan="4" class="doc" id="isFinal0"><pre>Matches if the given method or class declaration is final.
2606 Given:
2607 class A final {};
2609 struct B {
2610 virtual void f();
2613 struct C : B {
2614 void f() final;
2616 matches A and C::f, but not B, C, or B::f
2617 </pre></td></tr>
2620 <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>
2621 <tr><td colspan="4" class="doc" id="isLambda0"><pre>Matches the generated class of lambda expressions.
2623 Given:
2624 auto x = []{};
2626 cxxRecordDecl(isLambda()) matches the implicit class declaration of
2627 decltype(x)
2628 </pre></td></tr>
2631 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isSameOrDerivedFrom2')"><a name="isSameOrDerivedFrom2Anchor">isSameOrDerivedFrom</a></td><td>std::string BaseName</td></tr>
2632 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom2"><pre>Overloaded method as shortcut for
2633 isSameOrDerivedFrom(hasName(...)).
2634 </pre></td></tr>
2637 <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>
2638 <tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
2639 member variable template instantiations.
2641 Given
2642 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
2644 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
2646 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
2647 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2648 matches the template instantiation of X&lt;A&gt;.
2650 But given
2651 template &lt;typename T&gt; class X {}; class A {};
2652 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
2653 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
2654 does not match, as X&lt;A&gt; is an explicit template specialization.
2656 Usable 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;
2657 </pre></td></tr>
2660 <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>
2661 <tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
2662 a specific number of arguments (including absent default arguments).
2664 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2665 void f(int x, int y);
2666 f(0, 0);
2667 </pre></td></tr>
2670 <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>
2671 <tr><td colspan="4" class="doc" id="usesADL0"><pre>Matches call expressions which were resolved using ADL.
2673 Example matches y(x) but not y(42) or NS::y(x).
2674 namespace NS {
2675 struct X {};
2676 void y(X);
2679 void y(...);
2681 void test() {
2682 NS::X x;
2683 y(x); // Matches
2684 NS::y(x); // Doesn't match
2685 y(42); // Doesn't match
2686 using NS::y;
2687 y(x); // Found by both unqualified lookup and ADL, doesn't match
2689 </pre></td></tr>
2692 <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>
2693 <tr><td colspan="4" class="doc" id="hasCastKind0"><pre>Matches casts that has a given cast kind.
2695 Example: matches the implicit cast around 0
2696 (matcher = castExpr(hasCastKind(CK_NullToPointer)))
2697 int *p = 0;
2699 If the matcher is use from clang-query, CastKind parameter
2700 should be passed as a quoted string. e.g., ofKind("CK_NullToPointer").
2701 </pre></td></tr>
2704 <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>
2705 <tr><td colspan="4" class="doc" id="equals4"><pre></pre></td></tr>
2708 <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>
2709 <tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value of type ValueT.
2711 Given
2712 f('false, 3.14, 42);
2713 characterLiteral(equals(0))
2714 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2715 match false
2716 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2717 match 3.14
2718 integerLiteral(equals(42))
2719 matches 42
2721 Note that you cannot directly match a negative numeric literal because the
2722 minus sign is not part of the literal: It is a unary operator whose operand
2723 is the positive numeric literal. Instead, you must use a unaryOperator()
2724 matcher to match the minus sign:
2726 unaryOperator(hasOperatorName("-"),
2727 hasUnaryOperand(integerLiteral(equals(13))))
2729 Usable 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;,
2730 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;
2731 </pre></td></tr>
2734 <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>
2735 <tr><td colspan="4" class="doc" id="equals10"><pre></pre></td></tr>
2738 <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>
2739 <tr><td colspan="4" class="doc" id="equals7"><pre></pre></td></tr>
2742 <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>
2743 <tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N.
2745 Given
2746 template&lt;typename T&gt; struct C {};
2747 C&lt;int&gt; c;
2748 classTemplateSpecializationDecl(templateArgumentCountIs(1))
2749 matches C&lt;int&gt;.
2750 </pre></td></tr>
2753 <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>
2754 <tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
2755 child statements.
2757 Example: Given
2758 { for (;;) {} }
2759 compoundStmt(statementCountIs(0)))
2760 matches '{}'
2761 but does not match the outer compound statement.
2762 </pre></td></tr>
2765 <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>
2766 <tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches nodes that have the specified size.
2768 Given
2769 int a[42];
2770 int b[2 * 21];
2771 int c[41], d[43];
2772 char *s = "abcd";
2773 wchar_t *ws = L"abcd";
2774 char *w = "a";
2775 constantArrayType(hasSize(42))
2776 matches "int a[42]" and "int b[2 * 21]"
2777 stringLiteral(hasSize(4))
2778 matches "abcd", L"abcd"
2779 </pre></td></tr>
2782 <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>
2783 <tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
2784 declarations.
2786 Example: Given
2787 int a, b;
2788 int c;
2789 int d = 2, e;
2790 declCountIs(2)
2791 matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
2792 </pre></td></tr>
2795 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('equalsBoundNode1')"><a name="equalsBoundNode1Anchor">equalsBoundNode</a></td><td>std::string ID</td></tr>
2796 <tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
2798 Matches a node if it equals the node previously bound to ID.
2800 Given
2801 class X { int a; int b; };
2802 cxxRecordDecl(
2803 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
2804 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
2805 matches the class X, as a and b have the same type.
2807 Note that when multiple matches are involved via forEach* matchers,
2808 equalsBoundNodes acts as a filter.
2809 For example:
2810 compoundStmt(
2811 forEachDescendant(varDecl().bind("d")),
2812 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
2813 will trigger a match for each combination of variable declaration
2814 and reference to that variable declaration within a compound statement.
2815 </pre></td></tr>
2818 <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>
2819 <tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node.
2821 Decl has pointer identity in the AST.
2822 </pre></td></tr>
2825 <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>
2826 <tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute.
2828 Given
2829 __attribute__((device)) void f() { ... }
2830 decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
2831 f. If the matcher is used from clang-query, attr::Kind parameter should be
2832 passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
2833 </pre></td></tr>
2836 <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>
2837 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is
2838 partially matching a given regex.
2840 Example matches Y but not X
2841 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
2842 #include "ASTMatcher.h"
2843 class X {};
2844 ASTMatcher.h:
2845 class Y {};
2847 Usable 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;
2848 </pre></td></tr>
2851 <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>
2852 <tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file.
2854 Example matches X but not Y
2855 (matcher = cxxRecordDecl(isExpansionInMainFile())
2856 #include &lt;Y.h&gt;
2857 class X {};
2858 Y.h:
2859 class Y {};
2861 Usable 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;
2862 </pre></td></tr>
2865 <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>
2866 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files.
2868 Example matches Y but not X
2869 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
2870 #include &lt;SystemHeader.h&gt;
2871 class X {};
2872 SystemHeader.h:
2873 class Y {};
2875 Usable 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;
2876 </pre></td></tr>
2879 <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>
2880 <tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a declaration that has been implicitly added
2881 by the compiler (eg. implicit default/copy constructors).
2882 </pre></td></tr>
2885 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isInStdNamespace0')"><a name="isInStdNamespace0Anchor">isInStdNamespace</a></td><td></td></tr>
2886 <tr><td colspan="4" class="doc" id="isInStdNamespace0"><pre>Matches declarations in the namespace `std`, but not in nested namespaces.
2888 Given
2889 class vector {};
2890 namespace foo {
2891 class vector {};
2892 namespace std {
2893 class vector {};
2896 namespace std {
2897 inline namespace __1 {
2898 class vector {}; // #1
2899 namespace experimental {
2900 class vector {};
2904 cxxRecordDecl(hasName("vector"), isInStdNamespace()) will match only #1.
2905 </pre></td></tr>
2908 <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>
2909 <tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations.
2911 Given
2912 class C {
2913 public: int a;
2914 protected: int b;
2915 private: int c;
2917 fieldDecl(isPrivate())
2918 matches 'int c;'
2919 </pre></td></tr>
2922 <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>
2923 <tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations.
2925 Given
2926 class C {
2927 public: int a;
2928 protected: int b;
2929 private: int c;
2931 fieldDecl(isProtected())
2932 matches 'int b;'
2933 </pre></td></tr>
2936 <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>
2937 <tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations.
2939 Given
2940 class C {
2941 public: int a;
2942 protected: int b;
2943 private: int c;
2945 fieldDecl(isPublic())
2946 matches 'int a;'
2947 </pre></td></tr>
2950 <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>
2951 <tr><td colspan="4" class="doc" id="designatorCountIs0"><pre>Matches designated initializer expressions that contain
2952 a specific number of designators.
2954 Example: Given
2955 point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
2956 point ptarray2[10] = { [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 };
2957 designatorCountIs(2)
2958 matches '{ [2].y = 1.0, [0].x = 1.0 }',
2959 but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'.
2960 </pre></td></tr>
2963 <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>
2964 <tr><td colspan="4" class="doc" id="isScoped0"><pre>Matches C++11 scoped enum declaration.
2966 Example matches Y (matcher = enumDecl(isScoped()))
2967 enum X {};
2968 enum class Y {};
2969 </pre></td></tr>
2972 <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>
2973 <tr><td colspan="4" class="doc" id="isInstantiationDependent0"><pre>Matches expressions that are instantiation-dependent even if it is
2974 neither type- nor value-dependent.
2976 In the following example, the expression sizeof(sizeof(T() + T()))
2977 is instantiation-dependent (since it involves a template parameter T),
2978 but is neither type- nor value-dependent, since the type of the inner
2979 sizeof is known (std::size_t) and therefore the size of the outer
2980 sizeof is known.
2981 template&lt;typename T&gt;
2982 void f(T x, T y) { sizeof(sizeof(T() + T()); }
2983 expr(isInstantiationDependent()) matches sizeof(sizeof(T() + T())
2984 </pre></td></tr>
2987 <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>
2988 <tr><td colspan="4" class="doc" id="isTypeDependent0"><pre>Matches expressions that are type-dependent because the template type
2989 is not yet instantiated.
2991 For example, the expressions "x" and "x + y" are type-dependent in
2992 the following code, but "y" is not type-dependent:
2993 template&lt;typename T&gt;
2994 void add(T x, int y) {
2995 x + y;
2997 expr(isTypeDependent()) matches x + y
2998 </pre></td></tr>
3001 <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>
3002 <tr><td colspan="4" class="doc" id="isValueDependent0"><pre>Matches expression that are value-dependent because they contain a
3003 non-type template parameter.
3005 For example, the array bound of "Chars" in the following example is
3006 value-dependent.
3007 template&lt;int Size&gt; int f() { return Size; }
3008 expr(isValueDependent()) matches return Size
3009 </pre></td></tr>
3012 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('nullPointerConstant0')"><a name="nullPointerConstant0Anchor">nullPointerConstant</a></td><td></td></tr>
3013 <tr><td colspan="4" class="doc" id="nullPointerConstant0"><pre>Matches expressions that resolve to a null pointer constant, such as
3014 GNU's __null, C++11's nullptr, or C's NULL macro.
3016 Given:
3017 void *v1 = NULL;
3018 void *v2 = nullptr;
3019 void *v3 = __null; // GNU extension
3020 char *cp = (char *)0;
3021 int *ip = 0;
3022 int i = 0;
3023 expr(nullPointerConstant())
3024 matches the initializer for v1, v2, v3, cp, and ip. Does not match the
3025 initializer for i.
3026 </pre></td></tr>
3029 <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>
3030 <tr><td colspan="4" class="doc" id="hasBitWidth0"><pre>Matches non-static data members that are bit-fields of the specified
3031 bit width.
3033 Given
3034 class C {
3035 int a : 2;
3036 int b : 4;
3037 int c : 2;
3039 fieldDecl(hasBitWidth(2))
3040 matches 'int a;' and 'int c;' but not 'int b;'.
3041 </pre></td></tr>
3044 <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>
3045 <tr><td colspan="4" class="doc" id="isBitField0"><pre>Matches non-static data members that are bit-fields.
3047 Given
3048 class C {
3049 int a : 2;
3050 int b;
3052 fieldDecl(isBitField())
3053 matches 'int a;' but not 'int b;'.
3054 </pre></td></tr>
3057 <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>
3058 <tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value of type ValueT.
3060 Given
3061 f('false, 3.14, 42);
3062 characterLiteral(equals(0))
3063 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
3064 match false
3065 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
3066 match 3.14
3067 integerLiteral(equals(42))
3068 matches 42
3070 Note that you cannot directly match a negative numeric literal because the
3071 minus sign is not part of the literal: It is a unary operator whose operand
3072 is the positive numeric literal. Instead, you must use a unaryOperator()
3073 matcher to match the minus sign:
3075 unaryOperator(hasOperatorName("-"),
3076 hasUnaryOperand(integerLiteral(equals(13))))
3078 Usable 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;,
3079 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;
3080 </pre></td></tr>
3083 <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>
3084 <tr><td colspan="4" class="doc" id="equals12"><pre></pre></td></tr>
3087 <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>
3088 <tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec0"><pre>Matches functions that have a dynamic exception specification.
3090 Given:
3091 void f();
3092 void g() noexcept;
3093 void h() noexcept(true);
3094 void i() noexcept(false);
3095 void j() throw();
3096 void k() throw(int);
3097 void l() throw(...);
3098 functionDecl(hasDynamicExceptionSpec()) and
3099 functionProtoType(hasDynamicExceptionSpec())
3100 match the declarations of j, k, and l, but not f, g, h, or i.
3101 </pre></td></tr>
3104 <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>
3105 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names.
3107 Matches overloaded operator names specified in strings without the
3108 "operator" prefix: e.g. "&lt;&lt;".
3110 Given:
3111 class A { int operator*(); };
3112 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
3113 A a;
3114 a &lt;&lt; a; // &lt;-- This matches
3116 cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
3117 specified line and
3118 cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
3119 matches the declaration of A.
3121 Usable 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;
3122 </pre></td></tr>
3125 <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>
3126 <tr><td colspan="4" class="doc" id="hasTrailingReturn0"><pre>Matches a function declared with a trailing return type.
3128 Example matches Y (matcher = functionDecl(hasTrailingReturn()))
3129 int X() {}
3130 auto Y() -&gt; int {}
3131 </pre></td></tr>
3134 <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>
3135 <tr><td colspan="4" class="doc" id="isConstexpr1"><pre>Matches constexpr variable and function declarations,
3136 and if constexpr.
3138 Given:
3139 constexpr int foo = 42;
3140 constexpr int bar();
3141 void baz() { if constexpr(1 &gt; 0) {} }
3142 varDecl(isConstexpr())
3143 matches the declaration of foo.
3144 functionDecl(isConstexpr())
3145 matches the declaration of bar.
3146 ifStmt(isConstexpr())
3147 matches the if statement in baz.
3148 </pre></td></tr>
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('isDefaulted0')"><a name="isDefaulted0Anchor">isDefaulted</a></td><td></td></tr>
3152 <tr><td colspan="4" class="doc" id="isDefaulted0"><pre>Matches defaulted function declarations.
3154 Given:
3155 class A { ~A(); };
3156 class B { ~B() = default; };
3157 functionDecl(isDefaulted())
3158 matches the declaration of ~B, but not ~A.
3159 </pre></td></tr>
3162 <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>
3163 <tr><td colspan="4" class="doc" id="isDefinition3"><pre>Matches if a declaration has a body attached.
3165 Example matches A, va, fa
3166 class A {};
3167 class B; // Doesn't match, as it has no body.
3168 int va;
3169 extern int vb; // Doesn't match, as it doesn't define the variable.
3170 void fa() {}
3171 void fb(); // Doesn't match, as it has no body.
3172 @interface X
3173 - (void)ma; // Doesn't match, interface is declaration.
3174 @end
3175 @implementation X
3176 - (void)ma {}
3177 @end
3179 Usable 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;,
3180 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3181 </pre></td></tr>
3184 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isDeleted0')"><a name="isDeleted0Anchor">isDeleted</a></td><td></td></tr>
3185 <tr><td colspan="4" class="doc" id="isDeleted0"><pre>Matches deleted function declarations.
3187 Given:
3188 void Func();
3189 void DeletedFunc() = delete;
3190 functionDecl(isDeleted())
3191 matches the declaration of DeletedFunc, but not Func.
3192 </pre></td></tr>
3195 <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>
3196 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or
3197 static member variable template instantiations.
3199 Given
3200 template&lt;typename T&gt; void A(T t) { }
3201 template&lt;&gt; void A(int N) { }
3202 functionDecl(isExplicitTemplateSpecialization())
3203 matches the specialization A&lt;int&gt;().
3205 Usable 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;
3206 </pre></td></tr>
3209 <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>
3210 <tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function or variable declarations.
3212 Given:
3213 extern "C" void f() {}
3214 extern "C" { void g() {} }
3215 void h() {}
3216 extern "C" int x = 1;
3217 extern "C" int y = 2;
3218 int z = 3;
3219 functionDecl(isExternC())
3220 matches the declaration of f and g, but not the declaration of h.
3221 varDecl(isExternC())
3222 matches the declaration of x and y, but not the declaration of z.
3223 </pre></td></tr>
3226 <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>
3227 <tr><td colspan="4" class="doc" id="isInline1"><pre>Matches function and namespace declarations that are marked with
3228 the inline keyword.
3230 Given
3231 inline void f();
3232 void g();
3233 namespace n {
3234 inline namespace m {}
3236 functionDecl(isInline()) will match ::f().
3237 namespaceDecl(isInline()) will match n::m.
3238 </pre></td></tr>
3241 <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>
3242 <tr><td colspan="4" class="doc" id="isMain0"><pre>Determines whether the function is "main", which is the entry point
3243 into an executable program.
3244 </pre></td></tr>
3247 <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>
3248 <tr><td colspan="4" class="doc" id="isNoReturn0"><pre>Matches FunctionDecls that have a noreturn attribute.
3250 Given
3251 void nope();
3252 [[noreturn]] void a();
3253 __attribute__((noreturn)) void b();
3254 struct c { [[noreturn]] c(); };
3255 functionDecl(isNoReturn())
3256 matches all of those except
3257 void nope();
3258 </pre></td></tr>
3261 <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>
3262 <tr><td colspan="4" class="doc" id="isNoThrow0"><pre>Matches functions that have a non-throwing exception specification.
3264 Given:
3265 void f();
3266 void g() noexcept;
3267 void h() throw();
3268 void i() throw(int);
3269 void j() noexcept(false);
3270 functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
3271 match the declarations of g, and h, but not f, i or j.
3272 </pre></td></tr>
3275 <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>
3276 <tr><td colspan="4" class="doc" id="isStaticStorageClass0"><pre>Matches variable/function declarations that have "static" storage
3277 class specifier ("static" keyword) written in the source.
3279 Given:
3280 static void f() {}
3281 static int i = 0;
3282 extern int j;
3283 int k;
3284 functionDecl(isStaticStorageClass())
3285 matches the function declaration f.
3286 varDecl(isStaticStorageClass())
3287 matches the variable declaration i.
3288 </pre></td></tr>
3291 <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>
3292 <tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static
3293 member variable template instantiations.
3295 Given
3296 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
3298 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
3300 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
3301 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3302 matches the template instantiation of X&lt;A&gt;.
3304 But given
3305 template &lt;typename T&gt; class X {}; class A {};
3306 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
3307 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3308 does not match, as X&lt;A&gt; is an explicit template specialization.
3310 Usable 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;
3311 </pre></td></tr>
3314 <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>
3315 <tr><td colspan="4" class="doc" id="isVariadic0"><pre>Matches if a function declaration is variadic.
3317 Example matches f, but not g or h. The function i will not match, even when
3318 compiled in C mode.
3319 void f(...);
3320 void g(int);
3321 template &lt;typename... Ts&gt; void h(Ts...);
3322 void i();
3323 </pre></td></tr>
3326 <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>
3327 <tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
3328 specific parameter count.
3330 Given
3331 void f(int i) {}
3332 void g(int i, int j) {}
3333 void h(int i, int j);
3334 void j(int i);
3335 void k(int x, int y, int z, ...);
3336 functionDecl(parameterCountIs(2))
3337 matches g and h
3338 functionProtoType(parameterCountIs(2))
3339 matches g and h
3340 functionProtoType(parameterCountIs(3))
3341 matches k
3342 </pre></td></tr>
3345 <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>
3346 <tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec1"><pre>Matches functions that have a dynamic exception specification.
3348 Given:
3349 void f();
3350 void g() noexcept;
3351 void h() noexcept(true);
3352 void i() noexcept(false);
3353 void j() throw();
3354 void k() throw(int);
3355 void l() throw(...);
3356 functionDecl(hasDynamicExceptionSpec()) and
3357 functionProtoType(hasDynamicExceptionSpec())
3358 match the declarations of j, k, and l, but not f, g, h, or i.
3359 </pre></td></tr>
3362 <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>
3363 <tr><td colspan="4" class="doc" id="isNoThrow1"><pre>Matches functions that have a non-throwing exception specification.
3365 Given:
3366 void f();
3367 void g() noexcept;
3368 void h() throw();
3369 void i() throw(int);
3370 void j() noexcept(false);
3371 functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
3372 match the declarations of g, and h, but not f, i or j.
3373 </pre></td></tr>
3376 <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>
3377 <tr><td colspan="4" class="doc" id="parameterCountIs1"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
3378 specific parameter count.
3380 Given
3381 void f(int i) {}
3382 void g(int i, int j) {}
3383 void h(int i, int j);
3384 void j(int i);
3385 void k(int x, int y, int z, ...);
3386 functionDecl(parameterCountIs(2))
3387 matches g and h
3388 functionProtoType(parameterCountIs(2))
3389 matches g and h
3390 functionProtoType(parameterCountIs(3))
3391 matches k
3392 </pre></td></tr>
3395 <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>
3396 <tr><td colspan="4" class="doc" id="isConstexpr2"><pre>Matches constexpr variable and function declarations,
3397 and if constexpr.
3399 Given:
3400 constexpr int foo = 42;
3401 constexpr int bar();
3402 void baz() { if constexpr(1 &gt; 0) {} }
3403 varDecl(isConstexpr())
3404 matches the declaration of foo.
3405 functionDecl(isConstexpr())
3406 matches the declaration of bar.
3407 ifStmt(isConstexpr())
3408 matches the if statement in baz.
3409 </pre></td></tr>
3412 <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>
3413 <tr><td colspan="4" class="doc" id="equals6"><pre></pre></td></tr>
3416 <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>
3417 <tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value of type ValueT.
3419 Given
3420 f('false, 3.14, 42);
3421 characterLiteral(equals(0))
3422 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
3423 match false
3424 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
3425 match 3.14
3426 integerLiteral(equals(42))
3427 matches 42
3429 Note that you cannot directly match a negative numeric literal because the
3430 minus sign is not part of the literal: It is a unary operator whose operand
3431 is the positive numeric literal. Instead, you must use a unaryOperator()
3432 matcher to match the minus sign:
3434 unaryOperator(hasOperatorName("-"),
3435 hasUnaryOperand(integerLiteral(equals(13))))
3437 Usable 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;,
3438 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;
3439 </pre></td></tr>
3442 <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>
3443 <tr><td colspan="4" class="doc" id="equals13"><pre></pre></td></tr>
3446 <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>
3447 <tr><td colspan="4" class="doc" id="equals9"><pre></pre></td></tr>
3450 <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>
3451 <tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '-&gt;' as opposed
3452 to '.'.
3454 Member calls on the implicit this pointer match as called with '-&gt;'.
3456 Given
3457 class Y {
3458 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
3459 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
3460 int a;
3461 static int b;
3463 template &lt;class T&gt;
3464 class Z {
3465 void x() { this-&gt;m; }
3467 memberExpr(isArrow())
3468 matches this-&gt;x, x, y.x, a, this-&gt;b
3469 cxxDependentScopeMemberExpr(isArrow())
3470 matches this-&gt;m
3471 unresolvedMemberExpr(isArrow())
3472 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
3473 </pre></td></tr>
3476 <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>
3477 <tr><td colspan="4" class="doc" id="hasExternalFormalLinkage0"><pre>Matches a declaration that has external formal linkage.
3479 Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
3480 void f() {
3481 int x;
3482 static int y;
3484 int z;
3486 Example matches f() because it has external formal linkage despite being
3487 unique to the translation unit as though it has internal likage
3488 (matcher = functionDecl(hasExternalFormalLinkage()))
3490 namespace {
3491 void f() {}
3493 </pre></td></tr>
3496 <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>
3497 <tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name.
3499 Supports specifying enclosing namespaces or classes by prefixing the name
3500 with '&lt;enclosing&gt;::'.
3501 Does not match typedefs of an underlying type with the given name.
3503 Example matches X (Name == "X")
3504 class X;
3506 Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
3507 namespace a { namespace b { class X; } }
3508 </pre></td></tr>
3511 <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>
3512 <tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain
3513 a substring matched by the given RegExp.
3515 Supports specifying enclosing namespaces or classes by
3516 prefixing the name with '&lt;enclosing&gt;::'. Does not match typedefs
3517 of an underlying type with the given name.
3519 Example matches X (regexp == "::X")
3520 class X;
3522 Example matches X (regexp is one of "::X", "^foo::.*X", among others)
3523 namespace foo { namespace bar { class X; } }
3524 </pre></td></tr>
3527 <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>
3528 <tr><td colspan="4" class="doc" id="isAnonymous0"><pre>Matches anonymous namespace declarations.
3530 Given
3531 namespace n {
3532 namespace {} // #1
3534 namespaceDecl(isAnonymous()) will match #1 but not ::n.
3535 </pre></td></tr>
3538 <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>
3539 <tr><td colspan="4" class="doc" id="isInline0"><pre>Matches function and namespace declarations that are marked with
3540 the inline keyword.
3542 Given
3543 inline void f();
3544 void g();
3545 namespace n {
3546 inline namespace m {}
3548 functionDecl(isInline()) will match ::f().
3549 namespaceDecl(isInline()) will match n::m.
3550 </pre></td></tr>
3553 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPDefaultClause.html">OMPDefaultClause</a>&gt;</td><td class="name" onclick="toggle('isNoneKind0')"><a name="isNoneKind0Anchor">isNoneKind</a></td><td></td></tr>
3554 <tr><td colspan="4" class="doc" id="isNoneKind0"><pre>Matches if the OpenMP ``default`` clause has ``none`` kind specified.
3556 Given
3558 #pragma omp parallel
3559 #pragma omp parallel default(none)
3560 #pragma omp parallel default(shared)
3562 ``ompDefaultClause(isNoneKind())`` matches only ``default(none)``.
3563 </pre></td></tr>
3566 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPDefaultClause.html">OMPDefaultClause</a>&gt;</td><td class="name" onclick="toggle('isSharedKind0')"><a name="isSharedKind0Anchor">isSharedKind</a></td><td></td></tr>
3567 <tr><td colspan="4" class="doc" id="isSharedKind0"><pre>Matches if the OpenMP ``default`` clause has ``shared`` kind specified.
3569 Given
3571 #pragma omp parallel
3572 #pragma omp parallel default(none)
3573 #pragma omp parallel default(shared)
3575 ``ompDefaultClause(isSharedKind())`` matches only ``default(shared)``.
3576 </pre></td></tr>
3579 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPExecutableDirective.html">OMPExecutableDirective</a>&gt;</td><td class="name" onclick="toggle('isAllowedToContainClauseKind0')"><a name="isAllowedToContainClauseKind0Anchor">isAllowedToContainClauseKind</a></td><td>OpenMPClauseKind CKind</td></tr>
3580 <tr><td colspan="4" class="doc" id="isAllowedToContainClauseKind0"><pre>Matches if the OpenMP directive is allowed to contain the specified OpenMP
3581 clause kind.
3583 Given
3585 #pragma omp parallel
3586 #pragma omp parallel for
3587 #pragma omp for
3589 `ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches
3590 ``omp parallel`` and ``omp parallel for``.
3592 If the matcher is use from clang-query, ``OpenMPClauseKind`` parameter
3593 should be passed as a quoted string. e.g.,
3594 ``isAllowedToContainClauseKind("OMPC_default").``
3595 </pre></td></tr>
3598 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPExecutableDirective.html">OMPExecutableDirective</a>&gt;</td><td class="name" onclick="toggle('isStandaloneDirective0')"><a name="isStandaloneDirective0Anchor">isStandaloneDirective</a></td><td></td></tr>
3599 <tr><td colspan="4" class="doc" id="isStandaloneDirective0"><pre>Matches standalone OpenMP directives,
3600 i.e., directives that can't have a structured block.
3602 Given
3604 #pragma omp parallel
3606 #pragma omp taskyield
3608 ``ompExecutableDirective(isStandaloneDirective()))`` matches
3609 ``omp taskyield``.
3610 </pre></td></tr>
3613 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;</td><td class="name" onclick="toggle('isDerivedFrom3')"><a name="isDerivedFrom3Anchor">isDerivedFrom</a></td><td>std::string BaseName</td></tr>
3614 <tr><td colspan="4" class="doc" id="isDerivedFrom3"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
3615 </pre></td></tr>
3618 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;</td><td class="name" onclick="toggle('isDirectlyDerivedFrom3')"><a name="isDirectlyDerivedFrom3Anchor">isDirectlyDerivedFrom</a></td><td>std::string BaseName</td></tr>
3619 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom3"><pre>Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
3620 </pre></td></tr>
3623 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;</td><td class="name" onclick="toggle('isSameOrDerivedFrom3')"><a name="isSameOrDerivedFrom3Anchor">isSameOrDerivedFrom</a></td><td>std::string BaseName</td></tr>
3624 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom3"><pre>Overloaded method as shortcut for
3625 isSameOrDerivedFrom(hasName(...)).
3626 </pre></td></tr>
3629 <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>
3630 <tr><td colspan="4" class="doc" id="argumentCountIs2"><pre>Checks that a call expression or a constructor call expression has
3631 a specific number of arguments (including absent default arguments).
3633 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3634 void f(int x, int y);
3635 f(0, 0);
3636 </pre></td></tr>
3639 <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>
3640 <tr><td colspan="4" class="doc" id="hasKeywordSelector0"><pre>Matches when the selector is a keyword selector
3642 objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
3643 message expression in
3645 UIWebView *webView = ...;
3646 CGRect bodyFrame = webView.frame;
3647 bodyFrame.size.height = self.bodyContentHeight;
3648 webView.frame = bodyFrame;
3649 // ^---- matches here
3650 </pre></td></tr>
3653 <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>
3654 <tr><td colspan="4" class="doc" id="hasNullSelector0"><pre>Matches when the selector is the empty selector
3656 Matches only when the selector of the objCMessageExpr is NULL. This may
3657 represent an error condition in the tree!
3658 </pre></td></tr>
3661 <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>
3662 <tr><td colspan="4" class="doc" id="hasSelector0"><pre>Matches when BaseName == Selector.getAsString()
3664 matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:"));
3665 matches the outer message expr in the code below, but NOT the message
3666 invocation for self.bodyView.
3667 [self.bodyView loadHTMLString:html baseURL:NULL];
3668 </pre></td></tr>
3671 <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>
3672 <tr><td colspan="4" class="doc" id="hasUnarySelector0"><pre>Matches when the selector is a Unary Selector
3674 matcher = objCMessageExpr(matchesSelector(hasUnarySelector());
3675 matches self.bodyView in the code below, but NOT the outer message
3676 invocation of "loadHTMLString:baseURL:".
3677 [self.bodyView loadHTMLString:html baseURL:NULL];
3678 </pre></td></tr>
3681 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('isClassMessage0')"><a name="isClassMessage0Anchor">isClassMessage</a></td><td></td></tr>
3682 <tr><td colspan="4" class="doc" id="isClassMessage0"><pre>Returns true when the Objective-C message is sent to a class.
3684 Example
3685 matcher = objcMessageExpr(isClassMessage())
3686 matches
3687 [NSString stringWithFormat:@"format"];
3688 but not
3689 NSString *x = @"hello";
3690 [x containsString:@"h"];
3691 </pre></td></tr>
3694 <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>
3695 <tr><td colspan="4" class="doc" id="isInstanceMessage0"><pre>Returns true when the Objective-C message is sent to an instance.
3697 Example
3698 matcher = objcMessageExpr(isInstanceMessage())
3699 matches
3700 NSString *x = @"hello";
3701 [x containsString:@"h"];
3702 but not
3703 [NSString stringWithFormat:@"format"];
3704 </pre></td></tr>
3707 <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>
3708 <tr><td colspan="4" class="doc" id="matchesSelector0"><pre>Matches ObjC selectors whose name contains
3709 a substring matched by the given RegExp.
3710 matcher = objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
3711 invocation for self.bodyView.
3712 [self.bodyView loadHTMLString:html baseURL:NULL];
3713 </pre></td></tr>
3716 <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>
3717 <tr><td colspan="4" class="doc" id="numSelectorArgs0"><pre>Matches when the selector has the specified number of arguments
3719 matcher = objCMessageExpr(numSelectorArgs(0));
3720 matches self.bodyView in the code below
3722 matcher = objCMessageExpr(numSelectorArgs(2));
3723 matches the invocation of "loadHTMLString:baseURL:" but not that
3724 of self.bodyView
3725 [self.bodyView loadHTMLString:html baseURL:NULL];
3726 </pre></td></tr>
3729 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isClassMethod0')"><a name="isClassMethod0Anchor">isClassMethod</a></td><td></td></tr>
3730 <tr><td colspan="4" class="doc" id="isClassMethod0"><pre>Returns true when the Objective-C method declaration is a class method.
3732 Example
3733 matcher = objcMethodDecl(isClassMethod())
3734 matches
3735 @interface I + (void)foo; @end
3736 but not
3737 @interface I - (void)bar; @end
3738 </pre></td></tr>
3741 <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>
3742 <tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached.
3744 Example matches A, va, fa
3745 class A {};
3746 class B; // Doesn't match, as it has no body.
3747 int va;
3748 extern int vb; // Doesn't match, as it doesn't define the variable.
3749 void fa() {}
3750 void fb(); // Doesn't match, as it has no body.
3751 @interface X
3752 - (void)ma; // Doesn't match, interface is declaration.
3753 @end
3754 @implementation X
3755 - (void)ma {}
3756 @end
3758 Usable 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;,
3759 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
3760 </pre></td></tr>
3763 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isInstanceMethod0')"><a name="isInstanceMethod0Anchor">isInstanceMethod</a></td><td></td></tr>
3764 <tr><td colspan="4" class="doc" id="isInstanceMethod0"><pre>Returns true when the Objective-C method declaration is an instance method.
3766 Example
3767 matcher = objcMethodDecl(isInstanceMethod())
3768 matches
3769 @interface I - (void)bar; @end
3770 but not
3771 @interface I + (void)foo; @end
3772 </pre></td></tr>
3775 <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>
3776 <tr><td colspan="4" class="doc" id="hasDefaultArgument0"><pre>Matches a declaration that has default arguments.
3778 Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
3779 void x(int val) {}
3780 void y(int val = 0) {}
3782 Deprecated. Use hasInitializer() instead to be able to
3783 match on the contents of the default argument. For example:
3785 void x(int val = 7) {}
3786 void y(int val = 42) {}
3787 parmVarDecl(hasInitializer(integerLiteral(equals(42))))
3788 matches the parameter of y
3790 A matcher such as
3791 parmVarDecl(hasInitializer(anything()))
3792 is equivalent to parmVarDecl(hasDefaultArgument()).
3793 </pre></td></tr>
3796 <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>
3797 <tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string.
3799 Given
3800 class Y { public: void x(); };
3801 void z() { Y* y; y-&gt;x(); }
3802 cxxMemberCallExpr(on(hasType(asString("class Y *"))))
3803 matches y-&gt;x()
3804 </pre></td></tr>
3807 <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>
3808 <tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node.
3810 Matches a node if it equals the node previously bound to ID.
3812 Given
3813 class X { int a; int b; };
3814 cxxRecordDecl(
3815 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3816 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3817 matches the class X, as a and b have the same type.
3819 Note that when multiple matches are involved via forEach* matchers,
3820 equalsBoundNodes acts as a filter.
3821 For example:
3822 compoundStmt(
3823 forEachDescendant(varDecl().bind("d")),
3824 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3825 will trigger a match for each combination of variable declaration
3826 and reference to that variable declaration within a compound statement.
3827 </pre></td></tr>
3830 <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>
3831 <tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to
3832 the node, not hidden within a typedef.
3834 Given
3835 typedef const int const_int;
3836 const_int i;
3837 int *const j;
3838 int *volatile k;
3839 int m;
3840 varDecl(hasType(hasLocalQualifiers())) matches only j and k.
3841 i is const-qualified but the qualifier is not local.
3842 </pre></td></tr>
3845 <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>
3846 <tr><td colspan="4" class="doc" id="isAnyCharacter0"><pre>Matches QualType nodes that are of character type.
3848 Given
3849 void a(char);
3850 void b(wchar_t);
3851 void c(double);
3852 functionDecl(hasAnyParameter(hasType(isAnyCharacter())))
3853 matches "a(char)", "b(wchar_t)", but not "c(double)".
3854 </pre></td></tr>
3857 <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>
3858 <tr><td colspan="4" class="doc" id="isAnyPointer0"><pre>Matches QualType nodes that are of any pointer type; this includes
3859 the Objective-C object pointer type, which is different despite being
3860 syntactically similar.
3862 Given
3863 int *i = nullptr;
3865 @interface Foo
3866 @end
3867 Foo *f;
3869 int j;
3870 varDecl(hasType(isAnyPointer()))
3871 matches "int *i" and "Foo *f", but not "int j".
3872 </pre></td></tr>
3875 <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>
3876 <tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that
3877 include "top-level" const.
3879 Given
3880 void a(int);
3881 void b(int const);
3882 void c(const int);
3883 void d(const int*);
3884 void e(int const) {};
3885 functionDecl(hasAnyParameter(hasType(isConstQualified())))
3886 matches "void b(int const)", "void c(const int)" and
3887 "void e(int const) {}". It does not match d as there
3888 is no top-level const on the parameter type "const int *".
3889 </pre></td></tr>
3892 <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>
3893 <tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type.
3895 Given
3896 void a(int);
3897 void b(long);
3898 void c(double);
3899 functionDecl(hasAnyParameter(hasType(isInteger())))
3900 matches "a(int)", "b(long)", but not "c(double)".
3901 </pre></td></tr>
3904 <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>
3905 <tr><td colspan="4" class="doc" id="isSignedInteger0"><pre>Matches QualType nodes that are of signed integer type.
3907 Given
3908 void a(int);
3909 void b(unsigned long);
3910 void c(double);
3911 functionDecl(hasAnyParameter(hasType(isSignedInteger())))
3912 matches "a(int)", but not "b(unsigned long)" and "c(double)".
3913 </pre></td></tr>
3916 <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>
3917 <tr><td colspan="4" class="doc" id="isUnsignedInteger0"><pre>Matches QualType nodes that are of unsigned integer type.
3919 Given
3920 void a(int);
3921 void b(unsigned long);
3922 void c(double);
3923 functionDecl(hasAnyParameter(hasType(isUnsignedInteger())))
3924 matches "b(unsigned long)", but not "a(int)" and "c(double)".
3925 </pre></td></tr>
3928 <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>
3929 <tr><td colspan="4" class="doc" id="isVolatileQualified0"><pre>Matches QualType nodes that are volatile-qualified, i.e., that
3930 include "top-level" volatile.
3932 Given
3933 void a(int);
3934 void b(int volatile);
3935 void c(volatile int);
3936 void d(volatile int*);
3937 void e(int volatile) {};
3938 functionDecl(hasAnyParameter(hasType(isVolatileQualified())))
3939 matches "void b(int volatile)", "void c(volatile int)" and
3940 "void e(int volatile) {}". It does not match d as there
3941 is no top-level volatile on the parameter type "volatile int *".
3942 </pre></td></tr>
3945 <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>
3946 <tr><td colspan="4" class="doc" id="isClass0"><pre>Matches RecordDecl object that are spelled with "class."
3948 Example matches C, but not S or U.
3949 struct S {};
3950 class C {};
3951 union U {};
3952 </pre></td></tr>
3955 <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>
3956 <tr><td colspan="4" class="doc" id="isStruct0"><pre>Matches RecordDecl object that are spelled with "struct."
3958 Example matches S, but not C or U.
3959 struct S {};
3960 class C {};
3961 union U {};
3962 </pre></td></tr>
3965 <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>
3966 <tr><td colspan="4" class="doc" id="isUnion0"><pre>Matches RecordDecl object that are spelled with "union."
3968 Example matches U, but not C or S.
3969 struct S {};
3970 class C {};
3971 union U {};
3972 </pre></td></tr>
3975 <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>
3976 <tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node.
3978 Matches a node if it equals the node previously bound to ID.
3980 Given
3981 class X { int a; int b; };
3982 cxxRecordDecl(
3983 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3984 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3985 matches the class X, as a and b have the same type.
3987 Note that when multiple matches are involved via forEach* matchers,
3988 equalsBoundNodes acts as a filter.
3989 For example:
3990 compoundStmt(
3991 forEachDescendant(varDecl().bind("d")),
3992 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3993 will trigger a match for each combination of variable declaration
3994 and reference to that variable declaration within a compound statement.
3995 </pre></td></tr>
3998 <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>
3999 <tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node.
4001 Stmt has pointer identity in the AST.
4002 </pre></td></tr>
4005 <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>
4006 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches AST nodes that were expanded within files whose name is
4007 partially matching a given regex.
4009 Example matches Y but not X
4010 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
4011 #include "ASTMatcher.h"
4012 class X {};
4013 ASTMatcher.h:
4014 class Y {};
4016 Usable 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;
4017 </pre></td></tr>
4020 <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>
4021 <tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches AST nodes that were expanded within the main-file.
4023 Example matches X but not Y
4024 (matcher = cxxRecordDecl(isExpansionInMainFile())
4025 #include &lt;Y.h&gt;
4026 class X {};
4027 Y.h:
4028 class Y {};
4030 Usable 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;
4031 </pre></td></tr>
4034 <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>
4035 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches AST nodes that were expanded within system-header-files.
4037 Example matches Y but not X
4038 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
4039 #include &lt;SystemHeader.h&gt;
4040 class X {};
4041 SystemHeader.h:
4042 class Y {};
4044 Usable 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;
4045 </pre></td></tr>
4048 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('isOMPStructuredBlock0')"><a name="isOMPStructuredBlock0Anchor">isOMPStructuredBlock</a></td><td></td></tr>
4049 <tr><td colspan="4" class="doc" id="isOMPStructuredBlock0"><pre>Matches the Stmt AST node that is marked as being the structured-block
4050 of an OpenMP executable directive.
4052 Given
4054 #pragma omp parallel
4057 ``stmt(isOMPStructuredBlock()))`` matches ``{}``.
4058 </pre></td></tr>
4061 <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>
4062 <tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
4064 Given
4065 int a[42];
4066 int b[2 * 21];
4067 int c[41], d[43];
4068 char *s = "abcd";
4069 wchar_t *ws = L"abcd";
4070 char *w = "a";
4071 constantArrayType(hasSize(42))
4072 matches "int a[42]" and "int b[2 * 21]"
4073 stringLiteral(hasSize(4))
4074 matches "abcd", L"abcd"
4075 </pre></td></tr>
4078 <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>
4079 <tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
4081 Example matches A, va, fa
4082 class A {};
4083 class B; // Doesn't match, as it has no body.
4084 int va;
4085 extern int vb; // Doesn't match, as it doesn't define the variable.
4086 void fa() {}
4087 void fb(); // Doesn't match, as it has no body.
4088 @interface X
4089 - (void)ma; // Doesn't match, interface is declaration.
4090 @end
4091 @implementation X
4092 - (void)ma {}
4093 @end
4095 Usable 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;,
4096 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
4097 </pre></td></tr>
4100 <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>
4101 <tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value.
4103 Note that 'Value' is a string as the template argument's value is
4104 an arbitrary precision integer. 'Value' must be euqal to the canonical
4105 representation of that integral value in base 10.
4107 Given
4108 template&lt;int T&gt; struct C {};
4109 C&lt;42&gt; c;
4110 classTemplateSpecializationDecl(
4111 hasAnyTemplateArgument(equalsIntegralValue("42")))
4112 matches the implicit instantiation of C in C&lt;42&gt;.
4113 </pre></td></tr>
4116 <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>
4117 <tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value.
4119 Given
4120 template&lt;int T&gt; struct C {};
4121 C&lt;42&gt; c;
4122 classTemplateSpecializationDecl(
4123 hasAnyTemplateArgument(isIntegral()))
4124 matches the implicit instantiation of C in C&lt;42&gt;
4125 with isIntegral() matching 42.
4126 </pre></td></tr>
4129 <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>
4130 <tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N.
4132 Given
4133 template&lt;typename T&gt; struct C {};
4134 C&lt;int&gt; c;
4135 classTemplateSpecializationDecl(templateArgumentCountIs(1))
4136 matches C&lt;int&gt;.
4137 </pre></td></tr>
4140 <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>
4141 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is
4142 partially matching a given regex.
4144 Example matches Y but not X
4145 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
4146 #include "ASTMatcher.h"
4147 class X {};
4148 ASTMatcher.h:
4149 class Y {};
4151 Usable 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;
4152 </pre></td></tr>
4155 <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>
4156 <tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file.
4158 Example matches X but not Y
4159 (matcher = cxxRecordDecl(isExpansionInMainFile())
4160 #include &lt;Y.h&gt;
4161 class X {};
4162 Y.h:
4163 class Y {};
4165 Usable 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;
4166 </pre></td></tr>
4169 <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>
4170 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files.
4172 Example matches Y but not X
4173 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
4174 #include &lt;SystemHeader.h&gt;
4175 class X {};
4176 SystemHeader.h:
4177 class Y {};
4179 Usable 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;
4180 </pre></td></tr>
4183 <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>
4184 <tr><td colspan="4" class="doc" id="booleanType0"><pre>Matches type bool.
4186 Given
4187 struct S { bool func(); };
4188 functionDecl(returns(booleanType()))
4189 matches "bool func();"
4190 </pre></td></tr>
4193 <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>
4194 <tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
4196 Matches a node if it equals the node previously bound to ID.
4198 Given
4199 class X { int a; int b; };
4200 cxxRecordDecl(
4201 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
4202 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
4203 matches the class X, as a and b have the same type.
4205 Note that when multiple matches are involved via forEach* matchers,
4206 equalsBoundNodes acts as a filter.
4207 For example:
4208 compoundStmt(
4209 forEachDescendant(varDecl().bind("d")),
4210 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
4211 will trigger a match for each combination of variable declaration
4212 and reference to that variable declaration within a compound statement.
4213 </pre></td></tr>
4216 <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>
4217 <tr><td colspan="4" class="doc" id="equalsNode2"><pre>Matches if a node equals another node.
4219 Type has pointer identity in the AST.
4220 </pre></td></tr>
4223 <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>
4224 <tr><td colspan="4" class="doc" id="realFloatingPointType0"><pre>Matches any real floating-point type (float, double, long double).
4226 Given
4227 int i;
4228 float f;
4229 realFloatingPointType()
4230 matches "float f" but not "int i"
4231 </pre></td></tr>
4234 <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>
4235 <tr><td colspan="4" class="doc" id="voidType0"><pre>Matches type void.
4237 Given
4238 struct S { void func(); };
4239 functionDecl(returns(voidType()))
4240 matches "void func();"
4241 </pre></td></tr>
4244 <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>
4245 <tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
4247 Given
4248 int x;
4249 int s = sizeof(x) + alignof(x)
4250 unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
4251 matches sizeof(x)
4253 If the matcher is use from clang-query, UnaryExprOrTypeTrait parameter
4254 should be passed as a quoted string. e.g., ofKind("UETT_SizeOf").
4255 </pre></td></tr>
4258 <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>
4259 <tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or
4260 unary).
4262 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
4263 !(a || b)
4264 </pre></td></tr>
4267 <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>
4268 <tr><td colspan="4" class="doc" id="isArrow1"><pre>Matches member expressions that are called with '-&gt;' as opposed
4269 to '.'.
4271 Member calls on the implicit this pointer match as called with '-&gt;'.
4273 Given
4274 class Y {
4275 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
4276 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
4277 int a;
4278 static int b;
4280 template &lt;class T&gt;
4281 class Z {
4282 void x() { this-&gt;m; }
4284 memberExpr(isArrow())
4285 matches this-&gt;x, x, y.x, a, this-&gt;b
4286 cxxDependentScopeMemberExpr(isArrow())
4287 matches this-&gt;m
4288 unresolvedMemberExpr(isArrow())
4289 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
4290 </pre></td></tr>
4293 <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>
4294 <tr><td colspan="4" class="doc" id="hasAutomaticStorageDuration0"><pre>Matches a variable declaration that has automatic storage duration.
4296 Example matches x, but not y, z, or a.
4297 (matcher = varDecl(hasAutomaticStorageDuration())
4298 void f() {
4299 int x;
4300 static int y;
4301 thread_local int z;
4303 int a;
4304 </pre></td></tr>
4307 <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>
4308 <tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
4310 Example matches y and z (matcher = varDecl(hasGlobalStorage())
4311 void f() {
4312 int x;
4313 static int y;
4315 int z;
4316 </pre></td></tr>
4319 <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>
4320 <tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a
4321 non-static local variable.
4323 Example matches x (matcher = varDecl(hasLocalStorage())
4324 void f() {
4325 int x;
4326 static int y;
4328 int z;
4329 </pre></td></tr>
4332 <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>
4333 <tr><td colspan="4" class="doc" id="hasStaticStorageDuration0"><pre>Matches a variable declaration that has static storage duration.
4334 It includes the variable declared at namespace scope and those declared
4335 with "static" and "extern" storage class specifiers.
4337 void f() {
4338 int x;
4339 static int y;
4340 thread_local int z;
4342 int a;
4343 static int b;
4344 extern int c;
4345 varDecl(hasStaticStorageDuration())
4346 matches the function declaration y, a, b and c.
4347 </pre></td></tr>
4350 <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>
4351 <tr><td colspan="4" class="doc" id="hasThreadStorageDuration0"><pre>Matches a variable declaration that has thread storage duration.
4353 Example matches z, but not x, z, or a.
4354 (matcher = varDecl(hasThreadStorageDuration())
4355 void f() {
4356 int x;
4357 static int y;
4358 thread_local int z;
4360 int a;
4361 </pre></td></tr>
4364 <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>
4365 <tr><td colspan="4" class="doc" id="isConstexpr0"><pre>Matches constexpr variable and function declarations,
4366 and if constexpr.
4368 Given:
4369 constexpr int foo = 42;
4370 constexpr int bar();
4371 void baz() { if constexpr(1 &gt; 0) {} }
4372 varDecl(isConstexpr())
4373 matches the declaration of foo.
4374 functionDecl(isConstexpr())
4375 matches the declaration of bar.
4376 ifStmt(isConstexpr())
4377 matches the if statement in baz.
4378 </pre></td></tr>
4381 <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>
4382 <tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
4384 Example matches A, va, fa
4385 class A {};
4386 class B; // Doesn't match, as it has no body.
4387 int va;
4388 extern int vb; // Doesn't match, as it doesn't define the variable.
4389 void fa() {}
4390 void fb(); // Doesn't match, as it has no body.
4391 @interface X
4392 - (void)ma; // Doesn't match, interface is declaration.
4393 @end
4394 @implementation X
4395 - (void)ma {}
4396 @end
4398 Usable 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;,
4399 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
4400 </pre></td></tr>
4403 <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>
4404 <tr><td colspan="4" class="doc" id="isExceptionVariable0"><pre>Matches a variable declaration that is an exception variable from
4405 a C++ catch block, or an Objective-C statement.
4407 Example matches x (matcher = varDecl(isExceptionVariable())
4408 void f(int y) {
4409 try {
4410 } catch (int x) {
4413 </pre></td></tr>
4416 <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>
4417 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
4418 static member variable template instantiations.
4420 Given
4421 template&lt;typename T&gt; void A(T t) { }
4422 template&lt;&gt; void A(int N) { }
4423 functionDecl(isExplicitTemplateSpecialization())
4424 matches the specialization A&lt;int&gt;().
4426 Usable 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;
4427 </pre></td></tr>
4430 <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>
4431 <tr><td colspan="4" class="doc" id="isExternC1"><pre>Matches extern "C" function or variable declarations.
4433 Given:
4434 extern "C" void f() {}
4435 extern "C" { void g() {} }
4436 void h() {}
4437 extern "C" int x = 1;
4438 extern "C" int y = 2;
4439 int z = 3;
4440 functionDecl(isExternC())
4441 matches the declaration of f and g, but not the declaration of h.
4442 varDecl(isExternC())
4443 matches the declaration of x and y, but not the declaration of z.
4444 </pre></td></tr>
4447 <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>
4448 <tr><td colspan="4" class="doc" id="isStaticLocal0"><pre>Matches a static variable with local scope.
4450 Example matches y (matcher = varDecl(isStaticLocal()))
4451 void f() {
4452 int x;
4453 static int y;
4455 static int z;
4456 </pre></td></tr>
4459 <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>
4460 <tr><td colspan="4" class="doc" id="isStaticStorageClass1"><pre>Matches variable/function declarations that have "static" storage
4461 class specifier ("static" keyword) written in the source.
4463 Given:
4464 static void f() {}
4465 static int i = 0;
4466 extern int j;
4467 int k;
4468 functionDecl(isStaticStorageClass())
4469 matches the function declaration f.
4470 varDecl(isStaticStorageClass())
4471 matches the variable declaration i.
4472 </pre></td></tr>
4475 <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>
4476 <tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
4477 member variable template instantiations.
4479 Given
4480 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
4482 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
4484 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
4485 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4486 matches the template instantiation of X&lt;A&gt;.
4488 But given
4489 template &lt;typename T&gt; class X {}; class A {};
4490 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
4491 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4492 does not match, as X&lt;A&gt; is an explicit template specialization.
4494 Usable 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;
4495 </pre></td></tr>
4498 <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>
4499 <tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
4500 template instantiations.
4502 Given
4503 template&lt;typename T&gt; void A(T t) { T i; }
4504 A(0);
4505 A(0U);
4506 functionDecl(isInstantiated())
4507 matches 'A(int) {...};' and 'A(unsigned) {...}'.
4508 </pre></td></tr>
4511 <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>
4512 <tr><td colspan="4" class="doc" id="hasAnyName0"><pre>Matches NamedDecl nodes that have any of the specified names.
4514 This matcher is only provided as a performance optimization of hasName.
4515 hasAnyName(a, b, c)
4516 is equivalent to, but faster than
4517 anyOf(hasName(a), hasName(b), hasName(c))
4518 </pre></td></tr>
4521 <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>
4522 <tr><td colspan="4" class="doc" id="hasAnySelector0"><pre>Matches when at least one of the supplied string equals to the
4523 Selector.getAsString()
4525 matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
4526 matches both of the expressions below:
4527 [myObj methodA:argA];
4528 [myObj methodB:argB];
4529 </pre></td></tr>
4532 <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>
4533 <tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
4535 Given
4536 int j;
4537 template&lt;typename T&gt; void A(T t) { T i; j += 42;}
4538 A(0);
4539 A(0U);
4540 declStmt(isInTemplateInstantiation())
4541 matches 'int i;' and 'unsigned i'.
4542 unless(stmt(isInTemplateInstantiation()))
4543 will NOT match j += 42; as it's shared between the template definition and
4544 instantiation.
4545 </pre></td></tr>
4547 <!--END_NARROWING_MATCHERS -->
4548 </table>
4550 <!-- ======================================================================= -->
4551 <h2 id="traversal-matchers">AST Traversal Matchers</h2>
4552 <!-- ======================================================================= -->
4554 <p>Traversal matchers specify the relationship to other nodes that are
4555 reachable from the current node.</p>
4557 <p>Note that there are special traversal matchers (has, hasDescendant, forEach and
4558 forEachDescendant) which work on all nodes and allow users to write more generic
4559 match expressions.</p>
4561 <table>
4562 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
4563 <!-- START_TRAVERSAL_MATCHERS -->
4565 <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>
4566 <tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
4568 Unlike anyOf, eachOf will generate a match result for each
4569 matching submatcher.
4571 For example, in:
4572 class A { int a; int b; };
4573 The matcher:
4574 cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
4575 has(fieldDecl(hasName("b")).bind("v"))))
4576 will generate two results binding "v", the first of which binds
4577 the field declaration of a, the second the field declaration of
4580 Usable as: Any Matcher
4581 </pre></td></tr>
4584 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4585 <tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4586 provided matcher.
4588 Example matches X, A, A::X, B, B::C, B::C::X
4589 (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
4590 class X {};
4591 class A { class X {}; }; // Matches A, because A::X is a class of name
4592 // X inside A.
4593 class B { class C { class X {}; }; };
4595 DescendantT must be an AST base type.
4597 As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
4598 each result that matches instead of only on the first one.
4600 Note: Recursively combined ForEachDescendant can cause many matches:
4601 cxxRecordDecl(forEachDescendant(cxxRecordDecl(
4602 forEachDescendant(cxxRecordDecl())
4604 will match 10 times (plus injected class name matches) on:
4605 class A { class B { class C { class D { class E {}; }; }; }; };
4607 Usable as: Any Matcher
4608 </pre></td></tr>
4611 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
4612 <tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
4613 provided matcher.
4615 Example matches X, Y, Y::X, Z::Y, Z::Y::X
4616 (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
4617 class X {};
4618 class Y { class X {}; }; // Matches Y, because Y::X is a class of name X
4619 // inside Y.
4620 class Z { class Y { class X {}; }; }; // Does not match Z.
4622 ChildT must be an AST base type.
4624 As opposed to 'has', 'forEach' will cause a match for each result that
4625 matches instead of only on the first one.
4627 Usable as: Any Matcher
4628 </pre></td></tr>
4631 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
4632 <tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
4633 matcher.
4635 Given
4636 void f() { if (true) { int x = 42; } }
4637 void g() { for (;;) { int x = 43; } }
4638 expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
4640 Usable as: Any Matcher
4641 </pre></td></tr>
4644 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
4645 <tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
4646 provided matcher.
4648 Example matches X, Y, Z
4649 (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
4650 class X {}; // Matches X, because X::X is a class of name X inside X.
4651 class Y { class X {}; };
4652 class Z { class Y { class X {}; }; };
4654 DescendantT must be an AST base type.
4656 Usable as: Any Matcher
4657 </pre></td></tr>
4660 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
4661 <tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
4662 provided matcher.
4664 Example matches X, Y
4665 (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
4666 class X {}; // Matches X, because X::X is a class of name X inside X.
4667 class Y { class X {}; };
4668 class Z { class Y { class X {}; }; }; // Does not match Z.
4670 ChildT must be an AST base type.
4672 Usable as: Any Matcher
4673 Note that has is direct matcher, so it also matches things like implicit
4674 casts and paren casts. If you are matching with expr then you should
4675 probably consider using ignoringParenImpCasts like:
4676 has(ignoringParenImpCasts(expr())).
4677 </pre></td></tr>
4680 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
4681 <tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
4682 matcher.
4684 Given
4685 void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
4686 compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
4688 Usable as: Any Matcher
4689 </pre></td></tr>
4692 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('optionally0')"><a name="optionally0Anchor">optionally</a></td><td>Matcher&lt;*&gt;, ..., Matcher&lt;*&gt;</td></tr>
4693 <tr><td colspan="4" class="doc" id="optionally0"><pre>Matches any node regardless of the submatchers.
4695 However, optionally will generate a result binding for each matching
4696 submatcher.
4698 Useful when additional information which may or may not present about a
4699 main matching node is desired.
4701 For example, in:
4702 class Foo {
4703 int bar;
4705 The matcher:
4706 cxxRecordDecl(
4707 optionally(has(
4708 fieldDecl(hasName("bar")).bind("var")
4709 ))).bind("record")
4710 will produce a result binding for both "record" and "var".
4711 The matcher will produce a "record" binding for even if there is no data
4712 member named "bar" in that class.
4714 Usable as: Any Matcher
4715 </pre></td></tr>
4718 <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>
4719 <tr><td colspan="4" class="doc" id="hasCondition5"><pre>Matches the condition expression of an if statement, for loop,
4720 switch statement or conditional operator.
4722 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
4723 if (true) {}
4724 </pre></td></tr>
4727 <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>
4728 <tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator
4729 (binary or ternary).
4731 Example matches b
4732 condition ? a : b
4733 condition ?: b
4734 </pre></td></tr>
4737 <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>
4738 <tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
4740 Example 1 (conditional ternary operator): matches a
4741 condition ? a : b
4743 Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
4744 condition ?: b
4745 </pre></td></tr>
4748 <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>
4749 <tr><td colspan="4" class="doc" id="hasDeclaration15"><pre>Matches a node if the declaration associated with that node
4750 matches the given matcher.
4752 The associated declaration is:
4753 - for type nodes, the declaration of the underlying type
4754 - for CallExpr, the declaration of the callee
4755 - for MemberExpr, the declaration of the referenced member
4756 - for CXXConstructExpr, the declaration of the constructor
4757 - for CXXNewExpr, the declaration of the operator new
4758 - for ObjCIvarExpr, the declaration of the ivar
4760 For type nodes, hasDeclaration will generally match the declaration of the
4761 sugared type. Given
4762 class X {};
4763 typedef X Y;
4764 Y y;
4765 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
4766 typedefDecl. A common use case is to match the underlying, desugared type.
4767 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
4768 varDecl(hasType(hasUnqualifiedDesugaredType(
4769 recordType(hasDeclaration(decl())))))
4770 In this matcher, the decl will match the CXXRecordDecl of class X.
4772 Usable 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;,
4773 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;,
4774 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;,
4775 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;,
4776 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;,
4777 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;,
4778 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
4779 </pre></td></tr>
4782 <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>
4783 <tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
4785 Given
4786 int i[5];
4787 void f() { i[1] = 42; }
4788 arraySubscriptExpression(hasBase(implicitCastExpr(
4789 hasSourceExpression(declRefExpr()))))
4790 matches i[1] with the declRefExpr() matching i
4791 </pre></td></tr>
4794 <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>
4795 <tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
4797 Given
4798 int i[5];
4799 void f() { i[1] = 42; }
4800 arraySubscriptExpression(hasIndex(integerLiteral()))
4801 matches i[1] with the integerLiteral() matching 1
4802 </pre></td></tr>
4805 <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>
4806 <tr><td colspan="4" class="doc" id="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
4808 Example matches a (matcher = binaryOperator(hasLHS()))
4809 a || b
4810 </pre></td></tr>
4813 <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>
4814 <tr><td colspan="4" class="doc" id="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
4816 Example matches b (matcher = binaryOperator(hasRHS()))
4817 a || b
4818 </pre></td></tr>
4821 <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>
4822 <tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
4823 type.
4825 Given
4826 struct A {};
4827 A a[7];
4828 int b[7];
4829 arrayType(hasElementType(builtinType()))
4830 matches "int b[7]"
4832 Usable 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;
4833 </pre></td></tr>
4836 <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>
4837 <tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
4839 Given
4840 _Atomic(int) i;
4841 _Atomic(float) f;
4842 atomicType(hasValueType(isInteger()))
4843 matches "_Atomic(int) i"
4845 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
4846 </pre></td></tr>
4849 <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>
4850 <tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
4852 Note: There is no TypeLoc for the deduced type and thus no
4853 getDeducedLoc() matcher.
4855 Given
4856 auto a = 1;
4857 auto b = 2.0;
4858 autoType(hasDeducedType(isInteger()))
4859 matches "auto a"
4861 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
4862 </pre></td></tr>
4865 <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>
4866 <tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
4867 binary operator matches.
4868 </pre></td></tr>
4871 <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>
4872 <tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
4874 Example matches a (matcher = binaryOperator(hasLHS()))
4875 a || b
4876 </pre></td></tr>
4879 <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>
4880 <tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
4882 Example matches b (matcher = binaryOperator(hasRHS()))
4883 a || b
4884 </pre></td></tr>
4887 <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>
4888 <tr><td colspan="4" class="doc" id="hasAnyParameter2"><pre>Matches any parameter of a function or an ObjC method declaration or a
4889 block.
4891 Does not match the 'this' parameter of a method.
4893 Given
4894 class X { void f(int x, int y, int z) {} };
4895 cxxMethodDecl(hasAnyParameter(hasName("y")))
4896 matches f(int x, int y, int z) {}
4897 with hasAnyParameter(...)
4898 matching int y
4900 For ObjectiveC, given
4901 @interface I - (void) f:(int) y; @end
4903 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
4904 matches the declaration of method f with hasParameter
4905 matching y.
4907 For blocks, given
4908 b = ^(int y) { printf("%d", y) };
4910 the matcher blockDecl(hasAnyParameter(hasName("y")))
4911 matches the declaration of the block b with hasParameter
4912 matching y.
4913 </pre></td></tr>
4916 <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>
4917 <tr><td colspan="4" class="doc" id="hasParameter2"><pre>Matches the n'th parameter of a function or an ObjC method
4918 declaration or a block.
4920 Given
4921 class X { void f(int x) {} };
4922 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
4923 matches f(int x) {}
4924 with hasParameter(...)
4925 matching int x
4927 For ObjectiveC, given
4928 @interface I - (void) f:(int) y; @end
4930 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
4931 matches the declaration of method f with hasParameter
4932 matching y.
4933 </pre></td></tr>
4936 <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>
4937 <tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
4938 pointee matches a given matcher.
4940 Given
4941 int *a;
4942 int const *b;
4943 float const *f;
4944 pointerType(pointee(isConstQualified(), isInteger()))
4945 matches "int const *b"
4947 Usable 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;,
4948 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;
4949 </pre></td></tr>
4952 <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>
4953 <tr><td colspan="4" class="doc" id="forEachArgumentWithParam1"><pre>Matches all arguments and their respective ParmVarDecl.
4955 Given
4956 void f(int i);
4957 int y;
4958 f(y);
4959 callExpr(
4960 forEachArgumentWithParam(
4961 declRefExpr(to(varDecl(hasName("y")))),
4962 parmVarDecl(hasType(isInteger()))
4964 matches f(y);
4965 with declRefExpr(...)
4966 matching int y
4967 and parmVarDecl(...)
4968 matching int i
4969 </pre></td></tr>
4972 <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>
4973 <tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
4974 expression, or an ObjC-message-send expression.
4976 Given
4977 void x(int, int, int) { int y; x(1, y, 42); }
4978 callExpr(hasAnyArgument(declRefExpr()))
4979 matches x(1, y, 42)
4980 with hasAnyArgument(...)
4981 matching y
4983 For ObjectiveC, given
4984 @interface I - (void) f:(int) y; @end
4985 void foo(I *i) { [i f:12]; }
4986 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
4987 matches [i f:12]
4988 </pre></td></tr>
4991 <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>
4992 <tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
4993 call expression.
4995 Example matches y in x(y)
4996 (matcher = callExpr(hasArgument(0, declRefExpr())))
4997 void x(int) { int y; x(y); }
4998 </pre></td></tr>
5001 <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>
5002 <tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
5003 matches the given matcher.
5005 The associated declaration is:
5006 - for type nodes, the declaration of the underlying type
5007 - for CallExpr, the declaration of the callee
5008 - for MemberExpr, the declaration of the referenced member
5009 - for CXXConstructExpr, the declaration of the constructor
5010 - for CXXNewExpr, the declaration of the operator new
5011 - for ObjCIvarExpr, the declaration of the ivar
5013 For type nodes, hasDeclaration will generally match the declaration of the
5014 sugared type. Given
5015 class X {};
5016 typedef X Y;
5017 Y y;
5018 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5019 typedefDecl. A common use case is to match the underlying, desugared type.
5020 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5021 varDecl(hasType(hasUnqualifiedDesugaredType(
5022 recordType(hasDeclaration(decl())))))
5023 In this matcher, the decl will match the CXXRecordDecl of class X.
5025 Usable 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;,
5026 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;,
5027 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;,
5028 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;,
5029 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;,
5030 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;,
5031 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5032 </pre></td></tr>
5035 <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>
5036 <tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
5038 Given
5039 class A { A() : i(42), j(42) {} int i; int j; };
5040 cxxConstructorDecl(forEachConstructorInitializer(
5041 forField(decl().bind("x"))
5043 will trigger two matches, binding for 'i' and 'j' respectively.
5044 </pre></td></tr>
5047 <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>
5048 <tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
5050 Given
5051 struct Foo {
5052 Foo() : foo_(1) { }
5053 int foo_;
5055 cxxRecordDecl(has(cxxConstructorDecl(
5056 hasAnyConstructorInitializer(anything())
5058 record matches Foo, hasAnyConstructorInitializer matches foo_(1)
5059 </pre></td></tr>
5062 <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>
5063 <tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
5065 Given
5066 struct Foo {
5067 Foo() : foo_(1) { }
5068 int foo_;
5070 cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
5071 forField(hasName("foo_"))))))
5072 matches Foo
5073 with forField matching foo_
5074 </pre></td></tr>
5077 <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>
5078 <tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
5080 Given
5081 struct Foo {
5082 Foo() : foo_(1) { }
5083 int foo_;
5085 cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
5086 withInitializer(integerLiteral(equals(1)))))))
5087 matches Foo
5088 with withInitializer matching (1)
5089 </pre></td></tr>
5092 <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>
5093 <tr><td colspan="4" class="doc" id="hasObjectExpression2"><pre>Matches a member expression where the object expression is matched by a
5094 given matcher. Implicit object expressions are included; that is, it matches
5095 use of implicit `this`.
5097 Given
5098 struct X {
5099 int m;
5100 int f(X x) { x.m; return m; }
5102 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
5103 matches `x.m`, but not `m`; however,
5104 memberExpr(hasObjectExpression(hasType(pointsTo(
5105 cxxRecordDecl(hasName("X"))))))
5106 matches `m` (aka. `this-&gt;m`), but not `x.m`.
5107 </pre></td></tr>
5110 <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>
5111 <tr><td colspan="4" class="doc" id="hasBody3"><pre>Matches a 'for', 'while', 'do while' statement or a function
5112 definition that has a given body.
5114 Given
5115 for (;;) {}
5116 hasBody(compoundStmt())
5117 matches 'for (;;) {}'
5118 with compoundStmt()
5119 matching '{}'
5120 </pre></td></tr>
5123 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>&gt;</td><td class="name" onclick="toggle('hasInitStatement2')"><a name="hasInitStatement2Anchor">hasInitStatement</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
5124 <tr><td colspan="4" class="doc" id="hasInitStatement2"><pre>Matches selection statements with initializer.
5126 Given:
5127 void foo() {
5128 if (int i = foobar(); i &gt; 0) {}
5129 switch (int i = foobar(); i) {}
5130 for (auto&amp; a = get_range(); auto&amp; x : a) {}
5132 void bar() {
5133 if (foobar() &gt; 0) {}
5134 switch (foobar()) {}
5135 for (auto&amp; x : get_range()) {}
5137 ifStmt(hasInitStatement(anything()))
5138 matches the if statement in foo but not in bar.
5139 switchStmt(hasInitStatement(anything()))
5140 matches the switch statement in foo but not in bar.
5141 cxxForRangeStmt(hasInitStatement(anything()))
5142 matches the range for statement in foo but not in bar.
5143 </pre></td></tr>
5146 <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>
5147 <tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
5149 Example:
5150 forStmt(hasLoopVariable(anything()))
5151 matches 'int x' in
5152 for (int x : a) { }
5153 </pre></td></tr>
5156 <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>
5157 <tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
5159 Example:
5160 forStmt(hasRangeInit(anything()))
5161 matches 'a' in
5162 for (int x : a) { }
5163 </pre></td></tr>
5166 <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>
5167 <tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre>Matches on the implicit object argument of a member call expression. Unlike
5168 `on`, matches the argument directly without stripping away anything.
5170 Given
5171 class Y { public: void m(); };
5172 Y g();
5173 class X : public Y { void g(); };
5174 void z(Y y, X x) { y.m(); x.m(); x.g(); (g()).m(); }
5175 cxxMemberCallExpr(onImplicitObjectArgument(hasType(
5176 cxxRecordDecl(hasName("Y")))))
5177 matches `y.m()`, `x.m()` and (g()).m(), but not `x.g()`.
5178 cxxMemberCallExpr(on(callExpr()))
5179 does not match `(g()).m()`, because the parens are not ignored.
5181 FIXME: Overload to allow directly matching types?
5182 </pre></td></tr>
5185 <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>
5186 <tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression, after
5187 stripping off any parentheses or implicit casts.
5189 Given
5190 class Y { public: void m(); };
5191 Y g();
5192 class X : public Y {};
5193 void z(Y y, X x) { y.m(); (g()).m(); x.m(); }
5194 cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y")))))
5195 matches `y.m()` and `(g()).m()`.
5196 cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("X")))))
5197 matches `x.m()`.
5198 cxxMemberCallExpr(on(callExpr()))
5199 matches `(g()).m()`.
5201 FIXME: Overload to allow directly matching types?
5202 </pre></td></tr>
5205 <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>
5206 <tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
5207 </pre></td></tr>
5210 <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>
5211 <tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the type of the expression's implicit object argument either
5212 matches the InnerMatcher, or is a pointer to a type that matches the
5213 InnerMatcher.
5215 Given
5216 class Y { public: void m(); };
5217 class X : public Y { void g(); };
5218 void z() { Y y; y.m(); Y *p; p-&gt;m(); X x; x.m(); x.g(); }
5219 cxxMemberCallExpr(thisPointerType(hasDeclaration(
5220 cxxRecordDecl(hasName("Y")))))
5221 matches `y.m()`, `p-&gt;m()` and `x.m()`.
5222 cxxMemberCallExpr(thisPointerType(hasDeclaration(
5223 cxxRecordDecl(hasName("X")))))
5224 matches `x.g()`.
5225 </pre></td></tr>
5228 <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>
5229 <tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overridden by the given method. This matcher may
5230 produce multiple matches.
5232 Given
5233 class A { virtual void f(); };
5234 class B : public A { void f(); };
5235 class C : public B { void f(); };
5236 cxxMethodDecl(ofClass(hasName("C")),
5237 forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
5238 matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
5239 that B::f is not overridden by C::f).
5241 The check can produce multiple matches in case of multiple inheritance, e.g.
5242 class A1 { virtual void f(); };
5243 class A2 { virtual void f(); };
5244 class C : public A1, public A2 { void f(); };
5245 cxxMethodDecl(ofClass(hasName("C")),
5246 forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
5247 matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
5248 once with "b" binding "A2::f" and "d" binding "C::f".
5249 </pre></td></tr>
5252 <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>
5253 <tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
5254 belongs to.
5256 FIXME: Generalize this for other kinds of declarations.
5257 FIXME: What other kind of declarations would we need to generalize
5258 this to?
5260 Example matches A() in the last line
5261 (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
5262 ofClass(hasName("A"))))))
5263 class A {
5264 public:
5265 A();
5267 A a = A();
5268 </pre></td></tr>
5271 <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>
5272 <tr><td colspan="4" class="doc" id="hasArraySize0"><pre>Matches array new expressions with a given array size.
5274 Given:
5275 MyClass *p1 = new MyClass[10];
5276 cxxNewExpr(hasArraySize(integerLiteral(equals(10))))
5277 matches the expression 'new MyClass[10]'.
5278 </pre></td></tr>
5281 <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>
5282 <tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
5283 matches the given matcher.
5285 The associated declaration is:
5286 - for type nodes, the declaration of the underlying type
5287 - for CallExpr, the declaration of the callee
5288 - for MemberExpr, the declaration of the referenced member
5289 - for CXXConstructExpr, the declaration of the constructor
5290 - for CXXNewExpr, the declaration of the operator new
5291 - for ObjCIvarExpr, the declaration of the ivar
5293 For type nodes, hasDeclaration will generally match the declaration of the
5294 sugared type. Given
5295 class X {};
5296 typedef X Y;
5297 Y y;
5298 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5299 typedefDecl. A common use case is to match the underlying, desugared type.
5300 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5301 varDecl(hasType(hasUnqualifiedDesugaredType(
5302 recordType(hasDeclaration(decl())))))
5303 In this matcher, the decl will match the CXXRecordDecl of class X.
5305 Usable 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;,
5306 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;,
5307 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;,
5308 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;,
5309 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;,
5310 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;,
5311 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5312 </pre></td></tr>
5315 <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>
5316 <tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
5318 Given:
5319 class A { void func(); };
5320 class B { void member(); };
5322 cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
5323 A but not B.
5324 </pre></td></tr>
5327 <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>
5328 <tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from a class
5329 matching Base, or Objective-C classes that directly or indirectly
5330 subclass a class matching Base.
5332 Note that a class is not considered to be derived from itself.
5334 Example matches Y, Z, C (Base == hasName("X"))
5335 class X;
5336 class Y : public X {}; // directly derived
5337 class Z : public Y {}; // indirectly derived
5338 typedef X A;
5339 typedef A B;
5340 class C : public B {}; // derived from a typedef of X
5342 In the following example, Bar matches isDerivedFrom(hasName("X")):
5343 class Foo;
5344 typedef Foo X;
5345 class Bar : public Foo {}; // derived from a type that X is a typedef of
5347 In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
5348 @interface NSObject @end
5349 @interface Bar : NSObject @end
5351 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;
5352 </pre></td></tr>
5355 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isDirectlyDerivedFrom0')"><a name="isDirectlyDerivedFrom0Anchor">isDirectlyDerivedFrom</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
5356 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom0"><pre>Matches C++ or Objective-C classes that are directly derived from a class
5357 matching Base.
5359 Note that a class is not considered to be derived from itself.
5361 Example matches Y, C (Base == hasName("X"))
5362 class X;
5363 class Y : public X {}; // directly derived
5364 class Z : public Y {}; // indirectly derived
5365 typedef X A;
5366 typedef A B;
5367 class C : public B {}; // derived from a typedef of X
5369 In the following example, Bar matches isDerivedFrom(hasName("X")):
5370 class Foo;
5371 typedef Foo X;
5372 class Bar : public Foo {}; // derived from a type that X is a typedef of
5373 </pre></td></tr>
5376 <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>
5377 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
5378 match Base.
5379 </pre></td></tr>
5382 <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>
5383 <tr><td colspan="4" class="doc" id="hasAnyArgument2"><pre>Matches any argument of a call expression or a constructor call
5384 expression, or an ObjC-message-send expression.
5386 Given
5387 void x(int, int, int) { int y; x(1, y, 42); }
5388 callExpr(hasAnyArgument(declRefExpr()))
5389 matches x(1, y, 42)
5390 with hasAnyArgument(...)
5391 matching y
5393 For ObjectiveC, given
5394 @interface I - (void) f:(int) y; @end
5395 void foo(I *i) { [i f:12]; }
5396 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
5397 matches [i f:12]
5398 </pre></td></tr>
5401 <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>
5402 <tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
5403 given matcher.
5405 Example matches y.x() (matcher = callExpr(callee(
5406 cxxMethodDecl(hasName("x")))))
5407 class Y { public: void x(); };
5408 void z() { Y y; y.x(); }
5409 </pre></td></tr>
5412 <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>
5413 <tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches.
5415 Given
5416 class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
5417 void f() { f(); }
5418 callExpr(callee(expr()))
5419 matches this-&gt;x(), x(), y.x(), f()
5420 with callee(...)
5421 matching this-&gt;x, x, y.x, f respectively
5423 Note: Callee cannot take the more general internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
5424 because this introduces ambiguous overloads with calls to Callee taking a
5425 internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
5426 implemented in terms of implicit casts.
5427 </pre></td></tr>
5430 <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>
5431 <tr><td colspan="4" class="doc" id="forEachArgumentWithParam0"><pre>Matches all arguments and their respective ParmVarDecl.
5433 Given
5434 void f(int i);
5435 int y;
5436 f(y);
5437 callExpr(
5438 forEachArgumentWithParam(
5439 declRefExpr(to(varDecl(hasName("y")))),
5440 parmVarDecl(hasType(isInteger()))
5442 matches f(y);
5443 with declRefExpr(...)
5444 matching int y
5445 and parmVarDecl(...)
5446 matching int i
5447 </pre></td></tr>
5450 <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>
5451 <tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
5452 expression, or an ObjC-message-send expression.
5454 Given
5455 void x(int, int, int) { int y; x(1, y, 42); }
5456 callExpr(hasAnyArgument(declRefExpr()))
5457 matches x(1, y, 42)
5458 with hasAnyArgument(...)
5459 matching y
5461 For ObjectiveC, given
5462 @interface I - (void) f:(int) y; @end
5463 void foo(I *i) { [i f:12]; }
5464 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
5465 matches [i f:12]
5466 </pre></td></tr>
5469 <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>
5470 <tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
5471 call expression.
5473 Example matches y in x(y)
5474 (matcher = callExpr(hasArgument(0, declRefExpr())))
5475 void x(int) { int y; x(y); }
5476 </pre></td></tr>
5479 <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>
5480 <tr><td colspan="4" class="doc" id="hasDeclaration14"><pre>Matches a node if the declaration associated with that node
5481 matches the given matcher.
5483 The associated declaration is:
5484 - for type nodes, the declaration of the underlying type
5485 - for CallExpr, the declaration of the callee
5486 - for MemberExpr, the declaration of the referenced member
5487 - for CXXConstructExpr, the declaration of the constructor
5488 - for CXXNewExpr, the declaration of the operator new
5489 - for ObjCIvarExpr, the declaration of the ivar
5491 For type nodes, hasDeclaration will generally match the declaration of the
5492 sugared type. Given
5493 class X {};
5494 typedef X Y;
5495 Y y;
5496 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5497 typedefDecl. A common use case is to match the underlying, desugared type.
5498 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5499 varDecl(hasType(hasUnqualifiedDesugaredType(
5500 recordType(hasDeclaration(decl())))))
5501 In this matcher, the decl will match the CXXRecordDecl of class X.
5503 Usable 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;,
5504 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;,
5505 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;,
5506 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;,
5507 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;,
5508 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;,
5509 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5510 </pre></td></tr>
5513 <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>
5514 <tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
5515 extension, matches the constant given in the statement.
5517 Given
5518 switch (1) { case 1: case 1+1: case 3 ... 4: ; }
5519 caseStmt(hasCaseConstant(integerLiteral()))
5520 matches "case 1:"
5521 </pre></td></tr>
5524 <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>
5525 <tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression
5526 or opaque value's source expression matches the given matcher.
5528 Example 1: matches "a string"
5529 (matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
5530 class URL { URL(string); };
5531 URL url = "a string";
5533 Example 2: matches 'b' (matcher =
5534 opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
5535 int a = b ?: 1;
5536 </pre></td></tr>
5539 <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>
5540 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5541 functionDecl that have at least one TemplateArgument matching the given
5542 InnerMatcher.
5544 Given
5545 template&lt;typename T&gt; class A {};
5546 template&lt;&gt; class A&lt;double&gt; {};
5547 A&lt;int&gt; a;
5549 template&lt;typename T&gt; f() {};
5550 void func() { f&lt;int&gt;(); };
5552 classTemplateSpecializationDecl(hasAnyTemplateArgument(
5553 refersToType(asString("int"))))
5554 matches the specialization A&lt;int&gt;
5556 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
5557 matches the specialization f&lt;int&gt;
5558 </pre></td></tr>
5561 <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>
5562 <tr><td colspan="4" class="doc" id="hasSpecializedTemplate0"><pre>Matches the specialized template of a specialization declaration.
5564 Given
5565 template&lt;typename T&gt; class A {}; #1
5566 template&lt;&gt; class A&lt;int&gt; {}; #2
5567 classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl()))
5568 matches '#2' with classTemplateDecl() matching the class template
5569 declaration of 'A' at #1.
5570 </pre></td></tr>
5573 <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>
5574 <tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
5575 functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
5577 Given
5578 template&lt;typename T, typename U&gt; class A {};
5579 A&lt;bool, int&gt; b;
5580 A&lt;int, bool&gt; c;
5582 template&lt;typename T&gt; void f() {}
5583 void func() { f&lt;int&gt;(); };
5584 classTemplateSpecializationDecl(hasTemplateArgument(
5585 1, refersToType(asString("int"))))
5586 matches the specialization A&lt;bool, int&gt;
5588 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
5589 matches the specialization f&lt;int&gt;
5590 </pre></td></tr>
5593 <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>
5594 <tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
5595 type.
5597 Given
5598 struct A {};
5599 A a[7];
5600 int b[7];
5601 arrayType(hasElementType(builtinType()))
5602 matches "int b[7]"
5604 Usable 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;
5605 </pre></td></tr>
5608 <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>
5609 <tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
5610 a given matcher. Also matches StmtExprs that have CompoundStmt as children.
5612 Given
5613 { {}; 1+2; }
5614 hasAnySubstatement(compoundStmt())
5615 matches '{ {}; 1+2; }'
5616 with compoundStmt()
5617 matching '{}'
5618 </pre></td></tr>
5621 <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>
5622 <tr><td colspan="4" class="doc" id="hasDecayedType0"><pre>Matches the decayed type, whos decayed type matches InnerMatcher
5623 </pre></td></tr>
5626 <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>
5627 <tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
5628 matches the given matcher.
5630 The associated declaration is:
5631 - for type nodes, the declaration of the underlying type
5632 - for CallExpr, the declaration of the callee
5633 - for MemberExpr, the declaration of the referenced member
5634 - for CXXConstructExpr, the declaration of the constructor
5635 - for CXXNewExpr, the declaration of the operator new
5636 - for ObjCIvarExpr, the declaration of the ivar
5638 For type nodes, hasDeclaration will generally match the declaration of the
5639 sugared type. Given
5640 class X {};
5641 typedef X Y;
5642 Y y;
5643 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5644 typedefDecl. A common use case is to match the underlying, desugared type.
5645 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5646 varDecl(hasType(hasUnqualifiedDesugaredType(
5647 recordType(hasDeclaration(decl())))))
5648 In this matcher, the decl will match the CXXRecordDecl of class X.
5650 Usable 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;,
5651 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;,
5652 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;,
5653 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;,
5654 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;,
5655 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;,
5656 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5657 </pre></td></tr>
5660 <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>
5661 <tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a
5662 specific using shadow declaration.
5664 Given
5665 namespace a { void f() {} }
5666 using a::f;
5667 void g() {
5668 f(); // Matches this ..
5669 a::f(); // .. but not this.
5671 declRefExpr(throughUsingDecl(anything()))
5672 matches f()
5673 </pre></td></tr>
5676 <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>
5677 <tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
5678 specified matcher.
5680 Example matches x in if(x)
5681 (matcher = declRefExpr(to(varDecl(hasName("x")))))
5682 bool x;
5683 if (x) {}
5684 </pre></td></tr>
5687 <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>
5688 <tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
5690 Note that this does not work for global declarations because the AST
5691 breaks up multiple-declaration DeclStmt's into multiple single-declaration
5692 DeclStmt's.
5693 Example: Given non-global declarations
5694 int a, b = 0;
5695 int c;
5696 int d = 2, e;
5697 declStmt(containsDeclaration(
5698 0, varDecl(hasInitializer(anything()))))
5699 matches only 'int d = 2, e;', and
5700 declStmt(containsDeclaration(1, varDecl()))
5701 matches 'int a, b = 0' as well as 'int d = 2, e;'
5702 but 'int c;' is not matched.
5703 </pre></td></tr>
5706 <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>
5707 <tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
5709 Given
5710 int a, b;
5711 int c;
5712 declStmt(hasSingleDecl(anything()))
5713 matches 'int c;' but not 'int a, b;'.
5714 </pre></td></tr>
5717 <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>
5718 <tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches
5719 the inner matcher.
5721 Given
5722 int x;
5723 declaratorDecl(hasTypeLoc(loc(asString("int"))))
5724 matches int x
5725 </pre></td></tr>
5728 <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>
5729 <tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
5730 Decl, matches InnerMatcher.
5732 Given
5733 namespace N {
5734 namespace M {
5735 class D {};
5739 cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
5740 declaration of class D.
5741 </pre></td></tr>
5744 <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>
5745 <tr><td colspan="4" class="doc" id="hasUnderlyingType0"><pre>Matches DecltypeType nodes to find out the underlying type.
5747 Given
5748 decltype(1) a = 1;
5749 decltype(2.0) b = 2.0;
5750 decltypeType(hasUnderlyingType(isInteger()))
5751 matches the type of "a"
5753 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;
5754 </pre></td></tr>
5757 <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>
5758 <tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', 'do while' statement or a function
5759 definition that has a given body.
5761 Given
5762 for (;;) {}
5763 hasBody(compoundStmt())
5764 matches 'for (;;) {}'
5765 with compoundStmt()
5766 matching '{}'
5767 </pre></td></tr>
5770 <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>
5771 <tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
5772 switch statement or conditional operator.
5774 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5775 if (true) {}
5776 </pre></td></tr>
5779 <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>
5780 <tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
5781 matches InnerMatcher if the qualifier exists.
5783 Given
5784 namespace N {
5785 namespace M {
5786 class D {};
5789 N::M::D d;
5791 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
5792 matches the type of the variable declaration of d.
5793 </pre></td></tr>
5796 <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>
5797 <tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
5799 Given
5800 namespace N {
5801 namespace M {
5802 class D {};
5805 N::M::D d;
5807 elaboratedType(namesType(recordType(
5808 hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
5809 declaration of d.
5810 </pre></td></tr>
5813 <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>
5814 <tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
5815 matches the given matcher.
5817 The associated declaration is:
5818 - for type nodes, the declaration of the underlying type
5819 - for CallExpr, the declaration of the callee
5820 - for MemberExpr, the declaration of the referenced member
5821 - for CXXConstructExpr, the declaration of the constructor
5822 - for CXXNewExpr, the declaration of the operator new
5823 - for ObjCIvarExpr, the declaration of the ivar
5825 For type nodes, hasDeclaration will generally match the declaration of the
5826 sugared type. Given
5827 class X {};
5828 typedef X Y;
5829 Y y;
5830 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5831 typedefDecl. A common use case is to match the underlying, desugared type.
5832 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5833 varDecl(hasType(hasUnqualifiedDesugaredType(
5834 recordType(hasDeclaration(decl())))))
5835 In this matcher, the decl will match the CXXRecordDecl of class X.
5837 Usable 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;,
5838 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;,
5839 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;,
5840 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;,
5841 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;,
5842 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;,
5843 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5844 </pre></td></tr>
5847 <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>
5848 <tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
5850 (Note: Clang's AST refers to other conversions as "casts" too, and calls
5851 actual casts "explicit" casts.)
5852 </pre></td></tr>
5855 <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>
5856 <tr><td colspan="4" class="doc" id="hasType4"><pre>Overloaded to match the declaration of the expression's or value
5857 declaration's type.
5859 In case of a value declaration (for example a variable declaration),
5860 this resolves one layer of indirection. For example, in the value
5861 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
5862 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
5863 declaration of x.
5865 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5866 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5867 and friend class X (matcher = friendDecl(hasType("X"))
5868 class X {};
5869 void y(X &amp;x) { x; X z; }
5870 class Y { friend class X; };
5872 Usable 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;
5873 </pre></td></tr>
5876 <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>
5877 <tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
5878 matcher.
5880 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
5881 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
5882 and U (matcher = typedefDecl(hasType(asString("int")))
5883 and friend class X (matcher = friendDecl(hasType("X"))
5884 class X {};
5885 void y(X &amp;x) { x; X z; }
5886 typedef int U;
5887 class Y { friend class X; };
5888 </pre></td></tr>
5891 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('ignoringElidableConstructorCall0')"><a name="ignoringElidableConstructorCall0Anchor">ignoringElidableConstructorCall</a></td><td>ast_matchers::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5892 <tr><td colspan="4" class="doc" id="ignoringElidableConstructorCall0"><pre>Matches expressions that match InnerMatcher that are possibly wrapped in an
5893 elidable constructor and other corresponding bookkeeping nodes.
5895 In C++17, elidable copy constructors are no longer being generated in the
5896 AST as it is not permitted by the standard. They are, however, part of the
5897 AST in C++14 and earlier. So, a matcher must abstract over these differences
5898 to work in all language modes. This matcher skips elidable constructor-call
5899 AST nodes, `ExprWithCleanups` nodes wrapping elidable constructor-calls and
5900 various implicit nodes inside the constructor calls, all of which will not
5901 appear in the C++17 AST.
5903 Given
5905 struct H {};
5906 H G();
5907 void f() {
5908 H D = G();
5911 ``varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())))``
5912 matches ``H D = G()`` in C++11 through C++17 (and beyond).
5913 </pre></td></tr>
5916 <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>
5917 <tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
5918 are stripped off.
5920 Parentheses and explicit casts are not discarded.
5921 Given
5922 int arr[5];
5923 int a = 0;
5924 char b = 0;
5925 const int c = a;
5926 int *d = arr;
5927 long e = (long) 0l;
5928 The matchers
5929 varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
5930 varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
5931 would match the declarations for a, b, c, and d, but not e.
5932 While
5933 varDecl(hasInitializer(integerLiteral()))
5934 varDecl(hasInitializer(declRefExpr()))
5935 only match the declarations for b, c, and d.
5936 </pre></td></tr>
5939 <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>
5940 <tr><td colspan="4" class="doc" id="ignoringImplicit0"><pre>Matches expressions that match InnerMatcher after any implicit AST
5941 nodes are stripped off.
5943 Parentheses and explicit casts are not discarded.
5944 Given
5945 class C {};
5946 C a = C();
5947 C b;
5948 C c = b;
5949 The matchers
5950 varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr())))
5951 would match the declarations for a, b, and c.
5952 While
5953 varDecl(hasInitializer(cxxConstructExpr()))
5954 only match the declarations for b and c.
5955 </pre></td></tr>
5958 <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>
5959 <tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
5960 casts are stripped off.
5962 Implicit and non-C Style casts are also discarded.
5963 Given
5964 int a = 0;
5965 char b = (0);
5966 void* c = reinterpret_cast&lt;char*&gt;(0);
5967 char d = char(0);
5968 The matcher
5969 varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
5970 would match the declarations for a, b, c, and d.
5971 while
5972 varDecl(hasInitializer(integerLiteral()))
5973 only match the declaration for a.
5974 </pre></td></tr>
5977 <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>
5978 <tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
5979 parentheses are stripped off.
5981 Explicit casts are not discarded.
5982 Given
5983 int arr[5];
5984 int a = 0;
5985 char b = (0);
5986 const int c = a;
5987 int *d = (arr);
5988 long e = ((long) 0l);
5989 The matchers
5990 varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
5991 varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
5992 would match the declarations for a, b, c, and d, but not e.
5993 while
5994 varDecl(hasInitializer(integerLiteral()))
5995 varDecl(hasInitializer(declRefExpr()))
5996 would only match the declaration for a.
5997 </pre></td></tr>
6000 <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>
6001 <tr><td colspan="4" class="doc" id="ignoringParens1"><pre>Overload ignoringParens for Expr.
6003 Given
6004 const char* str = ("my-string");
6005 The matcher
6006 implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral())))
6007 would match the implicit cast resulting from the assignment.
6008 </pre></td></tr>
6011 <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>
6012 <tr><td colspan="4" class="doc" id="hasInClassInitializer0"><pre>Matches non-static data members that have an in-class initializer.
6014 Given
6015 class C {
6016 int a = 2;
6017 int b = 3;
6018 int c;
6020 fieldDecl(hasInClassInitializer(integerLiteral(equals(2))))
6021 matches 'int a;' but not 'int b;'.
6022 fieldDecl(hasInClassInitializer(anything()))
6023 matches 'int a;' and 'int b;' but not 'int c;'.
6024 </pre></td></tr>
6027 <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>
6028 <tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', 'do while' statement or a function
6029 definition that has a given body.
6031 Given
6032 for (;;) {}
6033 hasBody(compoundStmt())
6034 matches 'for (;;) {}'
6035 with compoundStmt()
6036 matching '{}'
6037 </pre></td></tr>
6040 <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>
6041 <tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
6042 switch statement or conditional operator.
6044 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6045 if (true) {}
6046 </pre></td></tr>
6049 <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>
6050 <tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
6052 Example:
6053 forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
6054 matches '++x' in
6055 for (x; x &lt; N; ++x) { }
6056 </pre></td></tr>
6059 <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>
6060 <tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
6062 Example:
6063 forStmt(hasLoopInit(declStmt()))
6064 matches 'int x = 0' in
6065 for (int x = 0; x &lt; N; ++x) { }
6066 </pre></td></tr>
6069 <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>
6070 <tr><td colspan="4" class="doc" id="hasType5"><pre>Overloaded to match the declaration of the expression's or value
6071 declaration's type.
6073 In case of a value declaration (for example a variable declaration),
6074 this resolves one layer of indirection. For example, in the value
6075 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
6076 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
6077 declaration of x.
6079 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6080 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6081 and friend class X (matcher = friendDecl(hasType("X"))
6082 class X {};
6083 void y(X &amp;x) { x; X z; }
6084 class Y { friend class X; };
6086 Usable 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;
6087 </pre></td></tr>
6090 <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>
6091 <tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
6092 matcher.
6094 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6095 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6096 and U (matcher = typedefDecl(hasType(asString("int")))
6097 and friend class X (matcher = friendDecl(hasType("X"))
6098 class X {};
6099 void y(X &amp;x) { x; X z; }
6100 typedef int U;
6101 class Y { friend class X; };
6102 </pre></td></tr>
6105 <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>
6106 <tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function or an ObjC method declaration or a
6107 block.
6109 Does not match the 'this' parameter of a method.
6111 Given
6112 class X { void f(int x, int y, int z) {} };
6113 cxxMethodDecl(hasAnyParameter(hasName("y")))
6114 matches f(int x, int y, int z) {}
6115 with hasAnyParameter(...)
6116 matching int y
6118 For ObjectiveC, given
6119 @interface I - (void) f:(int) y; @end
6121 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
6122 matches the declaration of method f with hasParameter
6123 matching y.
6125 For blocks, given
6126 b = ^(int y) { printf("%d", y) };
6128 the matcher blockDecl(hasAnyParameter(hasName("y")))
6129 matches the declaration of the block b with hasParameter
6130 matching y.
6131 </pre></td></tr>
6134 <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>
6135 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6136 functionDecl that have at least one TemplateArgument matching the given
6137 InnerMatcher.
6139 Given
6140 template&lt;typename T&gt; class A {};
6141 template&lt;&gt; class A&lt;double&gt; {};
6142 A&lt;int&gt; a;
6144 template&lt;typename T&gt; f() {};
6145 void func() { f&lt;int&gt;(); };
6147 classTemplateSpecializationDecl(hasAnyTemplateArgument(
6148 refersToType(asString("int"))))
6149 matches the specialization A&lt;int&gt;
6151 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
6152 matches the specialization f&lt;int&gt;
6153 </pre></td></tr>
6156 <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>
6157 <tr><td colspan="4" class="doc" id="hasBody4"><pre>Matches a 'for', 'while', 'do while' statement or a function
6158 definition that has a given body.
6160 Given
6161 for (;;) {}
6162 hasBody(compoundStmt())
6163 matches 'for (;;) {}'
6164 with compoundStmt()
6165 matching '{}'
6166 </pre></td></tr>
6169 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasExplicitSpecifier0')"><a name="hasExplicitSpecifier0Anchor">hasExplicitSpecifier</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6170 <tr><td colspan="4" class="doc" id="hasExplicitSpecifier0"><pre>Matches the expression in an explicit specifier if present in the given
6171 declaration.
6173 Given
6174 template&lt;bool b&gt;
6175 struct S {
6176 S(int); // #1
6177 explicit S(double); // #2
6178 operator int(); // #3
6179 explicit operator bool(); // #4
6180 explicit(false) S(bool) // # 7
6181 explicit(true) S(char) // # 8
6182 explicit(b) S(S) // # 9
6184 S(int) -&gt; S&lt;true&gt; // #5
6185 explicit S(double) -&gt; S&lt;false&gt; // #6
6186 cxxConstructorDecl(hasExplicitSpecifier(constantExpr())) will match #7, #8 and #9, but not #1 or #2.
6187 cxxConversionDecl(hasExplicitSpecifier(constantExpr())) will not match #3 or #4.
6188 cxxDeductionGuideDecl(hasExplicitSpecifier(constantExpr())) will not match #5 or #6.
6189 </pre></td></tr>
6192 <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>
6193 <tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function or an ObjC method
6194 declaration or a block.
6196 Given
6197 class X { void f(int x) {} };
6198 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
6199 matches f(int x) {}
6200 with hasParameter(...)
6201 matching int x
6203 For ObjectiveC, given
6204 @interface I - (void) f:(int) y; @end
6206 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
6207 matches the declaration of method f with hasParameter
6208 matching y.
6209 </pre></td></tr>
6212 <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>
6213 <tr><td colspan="4" class="doc" id="hasTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6214 functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
6216 Given
6217 template&lt;typename T, typename U&gt; class A {};
6218 A&lt;bool, int&gt; b;
6219 A&lt;int, bool&gt; c;
6221 template&lt;typename T&gt; void f() {}
6222 void func() { f&lt;int&gt;(); };
6223 classTemplateSpecializationDecl(hasTemplateArgument(
6224 1, refersToType(asString("int"))))
6225 matches the specialization A&lt;bool, int&gt;
6227 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
6228 matches the specialization f&lt;int&gt;
6229 </pre></td></tr>
6232 <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>
6233 <tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
6235 Given:
6236 class X { int f() { return 1; } };
6237 cxxMethodDecl(returns(asString("int")))
6238 matches int f() { return 1; }
6239 </pre></td></tr>
6242 <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>
6243 <tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
6244 switch statement or conditional operator.
6246 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6247 if (true) {}
6248 </pre></td></tr>
6251 <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>
6252 <tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
6254 Given
6255 if (A* a = GetAPointer()) {}
6256 hasConditionVariableStatement(...)
6257 matches 'A* a = GetAPointer()'.
6258 </pre></td></tr>
6261 <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>
6262 <tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
6264 Examples matches the if statement
6265 (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
6266 if (false) false; else true;
6267 </pre></td></tr>
6270 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;</td><td class="name" onclick="toggle('hasInitStatement0')"><a name="hasInitStatement0Anchor">hasInitStatement</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
6271 <tr><td colspan="4" class="doc" id="hasInitStatement0"><pre>Matches selection statements with initializer.
6273 Given:
6274 void foo() {
6275 if (int i = foobar(); i &gt; 0) {}
6276 switch (int i = foobar(); i) {}
6277 for (auto&amp; a = get_range(); auto&amp; x : a) {}
6279 void bar() {
6280 if (foobar() &gt; 0) {}
6281 switch (foobar()) {}
6282 for (auto&amp; x : get_range()) {}
6284 ifStmt(hasInitStatement(anything()))
6285 matches the if statement in foo but not in bar.
6286 switchStmt(hasInitStatement(anything()))
6287 matches the switch statement in foo but not in bar.
6288 cxxForRangeStmt(hasInitStatement(anything()))
6289 matches the range for statement in foo but not in bar.
6290 </pre></td></tr>
6293 <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>
6294 <tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
6296 Examples matches the if statement
6297 (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
6298 if (false) true; else false;
6299 </pre></td></tr>
6302 <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>
6303 <tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
6304 matcher.
6306 FIXME: Unit test this matcher
6307 </pre></td></tr>
6310 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InitListExpr.html">InitListExpr</a>&gt;</td><td class="name" onclick="toggle('hasInit0')"><a name="hasInit0Anchor">hasInit</a></td><td>unsigned N, ast_matchers::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6311 <tr><td colspan="4" class="doc" id="hasInit0"><pre>Matches the n'th item of an initializer list expression.
6313 Example matches y.
6314 (matcher = initListExpr(hasInit(0, expr())))
6315 int x{y}.
6316 </pre></td></tr>
6319 <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>
6320 <tr><td colspan="4" class="doc" id="hasSyntacticForm0"><pre>Matches the syntactic form of init list expressions
6321 (if expression have it).
6322 </pre></td></tr>
6325 <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>
6326 <tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
6327 matches the given matcher.
6329 The associated declaration is:
6330 - for type nodes, the declaration of the underlying type
6331 - for CallExpr, the declaration of the callee
6332 - for MemberExpr, the declaration of the referenced member
6333 - for CXXConstructExpr, the declaration of the constructor
6334 - for CXXNewExpr, the declaration of the operator new
6335 - for ObjCIvarExpr, the declaration of the ivar
6337 For type nodes, hasDeclaration will generally match the declaration of the
6338 sugared type. Given
6339 class X {};
6340 typedef X Y;
6341 Y y;
6342 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6343 typedefDecl. A common use case is to match the underlying, desugared type.
6344 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6345 varDecl(hasType(hasUnqualifiedDesugaredType(
6346 recordType(hasDeclaration(decl())))))
6347 In this matcher, the decl will match the CXXRecordDecl of class X.
6349 Usable 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;,
6350 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;,
6351 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;,
6352 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;,
6353 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;,
6354 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;,
6355 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6356 </pre></td></tr>
6359 <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>
6360 <tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
6361 matches the given matcher.
6363 The associated declaration is:
6364 - for type nodes, the declaration of the underlying type
6365 - for CallExpr, the declaration of the callee
6366 - for MemberExpr, the declaration of the referenced member
6367 - for CXXConstructExpr, the declaration of the constructor
6368 - for CXXNewExpr, the declaration of the operator new
6369 - for ObjCIvarExpr, the declaration of the ivar
6371 For type nodes, hasDeclaration will generally match the declaration of the
6372 sugared type. Given
6373 class X {};
6374 typedef X Y;
6375 Y y;
6376 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6377 typedefDecl. A common use case is to match the underlying, desugared type.
6378 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6379 varDecl(hasType(hasUnqualifiedDesugaredType(
6380 recordType(hasDeclaration(decl())))))
6381 In this matcher, the decl will match the CXXRecordDecl of class X.
6383 Usable 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;,
6384 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;,
6385 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;,
6386 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;,
6387 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;,
6388 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;,
6389 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6390 </pre></td></tr>
6393 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaExpr.html">LambdaExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyCapture1')"><a name="hasAnyCapture1Anchor">hasAnyCapture</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXThisExpr.html">CXXThisExpr</a>&gt; InnerMatcher</td></tr>
6394 <tr><td colspan="4" class="doc" id="hasAnyCapture1"><pre>Matches any capture of 'this' in a lambda expression.
6396 Given
6397 struct foo {
6398 void bar() {
6399 auto f = [this](){};
6402 lambdaExpr(hasAnyCapture(cxxThisExpr()))
6403 matches [this](){};
6404 </pre></td></tr>
6407 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaExpr.html">LambdaExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyCapture0')"><a name="hasAnyCapture0Anchor">hasAnyCapture</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt; InnerMatcher</td></tr>
6408 <tr><td colspan="4" class="doc" id="hasAnyCapture0"><pre>Matches any capture of a lambda expression.
6410 Given
6411 void foo() {
6412 int x;
6413 auto f = [x](){};
6415 lambdaExpr(hasAnyCapture(anything()))
6416 matches [x](){};
6417 </pre></td></tr>
6420 <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>
6421 <tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
6422 matches the given matcher.
6424 The associated declaration is:
6425 - for type nodes, the declaration of the underlying type
6426 - for CallExpr, the declaration of the callee
6427 - for MemberExpr, the declaration of the referenced member
6428 - for CXXConstructExpr, the declaration of the constructor
6429 - for CXXNewExpr, the declaration of the operator new
6430 - for ObjCIvarExpr, the declaration of the ivar
6432 For type nodes, hasDeclaration will generally match the declaration of the
6433 sugared type. Given
6434 class X {};
6435 typedef X Y;
6436 Y y;
6437 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6438 typedefDecl. A common use case is to match the underlying, desugared type.
6439 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6440 varDecl(hasType(hasUnqualifiedDesugaredType(
6441 recordType(hasDeclaration(decl())))))
6442 In this matcher, the decl will match the CXXRecordDecl of class X.
6444 Usable 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;,
6445 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;,
6446 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;,
6447 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;,
6448 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;,
6449 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;,
6450 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6451 </pre></td></tr>
6454 <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>
6455 <tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is matched by a
6456 given matcher. Implicit object expressions are included; that is, it matches
6457 use of implicit `this`.
6459 Given
6460 struct X {
6461 int m;
6462 int f(X x) { x.m; return m; }
6464 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
6465 matches `x.m`, but not `m`; however,
6466 memberExpr(hasObjectExpression(hasType(pointsTo(
6467 cxxRecordDecl(hasName("X"))))))
6468 matches `m` (aka. `this-&gt;m`), but not `x.m`.
6469 </pre></td></tr>
6472 <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>
6473 <tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
6474 given matcher.
6476 Given
6477 struct { int first, second; } first, second;
6478 int i(second.first);
6479 int j(first.second);
6480 memberExpr(member(hasName("first")))
6481 matches second.first
6482 but not first.second (because the member name there is "second").
6483 </pre></td></tr>
6486 <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>
6487 <tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
6488 pointee matches a given matcher.
6490 Given
6491 int *a;
6492 int const *b;
6493 float const *f;
6494 pointerType(pointee(isConstQualified(), isInteger()))
6495 matches "int const *b"
6497 Usable 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;,
6498 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;
6499 </pre></td></tr>
6502 <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>
6503 <tr><td colspan="4" class="doc" id="hasUnderlyingDecl0"><pre>Matches a NamedDecl whose underlying declaration matches the given
6504 matcher.
6506 Given
6507 namespace N { template&lt;class T&gt; void f(T t); }
6508 template &lt;class T&gt; void g() { using N::f; f(T()); }
6509 unresolvedLookupExpr(hasAnyDeclaration(
6510 namedDecl(hasUnderlyingDecl(hasName("::N::f")))))
6511 matches the use of f in g() .
6512 </pre></td></tr>
6515 <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>
6516 <tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
6518 Given
6519 struct A { struct B { struct C {}; }; };
6520 A::B::C c;
6521 nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
6522 matches "A::"
6523 </pre></td></tr>
6526 <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>
6527 <tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
6528 given TypeLoc.
6530 Given
6531 struct A { struct B { struct C {}; }; };
6532 A::B::C c;
6533 nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
6534 hasDeclaration(cxxRecordDecl(hasName("A")))))))
6535 matches "A::"
6536 </pre></td></tr>
6539 <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>
6540 <tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
6542 Given
6543 struct A { struct B { struct C {}; }; };
6544 A::B::C c;
6545 nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
6546 matches "A::"
6547 </pre></td></tr>
6550 <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>
6551 <tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
6552 given namespace matcher.
6554 Given
6555 namespace ns { struct A {}; }
6556 ns::A a;
6557 nestedNameSpecifier(specifiesNamespace(hasName("ns")))
6558 matches "ns::"
6559 </pre></td></tr>
6562 <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>
6563 <tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
6564 given QualType matcher without qualifiers.
6566 Given
6567 struct A { struct B { struct C {}; }; };
6568 A::B::C c;
6569 nestedNameSpecifier(specifiesType(
6570 hasDeclaration(cxxRecordDecl(hasName("A")))
6572 matches "A::"
6573 </pre></td></tr>
6576 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPExecutableDirective.html">OMPExecutableDirective</a>&gt;</td><td class="name" onclick="toggle('hasAnyClause0')"><a name="hasAnyClause0Anchor">hasAnyClause</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPClause.html">OMPClause</a>&gt; InnerMatcher</td></tr>
6577 <tr><td colspan="4" class="doc" id="hasAnyClause0"><pre>Matches any clause in an OpenMP directive.
6579 Given
6581 #pragma omp parallel
6582 #pragma omp parallel default(none)
6584 ``ompExecutableDirective(hasAnyClause(anything()))`` matches
6585 ``omp parallel default(none)``.
6586 </pre></td></tr>
6589 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPExecutableDirective.html">OMPExecutableDirective</a>&gt;</td><td class="name" onclick="toggle('hasStructuredBlock0')"><a name="hasStructuredBlock0Anchor">hasStructuredBlock</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
6590 <tr><td colspan="4" class="doc" id="hasStructuredBlock0"><pre>Matches the structured-block of the OpenMP executable directive
6592 Prerequisite: the executable directive must not be standalone directive.
6593 If it is, it will never match.
6595 Given
6597 #pragma omp parallel
6599 #pragma omp parallel
6602 ``ompExecutableDirective(hasStructuredBlock(nullStmt()))`` will match ``;``
6603 </pre></td></tr>
6606 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;</td><td class="name" onclick="toggle('isDerivedFrom1')"><a name="isDerivedFrom1Anchor">isDerivedFrom</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
6607 <tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Matches C++ classes that are directly or indirectly derived from a class
6608 matching Base, or Objective-C classes that directly or indirectly
6609 subclass a class matching Base.
6611 Note that a class is not considered to be derived from itself.
6613 Example matches Y, Z, C (Base == hasName("X"))
6614 class X;
6615 class Y : public X {}; // directly derived
6616 class Z : public Y {}; // indirectly derived
6617 typedef X A;
6618 typedef A B;
6619 class C : public B {}; // derived from a typedef of X
6621 In the following example, Bar matches isDerivedFrom(hasName("X")):
6622 class Foo;
6623 typedef Foo X;
6624 class Bar : public Foo {}; // derived from a type that X is a typedef of
6626 In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
6627 @interface NSObject @end
6628 @interface Bar : NSObject @end
6630 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;
6631 </pre></td></tr>
6634 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;</td><td class="name" onclick="toggle('isDirectlyDerivedFrom1')"><a name="isDirectlyDerivedFrom1Anchor">isDirectlyDerivedFrom</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
6635 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom1"><pre>Matches C++ or Objective-C classes that are directly derived from a class
6636 matching Base.
6638 Note that a class is not considered to be derived from itself.
6640 Example matches Y, C (Base == hasName("X"))
6641 class X;
6642 class Y : public X {}; // directly derived
6643 class Z : public Y {}; // indirectly derived
6644 typedef X A;
6645 typedef A B;
6646 class C : public B {}; // derived from a typedef of X
6648 In the following example, Bar matches isDerivedFrom(hasName("X")):
6649 class Foo;
6650 typedef Foo X;
6651 class Bar : public Foo {}; // derived from a type that X is a typedef of
6652 </pre></td></tr>
6655 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>&gt;</td><td class="name" onclick="toggle('isSameOrDerivedFrom1')"><a name="isSameOrDerivedFrom1Anchor">isSameOrDerivedFrom</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
6656 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Similar to isDerivedFrom(), but also matches classes that directly
6657 match Base.
6658 </pre></td></tr>
6661 <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>
6662 <tr><td colspan="4" class="doc" id="hasAnyArgument3"><pre>Matches any argument of a call expression or a constructor call
6663 expression, or an ObjC-message-send expression.
6665 Given
6666 void x(int, int, int) { int y; x(1, y, 42); }
6667 callExpr(hasAnyArgument(declRefExpr()))
6668 matches x(1, y, 42)
6669 with hasAnyArgument(...)
6670 matching y
6672 For ObjectiveC, given
6673 @interface I - (void) f:(int) y; @end
6674 void foo(I *i) { [i f:12]; }
6675 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
6676 matches [i f:12]
6677 </pre></td></tr>
6680 <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>
6681 <tr><td colspan="4" class="doc" id="hasArgument2"><pre>Matches the n'th argument of a call expression or a constructor
6682 call expression.
6684 Example matches y in x(y)
6685 (matcher = callExpr(hasArgument(0, declRefExpr())))
6686 void x(int) { int y; x(y); }
6687 </pre></td></tr>
6690 <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>
6691 <tr><td colspan="4" class="doc" id="hasReceiver0"><pre>Matches if the Objective-C message is sent to an instance,
6692 and the inner matcher matches on that instance.
6694 For example the method call in
6695 NSString *x = @"hello";
6696 [x containsString:@"h"];
6697 is matched by
6698 objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
6699 </pre></td></tr>
6702 <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>
6703 <tr><td colspan="4" class="doc" id="hasReceiverType0"><pre>Matches on the receiver of an ObjectiveC Message expression.
6705 Example
6706 matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *")));
6707 matches the [webView ...] message invocation.
6708 NSString *webViewJavaScript = ...
6709 UIWebView *webView = ...
6710 [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
6711 </pre></td></tr>
6714 <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>
6715 <tr><td colspan="4" class="doc" id="hasAnyParameter1"><pre>Matches any parameter of a function or an ObjC method declaration or a
6716 block.
6718 Does not match the 'this' parameter of a method.
6720 Given
6721 class X { void f(int x, int y, int z) {} };
6722 cxxMethodDecl(hasAnyParameter(hasName("y")))
6723 matches f(int x, int y, int z) {}
6724 with hasAnyParameter(...)
6725 matching int y
6727 For ObjectiveC, given
6728 @interface I - (void) f:(int) y; @end
6730 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
6731 matches the declaration of method f with hasParameter
6732 matching y.
6734 For blocks, given
6735 b = ^(int y) { printf("%d", y) };
6737 the matcher blockDecl(hasAnyParameter(hasName("y")))
6738 matches the declaration of the block b with hasParameter
6739 matching y.
6740 </pre></td></tr>
6743 <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>
6744 <tr><td colspan="4" class="doc" id="hasParameter1"><pre>Matches the n'th parameter of a function or an ObjC method
6745 declaration or a block.
6747 Given
6748 class X { void f(int x) {} };
6749 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
6750 matches f(int x) {}
6751 with hasParameter(...)
6752 matching int x
6754 For ObjectiveC, given
6755 @interface I - (void) f:(int) y; @end
6757 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
6758 matches the declaration of method f with hasParameter
6759 matching y.
6760 </pre></td></tr>
6763 <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>
6764 <tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre>Matches if the cast's source expression
6765 or opaque value's source expression matches the given matcher.
6767 Example 1: matches "a string"
6768 (matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
6769 class URL { URL(string); };
6770 URL url = "a string";
6772 Example 2: matches 'b' (matcher =
6773 opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
6774 int a = b ?: 1;
6775 </pre></td></tr>
6778 <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>
6779 <tr><td colspan="4" class="doc" id="hasAnyDeclaration0"><pre>Matches an OverloadExpr if any of the declarations in the set of
6780 overloads matches the given matcher.
6782 Given
6783 template &lt;typename T&gt; void foo(T);
6784 template &lt;typename T&gt; void bar(T);
6785 template &lt;typename T&gt; void baz(T t) {
6786 foo(t);
6787 bar(t);
6789 unresolvedLookupExpr(hasAnyDeclaration(
6790 functionTemplateDecl(hasName("foo"))))
6791 matches foo in foo(t); but not bar in bar(t);
6792 </pre></td></tr>
6795 <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>
6796 <tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
6798 Given
6799 int (*ptr_to_array)[4];
6800 int (*ptr_to_func)(int);
6802 varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
6803 ptr_to_func but not ptr_to_array.
6805 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
6806 </pre></td></tr>
6809 <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>
6810 <tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
6811 pointee matches a given matcher.
6813 Given
6814 int *a;
6815 int const *b;
6816 float const *f;
6817 pointerType(pointee(isConstQualified(), isInteger()))
6818 matches "int const *b"
6820 Usable 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;,
6821 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;
6822 </pre></td></tr>
6825 <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>
6826 <tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
6828 Given:
6829 typedef int &amp;int_ref;
6830 int a;
6831 int_ref b = a;
6833 varDecl(hasType(qualType(referenceType()))))) will not match the
6834 declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
6835 </pre></td></tr>
6838 <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>
6839 <tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
6840 matches the given matcher.
6842 The associated declaration is:
6843 - for type nodes, the declaration of the underlying type
6844 - for CallExpr, the declaration of the callee
6845 - for MemberExpr, the declaration of the referenced member
6846 - for CXXConstructExpr, the declaration of the constructor
6847 - for CXXNewExpr, the declaration of the operator new
6848 - for ObjCIvarExpr, the declaration of the ivar
6850 For type nodes, hasDeclaration will generally match the declaration of the
6851 sugared type. Given
6852 class X {};
6853 typedef X Y;
6854 Y y;
6855 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6856 typedefDecl. A common use case is to match the underlying, desugared type.
6857 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6858 varDecl(hasType(hasUnqualifiedDesugaredType(
6859 recordType(hasDeclaration(decl())))))
6860 In this matcher, the decl will match the CXXRecordDecl of class X.
6862 Usable 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;,
6863 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;,
6864 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;,
6865 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;,
6866 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;,
6867 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;,
6868 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6869 </pre></td></tr>
6872 <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>
6873 <tr><td colspan="4" class="doc" id="ignoringParens0"><pre>Matches types that match InnerMatcher after any parens are stripped.
6875 Given
6876 void (*fp)(void);
6877 The matcher
6878 varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
6879 would match the declaration for fp.
6880 </pre></td></tr>
6883 <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>
6884 <tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
6885 </pre></td></tr>
6888 <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>
6889 <tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
6890 matches the specified matcher.
6892 Example matches y-&gt;x()
6893 (matcher = cxxMemberCallExpr(on(hasType(pointsTo
6894 cxxRecordDecl(hasName("Y")))))))
6895 class Y { public: void x(); };
6896 void z() { Y *y; y-&gt;x(); }
6897 </pre></td></tr>
6900 <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>
6901 <tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
6902 </pre></td></tr>
6905 <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>
6906 <tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
6907 type matches the specified matcher.
6909 Example matches X &amp;x and const X &amp;y
6910 (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
6911 class X {
6912 void a(X b) {
6913 X &amp;x = b;
6914 const X &amp;y = b;
6917 </pre></td></tr>
6920 <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>
6921 <tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
6922 matches the given matcher.
6924 The associated declaration is:
6925 - for type nodes, the declaration of the underlying type
6926 - for CallExpr, the declaration of the callee
6927 - for MemberExpr, the declaration of the referenced member
6928 - for CXXConstructExpr, the declaration of the constructor
6929 - for CXXNewExpr, the declaration of the operator new
6930 - for ObjCIvarExpr, the declaration of the ivar
6932 For type nodes, hasDeclaration will generally match the declaration of the
6933 sugared type. Given
6934 class X {};
6935 typedef X Y;
6936 Y y;
6937 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6938 typedefDecl. A common use case is to match the underlying, desugared type.
6939 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6940 varDecl(hasType(hasUnqualifiedDesugaredType(
6941 recordType(hasDeclaration(decl())))))
6942 In this matcher, the decl will match the CXXRecordDecl of class X.
6944 Usable 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;,
6945 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;,
6946 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;,
6947 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;,
6948 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;,
6949 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;,
6950 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6951 </pre></td></tr>
6954 <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>
6955 <tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
6956 pointee matches a given matcher.
6958 Given
6959 int *a;
6960 int const *b;
6961 float const *f;
6962 pointerType(pointee(isConstQualified(), isInteger()))
6963 matches "int const *b"
6965 Usable 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;,
6966 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;
6967 </pre></td></tr>
6970 <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>
6971 <tr><td colspan="4" class="doc" id="hasReturnValue0"><pre>Matches the return value expression of a return statement
6973 Given
6974 return a + b;
6975 hasReturnValue(binaryOperator())
6976 matches 'return a + b'
6977 with binaryOperator()
6978 matching 'a + b'
6979 </pre></td></tr>
6982 <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>
6983 <tr><td colspan="4" class="doc" id="hasAnySubstatement1"><pre>Matches compound statements where at least one substatement matches
6984 a given matcher. Also matches StmtExprs that have CompoundStmt as children.
6986 Given
6987 { {}; 1+2; }
6988 hasAnySubstatement(compoundStmt())
6989 matches '{ {}; 1+2; }'
6990 with compoundStmt()
6991 matching '{}'
6992 </pre></td></tr>
6995 <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>
6996 <tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
6997 alignof.
6998 </pre></td></tr>
7001 <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>
7002 <tr><td colspan="4" class="doc" id="forFunction0"><pre>Matches declaration of the function the statement belongs to
7004 Given:
7005 F&amp; operator=(const F&amp; o) {
7006 std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
7007 return *this;
7009 returnStmt(forFunction(hasName("operator=")))
7010 matches 'return *this'
7011 but does not match 'return v &gt; 0'
7012 </pre></td></tr>
7015 <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>
7016 <tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
7017 sizeof.
7018 </pre></td></tr>
7021 <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>
7022 <tr><td colspan="4" class="doc" id="hasReplacementType0"><pre>Matches template type parameter substitutions that have a replacement
7023 type that matches the provided matcher.
7025 Given
7026 template &lt;typename T&gt;
7027 double F(T t);
7028 int i;
7029 double j = F(i);
7031 substTemplateTypeParmType(hasReplacementType(type())) matches int
7032 </pre></td></tr>
7035 <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>
7036 <tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
7037 statement. This matcher may produce multiple matches.
7039 Given
7040 switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
7041 switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
7042 matches four times, with "c" binding each of "case 1:", "case 2:",
7043 "case 3:" and "case 4:", and "s" respectively binding "switch (1)",
7044 "switch (1)", "switch (2)" and "switch (2)".
7045 </pre></td></tr>
7048 <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>
7049 <tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
7050 switch statement or conditional operator.
7052 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
7053 if (true) {}
7054 </pre></td></tr>
7057 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1SwitchStmt.html">SwitchStmt</a>&gt;</td><td class="name" onclick="toggle('hasInitStatement1')"><a name="hasInitStatement1Anchor">hasInitStatement</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
7058 <tr><td colspan="4" class="doc" id="hasInitStatement1"><pre>Matches selection statements with initializer.
7060 Given:
7061 void foo() {
7062 if (int i = foobar(); i &gt; 0) {}
7063 switch (int i = foobar(); i) {}
7064 for (auto&amp; a = get_range(); auto&amp; x : a) {}
7066 void bar() {
7067 if (foobar() &gt; 0) {}
7068 switch (foobar()) {}
7069 for (auto&amp; x : get_range()) {}
7071 ifStmt(hasInitStatement(anything()))
7072 matches the if statement in foo but not in bar.
7073 switchStmt(hasInitStatement(anything()))
7074 matches the switch statement in foo but not in bar.
7075 cxxForRangeStmt(hasInitStatement(anything()))
7076 matches the range for statement in foo but not in bar.
7077 </pre></td></tr>
7080 <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>
7081 <tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
7082 matches the given matcher.
7084 The associated declaration is:
7085 - for type nodes, the declaration of the underlying type
7086 - for CallExpr, the declaration of the callee
7087 - for MemberExpr, the declaration of the referenced member
7088 - for CXXConstructExpr, the declaration of the constructor
7089 - for CXXNewExpr, the declaration of the operator new
7090 - for ObjCIvarExpr, the declaration of the ivar
7092 For type nodes, hasDeclaration will generally match the declaration of the
7093 sugared type. Given
7094 class X {};
7095 typedef X Y;
7096 Y y;
7097 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7098 typedefDecl. A common use case is to match the underlying, desugared type.
7099 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7100 varDecl(hasType(hasUnqualifiedDesugaredType(
7101 recordType(hasDeclaration(decl())))))
7102 In this matcher, the decl will match the CXXRecordDecl of class X.
7104 Usable 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;,
7105 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;,
7106 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;,
7107 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;,
7108 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;,
7109 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;,
7110 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7111 </pre></td></tr>
7114 <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>
7115 <tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
7117 Given
7118 struct B { int next; };
7119 template&lt;int(B::*next_ptr)&gt; struct A {};
7120 A&lt;&amp;B::next&gt; a;
7121 templateSpecializationType(hasAnyTemplateArgument(
7122 isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
7123 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
7124 B::next
7125 </pre></td></tr>
7128 <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>
7129 <tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
7130 declaration.
7132 Given
7133 struct B { int next; };
7134 template&lt;int(B::*next_ptr)&gt; struct A {};
7135 A&lt;&amp;B::next&gt; a;
7136 classTemplateSpecializationDecl(hasAnyTemplateArgument(
7137 refersToDeclaration(fieldDecl(hasName("next")))))
7138 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
7139 B::next
7140 </pre></td></tr>
7143 <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>
7144 <tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that referes to an integral type.
7146 Given
7147 template&lt;int T&gt; struct C {};
7148 C&lt;42&gt; c;
7149 classTemplateSpecializationDecl(
7150 hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
7151 matches the implicit instantiation of C in C&lt;42&gt;.
7152 </pre></td></tr>
7155 <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>
7156 <tr><td colspan="4" class="doc" id="refersToTemplate0"><pre>Matches a TemplateArgument that refers to a certain template.
7158 Given
7159 template&lt;template &lt;typename&gt; class S&gt; class X {};
7160 template&lt;typename T&gt; class Y {};
7161 X&lt;Y&gt; xi;
7162 classTemplateSpecializationDecl(hasAnyTemplateArgument(
7163 refersToTemplate(templateName())))
7164 matches the specialization X&lt;Y&gt;
7165 </pre></td></tr>
7168 <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>
7169 <tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
7171 Given
7172 struct X {};
7173 template&lt;typename T&gt; struct A {};
7174 A&lt;X&gt; a;
7175 classTemplateSpecializationDecl(hasAnyTemplateArgument(
7176 refersToType(class(hasName("X")))))
7177 matches the specialization A&lt;X&gt;
7178 </pre></td></tr>
7181 <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>
7182 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
7183 functionDecl that have at least one TemplateArgument matching the given
7184 InnerMatcher.
7186 Given
7187 template&lt;typename T&gt; class A {};
7188 template&lt;&gt; class A&lt;double&gt; {};
7189 A&lt;int&gt; a;
7191 template&lt;typename T&gt; f() {};
7192 void func() { f&lt;int&gt;(); };
7194 classTemplateSpecializationDecl(hasAnyTemplateArgument(
7195 refersToType(asString("int"))))
7196 matches the specialization A&lt;int&gt;
7198 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
7199 matches the specialization f&lt;int&gt;
7200 </pre></td></tr>
7203 <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>
7204 <tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
7205 matches the given matcher.
7207 The associated declaration is:
7208 - for type nodes, the declaration of the underlying type
7209 - for CallExpr, the declaration of the callee
7210 - for MemberExpr, the declaration of the referenced member
7211 - for CXXConstructExpr, the declaration of the constructor
7212 - for CXXNewExpr, the declaration of the operator new
7213 - for ObjCIvarExpr, the declaration of the ivar
7215 For type nodes, hasDeclaration will generally match the declaration of the
7216 sugared type. Given
7217 class X {};
7218 typedef X Y;
7219 Y y;
7220 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7221 typedefDecl. A common use case is to match the underlying, desugared type.
7222 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7223 varDecl(hasType(hasUnqualifiedDesugaredType(
7224 recordType(hasDeclaration(decl())))))
7225 In this matcher, the decl will match the CXXRecordDecl of class X.
7227 Usable 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;,
7228 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;,
7229 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;,
7230 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;,
7231 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;,
7232 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;,
7233 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7234 </pre></td></tr>
7237 <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>
7238 <tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
7239 functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
7241 Given
7242 template&lt;typename T, typename U&gt; class A {};
7243 A&lt;bool, int&gt; b;
7244 A&lt;int, bool&gt; c;
7246 template&lt;typename T&gt; void f() {}
7247 void func() { f&lt;int&gt;(); };
7248 classTemplateSpecializationDecl(hasTemplateArgument(
7249 1, refersToType(asString("int"))))
7250 matches the specialization A&lt;bool, int&gt;
7252 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
7253 matches the specialization f&lt;int&gt;
7254 </pre></td></tr>
7257 <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>
7258 <tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
7259 matches the given matcher.
7261 The associated declaration is:
7262 - for type nodes, the declaration of the underlying type
7263 - for CallExpr, the declaration of the callee
7264 - for MemberExpr, the declaration of the referenced member
7265 - for CXXConstructExpr, the declaration of the constructor
7266 - for CXXNewExpr, the declaration of the operator new
7267 - for ObjCIvarExpr, the declaration of the ivar
7269 For type nodes, hasDeclaration will generally match the declaration of the
7270 sugared type. Given
7271 class X {};
7272 typedef X Y;
7273 Y y;
7274 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7275 typedefDecl. A common use case is to match the underlying, desugared type.
7276 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7277 varDecl(hasType(hasUnqualifiedDesugaredType(
7278 recordType(hasDeclaration(decl())))))
7279 In this matcher, the decl will match the CXXRecordDecl of class X.
7281 Usable 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;,
7282 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;,
7283 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;,
7284 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;,
7285 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;,
7286 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;,
7287 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7288 </pre></td></tr>
7291 <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>
7292 <tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
7294 Generates results for each match.
7296 For example, in:
7297 class A { class B {}; class C {}; };
7298 The matcher:
7299 cxxRecordDecl(hasName("::A"),
7300 findAll(cxxRecordDecl(isDefinition()).bind("m")))
7301 will generate results for A, B and C.
7303 Usable as: Any Matcher
7304 </pre></td></tr>
7307 <tr><td>Matcher&lt;T&gt;</td><td class="name" onclick="toggle('traverse1')"><a name="traverse1Anchor">traverse</a></td><td>ast_type_traits::TraversalKind TK, const BindableMatcher&lt;T&gt; InnerMatcher</td></tr>
7308 <tr><td colspan="4" class="doc" id="traverse1"><pre></pre></td></tr>
7311 <tr><td>Matcher&lt;T&gt;</td><td class="name" onclick="toggle('traverse0')"><a name="traverse0Anchor">traverse</a></td><td>ast_type_traits::TraversalKind TK, const Matcher&lt;T&gt; InnerMatcher</td></tr>
7312 <tr><td colspan="4" class="doc" id="traverse0"><pre>Causes all nested matchers to be matched with the specified traversal kind.
7314 Given
7315 void foo()
7317 int i = 3.0;
7319 The matcher
7320 traverse(ast_type_traits::TK_IgnoreImplicitCastsAndParentheses,
7321 varDecl(hasInitializer(floatLiteral().bind("init")))
7323 matches the variable declaration with "init" bound to the "3.0".
7324 </pre></td></tr>
7327 <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>
7328 <tr><td colspan="4" class="doc" id="hasType2"><pre>Matches if the expression's or declaration's type matches a type
7329 matcher.
7331 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
7332 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
7333 and U (matcher = typedefDecl(hasType(asString("int")))
7334 and friend class X (matcher = friendDecl(hasType("X"))
7335 class X {};
7336 void y(X &amp;x) { x; X z; }
7337 typedef int U;
7338 class Y { friend class X; };
7339 </pre></td></tr>
7342 <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>
7343 <tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
7344 matches the given matcher.
7346 The associated declaration is:
7347 - for type nodes, the declaration of the underlying type
7348 - for CallExpr, the declaration of the callee
7349 - for MemberExpr, the declaration of the referenced member
7350 - for CXXConstructExpr, the declaration of the constructor
7351 - for CXXNewExpr, the declaration of the operator new
7352 - for ObjCIvarExpr, the declaration of the ivar
7354 For type nodes, hasDeclaration will generally match the declaration of the
7355 sugared type. Given
7356 class X {};
7357 typedef X Y;
7358 Y y;
7359 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7360 typedefDecl. A common use case is to match the underlying, desugared type.
7361 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7362 varDecl(hasType(hasUnqualifiedDesugaredType(
7363 recordType(hasDeclaration(decl())))))
7364 In this matcher, the decl will match the CXXRecordDecl of class X.
7366 Usable 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;,
7367 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;,
7368 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;,
7369 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;,
7370 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;,
7371 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;,
7372 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7373 </pre></td></tr>
7376 <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>
7377 <tr><td colspan="4" class="doc" id="hasUnqualifiedDesugaredType0"><pre>Matches if the matched type matches the unqualified desugared
7378 type of the matched node.
7380 For example, in:
7381 class A {};
7382 using B = A;
7383 The matcher type(hasUnqualifiedDesugaredType(recordType())) matches
7384 both B and A.
7385 </pre></td></tr>
7388 <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>
7389 <tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
7391 Given
7392 int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
7393 unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
7394 matches sizeof(a) and alignof(c)
7395 </pre></td></tr>
7398 <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>
7399 <tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
7401 Example matches true (matcher = hasUnaryOperand(
7402 cxxBoolLiteral(equals(true))))
7403 !true
7404 </pre></td></tr>
7407 <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>
7408 <tr><td colspan="4" class="doc" id="hasObjectExpression1"><pre>Matches a member expression where the object expression is matched by a
7409 given matcher. Implicit object expressions are included; that is, it matches
7410 use of implicit `this`.
7412 Given
7413 struct X {
7414 int m;
7415 int f(X x) { x.m; return m; }
7417 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
7418 matches `x.m`, but not `m`; however,
7419 memberExpr(hasObjectExpression(hasType(pointsTo(
7420 cxxRecordDecl(hasName("X"))))))
7421 matches `m` (aka. `this-&gt;m`), but not `x.m`.
7422 </pre></td></tr>
7425 <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>
7426 <tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
7427 matches the given matcher.
7429 The associated declaration is:
7430 - for type nodes, the declaration of the underlying type
7431 - for CallExpr, the declaration of the callee
7432 - for MemberExpr, the declaration of the referenced member
7433 - for CXXConstructExpr, the declaration of the constructor
7434 - for CXXNewExpr, the declaration of the operator new
7435 - for ObjCIvarExpr, the declaration of the ivar
7437 For type nodes, hasDeclaration will generally match the declaration of the
7438 sugared type. Given
7439 class X {};
7440 typedef X Y;
7441 Y y;
7442 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7443 typedefDecl. A common use case is to match the underlying, desugared type.
7444 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7445 varDecl(hasType(hasUnqualifiedDesugaredType(
7446 recordType(hasDeclaration(decl())))))
7447 In this matcher, the decl will match the CXXRecordDecl of class X.
7449 Usable 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;,
7450 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;,
7451 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;,
7452 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;,
7453 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;,
7454 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;,
7455 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7456 </pre></td></tr>
7459 <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>
7460 <tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
7462 Given
7463 namespace X { void b(); }
7464 using X::b;
7465 usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
7466 matches using X::b </pre></td></tr>
7469 <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>
7470 <tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
7471 matched by the given matcher.
7473 Given
7474 namespace X { int a; void b(); }
7475 using X::a;
7476 using X::b;
7477 usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
7478 matches using X::b but not using X::a </pre></td></tr>
7481 <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>
7482 <tr><td colspan="4" class="doc" id="hasType6"><pre>Overloaded to match the declaration of the expression's or value
7483 declaration's type.
7485 In case of a value declaration (for example a variable declaration),
7486 this resolves one layer of indirection. For example, in the value
7487 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
7488 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
7489 declaration of x.
7491 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
7492 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
7493 and friend class X (matcher = friendDecl(hasType("X"))
7494 class X {};
7495 void y(X &amp;x) { x; X z; }
7496 class Y { friend class X; };
7498 Usable 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;
7499 </pre></td></tr>
7502 <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>
7503 <tr><td colspan="4" class="doc" id="hasType3"><pre>Matches if the expression's or declaration's type matches a type
7504 matcher.
7506 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
7507 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
7508 and U (matcher = typedefDecl(hasType(asString("int")))
7509 and friend class X (matcher = friendDecl(hasType("X"))
7510 class X {};
7511 void y(X &amp;x) { x; X z; }
7512 typedef int U;
7513 class Y { friend class X; };
7514 </pre></td></tr>
7517 <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>
7518 <tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
7519 that matches the given matcher.
7521 Example matches x (matcher = varDecl(hasInitializer(callExpr())))
7522 bool y() { return true; }
7523 bool x = y();
7524 </pre></td></tr>
7527 <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>
7528 <tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
7529 expression.
7531 Given
7532 void f(int b) {
7533 int a[b];
7535 variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
7536 varDecl(hasName("b")))))))
7537 matches "int a[b]"
7538 </pre></td></tr>
7541 <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>
7542 <tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', 'do while' statement or a function
7543 definition that has a given body.
7545 Given
7546 for (;;) {}
7547 hasBody(compoundStmt())
7548 matches 'for (;;) {}'
7549 with compoundStmt()
7550 matching '{}'
7551 </pre></td></tr>
7554 <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>
7555 <tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
7556 switch statement or conditional operator.
7558 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
7559 if (true) {}
7560 </pre></td></tr>
7563 <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>
7564 <tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
7565 NestedNameSpecifier-matcher matches.
7566 </pre></td></tr>
7569 <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>
7570 <tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
7571 QualType-matcher matches.
7572 </pre></td></tr>
7574 <!--END_TRAVERSAL_MATCHERS -->
7575 </table>
7577 </div>
7578 </body>
7579 </html>