[SCCP] Avoid modifying AdditionalUsers while iterating over it
[llvm-project.git] / clang / docs / LibASTMatchersReference.html
blobb8fb27b126fc1e742808e6f09ff0ab43f223907f
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 span.mono { font-family: monospace; }
22 .traverse_compare, .traverse_compare td, .traverse_compare th {
23 border: 1px solid black;
24 border-collapse: collapse;
26 </style>
27 <script type="text/javascript">
28 function toggle(id) {
29 if (!id) return;
30 row = document.getElementById(id);
31 if (row.style.display != 'table-cell')
32 row.style.display = 'table-cell';
33 else
34 row.style.display = 'none';
36 </script>
37 </head>
38 <body onLoad="toggle(location.hash.substring(1, location.hash.length - 6))">
40 <!--#include virtual="../menu.html.incl"-->
42 <div id="content">
44 <h1>AST Matcher Reference</h1>
46 <p>This document shows all currently implemented matchers. The matchers are grouped
47 by category and node type they match. You can click on matcher names to show the
48 matcher's source documentation.</p>
50 <p>There are three different basic categories of matchers:
51 <ul>
52 <li><a href="#decl-matchers">Node Matchers:</a> Matchers that match a specific type of AST node.</li>
53 <li><a href="#narrowing-matchers">Narrowing Matchers:</a> Matchers that match attributes on AST nodes.</li>
54 <li><a href="#traversal-matchers">Traversal Matchers:</a> Matchers that allow traversal between AST nodes.</li>
55 </ul>
56 </p>
58 <p>Within each category the matchers are ordered by node type they match on.
59 Note that if a matcher can match multiple node types, it will appear
60 multiple times. This means that by searching for Matcher&lt;Stmt&gt; you can
61 find all matchers that can be used to match on Stmt nodes.</p>
63 <p>The exception to that rule are matchers that can match on any node. Those
64 are marked with a * and are listed in the beginning of each category.</p>
66 <p>Note that the categorization of matchers is a great help when you combine
67 them into matcher expressions. You will usually want to form matcher expressions
68 that read like english sentences by alternating between node matchers and
69 narrowing or traversal matchers, like this:
70 <pre>
71 recordDecl(hasDescendant(
72 ifStmt(hasTrueExpression(
73 expr(hasDescendant(
74 ifStmt()))))))
75 </pre>
76 </p>
78 <!-- ======================================================================= -->
79 <h2 id="traverse-mode">Traverse Mode</h2>
80 <!-- ======================================================================= -->
82 <p>The default mode of operation of AST Matchers visits all nodes in the AST,
83 even if they are not spelled in the source. This is
84 <span class="mono">AsIs</span> mode. This mode requires writing AST matchers
85 that explicitly traverse or ignore implicit nodes, such as parentheses
86 surrounding an expression or expressions with cleanups. These implicit
87 nodes are not always obvious from the syntax of the source code, and so this
88 mode requires careful consideration and testing to get the desired behavior
89 from an AST matcher.
90 </p>
92 <p>In addition, because template instantiations are matched in the default mode,
93 transformations can be accidentally made to template declarations. Finally,
94 because implicit nodes are matched by default, transformations can be made on
95 entirely incorrect places in the code.</p>
97 <p>For these reasons, it is possible to ignore AST nodes which are not spelled
98 in the source using the <span class="mono">IgnoreUnlessSpelledInSource</span>
99 mode. This is likely to be far less error-prone for users who are not already
100 very familiar with where implicit nodes appear in the AST. It is also likely
101 to be less error-prone for experienced AST users, as difficult cases do not
102 need to be encountered and matcher expressions adjusted for these cases.</p>
104 <p>In clang-query, the mode can be changed with
105 <pre>
106 set traversal IgnoreUnlessSpelledInSource
107 </pre>
108 </p>
109 This affects both matchers and AST dump output in results.
111 <p>When using the C++ API such as in clang-tidy checks, the
112 <span class="mono">traverse()</span> matcher is used to set the mode:
113 <pre>
114 Finder->addMatcher(traverse(TK_IgnoreUnlessSpelledInSource,
115 returnStmt(hasReturnArgument(integerLiteral(equals(0))))
116 ), this);
117 </pre>
118 </p>
119 <p>The following table compares the <span class="mono">AsIs</span> mode with
120 the <span class="mono">IgnoreUnlessSpelledInSource</span> mode:</p>
122 <table class="traverse_compare">
123 <tr>
124 <th></th>
125 <th><span class="mono">AsIs</span></th>
126 <th><span class="mono">IgnoreUnlessSpelledInSource</span></th>
127 </tr>
128 <tr>
129 <td>AST dump of <span class="mono">func1</span>:
130 <pre>
131 struct B {
132 B(int);
135 B func1() { return 42; }
136 </pre>
138 </td>
139 <td>
140 C++98 dialect:
141 <pre>
142 FunctionDecl
143 `-CompoundStmt
144 `-ReturnStmt
145 `-ExprWithCleanups
146 `-CXXConstructExpr
147 `-MaterializeTemporaryExpr
148 `-ImplicitCastExpr
149 `-ImplicitCastExpr
150 `-CXXConstructExpr
151 `-IntegerLiteral 'int' 42
152 </pre>
153 C++11, C++14 dialect:
154 <pre>
155 FunctionDecl
156 `-CompoundStmt
157 `-ReturnStmt
158 `-ExprWithCleanups
159 `-CXXConstructExpr
160 `-MaterializeTemporaryExpr
161 `-ImplicitCastExpr
162 `-CXXConstructExpr
163 `-IntegerLiteral 'int' 42
164 </pre>
165 C++17, C++20 dialect:
166 <pre>
167 FunctionDecl
168 `-CompoundStmt
169 `-ReturnStmt
170 `-ImplicitCastExpr
171 `-CXXConstructExpr
172 `-IntegerLiteral 'int' 42
173 </pre>
174 </td>
175 <td>
176 All dialects:
177 <pre>
178 FunctionDecl
179 `-CompoundStmt
180 `-ReturnStmt
181 `-IntegerLiteral 'int' 42
182 </pre></td>
183 </tr>
185 <tr>
186 <td>Matcher for returned <span class="mono">42</span>:
187 <pre>
188 struct B {
189 B(int);
192 B func1() { return 42; }
193 </pre>
195 </td>
196 <td>
197 All dialects:
198 <pre>
199 returnStmt(hasReturnValue(
200 ignoringImplicit(
201 ignoringElidableConstructorCall(
202 ignoringImplicit(
203 cxxConstructExpr(hasArgument(0,
204 ignoringImplicit(
205 integerLiteral().bind("returnVal")
212 </pre></td>
213 <td>
214 All dialects:
215 <pre>
216 returnStmt(hasReturnValue(
217 integerLiteral().bind("returnVal")
219 </pre></td>
220 </tr>
221 <tr>
222 <td>Match result for
223 <pre>implicitCastExpr()</pre>
224 given:
225 <pre>
226 struct B {
227 B(int);
230 B func1() { return 42; }
231 </pre>
233 </td>
234 <td>
235 Match found.</td>
236 <td>
237 No match.</td>
238 </tr>
239 <tr>
240 <td>Match result for:
241 <pre>
242 cxxConstructorDecl(
243 isCopyConstructor()
244 ).bind("prepend_explicit")
245 </pre>
246 given:
247 <pre>
248 struct Other {};
249 struct Copyable {
250 Other m_o;
251 Copyable();
253 </pre>
254 </td>
255 <td>
256 Match found. Insertion produces incorrect output:
257 <pre>
258 struct Other {};
259 struct explicit Copyable {
260 Other m_o;
261 Copyable();
263 </pre>
264 </td>
265 <td>
266 No match found. Incorrect replacement not possible.
267 </td>
268 </tr>
269 <tr>
270 <td>Replacement of <span class="mono">begin()</span>
271 with <span class="mono">cbegin()</span>:
272 <pre>
273 cxxMemberCallExpr(
274 on(ConstContainerExpr),
275 callee(cxxMethodDecl(hasName("begin")))
276 ).bind("replace_with_cbegin")
277 </pre>
278 given:
279 <pre>
280 void foo() {
281 const Container c;
282 c.begin();
284 for (auto i : c) {
287 </pre>
288 </td>
289 <td>
290 2 matches found. Replacement produces incorrect output:
291 <pre>
292 void foo() {
293 const Container c;
294 c.cbegin();
296 for (auto i :.cbegin() c) {
299 </pre>
300 </td>
301 <td>
302 1 match found. Replacement produces correct output:
303 <pre>
304 void foo() {
305 const Container c;
306 c.cbegin();
308 for (auto i : c) {
311 </pre>
312 </td>
313 </tr>
314 <tr>
315 <td>Replacement of <span class="mono">int</span> member
316 with <span class="mono">safe_int</span>:
317 <pre>
318 fieldDecl(
319 hasType(asString("int"))
320 ).bind("use_safe_int")
321 </pre>
322 given:
323 <pre>
324 struct S {
325 int m_i;
328 template &lt;typename T&gt; struct TemplStruct {
329 TemplStruct() {}
330 ~TemplStruct() {}
332 private:
333 T m_t;
336 void instantiate() { TemplStruct&lt;int&gt; ti; }
337 </pre>
338 </td>
339 <td>
340 2 matches found. Replacement produces incorrect output:
341 <pre>
342 struct S {
343 safe_int m_i;
346 template &lt;typename T&gt; struct TemplStruct {
347 TemplStruct() {}
348 ~TemplStruct() {}
350 private:
351 safe_int m_t;
354 void instantiate() { TemplStruct&lt;int&gt; ti; }
355 </pre>
356 </td>
357 <td>
358 1 match found. Replacement produces correct output:
359 <pre>
360 struct S {
361 safe_int m_i;
364 template &lt;typename T&gt; struct TemplStruct {
365 TemplStruct() {}
366 ~TemplStruct() {}
368 private:
369 T m_t;
372 void instantiate() { TemplStruct&lt;int&gt; ti; }
373 </pre>
374 </td>
375 </tr>
376 <tr>
377 <td>Add prefix to member initializer
378 <pre>
379 cxxCtorInitializer(
380 forField(fieldDecl())
381 ).bind("add_prefix")
382 </pre>
383 given:
384 <pre>
385 struct Simple {};
387 struct Record {
388 Record() : i(42) {}
389 private:
390 int i;
391 Simple s;
393 </pre>
394 </td>
395 <td>
396 2 matches found. Replacement produces incorrect output:
397 <pre>
398 struct Simple {};
400 struct Record {
401 m_Record() : m_i(42) {}
402 private:
403 int i;
404 Simple s;
406 </pre>
407 </td>
408 <td>
409 1 match found. Replacement produces correct output:
410 <pre>
411 struct Simple {};
413 struct Record {
414 Record() : m_i(42) {}
415 private:
416 int i;
417 Simple s;
419 </pre>
420 </td>
421 </tr>
422 <tr>
423 <td>Ignored default arguments
424 <pre>
425 callExpr(
426 callee(functionDecl(
427 hasName("hasDefaultArg")
429 argumentCountIs(1)
430 ).bind("add_prefix")
431 </pre>
432 given:
433 <pre>
434 void hasDefaultArg(int i, int j = 0) {}
435 void callDefaultArg() { hasDefaultArg(42); }
436 </pre>
437 </td>
438 <td>
439 No match.
440 </td>
441 <td>
442 1 match found.
443 </td>
444 </tr>
445 <tr>
446 <td>Lambda fields
447 <pre>
448 fieldDecl(
449 hasType(asString("int"))
450 ).bind("make_safe")
451 </pre>
452 given:
453 <pre>
454 struct S {
455 int m_i;
458 void func() {
459 int a = 0;
460 int c = 0;
462 auto l = [a, b = c](int d) { int e = d; };
463 l(43);
465 </pre>
466 </td>
467 <td>
468 2 matches found. Replacement produces incorrect output:
469 <pre>
470 struct S {
471 safe_int m_i;
474 void func() {
475 int a = 0;
476 int c = 0;
478 auto l = [safe_a, safe_b = c](int d) { int e = d; };
479 l(43);
481 </pre>
482 </td>
483 <td>
484 1 match found. Replacement produces correct output:
485 <pre>
486 struct S {
487 safe_int m_i;
490 void func() {
491 int a = 0;
492 int c = 0;
494 auto l = [a, b = c](int d) { int e = d; };
495 l(43);
497 </pre>
498 </td>
500 </tr>
506 <tr>
507 <td>Rewritten binary operators
508 <pre>
509 binaryOperator(
510 hasOperatorName("&lt;"),
511 hasRHS(hasDescendant(integerLiteral(equals(0))))
513 </pre>
514 given:
515 <pre>
516 #include &lt;compare&gt;
518 class HasSpaceship {
519 public:
520 int x;
521 bool operator==(const HasSpaceship&) const = default;
522 std::strong_ordering operator<=>(const HasSpaceship&) const = default;
525 bool isLess(const HasSpaceship& a, const HasSpaceship& b) {
526 return a < b;
528 </pre>
529 </td>
530 <td>
531 1 match found.
533 <pre>
534 return a < b;
535 ^~~~~
536 </pre>
538 </td>
539 <td>
540 No match found.
541 </td>
542 </tr>
543 </table>
545 <!-- ======================================================================= -->
546 <h2 id="decl-matchers">Node Matchers</h2>
547 <!-- ======================================================================= -->
549 <p>Node matchers are at the core of matcher expressions - they specify the type
550 of node that is expected. Every match expression starts with a node matcher,
551 which can then be further refined with a narrowing or traversal matcher. All
552 traversal matchers take node matchers as their arguments.</p>
554 <p>For convenience, all node matchers take an arbitrary number of arguments
555 and implicitly act as allOf matchers.</p>
557 <p>Node matchers are the only matchers that support the bind("id") call to
558 bind the matched node to the given string, to be later retrieved from the
559 match callback.</p>
561 <p>It is important to remember that the arguments to node matchers are
562 predicates on the same node, just with additional information about the type.
563 This is often useful to make matcher expression more readable by inlining bind
564 calls into redundant node matchers inside another node matcher:
565 <pre>
566 // This binds the CXXRecordDecl to "id", as the decl() matcher will stay on
567 // the same node.
568 recordDecl(decl().bind("id"), hasName("::MyClass"))
569 </pre>
570 </p>
572 <table>
573 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
574 <!-- START_DECL_MATCHERS -->
576 <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>
577 <tr><td colspan="4" class="doc" id="cxxCtorInitializer0"><pre>Matches constructor initializers.
579 Examples matches i(42).
580 class C {
581 C() : i(42) {}
582 int i;
584 </pre></td></tr>
587 <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>
588 <tr><td colspan="4" class="doc" id="accessSpecDecl0"><pre>Matches C++ access specifier declarations.
590 Given
591 class C {
592 public:
593 int a;
595 accessSpecDecl()
596 matches 'public:'
597 </pre></td></tr>
600 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('bindingDecl0')"><a name="bindingDecl0Anchor">bindingDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BindingDecl.html">BindingDecl</a>&gt;...</td></tr>
601 <tr><td colspan="4" class="doc" id="bindingDecl0"><pre>Matches binding declarations
602 Example matches foo and bar
603 (matcher = bindingDecl()
605 auto [foo, bar] = std::make_pair{42, 42};
606 </pre></td></tr>
609 <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>
610 <tr><td colspan="4" class="doc" id="blockDecl0"><pre>Matches block declarations.
612 Example matches the declaration of the nameless block printing an input
613 integer.
615 myFunc(^(int p) {
616 printf("%d", p);
618 </pre></td></tr>
621 <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>
622 <tr><td colspan="4" class="doc" id="classTemplateDecl0"><pre>Matches C++ class template declarations.
624 Example matches Z
625 template&lt;class T&gt; class Z {};
626 </pre></td></tr>
629 <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>
630 <tr><td colspan="4" class="doc" id="classTemplatePartialSpecializationDecl0"><pre>Matches C++ class template partial specializations.
632 Given
633 template&lt;class T1, class T2, int I&gt;
634 class A {};
636 template&lt;class T, int I&gt;
637 class A&lt;T, T*, I&gt; {};
639 template&lt;&gt;
640 class A&lt;int, int, 1&gt; {};
641 classTemplatePartialSpecializationDecl()
642 matches the specialization A&lt;T,T*,I&gt; but not A&lt;int,int,1&gt;
643 </pre></td></tr>
646 <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>
647 <tr><td colspan="4" class="doc" id="classTemplateSpecializationDecl0"><pre>Matches C++ class template specializations.
649 Given
650 template&lt;typename T&gt; class A {};
651 template&lt;&gt; class A&lt;double&gt; {};
652 A&lt;int&gt; a;
653 classTemplateSpecializationDecl()
654 matches the specializations A&lt;int&gt; and A&lt;double&gt;
655 </pre></td></tr>
658 <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>
659 <tr><td colspan="4" class="doc" id="cxxConstructorDecl0"><pre>Matches C++ constructor declarations.
661 Example matches Foo::Foo() and Foo::Foo(int)
662 class Foo {
663 public:
664 Foo();
665 Foo(int);
666 int DoSomething();
668 </pre></td></tr>
671 <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>
672 <tr><td colspan="4" class="doc" id="cxxConversionDecl0"><pre>Matches conversion operator declarations.
674 Example matches the operator.
675 class X { operator int() const; };
676 </pre></td></tr>
679 <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>
680 <tr><td colspan="4" class="doc" id="cxxDeductionGuideDecl0"><pre>Matches user-defined and implicitly generated deduction guide.
682 Example matches the deduction guide.
683 template&lt;typename T&gt;
684 class X { X(int) };
685 X(int) -&gt; X&lt;int&gt;;
686 </pre></td></tr>
689 <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>
690 <tr><td colspan="4" class="doc" id="cxxDestructorDecl0"><pre>Matches explicit C++ destructor declarations.
692 Example matches Foo::~Foo()
693 class Foo {
694 public:
695 virtual ~Foo();
697 </pre></td></tr>
700 <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>
701 <tr><td colspan="4" class="doc" id="cxxMethodDecl0"><pre>Matches method declarations.
703 Example matches y
704 class X { void y(); };
705 </pre></td></tr>
708 <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>
709 <tr><td colspan="4" class="doc" id="cxxRecordDecl0"><pre>Matches C++ class declarations.
711 Example matches X, Z
712 class X;
713 template&lt;class T&gt; class Z {};
714 </pre></td></tr>
717 <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>
718 <tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations.
720 Examples matches X, C, and the friend declaration inside C;
721 void X();
722 class C {
723 friend X;
725 </pre></td></tr>
728 <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>
729 <tr><td colspan="4" class="doc" id="declaratorDecl0"><pre>Matches declarator declarations (field, variable, function
730 and non-type template parameter declarations).
732 Given
733 class X { int y; };
734 declaratorDecl()
735 matches int y.
736 </pre></td></tr>
739 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('decompositionDecl0')"><a name="decompositionDecl0Anchor">decompositionDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecompositionDecl.html">DecompositionDecl</a>&gt;...</td></tr>
740 <tr><td colspan="4" class="doc" id="decompositionDecl0"><pre>Matches decomposition-declarations.
742 Examples matches the declaration node with foo and bar, but not
743 number.
744 (matcher = declStmt(has(decompositionDecl())))
746 int number = 42;
747 auto [foo, bar] = std::make_pair{42, 42};
748 </pre></td></tr>
751 <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>
752 <tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants.
754 Example matches A, B, C
755 enum X {
756 A, B, C
758 </pre></td></tr>
761 <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>
762 <tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations.
764 Example matches X
765 enum X {
766 A, B, C
768 </pre></td></tr>
771 <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>
772 <tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations.
774 Given
775 class X { int m; };
776 fieldDecl()
777 matches 'm'.
778 </pre></td></tr>
781 <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>
782 <tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations.
784 Given
785 class X { friend void foo(); };
786 friendDecl()
787 matches 'friend void foo()'.
788 </pre></td></tr>
791 <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>
792 <tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations.
794 Example matches f
795 void f();
796 </pre></td></tr>
799 <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>
800 <tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations.
802 Example matches f
803 template&lt;class T&gt; void f(T t) {}
804 </pre></td></tr>
807 <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>
808 <tr><td colspan="4" class="doc" id="indirectFieldDecl0"><pre>Matches indirect field declarations.
810 Given
811 struct X { struct { int a; }; };
812 indirectFieldDecl()
813 matches 'a'.
814 </pre></td></tr>
817 <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>
818 <tr><td colspan="4" class="doc" id="labelDecl0"><pre>Matches a declaration of label.
820 Given
821 goto FOO;
822 FOO: bar();
823 labelDecl()
824 matches 'FOO:'
825 </pre></td></tr>
828 <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>
829 <tr><td colspan="4" class="doc" id="linkageSpecDecl0"><pre>Matches a declaration of a linkage specification.
831 Given
832 extern "C" {}
833 linkageSpecDecl()
834 matches "extern "C" {}"
835 </pre></td></tr>
838 <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>
839 <tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name.
841 Example matches X, S, the anonymous union type, i, and U;
842 typedef int X;
843 struct S {
844 union {
845 int i;
846 } U;
848 </pre></td></tr>
851 <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>
852 <tr><td colspan="4" class="doc" id="namespaceAliasDecl0"><pre>Matches a declaration of a namespace alias.
854 Given
855 namespace test {}
856 namespace alias = ::test;
857 namespaceAliasDecl()
858 matches "namespace alias" but not "namespace test"
859 </pre></td></tr>
862 <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>
863 <tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace.
865 Given
866 namespace {}
867 namespace test {}
868 namespaceDecl()
869 matches "namespace {}" and "namespace test {}"
870 </pre></td></tr>
873 <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>
874 <tr><td colspan="4" class="doc" id="nonTypeTemplateParmDecl0"><pre>Matches non-type template parameter declarations.
876 Given
877 template &lt;typename T, int N&gt; struct C {};
878 nonTypeTemplateParmDecl()
879 matches 'N', but not 'T'.
880 </pre></td></tr>
883 <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>
884 <tr><td colspan="4" class="doc" id="objcCategoryDecl0"><pre>Matches Objective-C category declarations.
886 Example matches Foo (Additions)
887 @interface Foo (Additions)
888 @end
889 </pre></td></tr>
892 <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>
893 <tr><td colspan="4" class="doc" id="objcCategoryImplDecl0"><pre>Matches Objective-C category definitions.
895 Example matches Foo (Additions)
896 @implementation Foo (Additions)
897 @end
898 </pre></td></tr>
901 <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>
902 <tr><td colspan="4" class="doc" id="objcImplementationDecl0"><pre>Matches Objective-C implementation declarations.
904 Example matches Foo
905 @implementation Foo
906 @end
907 </pre></td></tr>
910 <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>
911 <tr><td colspan="4" class="doc" id="objcInterfaceDecl0"><pre>Matches Objective-C interface declarations.
913 Example matches Foo
914 @interface Foo
915 @end
916 </pre></td></tr>
919 <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>
920 <tr><td colspan="4" class="doc" id="objcIvarDecl0"><pre>Matches Objective-C instance variable declarations.
922 Example matches _enabled
923 @implementation Foo {
924 BOOL _enabled;
926 @end
927 </pre></td></tr>
930 <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>
931 <tr><td colspan="4" class="doc" id="objcMethodDecl0"><pre>Matches Objective-C method declarations.
933 Example matches both declaration and definition of -[Foo method]
934 @interface Foo
935 - (void)method;
936 @end
938 @implementation Foo
939 - (void)method {}
940 @end
941 </pre></td></tr>
944 <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>
945 <tr><td colspan="4" class="doc" id="objcPropertyDecl0"><pre>Matches Objective-C property declarations.
947 Example matches enabled
948 @interface Foo
949 @property BOOL enabled;
950 @end
951 </pre></td></tr>
954 <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>
955 <tr><td colspan="4" class="doc" id="objcProtocolDecl0"><pre>Matches Objective-C protocol declarations.
957 Example matches FooDelegate
958 @protocol FooDelegate
959 @end
960 </pre></td></tr>
963 <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>
964 <tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations.
966 Given
967 void f(int x);
968 parmVarDecl()
969 matches int x.
970 </pre></td></tr>
973 <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>
974 <tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches class, struct, and union declarations.
976 Example matches X, Z, U, and S
977 class X;
978 template&lt;class T&gt; class Z {};
979 struct S {};
980 union U {};
981 </pre></td></tr>
984 <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>
985 <tr><td colspan="4" class="doc" id="staticAssertDecl0"><pre>Matches a C++ static_assert declaration.
987 Example:
988 staticAssertExpr()
989 matches
990 static_assert(sizeof(S) == sizeof(int))
992 struct S {
993 int x;
995 static_assert(sizeof(S) == sizeof(int));
996 </pre></td></tr>
999 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('tagDecl0')"><a name="tagDecl0Anchor">tagDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;...</td></tr>
1000 <tr><td colspan="4" class="doc" id="tagDecl0"><pre>Matches tag declarations.
1002 Example matches X, Z, U, S, E
1003 class X;
1004 template&lt;class T&gt; class Z {};
1005 struct S {};
1006 union U {};
1007 enum E {
1008 A, B, C
1010 </pre></td></tr>
1013 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('templateTemplateParmDecl0')"><a name="templateTemplateParmDecl0Anchor">templateTemplateParmDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateTemplateParmDecl.html">TemplateTemplateParmDecl</a>&gt;...</td></tr>
1014 <tr><td colspan="4" class="doc" id="templateTemplateParmDecl0"><pre>Matches template template parameter declarations.
1016 Given
1017 template &lt;template &lt;typename&gt; class Z, int N&gt; struct C {};
1018 templateTypeParmDecl()
1019 matches 'Z', but not 'N'.
1020 </pre></td></tr>
1023 <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>
1024 <tr><td colspan="4" class="doc" id="templateTypeParmDecl0"><pre>Matches template type parameter declarations.
1026 Given
1027 template &lt;typename T, int N&gt; struct C {};
1028 templateTypeParmDecl()
1029 matches 'T', but not 'N'.
1030 </pre></td></tr>
1033 <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>
1034 <tr><td colspan="4" class="doc" id="translationUnitDecl0"><pre>Matches the top declaration context.
1036 Given
1037 int X;
1038 namespace NS {
1039 int Y;
1040 } // namespace NS
1041 decl(hasDeclContext(translationUnitDecl()))
1042 matches "int X", but not "int Y".
1043 </pre></td></tr>
1046 <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>
1047 <tr><td colspan="4" class="doc" id="typeAliasDecl0"><pre>Matches type alias declarations.
1049 Given
1050 typedef int X;
1051 using Y = int;
1052 typeAliasDecl()
1053 matches "using Y = int", but not "typedef int X"
1054 </pre></td></tr>
1057 <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>
1058 <tr><td colspan="4" class="doc" id="typeAliasTemplateDecl0"><pre>Matches type alias template declarations.
1060 typeAliasTemplateDecl() matches
1061 template &lt;typename T&gt;
1062 using Y = X&lt;T&gt;;
1063 </pre></td></tr>
1066 <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>
1067 <tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef declarations.
1069 Given
1070 typedef int X;
1071 using Y = int;
1072 typedefDecl()
1073 matches "typedef int X", but not "using Y = int"
1074 </pre></td></tr>
1077 <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>
1078 <tr><td colspan="4" class="doc" id="typedefNameDecl0"><pre>Matches typedef name declarations.
1080 Given
1081 typedef int X;
1082 using Y = int;
1083 typedefNameDecl()
1084 matches "typedef int X" and "using Y = int"
1085 </pre></td></tr>
1088 <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>
1089 <tr><td colspan="4" class="doc" id="unresolvedUsingTypenameDecl0"><pre>Matches unresolved using value declarations that involve the
1090 typename.
1092 Given
1093 template &lt;typename T&gt;
1094 struct Base { typedef T Foo; };
1096 template&lt;typename T&gt;
1097 struct S : private Base&lt;T&gt; {
1098 using typename Base&lt;T&gt;::Foo;
1100 unresolvedUsingTypenameDecl()
1101 matches using Base&lt;T&gt;::Foo </pre></td></tr>
1104 <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>
1105 <tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations.
1107 Given
1108 template&lt;typename X&gt;
1109 class C : private X {
1110 using X::x;
1112 unresolvedUsingValueDecl()
1113 matches using X::x </pre></td></tr>
1116 <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>
1117 <tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations.
1119 Given
1120 namespace X { int x; }
1121 using X::x;
1122 usingDecl()
1123 matches using X::x </pre></td></tr>
1126 <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>
1127 <tr><td colspan="4" class="doc" id="usingDirectiveDecl0"><pre>Matches using namespace declarations.
1129 Given
1130 namespace X { int x; }
1131 using namespace X;
1132 usingDirectiveDecl()
1133 matches using namespace X </pre></td></tr>
1136 <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>
1137 <tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value declaration.
1139 Example matches A, B, C and F
1140 enum X { A, B, C };
1141 void F();
1142 </pre></td></tr>
1145 <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>
1146 <tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations.
1148 Note: this does not match declarations of member variables, which are
1149 "field" declarations in Clang parlance.
1151 Example matches a
1152 int a;
1153 </pre></td></tr>
1156 <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>
1157 <tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
1158 </pre></td></tr>
1161 <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>
1162 <tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers.
1164 Given
1165 namespace ns {
1166 struct A { static void f(); };
1167 void A::f() {}
1168 void g() { A::f(); }
1170 ns::A a;
1171 nestedNameSpecifier()
1172 matches "ns::" and both "A::"
1173 </pre></td></tr>
1176 <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>
1177 <tr><td colspan="4" class="doc" id="ompDefaultClause0"><pre>Matches OpenMP ``default`` clause.
1179 Given
1181 #pragma omp parallel default(none)
1182 #pragma omp parallel default(shared)
1183 #pragma omp parallel default(firstprivate)
1184 #pragma omp parallel
1186 ``ompDefaultClause()`` matches ``default(none)``, ``default(shared)``, and
1187 ``default(firstprivate)``
1188 </pre></td></tr>
1191 <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>
1192 <tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST.
1193 </pre></td></tr>
1196 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1197 <tr><td colspan="4" class="doc" id="addrLabelExpr0"><pre>Matches address of label statements (GNU extension).
1199 Given
1200 FOO: bar();
1201 void *ptr = &amp;&amp;FOO;
1202 goto *bar;
1203 addrLabelExpr()
1204 matches '&amp;&amp;FOO'
1205 </pre></td></tr>
1208 <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>
1209 <tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions.
1211 Given
1212 int i = a[1];
1213 arraySubscriptExpr()
1214 matches "a[1]"
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('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>
1219 <tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements.
1221 int i = 100;
1222 __asm("mov al, 2");
1223 asmStmt()
1224 matches '__asm("mov al, 2")'
1225 </pre></td></tr>
1228 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1229 <tr><td colspan="4" class="doc" id="atomicExpr0"><pre>Matches atomic builtins.
1230 Example matches __atomic_load_n(ptr, 1)
1231 void foo() { int *ptr; __atomic_load_n(ptr, 1); }
1232 </pre></td></tr>
1235 <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>
1236 <tr><td colspan="4" class="doc" id="autoreleasePoolStmt0"><pre>Matches an Objective-C autorelease pool statement.
1238 Given
1239 @autoreleasepool {
1240 int x = 0;
1242 autoreleasePoolStmt(stmt()) matches the declaration of "x"
1243 inside the autorelease pool.
1244 </pre></td></tr>
1247 <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>
1248 <tr><td colspan="4" class="doc" id="binaryConditionalOperator0"><pre>Matches binary conditional operator expressions (GNU extension).
1250 Example matches a ?: b
1251 (a ?: b) + 42;
1252 </pre></td></tr>
1255 <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>
1256 <tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions.
1258 Example matches a || b
1259 !(a || b)
1260 See also the binaryOperation() matcher for more-general matching.
1261 </pre></td></tr>
1264 <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>
1265 <tr><td colspan="4" class="doc" id="blockExpr0"><pre>Matches a reference to a block.
1267 Example: matches "^{}":
1268 void f() { ^{}(); }
1269 </pre></td></tr>
1272 <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>
1273 <tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements.
1275 Given
1276 while (true) { break; }
1277 breakStmt()
1278 matches 'break'
1279 </pre></td></tr>
1282 <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>
1283 <tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression.
1285 Example: Matches (int) 2.2f in
1286 int i = (int) 2.2f;
1287 </pre></td></tr>
1290 <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>
1291 <tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions.
1293 Example matches x.y() and y()
1294 X x;
1295 x.y();
1296 y();
1297 </pre></td></tr>
1300 <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>
1301 <tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements.
1303 Given
1304 switch(a) { case 42: break; default: break; }
1305 caseStmt()
1306 matches 'case 42:'.
1307 </pre></td></tr>
1310 <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>
1311 <tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST.
1313 Example: castExpr() matches each of the following:
1314 (int) 3;
1315 const_cast&lt;Expr *&gt;(SubExpr);
1316 char c = 0;
1317 but does not match
1318 int i = (0);
1319 int k = 0;
1320 </pre></td></tr>
1323 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1324 <tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t).
1326 Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
1327 though.
1329 Example matches 'a', L'a'
1330 char ch = 'a';
1331 wchar_t chw = L'a';
1332 </pre></td></tr>
1335 <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>
1336 <tr><td colspan="4" class="doc" id="chooseExpr0"><pre>Matches GNU __builtin_choose_expr.
1337 </pre></td></tr>
1340 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('coawaitExpr0')"><a name="coawaitExpr0Anchor">coawaitExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CoawaitExpr.html">CoawaitExpr</a>&gt;...</td></tr>
1341 <tr><td colspan="4" class="doc" id="coawaitExpr0"><pre>Matches co_await expressions.
1343 Given
1344 co_await 1;
1345 coawaitExpr()
1346 matches 'co_await 1'
1347 </pre></td></tr>
1350 <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>
1351 <tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
1353 Example match: {1}, (1, 2)
1354 int array[4] = {1};
1355 vector int myvec = (vector int)(1, 2);
1356 </pre></td></tr>
1359 <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>
1360 <tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements.
1362 Example matches '{}' and '{{}}' in 'for (;;) {{}}'
1363 for (;;) {{}}
1364 </pre></td></tr>
1367 <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>
1368 <tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions.
1370 Example matches a ? b : c
1371 (a ? b : c) + 42
1372 </pre></td></tr>
1375 <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>
1376 <tr><td colspan="4" class="doc" id="constantExpr0"><pre>Matches a constant expression wrapper.
1378 Example matches the constant in the case statement:
1379 (matcher = constantExpr())
1380 switch (a) {
1381 case 37: break;
1383 </pre></td></tr>
1386 <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>
1387 <tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements.
1389 Given
1390 while (true) { continue; }
1391 continueStmt()
1392 matches 'continue'
1393 </pre></td></tr>
1396 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('coreturnStmt0')"><a name="coreturnStmt0Anchor">coreturnStmt</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CoreturnStmt.html">CoreturnStmt</a>&gt;...</td></tr>
1397 <tr><td colspan="4" class="doc" id="coreturnStmt0"><pre>Matches co_return statements.
1399 Given
1400 while (true) { co_return; }
1401 coreturnStmt()
1402 matches 'co_return'
1403 </pre></td></tr>
1406 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('coyieldExpr0')"><a name="coyieldExpr0Anchor">coyieldExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CoyieldExpr.html">CoyieldExpr</a>&gt;...</td></tr>
1407 <tr><td colspan="4" class="doc" id="coyieldExpr0"><pre>Matches co_yield expressions.
1409 Given
1410 co_yield 1;
1411 coyieldExpr()
1412 matches 'co_yield 1'
1413 </pre></td></tr>
1416 <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>
1417 <tr><td colspan="4" class="doc" id="cudaKernelCallExpr0"><pre>Matches CUDA kernel call expression.
1419 Example matches,
1420 kernel&lt;&lt;&lt;i,j&gt;&gt;&gt;();
1421 </pre></td></tr>
1424 <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>
1425 <tr><td colspan="4" class="doc" id="cxxBindTemporaryExpr0"><pre>Matches nodes where temporaries are created.
1427 Example matches FunctionTakesString(GetStringByValue())
1428 (matcher = cxxBindTemporaryExpr())
1429 FunctionTakesString(GetStringByValue());
1430 FunctionTakesStringByPointer(GetStringPointer());
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('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>
1435 <tr><td colspan="4" class="doc" id="cxxBoolLiteral0"><pre>Matches bool literals.
1437 Example matches true
1438 true
1439 </pre></td></tr>
1442 <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>
1443 <tr><td colspan="4" class="doc" id="cxxCatchStmt0"><pre>Matches catch statements.
1445 try {} catch(int i) {}
1446 cxxCatchStmt()
1447 matches 'catch(int i)'
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('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>
1452 <tr><td colspan="4" class="doc" id="cxxConstCastExpr0"><pre>Matches a const_cast expression.
1454 Example: Matches const_cast&lt;int*&gt;(&amp;r) in
1455 int n = 42;
1456 const int &amp;r(n);
1457 int* p = const_cast&lt;int*&gt;(&amp;r);
1458 </pre></td></tr>
1461 <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>
1462 <tr><td colspan="4" class="doc" id="cxxConstructExpr0"><pre>Matches constructor call expressions (including implicit ones).
1464 Example matches string(ptr, n) and ptr within arguments of f
1465 (matcher = cxxConstructExpr())
1466 void f(const string &amp;a, const string &amp;b);
1467 char *ptr;
1468 int n;
1469 f(string(ptr, n), ptr);
1470 </pre></td></tr>
1473 <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>
1474 <tr><td colspan="4" class="doc" id="cxxDefaultArgExpr0"><pre>Matches the value of a default argument at the call site.
1476 Example matches the CXXDefaultArgExpr placeholder inserted for the
1477 default value of the second parameter in the call expression f(42)
1478 (matcher = cxxDefaultArgExpr())
1479 void f(int x, int y = 0);
1480 f(42);
1481 </pre></td></tr>
1484 <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>
1485 <tr><td colspan="4" class="doc" id="cxxDeleteExpr0"><pre>Matches delete expressions.
1487 Given
1488 delete X;
1489 cxxDeleteExpr()
1490 matches 'delete X'.
1491 </pre></td></tr>
1494 <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>
1495 <tr><td colspan="4" class="doc" id="cxxDependentScopeMemberExpr0"><pre>Matches member expressions where the actual member referenced could not be
1496 resolved because the base expression or the member name was dependent.
1498 Given
1499 template &lt;class T&gt; void f() { T t; t.g(); }
1500 cxxDependentScopeMemberExpr()
1501 matches t.g
1502 </pre></td></tr>
1505 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1506 <tr><td colspan="4" class="doc" id="cxxDynamicCastExpr0"><pre>Matches a dynamic_cast expression.
1508 Example:
1509 cxxDynamicCastExpr()
1510 matches
1511 dynamic_cast&lt;D*&gt;(&amp;b);
1513 struct B { virtual ~B() {} }; struct D : B {};
1514 B b;
1515 D* p = dynamic_cast&lt;D*&gt;(&amp;b);
1516 </pre></td></tr>
1519 <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>
1520 <tr><td colspan="4" class="doc" id="cxxForRangeStmt0"><pre>Matches range-based for statements.
1522 cxxForRangeStmt() matches 'for (auto a : i)'
1523 int i[] = {1, 2, 3}; for (auto a : i);
1524 for(int j = 0; j &lt; 5; ++j);
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('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>
1529 <tr><td colspan="4" class="doc" id="cxxFunctionalCastExpr0"><pre>Matches functional cast expressions
1531 Example: Matches Foo(bar);
1532 Foo f = bar;
1533 Foo g = (Foo) bar;
1534 Foo h = Foo(bar);
1535 </pre></td></tr>
1538 <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>
1539 <tr><td colspan="4" class="doc" id="cxxMemberCallExpr0"><pre>Matches member call expressions.
1541 Example matches x.y()
1542 X x;
1543 x.y();
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('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>
1548 <tr><td colspan="4" class="doc" id="cxxNewExpr0"><pre>Matches new expressions.
1550 Given
1551 new X;
1552 cxxNewExpr()
1553 matches 'new X'.
1554 </pre></td></tr>
1557 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxNoexceptExpr0')"><a name="cxxNoexceptExpr0Anchor">cxxNoexceptExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNoexceptExpr.html">CXXNoexceptExpr</a>&gt;...</td></tr>
1558 <tr><td colspan="4" class="doc" id="cxxNoexceptExpr0"><pre>Matches noexcept expressions.
1560 Given
1561 bool a() noexcept;
1562 bool b() noexcept(true);
1563 bool c() noexcept(false);
1564 bool d() noexcept(noexcept(a()));
1565 bool e = noexcept(b()) || noexcept(c());
1566 cxxNoexceptExpr()
1567 matches `noexcept(a())`, `noexcept(b())` and `noexcept(c())`.
1568 doesn't match the noexcept specifier in the declarations a, b, c or d.
1569 </pre></td></tr>
1572 <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>
1573 <tr><td colspan="4" class="doc" id="cxxNullPtrLiteralExpr0"><pre>Matches nullptr literal.
1574 </pre></td></tr>
1577 <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>
1578 <tr><td colspan="4" class="doc" id="cxxOperatorCallExpr0"><pre>Matches overloaded operator calls.
1580 Note that if an operator isn't overloaded, it won't match. Instead, use
1581 binaryOperator matcher.
1582 Currently it does not match operators such as new delete.
1583 FIXME: figure out why these do not match?
1585 Example matches both operator&lt;&lt;((o &lt;&lt; b), c) and operator&lt;&lt;(o, b)
1586 (matcher = cxxOperatorCallExpr())
1587 ostream &amp;operator&lt;&lt; (ostream &amp;out, int i) { };
1588 ostream &amp;o; int b = 1, c = 1;
1589 o &lt;&lt; b &lt;&lt; c;
1590 See also the binaryOperation() matcher for more-general matching of binary
1591 uses of this AST node.
1592 </pre></td></tr>
1595 <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>
1596 <tr><td colspan="4" class="doc" id="cxxReinterpretCastExpr0"><pre>Matches a reinterpret_cast expression.
1598 Either the source expression or the destination type can be matched
1599 using has(), but hasDestinationType() is more specific and can be
1600 more readable.
1602 Example matches reinterpret_cast&lt;char*&gt;(&amp;p) in
1603 void* p = reinterpret_cast&lt;char*&gt;(&amp;p);
1604 </pre></td></tr>
1607 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxRewrittenBinaryOperator0')"><a name="cxxRewrittenBinaryOperator0Anchor">cxxRewrittenBinaryOperator</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;...</td></tr>
1608 <tr><td colspan="4" class="doc" id="cxxRewrittenBinaryOperator0"><pre>Matches rewritten binary operators
1610 Example matches use of "&lt;":
1611 #include &lt;compare&gt;
1612 struct HasSpaceshipMem {
1613 int a;
1614 constexpr auto operator&lt;=&gt;(const HasSpaceshipMem&amp;) const = default;
1616 void compare() {
1617 HasSpaceshipMem hs1, hs2;
1618 if (hs1 &lt; hs2)
1619 return;
1621 See also the binaryOperation() matcher for more-general matching
1622 of this AST node.
1623 </pre></td></tr>
1626 <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>
1627 <tr><td colspan="4" class="doc" id="cxxStaticCastExpr0"><pre>Matches a C++ static_cast expression.
1629 See also: hasDestinationType
1630 See also: reinterpretCast
1632 Example:
1633 cxxStaticCastExpr()
1634 matches
1635 static_cast&lt;long&gt;(8)
1637 long eight(static_cast&lt;long&gt;(8));
1638 </pre></td></tr>
1641 <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>
1642 <tr><td colspan="4" class="doc" id="cxxStdInitializerListExpr0"><pre>Matches C++ initializer list expressions.
1644 Given
1645 std::vector&lt;int&gt; a({ 1, 2, 3 });
1646 std::vector&lt;int&gt; b = { 4, 5 };
1647 int c[] = { 6, 7 };
1648 std::pair&lt;int, int&gt; d = { 8, 9 };
1649 cxxStdInitializerListExpr()
1650 matches "{ 1, 2, 3 }" and "{ 4, 5 }"
1651 </pre></td></tr>
1654 <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>
1655 <tr><td colspan="4" class="doc" id="cxxTemporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments
1657 Example: Matches Foo(bar, bar)
1658 Foo h = Foo(bar, bar);
1659 </pre></td></tr>
1662 <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>
1663 <tr><td colspan="4" class="doc" id="cxxThisExpr0"><pre>Matches implicit and explicit this expressions.
1665 Example matches the implicit this expression in "return i".
1666 (matcher = cxxThisExpr())
1667 struct foo {
1668 int i;
1669 int f() { return i; }
1671 </pre></td></tr>
1674 <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>
1675 <tr><td colspan="4" class="doc" id="cxxThrowExpr0"><pre>Matches throw expressions.
1677 try { throw 5; } catch(int i) {}
1678 cxxThrowExpr()
1679 matches 'throw 5'
1680 </pre></td></tr>
1683 <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>
1684 <tr><td colspan="4" class="doc" id="cxxTryStmt0"><pre>Matches try statements.
1686 try {} catch(int i) {}
1687 cxxTryStmt()
1688 matches 'try {}'
1689 </pre></td></tr>
1692 <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>
1693 <tr><td colspan="4" class="doc" id="cxxUnresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions.
1695 Example matches T(t) in return statement of f
1696 (matcher = cxxUnresolvedConstructExpr())
1697 template &lt;typename T&gt;
1698 void f(const T&amp; t) { return T(t); }
1699 </pre></td></tr>
1702 <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>
1703 <tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations.
1705 Example matches x in if (x)
1706 bool x;
1707 if (x) {}
1708 </pre></td></tr>
1711 <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>
1712 <tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements.
1714 Given
1715 int a;
1716 declStmt()
1717 matches 'int a'.
1718 </pre></td></tr>
1721 <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>
1722 <tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements.
1724 Given
1725 switch(a) { case 42: break; default: break; }
1726 defaultStmt()
1727 matches 'default:'.
1728 </pre></td></tr>
1731 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('dependentCoawaitExpr0')"><a name="dependentCoawaitExpr0Anchor">dependentCoawaitExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DependentCoawaitExpr.html">DependentCoawaitExpr</a>&gt;...</td></tr>
1732 <tr><td colspan="4" class="doc" id="dependentCoawaitExpr0"><pre>Matches co_await expressions where the type of the promise is dependent
1733 </pre></td></tr>
1736 <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>
1737 <tr><td colspan="4" class="doc" id="designatedInitExpr0"><pre>Matches C99 designated initializer expressions [C99 6.7.8].
1739 Example: Matches { [2].y = 1.0, [0].x = 1.0 }
1740 point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
1741 </pre></td></tr>
1744 <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>
1745 <tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements.
1747 Given
1748 do {} while (true);
1749 doStmt()
1750 matches 'do {} while(true)'
1751 </pre></td></tr>
1754 <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>
1755 <tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions.
1757 Matches any cast expression written in user code, whether it be a
1758 C-style cast, a functional-style cast, or a keyword cast.
1760 Does not match implicit conversions.
1762 Note: the name "explicitCast" is chosen to match Clang's terminology, as
1763 Clang uses the term "cast" to apply to implicit conversions as well as to
1764 actual cast expressions.
1766 See also: hasDestinationType.
1768 Example: matches all five of the casts in
1769 int((int)(reinterpret_cast&lt;int&gt;(static_cast&lt;int&gt;(const_cast&lt;int&gt;(42)))))
1770 but does not match the implicit conversion in
1771 long ell = 42;
1772 </pre></td></tr>
1775 <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>
1776 <tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions.
1778 Example matches x()
1779 void f() { x(); }
1780 </pre></td></tr>
1783 <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>
1784 <tr><td colspan="4" class="doc" id="exprWithCleanups0"><pre>Matches expressions that introduce cleanups to be run at the end
1785 of the sub-expression's evaluation.
1787 Example matches std::string()
1788 const std::string str = std::string();
1789 </pre></td></tr>
1792 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('fixedPointLiteral0')"><a name="fixedPointLiteral0Anchor">fixedPointLiteral</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FixedPointLiteral.html">FixedPointLiteral</a>&gt;...</td></tr>
1793 <tr><td colspan="4" class="doc" id="fixedPointLiteral0"><pre>Matches fixed point literals
1794 </pre></td></tr>
1797 <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>
1798 <tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes / encodings, e.g.
1799 1.0, 1.0f, 1.0L and 1e10.
1801 Does not match implicit conversions such as
1802 float a = 10;
1803 </pre></td></tr>
1806 <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>
1807 <tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements.
1809 Example matches 'for (;;) {}'
1810 for (;;) {}
1811 int i[] = {1, 2, 3}; for (auto a : i);
1812 </pre></td></tr>
1815 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('genericSelectionExpr0')"><a name="genericSelectionExpr0Anchor">genericSelectionExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1GenericSelectionExpr.html">GenericSelectionExpr</a>&gt;...</td></tr>
1816 <tr><td colspan="4" class="doc" id="genericSelectionExpr0"><pre>Matches C11 _Generic expression.
1817 </pre></td></tr>
1820 <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>
1821 <tr><td colspan="4" class="doc" id="gnuNullExpr0"><pre>Matches GNU __null expression.
1822 </pre></td></tr>
1825 <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>
1826 <tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements.
1828 Given
1829 goto FOO;
1830 FOO: bar();
1831 gotoStmt()
1832 matches 'goto FOO'
1833 </pre></td></tr>
1836 <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>
1837 <tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements.
1839 Example matches 'if (x) {}'
1840 if (x) {}
1841 </pre></td></tr>
1844 <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>
1845 <tr><td colspan="4" class="doc" id="imaginaryLiteral0"><pre>Matches imaginary literals, which are based on integer and floating
1846 point literals e.g.: 1i, 1.0i
1847 </pre></td></tr>
1850 <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>
1851 <tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST.
1853 This matches many different places, including function call return value
1854 eliding, as well as any type conversions.
1855 </pre></td></tr>
1858 <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>
1859 <tr><td colspan="4" class="doc" id="implicitValueInitExpr0"><pre>Matches implicit initializers of init list expressions.
1861 Given
1862 point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
1863 implicitValueInitExpr()
1864 matches "[0].y" (implicitly)
1865 </pre></td></tr>
1868 <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>
1869 <tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions.
1871 Given
1872 int a[] = { 1, 2 };
1873 struct B { int x, y; };
1874 B b = { 5, 6 };
1875 initListExpr()
1876 matches "{ 1, 2 }" and "{ 5, 6 }"
1877 </pre></td></tr>
1880 <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>
1881 <tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes / encodings, e.g.
1882 1, 1L, 0x1 and 1U.
1884 Does not match character-encoded integers such as L'a'.
1885 </pre></td></tr>
1888 <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>
1889 <tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements.
1891 Given
1892 goto FOO;
1893 FOO: bar();
1894 labelStmt()
1895 matches 'FOO:'
1896 </pre></td></tr>
1899 <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>
1900 <tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions.
1902 Example matches [&amp;](){return 5;}
1903 [&amp;](){return 5;}
1904 </pre></td></tr>
1907 <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>
1908 <tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized.
1910 Example: Given
1911 struct T {void func();};
1912 T f();
1913 void g(T);
1914 materializeTemporaryExpr() matches 'f()' in these statements
1915 T u(f());
1916 g(f());
1917 f().func();
1918 but does not match
1919 f();
1920 </pre></td></tr>
1923 <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>
1924 <tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions.
1926 Given
1927 class Y {
1928 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
1929 int a; static int b;
1931 memberExpr()
1932 matches this-&gt;x, x, y.x, a, this-&gt;b
1933 </pre></td></tr>
1936 <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>
1937 <tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements.
1939 foo();;
1940 nullStmt()
1941 matches the second ';'
1942 </pre></td></tr>
1945 <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>
1946 <tr><td colspan="4" class="doc" id="objcCatchStmt0"><pre>Matches Objective-C @catch statements.
1948 Example matches @catch
1949 @try {}
1950 @catch (...) {}
1951 </pre></td></tr>
1954 <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>
1955 <tr><td colspan="4" class="doc" id="objcFinallyStmt0"><pre>Matches Objective-C @finally statements.
1957 Example matches @finally
1958 @try {}
1959 @finally {}
1960 </pre></td></tr>
1963 <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>
1964 <tr><td colspan="4" class="doc" id="objcIvarRefExpr0"><pre>Matches a reference to an ObjCIvar.
1966 Example: matches "a" in "init" method:
1967 @implementation A {
1968 NSString *a;
1970 - (void) init {
1971 a = @"hello";
1973 </pre></td></tr>
1976 <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>
1977 <tr><td colspan="4" class="doc" id="objcMessageExpr0"><pre>Matches ObjectiveC Message invocation expressions.
1979 The innermost message send invokes the "alloc" class method on the
1980 NSString class, while the outermost message send invokes the
1981 "initWithString" instance method on the object returned from
1982 NSString's "alloc". This matcher should match both message sends.
1983 [[NSString alloc] initWithString:@"Hello"]
1984 </pre></td></tr>
1987 <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>
1988 <tr><td colspan="4" class="doc" id="objcThrowStmt0"><pre>Matches Objective-C statements.
1990 Example matches @throw obj;
1991 </pre></td></tr>
1994 <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>
1995 <tr><td colspan="4" class="doc" id="objcTryStmt0"><pre>Matches Objective-C @try statements.
1997 Example matches @try
1998 @try {}
1999 @catch (...) {}
2000 </pre></td></tr>
2003 <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>
2004 <tr><td colspan="4" class="doc" id="ompExecutableDirective0"><pre>Matches any ``#pragma omp`` executable directive.
2006 Given
2008 #pragma omp parallel
2009 #pragma omp parallel default(none)
2010 #pragma omp taskyield
2012 ``ompExecutableDirective()`` matches ``omp parallel``,
2013 ``omp parallel default(none)`` and ``omp taskyield``.
2014 </pre></td></tr>
2017 <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>
2018 <tr><td colspan="4" class="doc" id="opaqueValueExpr0"><pre>Matches opaque value expressions. They are used as helpers
2019 to reference another expressions and can be met
2020 in BinaryConditionalOperators, for example.
2022 Example matches 'a'
2023 (a ?: c) + 42;
2024 </pre></td></tr>
2027 <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>
2028 <tr><td colspan="4" class="doc" id="parenExpr0"><pre>Matches parentheses used in expressions.
2030 Example matches (foo() + 1)
2031 int foo() { return 1; }
2032 int a = (foo() + 1);
2033 </pre></td></tr>
2036 <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>
2037 <tr><td colspan="4" class="doc" id="parenListExpr0"><pre>Matches paren list expressions.
2038 ParenListExprs don't have a predefined type and are used for late parsing.
2039 In the final AST, they can be met in template declarations.
2041 Given
2042 template&lt;typename T&gt; class X {
2043 void f() {
2044 X x(*this);
2045 int a = 0, b = 1; int i = (a, b);
2048 parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
2049 has a predefined type and is a ParenExpr, not a ParenListExpr.
2050 </pre></td></tr>
2053 <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>
2054 <tr><td colspan="4" class="doc" id="predefinedExpr0"><pre>Matches predefined identifier expressions [C99 6.4.2.2].
2056 Example: Matches __func__
2057 printf("%s", __func__);
2058 </pre></td></tr>
2061 <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>
2062 <tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements.
2064 Given
2065 return 1;
2066 returnStmt()
2067 matches 'return 1'
2068 </pre></td></tr>
2071 <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>
2072 <tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements.
2074 Given
2075 { ++a; }
2076 stmt()
2077 matches both the compound statement '{ ++a; }' and '++a'.
2078 </pre></td></tr>
2081 <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>
2082 <tr><td colspan="4" class="doc" id="stmtExpr0"><pre>Matches statement expression (GNU extension).
2084 Example match: ({ int X = 4; X; })
2085 int C = ({ int X = 4; X; });
2086 </pre></td></tr>
2089 <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>
2090 <tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
2092 Example matches "abcd", L"abcd"
2093 char *s = "abcd";
2094 wchar_t *ws = L"abcd";
2095 </pre></td></tr>
2098 <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>
2099 <tr><td colspan="4" class="doc" id="substNonTypeTemplateParmExpr0"><pre>Matches substitutions of non-type template parameters.
2101 Given
2102 template &lt;int N&gt;
2103 struct A { static const int n = N; };
2104 struct B : public A&lt;42&gt; {};
2105 substNonTypeTemplateParmExpr()
2106 matches "N" in the right-hand side of "static const int n = N;"
2107 </pre></td></tr>
2110 <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>
2111 <tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements.
2113 Given
2114 switch(a) { case 42: break; default: break; }
2115 switchCase()
2116 matches 'case 42:' and 'default:'.
2117 </pre></td></tr>
2120 <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>
2121 <tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements.
2123 Given
2124 switch(a) { case 42: break; default: break; }
2125 switchStmt()
2126 matches 'switch(a)'.
2127 </pre></td></tr>
2130 <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>
2131 <tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
2133 Given
2134 Foo x = bar;
2135 int y = sizeof(x) + alignof(x);
2136 unaryExprOrTypeTraitExpr()
2137 matches sizeof(x) and alignof(x)
2138 </pre></td></tr>
2141 <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>
2142 <tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions.
2144 Example matches !a
2145 !a || b
2146 </pre></td></tr>
2149 <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>
2150 <tr><td colspan="4" class="doc" id="unresolvedLookupExpr0"><pre>Matches reference to a name that can be looked up during parsing
2151 but could not be resolved to a specific declaration.
2153 Given
2154 template&lt;typename T&gt;
2155 T foo() { T a; return a; }
2156 template&lt;typename T&gt;
2157 void bar() {
2158 foo&lt;T&gt;();
2160 unresolvedLookupExpr()
2161 matches foo&lt;T&gt;() </pre></td></tr>
2164 <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>
2165 <tr><td colspan="4" class="doc" id="unresolvedMemberExpr0"><pre>Matches unresolved member expressions.
2167 Given
2168 struct X {
2169 template &lt;class T&gt; void f();
2170 void g();
2172 template &lt;class T&gt; void h() { X x; x.f&lt;T&gt;(); x.g(); }
2173 unresolvedMemberExpr()
2174 matches x.f&lt;T&gt;
2175 </pre></td></tr>
2178 <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>
2179 <tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call.
2181 Example match: "foo"_suffix
2182 </pre></td></tr>
2185 <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>
2186 <tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements.
2188 Given
2189 while (true) {}
2190 whileStmt()
2191 matches 'while (true) {}'.
2192 </pre></td></tr>
2195 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;</td><td class="name" onclick="toggle('templateArgumentLoc0')"><a name="templateArgumentLoc0Anchor">templateArgumentLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;...</td></tr>
2196 <tr><td colspan="4" class="doc" id="templateArgumentLoc0"><pre>Matches template arguments (with location info).
2198 Given
2199 template &lt;typename T&gt; struct C {};
2200 C&lt;int&gt; c;
2201 templateArgumentLoc()
2202 matches 'int' in C&lt;int&gt;.
2203 </pre></td></tr>
2206 <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>
2207 <tr><td colspan="4" class="doc" id="templateArgument0"><pre>Matches template arguments.
2209 Given
2210 template &lt;typename T&gt; struct C {};
2211 C&lt;int&gt; c;
2212 templateArgument()
2213 matches 'int' in C&lt;int&gt;.
2214 </pre></td></tr>
2217 <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>
2218 <tr><td colspan="4" class="doc" id="templateName0"><pre>Matches template name.
2220 Given
2221 template &lt;typename T&gt; class X { };
2222 X&lt;int&gt; xi;
2223 templateName()
2224 matches 'X' in X&lt;int&gt;.
2225 </pre></td></tr>
2228 <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>
2229 <tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST.
2230 </pre></td></tr>
2233 <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>
2234 <tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays.
2236 Given
2237 int a[] = { 2, 3 };
2238 int b[4];
2239 void f() { int c[a[0]]; }
2240 arrayType()
2241 matches "int a[]", "int b[4]" and "int c[a[0]]";
2242 </pre></td></tr>
2245 <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>
2246 <tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types.
2248 Given
2249 _Atomic(int) i;
2250 atomicType()
2251 matches "_Atomic(int) i"
2252 </pre></td></tr>
2255 <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>
2256 <tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types.
2258 Given:
2259 auto n = 4;
2260 int v[] = { 2, 3 }
2261 for (auto i : v) { }
2262 autoType()
2263 matches "auto n" and "auto i"
2264 </pre></td></tr>
2267 <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>
2268 <tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as
2269 "void (^)(int)".
2271 The pointee is always required to be a FunctionType.
2272 </pre></td></tr>
2275 <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>
2276 <tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types.
2278 Given
2279 struct A {};
2280 A a;
2281 int b;
2282 float c;
2283 bool d;
2284 builtinType()
2285 matches "int b", "float c" and "bool d"
2286 </pre></td></tr>
2289 <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>
2290 <tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types.
2292 Given
2293 _Complex float f;
2294 complexType()
2295 matches "_Complex float f"
2296 </pre></td></tr>
2299 <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>
2300 <tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size.
2302 Given
2303 void() {
2304 int a[2];
2305 int b[] = { 2, 3 };
2306 int c[b[0]];
2308 constantArrayType()
2309 matches "int a[2]"
2310 </pre></td></tr>
2313 <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>
2314 <tr><td colspan="4" class="doc" id="decayedType0"><pre>Matches decayed type
2315 Example matches i[] in declaration of f.
2316 (matcher = valueDecl(hasType(decayedType(hasDecayedType(pointerType())))))
2317 Example matches i[1].
2318 (matcher = expr(hasType(decayedType(hasDecayedType(pointerType())))))
2319 void f(int i[]) {
2320 i[1] = 0;
2322 </pre></td></tr>
2325 <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>
2326 <tr><td colspan="4" class="doc" id="decltypeType0"><pre>Matches types nodes representing C++11 decltype(&lt;expr&gt;) types.
2328 Given:
2329 short i = 1;
2330 int j = 42;
2331 decltype(i + j) result = i + j;
2332 decltypeType()
2333 matches "decltype(i + j)"
2334 </pre></td></tr>
2337 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('deducedTemplateSpecializationType0')"><a name="deducedTemplateSpecializationType0Anchor">deducedTemplateSpecializationType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeducedTemplateSpecializationType.html">DeducedTemplateSpecializationType</a>&gt;...</td></tr>
2338 <tr><td colspan="4" class="doc" id="deducedTemplateSpecializationType0"><pre>Matches C++17 deduced template specialization types, e.g. deduced class
2339 template types.
2341 Given
2342 template &lt;typename T&gt;
2343 class C { public: C(T); };
2345 C c(123);
2346 deducedTemplateSpecializationType() matches the type in the declaration
2347 of the variable c.
2348 </pre></td></tr>
2351 <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>
2352 <tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression.
2354 Given
2355 template&lt;typename T, int Size&gt;
2356 class array {
2357 T data[Size];
2359 dependentSizedArrayType
2360 matches "T data[Size]"
2361 </pre></td></tr>
2364 <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>
2365 <tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a
2366 qualified name.
2368 Given
2369 namespace N {
2370 namespace M {
2371 class D {};
2374 class C {};
2376 class C c;
2377 N::M::D d;
2379 elaboratedType() matches the type of the variable declarations of both
2380 c and d.
2381 </pre></td></tr>
2384 <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>
2385 <tr><td colspan="4" class="doc" id="enumType0"><pre>Matches enum types.
2387 Given
2388 enum C { Green };
2389 enum class S { Red };
2391 C c;
2392 S s;
2394 enumType() matches the type of the variable declarations of both c and
2396 </pre></td></tr>
2399 <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>
2400 <tr><td colspan="4" class="doc" id="functionProtoType0"><pre>Matches FunctionProtoType nodes.
2402 Given
2403 int (*f)(int);
2404 void g();
2405 functionProtoType()
2406 matches "int (*f)(int)" and the type of "g" in C++ mode.
2407 In C mode, "g" is not matched because it does not contain a prototype.
2408 </pre></td></tr>
2411 <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>
2412 <tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes.
2414 Given
2415 int (*f)(int);
2416 void g();
2417 functionType()
2418 matches "int (*f)(int)" and the type of "g".
2419 </pre></td></tr>
2422 <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>
2423 <tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size.
2425 Given
2426 int a[] = { 2, 3 };
2427 int b[42];
2428 void f(int c[]) { int d[a[0]]; };
2429 incompleteArrayType()
2430 matches "int a[]" and "int c[]"
2431 </pre></td></tr>
2434 <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>
2435 <tr><td colspan="4" class="doc" id="injectedClassNameType0"><pre>Matches injected class name types.
2437 Example matches S s, but not S&lt;T&gt; s.
2438 (matcher = parmVarDecl(hasType(injectedClassNameType())))
2439 template &lt;typename T&gt; struct S {
2440 void f(S s);
2441 void g(S&lt;T&gt; s);
2443 </pre></td></tr>
2446 <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>
2447 <tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types.
2449 Given:
2450 int *a;
2451 int &amp;b = *a;
2452 int &amp;&amp;c = 1;
2453 auto &amp;d = b;
2454 auto &amp;&amp;e = c;
2455 auto &amp;&amp;f = 2;
2456 int g = 5;
2458 lValueReferenceType() matches the types of b, d, and e. e is
2459 matched since the type is deduced as int&amp; by reference collapsing rules.
2460 </pre></td></tr>
2463 <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>
2464 <tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types.
2465 Given
2466 struct A { int i; }
2467 A::* ptr = A::i;
2468 memberPointerType()
2469 matches "A::* ptr"
2470 </pre></td></tr>
2473 <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>
2474 <tr><td colspan="4" class="doc" id="objcObjectPointerType0"><pre>Matches an Objective-C object pointer type, which is different from
2475 a pointer type, despite being syntactically similar.
2477 Given
2478 int *a;
2480 @interface Foo
2481 @end
2482 Foo *f;
2483 pointerType()
2484 matches "Foo *f", but does not match "int *a".
2485 </pre></td></tr>
2488 <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>
2489 <tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes.
2491 Given
2492 int (*ptr_to_array)[4];
2493 int *array_of_ptrs[4];
2495 varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
2496 array_of_ptrs.
2497 </pre></td></tr>
2500 <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>
2501 <tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types, but does not match Objective-C object pointer
2502 types.
2504 Given
2505 int *a;
2506 int &amp;b = *a;
2507 int c = 5;
2509 @interface Foo
2510 @end
2511 Foo *f;
2512 pointerType()
2513 matches "int *a", but does not match "Foo *f".
2514 </pre></td></tr>
2517 <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>
2518 <tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types.
2520 Given:
2521 int *a;
2522 int &amp;b = *a;
2523 int &amp;&amp;c = 1;
2524 auto &amp;d = b;
2525 auto &amp;&amp;e = c;
2526 auto &amp;&amp;f = 2;
2527 int g = 5;
2529 rValueReferenceType() matches the types of c and f. e is not
2530 matched as it is deduced to int&amp; by reference collapsing rules.
2531 </pre></td></tr>
2534 <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>
2535 <tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes).
2537 Given
2538 class C {};
2539 struct S {};
2541 C c;
2542 S s;
2544 recordType() matches the type of the variable declarations of both c
2545 and s.
2546 </pre></td></tr>
2549 <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>
2550 <tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types.
2552 Given
2553 int *a;
2554 int &amp;b = *a;
2555 int &amp;&amp;c = 1;
2556 auto &amp;d = b;
2557 auto &amp;&amp;e = c;
2558 auto &amp;&amp;f = 2;
2559 int g = 5;
2561 referenceType() matches the types of b, c, d, e, and f.
2562 </pre></td></tr>
2565 <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>
2566 <tr><td colspan="4" class="doc" id="substTemplateTypeParmType0"><pre>Matches types that represent the result of substituting a type for a
2567 template type parameter.
2569 Given
2570 template &lt;typename T&gt;
2571 void F(T t) {
2572 int i = 1 + t;
2575 substTemplateTypeParmType() matches the type of 't' but not '1'
2576 </pre></td></tr>
2579 <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>
2580 <tr><td colspan="4" class="doc" id="tagType0"><pre>Matches tag types (record and enum types).
2582 Given
2583 enum E {};
2584 class C {};
2586 E e;
2587 C c;
2589 tagType() matches the type of the variable declarations of both e
2590 and c.
2591 </pre></td></tr>
2594 <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>
2595 <tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types.
2597 Given
2598 template &lt;typename T&gt;
2599 class C { };
2601 template class C&lt;int&gt;; // A
2602 C&lt;char&gt; var; // B
2604 templateSpecializationType() matches the type of the explicit
2605 instantiation in A and the type of the variable declaration in B.
2606 </pre></td></tr>
2609 <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>
2610 <tr><td colspan="4" class="doc" id="templateTypeParmType0"><pre>Matches template type parameter types.
2612 Example matches T, but not int.
2613 (matcher = templateTypeParmType())
2614 template &lt;typename T&gt; void f(int i);
2615 </pre></td></tr>
2618 <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>
2619 <tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST.
2620 </pre></td></tr>
2623 <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>
2624 <tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types.
2626 Given
2627 typedef int X;
2628 typedefType()
2629 matches "typedef int X"
2630 </pre></td></tr>
2633 <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>
2634 <tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations.
2636 Given:
2637 typedef __underlying_type(T) type;
2638 unaryTransformType()
2639 matches "__underlying_type(T)"
2640 </pre></td></tr>
2643 <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>
2644 <tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an
2645 integer-constant-expression.
2647 Given
2648 void f() {
2649 int a[] = { 2, 3 }
2650 int b[42];
2651 int c[a[0]];
2653 variableArrayType()
2654 matches "int c[a[0]]"
2655 </pre></td></tr>
2657 <!--END_DECL_MATCHERS -->
2658 </table>
2660 <!-- ======================================================================= -->
2661 <h2 id="narrowing-matchers">Narrowing Matchers</h2>
2662 <!-- ======================================================================= -->
2664 <p>Narrowing matchers match certain attributes on the current node, thus
2665 narrowing down the set of nodes of the current type to match on.</p>
2667 <p>There are special logical narrowing matchers (allOf, anyOf, anything and unless)
2668 which allow users to create more powerful match expressions.</p>
2670 <table>
2671 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
2672 <!-- START_NARROWING_MATCHERS -->
2674 <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>
2675 <tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match.
2677 Usable as: Any Matcher
2678 </pre></td></tr>
2681 <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>
2682 <tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches.
2684 Usable as: Any Matcher
2685 </pre></td></tr>
2688 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr>
2689 <tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node.
2691 Useful when another matcher requires a child matcher, but there's no
2692 additional constraint. This will often be used with an explicit conversion
2693 to an internal::Matcher&lt;&gt; type such as TypeMatcher.
2695 Example: DeclarationMatcher(anything()) matches all declarations, e.g.,
2696 "int* p" and "void f()" in
2697 int* p;
2698 void f();
2700 Usable as: Any Matcher
2701 </pre></td></tr>
2704 <tr><td><em>unspecified</em></td><td class="name" onclick="toggle('mapAnyOf0')"><a name="mapAnyOf0Anchor">mapAnyOf</a></td><td>nodeMatcherFunction...</td></tr>
2705 <tr><td colspan="4" class="doc" id="mapAnyOf0"><pre>Matches any of the NodeMatchers with InnerMatchers nested within
2707 Given
2708 if (true);
2709 for (; true; );
2710 with the matcher
2711 mapAnyOf(ifStmt, forStmt).with(
2712 hasCondition(cxxBoolLiteralExpr(equals(true)))
2713 ).bind("trueCond")
2714 matches the if and the for. It is equivalent to:
2715 auto trueCond = hasCondition(cxxBoolLiteralExpr(equals(true)));
2716 anyOf(
2717 ifStmt(trueCond).bind("trueCond"),
2718 forStmt(trueCond).bind("trueCond")
2721 The with() chain-call accepts zero or more matchers which are combined
2722 as-if with allOf() in each of the node matchers.
2723 Usable as: Any Matcher
2724 </pre></td></tr>
2727 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher&lt;*&gt;</td></tr>
2728 <tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match.
2730 Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
2731 class X {};
2732 class Y {};
2734 Usable as: Any Matcher
2735 </pre></td></tr>
2738 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasAnyOperatorName0')"><a name="hasAnyOperatorName0Anchor">hasAnyOperatorName</a></td><td>StringRef, ..., StringRef</td></tr>
2739 <tr><td colspan="4" class="doc" id="hasAnyOperatorName0"><pre>Matches operator expressions (binary or unary) that have any of the
2740 specified names.
2742 hasAnyOperatorName("+", "-")
2743 Is equivalent to
2744 anyOf(hasOperatorName("+"), hasOperatorName("-"))
2745 </pre></td></tr>
2748 <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>
2749 <tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions (binary or
2750 unary).
2752 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
2753 !(a || b)
2754 </pre></td></tr>
2757 <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>
2758 <tr><td colspan="4" class="doc" id="isAssignmentOperator0"><pre>Matches all kinds of assignment operators.
2760 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2761 if (a == b)
2762 a += b;
2764 Example 2: matches s1 = s2
2765 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
2766 struct S { S&amp; operator=(const S&amp;); };
2767 void x() { S s1, s2; s1 = s2; }
2768 </pre></td></tr>
2771 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('isComparisonOperator0')"><a name="isComparisonOperator0Anchor">isComparisonOperator</a></td><td></td></tr>
2772 <tr><td colspan="4" class="doc" id="isComparisonOperator0"><pre>Matches comparison operators.
2774 Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
2775 if (a == b)
2776 a += b;
2778 Example 2: matches s1 &lt; s2
2779 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
2780 struct S { bool operator&lt;(const S&amp; other); };
2781 void x(S s1, S s2) { bool b1 = s1 &lt; s2; }
2782 </pre></td></tr>
2785 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;</td><td class="name" onclick="toggle('isPrivate1')"><a name="isPrivate1Anchor">isPrivate</a></td><td></td></tr>
2786 <tr><td colspan="4" class="doc" id="isPrivate1"><pre>Matches private C++ declarations and C++ base specifers that specify private
2787 inheritance.
2789 Examples:
2790 class C {
2791 public: int a;
2792 protected: int b;
2793 private: int c; // fieldDecl(isPrivate()) matches 'c'
2796 struct Base {};
2797 struct Derived1 : private Base {}; // matches 'Base'
2798 class Derived2 : Base {}; // matches 'Base'
2799 </pre></td></tr>
2802 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;</td><td class="name" onclick="toggle('isProtected1')"><a name="isProtected1Anchor">isProtected</a></td><td></td></tr>
2803 <tr><td colspan="4" class="doc" id="isProtected1"><pre>Matches protected C++ declarations and C++ base specifers that specify
2804 protected inheritance.
2806 Examples:
2807 class C {
2808 public: int a;
2809 protected: int b; // fieldDecl(isProtected()) matches 'b'
2810 private: int c;
2813 class Base {};
2814 class Derived : protected Base {}; // matches 'Base'
2815 </pre></td></tr>
2818 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;</td><td class="name" onclick="toggle('isPublic1')"><a name="isPublic1Anchor">isPublic</a></td><td></td></tr>
2819 <tr><td colspan="4" class="doc" id="isPublic1"><pre>Matches public C++ declarations and C++ base specifers that specify public
2820 inheritance.
2822 Examples:
2823 class C {
2824 public: int a; // fieldDecl(isPublic()) matches 'a'
2825 protected: int b;
2826 private: int c;
2829 class Base {};
2830 class Derived1 : public Base {}; // matches 'Base'
2831 struct Derived2 : Base {}; // matches 'Base'
2832 </pre></td></tr>
2835 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;</td><td class="name" onclick="toggle('isVirtual1')"><a name="isVirtual1Anchor">isVirtual</a></td><td></td></tr>
2836 <tr><td colspan="4" class="doc" id="isVirtual1"><pre>Matches declarations of virtual methods and C++ base specifers that specify
2837 virtual inheritance.
2839 Example:
2840 class A {
2841 public:
2842 virtual void x(); // matches x
2845 Example:
2846 class Base {};
2847 class DirectlyDerived : virtual Base {}; // matches Base
2848 class IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
2850 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
2851 </pre></td></tr>
2854 <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>
2855 <tr><td colspan="4" class="doc" id="equals5"><pre></pre></td></tr>
2858 <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>
2859 <tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value of type ValueT.
2861 Given
2862 f('false, 3.14, 42);
2863 characterLiteral(equals(0))
2864 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2865 match false
2866 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2867 match 3.14
2868 integerLiteral(equals(42))
2869 matches 42
2871 Note that you cannot directly match a negative numeric literal because the
2872 minus sign is not part of the literal: It is a unary operator whose operand
2873 is the positive numeric literal. Instead, you must use a unaryOperator()
2874 matcher to match the minus sign:
2876 unaryOperator(hasOperatorName("-"),
2877 hasUnaryOperand(integerLiteral(equals(13))))
2879 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;,
2880 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;
2881 </pre></td></tr>
2884 <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>
2885 <tr><td colspan="4" class="doc" id="equals11"><pre></pre></td></tr>
2888 <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>
2889 <tr><td colspan="4" class="doc" id="equals8"><pre></pre></td></tr>
2892 <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>
2893 <tr><td colspan="4" class="doc" id="isCatchAll0"><pre>Matches a C++ catch statement that has a catch-all handler.
2895 Given
2896 try {
2897 // ...
2898 } catch (int) {
2899 // ...
2900 } catch (...) {
2901 // ...
2903 cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
2904 </pre></td></tr>
2907 <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>
2908 <tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has
2909 a specific number of arguments (including absent default arguments).
2911 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2912 void f(int x, int y);
2913 f(0, 0);
2914 </pre></td></tr>
2917 <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>
2918 <tr><td colspan="4" class="doc" id="isListInitialization0"><pre>Matches a constructor call expression which uses list initialization.
2919 </pre></td></tr>
2922 <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>
2923 <tr><td colspan="4" class="doc" id="requiresZeroInitialization0"><pre>Matches a constructor call expression which requires
2924 zero initialization.
2926 Given
2927 void foo() {
2928 struct point { double x; double y; };
2929 point pt[2] = { { 1.0, 2.0 } };
2931 initListExpr(has(cxxConstructExpr(requiresZeroInitialization()))
2932 will match the implicit array filler for pt[1].
2933 </pre></td></tr>
2936 <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>
2937 <tr><td colspan="4" class="doc" id="isCopyConstructor0"><pre>Matches constructor declarations that are copy constructors.
2939 Given
2940 struct S {
2941 S(); // #1
2942 S(const S &amp;); // #2
2943 S(S &amp;&amp;); // #3
2945 cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3.
2946 </pre></td></tr>
2949 <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>
2950 <tr><td colspan="4" class="doc" id="isDefaultConstructor0"><pre>Matches constructor declarations that are default constructors.
2952 Given
2953 struct S {
2954 S(); // #1
2955 S(const S &amp;); // #2
2956 S(S &amp;&amp;); // #3
2958 cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3.
2959 </pre></td></tr>
2962 <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>
2963 <tr><td colspan="4" class="doc" id="isDelegatingConstructor0"><pre>Matches constructors that delegate to another constructor.
2965 Given
2966 struct S {
2967 S(); // #1
2968 S(int) {} // #2
2969 S(S &amp;&amp;) : S() {} // #3
2971 S::S() : S(0) {} // #4
2972 cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not
2973 #1 or #2.
2974 </pre></td></tr>
2977 <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>
2978 <tr><td colspan="4" class="doc" id="isExplicit0"><pre>Matches constructor, conversion function, and deduction guide declarations
2979 that have an explicit specifier if this explicit specifier is resolved to
2980 true.
2982 Given
2983 template&lt;bool b&gt;
2984 struct S {
2985 S(int); // #1
2986 explicit S(double); // #2
2987 operator int(); // #3
2988 explicit operator bool(); // #4
2989 explicit(false) S(bool) // # 7
2990 explicit(true) S(char) // # 8
2991 explicit(b) S(S) // # 9
2993 S(int) -&gt; S&lt;true&gt; // #5
2994 explicit S(double) -&gt; S&lt;false&gt; // #6
2995 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
2996 cxxConversionDecl(isExplicit()) will match #4, but not #3.
2997 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
2998 </pre></td></tr>
3001 <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>
3002 <tr><td colspan="4" class="doc" id="isMoveConstructor0"><pre>Matches constructor declarations that are move constructors.
3004 Given
3005 struct S {
3006 S(); // #1
3007 S(const S &amp;); // #2
3008 S(S &amp;&amp;); // #3
3010 cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2.
3011 </pre></td></tr>
3014 <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>
3015 <tr><td colspan="4" class="doc" id="isExplicit1"><pre>Matches constructor, conversion function, and deduction guide declarations
3016 that have an explicit specifier if this explicit specifier is resolved to
3017 true.
3019 Given
3020 template&lt;bool b&gt;
3021 struct S {
3022 S(int); // #1
3023 explicit S(double); // #2
3024 operator int(); // #3
3025 explicit operator bool(); // #4
3026 explicit(false) S(bool) // # 7
3027 explicit(true) S(char) // # 8
3028 explicit(b) S(S) // # 9
3030 S(int) -&gt; S&lt;true&gt; // #5
3031 explicit S(double) -&gt; S&lt;false&gt; // #6
3032 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
3033 cxxConversionDecl(isExplicit()) will match #4, but not #3.
3034 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
3035 </pre></td></tr>
3038 <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>
3039 <tr><td colspan="4" class="doc" id="isBaseInitializer0"><pre>Matches a constructor initializer if it is initializing a base, as
3040 opposed to a member.
3042 Given
3043 struct B {};
3044 struct D : B {
3045 int I;
3046 D(int i) : I(i) {}
3048 struct E : B {
3049 E() : B() {}
3051 cxxConstructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
3052 will match E(), but not match D(int).
3053 </pre></td></tr>
3056 <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>
3057 <tr><td colspan="4" class="doc" id="isMemberInitializer0"><pre>Matches a constructor initializer if it is initializing a member, as
3058 opposed to a base.
3060 Given
3061 struct B {};
3062 struct D : B {
3063 int I;
3064 D(int i) : I(i) {}
3066 struct E : B {
3067 E() : B() {}
3069 cxxConstructorDecl(hasAnyConstructorInitializer(isMemberInitializer()))
3070 will match D(int), but not match E().
3071 </pre></td></tr>
3074 <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>
3075 <tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in
3076 code (as opposed to implicitly added by the compiler).
3078 Given
3079 struct Foo {
3080 Foo() { }
3081 Foo(int) : foo_("A") { }
3082 string foo_;
3084 cxxConstructorDecl(hasAnyConstructorInitializer(isWritten()))
3085 will match Foo(int), but not Foo()
3086 </pre></td></tr>
3089 <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>
3090 <tr><td colspan="4" class="doc" id="isExplicit2"><pre>Matches constructor, conversion function, and deduction guide declarations
3091 that have an explicit specifier if this explicit specifier is resolved to
3092 true.
3094 Given
3095 template&lt;bool b&gt;
3096 struct S {
3097 S(int); // #1
3098 explicit S(double); // #2
3099 operator int(); // #3
3100 explicit operator bool(); // #4
3101 explicit(false) S(bool) // # 7
3102 explicit(true) S(char) // # 8
3103 explicit(b) S(S) // # 9
3105 S(int) -&gt; S&lt;true&gt; // #5
3106 explicit S(double) -&gt; S&lt;false&gt; // #6
3107 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
3108 cxxConversionDecl(isExplicit()) will match #4, but not #3.
3109 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
3110 </pre></td></tr>
3113 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;</td><td class="name" onclick="toggle('hasMemberName0')"><a name="hasMemberName0Anchor">hasMemberName</a></td><td>std::string N</td></tr>
3114 <tr><td colspan="4" class="doc" id="hasMemberName0"><pre>Matches template-dependent, but known, member names.
3116 In template declarations, dependent members are not resolved and so can
3117 not be matched to particular named declarations.
3119 This matcher allows to match on the known name of members.
3121 Given
3122 template &lt;typename T&gt;
3123 struct S {
3124 void mem();
3126 template &lt;typename T&gt;
3127 void x() {
3128 S&lt;T&gt; s;
3129 s.mem();
3131 cxxDependentScopeMemberExpr(hasMemberName("mem")) matches `s.mem()`
3132 </pre></td></tr>
3135 <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>
3136 <tr><td colspan="4" class="doc" id="isArrow2"><pre>Matches member expressions that are called with '-&gt;' as opposed
3137 to '.'.
3139 Member calls on the implicit this pointer match as called with '-&gt;'.
3141 Given
3142 class Y {
3143 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
3144 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
3145 int a;
3146 static int b;
3148 template &lt;class T&gt;
3149 class Z {
3150 void x() { this-&gt;m; }
3152 memberExpr(isArrow())
3153 matches this-&gt;x, x, y.x, a, this-&gt;b
3154 cxxDependentScopeMemberExpr(isArrow())
3155 matches this-&gt;m
3156 unresolvedMemberExpr(isArrow())
3157 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
3158 </pre></td></tr>
3161 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;</td><td class="name" onclick="toggle('memberHasSameNameAsBoundNode0')"><a name="memberHasSameNameAsBoundNode0Anchor">memberHasSameNameAsBoundNode</a></td><td>std::string BindingID</td></tr>
3162 <tr><td colspan="4" class="doc" id="memberHasSameNameAsBoundNode0"><pre>Matches template-dependent, but known, member names against an already-bound
3163 node
3165 In template declarations, dependent members are not resolved and so can
3166 not be matched to particular named declarations.
3168 This matcher allows to match on the name of already-bound VarDecl, FieldDecl
3169 and CXXMethodDecl nodes.
3171 Given
3172 template &lt;typename T&gt;
3173 struct S {
3174 void mem();
3176 template &lt;typename T&gt;
3177 void x() {
3178 S&lt;T&gt; s;
3179 s.mem();
3181 The matcher
3182 @code
3183 cxxDependentScopeMemberExpr(
3184 hasObjectExpression(declRefExpr(hasType(templateSpecializationType(
3185 hasDeclaration(classTemplateDecl(has(cxxRecordDecl(has(
3186 cxxMethodDecl(hasName("mem")).bind("templMem")
3187 )))))
3188 )))),
3189 memberHasSameNameAsBoundNode("templMem")
3191 @endcode
3192 first matches and binds the @c mem member of the @c S template, then
3193 compares its name to the usage in @c s.mem() in the @c x function template
3194 </pre></td></tr>
3197 <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>
3198 <tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
3200 Given
3201 struct A {
3202 void foo() const;
3203 void bar();
3206 cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
3207 </pre></td></tr>
3210 <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>
3211 <tr><td colspan="4" class="doc" id="isCopyAssignmentOperator0"><pre>Matches if the given method declaration declares a copy assignment
3212 operator.
3214 Given
3215 struct A {
3216 A &amp;operator=(const A &amp;);
3217 A &amp;operator=(A &amp;&amp;);
3220 cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
3221 the second one.
3222 </pre></td></tr>
3225 <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>
3226 <tr><td colspan="4" class="doc" id="isFinal1"><pre>Matches if the given method or class declaration is final.
3228 Given:
3229 class A final {};
3231 struct B {
3232 virtual void f();
3235 struct C : B {
3236 void f() final;
3238 matches A and C::f, but not B, C, or B::f
3239 </pre></td></tr>
3242 <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>
3243 <tr><td colspan="4" class="doc" id="isMoveAssignmentOperator0"><pre>Matches if the given method declaration declares a move assignment
3244 operator.
3246 Given
3247 struct A {
3248 A &amp;operator=(const A &amp;);
3249 A &amp;operator=(A &amp;&amp;);
3252 cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
3253 the first one.
3254 </pre></td></tr>
3257 <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>
3258 <tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
3260 Given
3261 class A {
3262 public:
3263 virtual void x();
3265 class B : public A {
3266 public:
3267 virtual void x();
3269 matches B::x
3270 </pre></td></tr>
3273 <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>
3274 <tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure.
3276 Given
3277 class A {
3278 public:
3279 virtual void x() = 0;
3281 matches A::x
3282 </pre></td></tr>
3285 <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>
3286 <tr><td colspan="4" class="doc" id="isUserProvided0"><pre>Matches method declarations that are user-provided.
3288 Given
3289 struct S {
3290 S(); // #1
3291 S(const S &amp;) = default; // #2
3292 S(S &amp;&amp;) = delete; // #3
3294 cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3.
3295 </pre></td></tr>
3298 <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>
3299 <tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches declarations of virtual methods and C++ base specifers that specify
3300 virtual inheritance.
3302 Example:
3303 class A {
3304 public:
3305 virtual void x(); // matches x
3308 Example:
3309 class Base {};
3310 class DirectlyDerived : virtual Base {}; // matches Base
3311 class IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
3313 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
3314 </pre></td></tr>
3317 <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>
3318 <tr><td colspan="4" class="doc" id="isVirtualAsWritten0"><pre>Matches if the given method declaration has an explicit "virtual".
3320 Given
3321 class A {
3322 public:
3323 virtual void x();
3325 class B : public A {
3326 public:
3327 void x();
3329 matches A::x but not B::x
3330 </pre></td></tr>
3333 <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>
3334 <tr><td colspan="4" class="doc" id="isArray0"><pre>Matches array new expressions.
3336 Given:
3337 MyClass *p1 = new MyClass[10];
3338 cxxNewExpr(isArray())
3339 matches the expression 'new MyClass[10]'.
3340 </pre></td></tr>
3343 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyOperatorName1')"><a name="hasAnyOperatorName1Anchor">hasAnyOperatorName</a></td><td>StringRef, ..., StringRef</td></tr>
3344 <tr><td colspan="4" class="doc" id="hasAnyOperatorName1"><pre>Matches operator expressions (binary or unary) that have any of the
3345 specified names.
3347 hasAnyOperatorName("+", "-")
3348 Is equivalent to
3349 anyOf(hasOperatorName("+"), hasOperatorName("-"))
3350 </pre></td></tr>
3353 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyOverloadedOperatorName0')"><a name="hasAnyOverloadedOperatorName0Anchor">hasAnyOverloadedOperatorName</a></td><td>StringRef, ..., StringRef</td></tr>
3354 <tr><td colspan="4" class="doc" id="hasAnyOverloadedOperatorName0"><pre>Matches overloaded operator names.
3356 Matches overloaded operator names specified in strings without the
3357 "operator" prefix: e.g. "&lt;&lt;".
3359 hasAnyOverloadedOperatorName("+", "-")
3360 Is equivalent to
3361 anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-"))
3362 </pre></td></tr>
3365 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('hasOperatorName1')"><a name="hasOperatorName1Anchor">hasOperatorName</a></td><td>std::string Name</td></tr>
3366 <tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or
3367 unary).
3369 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3370 !(a || b)
3371 </pre></td></tr>
3374 <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>
3375 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
3377 Matches overloaded operator names specified in strings without the
3378 "operator" prefix: e.g. "&lt;&lt;".
3380 Given:
3381 class A { int operator*(); };
3382 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
3383 A a;
3384 a &lt;&lt; a; // &lt;-- This matches
3386 cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
3387 specified line and
3388 cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
3389 matches the declaration of A.
3391 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;
3392 </pre></td></tr>
3395 <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>
3396 <tr><td colspan="4" class="doc" id="isAssignmentOperator1"><pre>Matches all kinds of assignment operators.
3398 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
3399 if (a == b)
3400 a += b;
3402 Example 2: matches s1 = s2
3403 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
3404 struct S { S&amp; operator=(const S&amp;); };
3405 void x() { S s1, s2; s1 = s2; }
3406 </pre></td></tr>
3409 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('isComparisonOperator1')"><a name="isComparisonOperator1Anchor">isComparisonOperator</a></td><td></td></tr>
3410 <tr><td colspan="4" class="doc" id="isComparisonOperator1"><pre>Matches comparison operators.
3412 Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
3413 if (a == b)
3414 a += b;
3416 Example 2: matches s1 &lt; s2
3417 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
3418 struct S { bool operator&lt;(const S&amp; other); };
3419 void x(S s1, S s2) { bool b1 = s1 &lt; s2; }
3420 </pre></td></tr>
3423 <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>
3424 <tr><td colspan="4" class="doc" id="hasDefinition0"><pre>Matches a class declaration that is defined.
3426 Example matches x (matcher = cxxRecordDecl(hasDefinition()))
3427 class x {};
3428 class y;
3429 </pre></td></tr>
3432 <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>
3433 <tr><td colspan="4" class="doc" id="isDerivedFrom2"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
3434 </pre></td></tr>
3437 <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>
3438 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom2"><pre>Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
3439 </pre></td></tr>
3442 <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>
3443 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
3444 static member variable template instantiations.
3446 Given
3447 template&lt;typename T&gt; void A(T t) { }
3448 template&lt;&gt; void A(int N) { }
3449 functionDecl(isExplicitTemplateSpecialization())
3450 matches the specialization A&lt;int&gt;().
3452 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;
3453 </pre></td></tr>
3456 <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>
3457 <tr><td colspan="4" class="doc" id="isFinal0"><pre>Matches if the given method or class declaration is final.
3459 Given:
3460 class A final {};
3462 struct B {
3463 virtual void f();
3466 struct C : B {
3467 void f() final;
3469 matches A and C::f, but not B, C, or B::f
3470 </pre></td></tr>
3473 <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>
3474 <tr><td colspan="4" class="doc" id="isLambda0"><pre>Matches the generated class of lambda expressions.
3476 Given:
3477 auto x = []{};
3479 cxxRecordDecl(isLambda()) matches the implicit class declaration of
3480 decltype(x)
3481 </pre></td></tr>
3484 <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>
3485 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom2"><pre>Overloaded method as shortcut for
3486 isSameOrDerivedFrom(hasName(...)).
3487 </pre></td></tr>
3490 <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>
3491 <tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
3492 member variable template instantiations.
3494 Given
3495 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
3497 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
3499 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
3500 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3501 matches the template instantiation of X&lt;A&gt;.
3503 But given
3504 template &lt;typename T&gt; class X {}; class A {};
3505 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
3506 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3507 does not match, as X&lt;A&gt; is an explicit template specialization.
3509 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;
3510 </pre></td></tr>
3513 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasAnyOperatorName2')"><a name="hasAnyOperatorName2Anchor">hasAnyOperatorName</a></td><td>StringRef, ..., StringRef</td></tr>
3514 <tr><td colspan="4" class="doc" id="hasAnyOperatorName2"><pre>Matches operator expressions (binary or unary) that have any of the
3515 specified names.
3517 hasAnyOperatorName("+", "-")
3518 Is equivalent to
3519 anyOf(hasOperatorName("+"), hasOperatorName("-"))
3520 </pre></td></tr>
3523 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperatorName2')"><a name="hasOperatorName2Anchor">hasOperatorName</a></td><td>std::string Name</td></tr>
3524 <tr><td colspan="4" class="doc" id="hasOperatorName2"><pre>Matches the operator Name of operator expressions (binary or
3525 unary).
3527 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3528 !(a || b)
3529 </pre></td></tr>
3532 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('isAssignmentOperator2')"><a name="isAssignmentOperator2Anchor">isAssignmentOperator</a></td><td></td></tr>
3533 <tr><td colspan="4" class="doc" id="isAssignmentOperator2"><pre>Matches all kinds of assignment operators.
3535 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
3536 if (a == b)
3537 a += b;
3539 Example 2: matches s1 = s2
3540 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
3541 struct S { S&amp; operator=(const S&amp;); };
3542 void x() { S s1, s2; s1 = s2; }
3543 </pre></td></tr>
3546 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('isComparisonOperator2')"><a name="isComparisonOperator2Anchor">isComparisonOperator</a></td><td></td></tr>
3547 <tr><td colspan="4" class="doc" id="isComparisonOperator2"><pre>Matches comparison operators.
3549 Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
3550 if (a == b)
3551 a += b;
3553 Example 2: matches s1 &lt; s2
3554 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
3555 struct S { bool operator&lt;(const S&amp; other); };
3556 void x(S s1, S s2) { bool b1 = s1 &lt; s2; }
3557 </pre></td></tr>
3560 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountIs2')"><a name="argumentCountIs2Anchor">argumentCountIs</a></td><td>unsigned N</td></tr>
3561 <tr><td colspan="4" class="doc" id="argumentCountIs2"><pre>Checks that a call expression or a constructor call expression has
3562 a specific number of arguments (including absent default arguments).
3564 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3565 void f(int x, int y);
3566 f(0, 0);
3567 </pre></td></tr>
3570 <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>
3571 <tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
3572 a specific number of arguments (including absent default arguments).
3574 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3575 void f(int x, int y);
3576 f(0, 0);
3577 </pre></td></tr>
3580 <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>
3581 <tr><td colspan="4" class="doc" id="usesADL0"><pre>Matches call expressions which were resolved using ADL.
3583 Example matches y(x) but not y(42) or NS::y(x).
3584 namespace NS {
3585 struct X {};
3586 void y(X);
3589 void y(...);
3591 void test() {
3592 NS::X x;
3593 y(x); // Matches
3594 NS::y(x); // Doesn't match
3595 y(42); // Doesn't match
3596 using NS::y;
3597 y(x); // Found by both unqualified lookup and ADL, doesn't match
3599 </pre></td></tr>
3602 <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>
3603 <tr><td colspan="4" class="doc" id="hasCastKind0"><pre>Matches casts that has a given cast kind.
3605 Example: matches the implicit cast around 0
3606 (matcher = castExpr(hasCastKind(CK_NullToPointer)))
3607 int *p = 0;
3609 If the matcher is use from clang-query, CastKind parameter
3610 should be passed as a quoted string. e.g., hasCastKind("CK_NullToPointer").
3611 </pre></td></tr>
3614 <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>
3615 <tr><td colspan="4" class="doc" id="equals4"><pre></pre></td></tr>
3618 <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>
3619 <tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value of type ValueT.
3621 Given
3622 f('false, 3.14, 42);
3623 characterLiteral(equals(0))
3624 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
3625 match false
3626 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
3627 match 3.14
3628 integerLiteral(equals(42))
3629 matches 42
3631 Note that you cannot directly match a negative numeric literal because the
3632 minus sign is not part of the literal: It is a unary operator whose operand
3633 is the positive numeric literal. Instead, you must use a unaryOperator()
3634 matcher to match the minus sign:
3636 unaryOperator(hasOperatorName("-"),
3637 hasUnaryOperand(integerLiteral(equals(13))))
3639 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;,
3640 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;
3641 </pre></td></tr>
3644 <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>
3645 <tr><td colspan="4" class="doc" id="equals10"><pre></pre></td></tr>
3648 <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>
3649 <tr><td colspan="4" class="doc" id="equals7"><pre></pre></td></tr>
3652 <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>
3653 <tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N.
3655 Given
3656 template&lt;typename T&gt; struct C {};
3657 C&lt;int&gt; c;
3658 classTemplateSpecializationDecl(templateArgumentCountIs(1))
3659 matches C&lt;int&gt;.
3660 </pre></td></tr>
3663 <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>
3664 <tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
3665 child statements.
3667 Example: Given
3668 { for (;;) {} }
3669 compoundStmt(statementCountIs(0)))
3670 matches '{}'
3671 but does not match the outer compound statement.
3672 </pre></td></tr>
3675 <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>
3676 <tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches nodes that have the specified size.
3678 Given
3679 int a[42];
3680 int b[2 * 21];
3681 int c[41], d[43];
3682 char *s = "abcd";
3683 wchar_t *ws = L"abcd";
3684 char *w = "a";
3685 constantArrayType(hasSize(42))
3686 matches "int a[42]" and "int b[2 * 21]"
3687 stringLiteral(hasSize(4))
3688 matches "abcd", L"abcd"
3689 </pre></td></tr>
3692 <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>
3693 <tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
3694 declarations.
3696 Example: Given
3697 int a, b;
3698 int c;
3699 int d = 2, e;
3700 declCountIs(2)
3701 matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
3702 </pre></td></tr>
3705 <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>
3706 <tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
3708 Matches a node if it equals the node previously bound to ID.
3710 Given
3711 class X { int a; int b; };
3712 cxxRecordDecl(
3713 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3714 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3715 matches the class X, as a and b have the same type.
3717 Note that when multiple matches are involved via forEach* matchers,
3718 equalsBoundNodes acts as a filter.
3719 For example:
3720 compoundStmt(
3721 forEachDescendant(varDecl().bind("d")),
3722 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3723 will trigger a match for each combination of variable declaration
3724 and reference to that variable declaration within a compound statement.
3725 </pre></td></tr>
3728 <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>
3729 <tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node.
3731 Decl has pointer identity in the AST.
3732 </pre></td></tr>
3735 <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>
3736 <tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute.
3738 Given
3739 __attribute__((device)) void f() { ... }
3740 decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
3741 f. If the matcher is used from clang-query, attr::Kind parameter should be
3742 passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
3743 </pre></td></tr>
3746 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isExpandedFromMacro0')"><a name="isExpandedFromMacro0Anchor">isExpandedFromMacro</a></td><td>std::string MacroName</td></tr>
3747 <tr><td colspan="4" class="doc" id="isExpandedFromMacro0"><pre>Matches statements that are (transitively) expanded from the named macro.
3748 Does not match if only part of the statement is expanded from that macro or
3749 if different parts of the the statement are expanded from different
3750 appearances of the macro.
3751 </pre></td></tr>
3754 <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>StringRef RegExp, Regex::RegexFlags Flags = NoFlags</td></tr>
3755 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is
3756 partially matching a given regex.
3758 Example matches Y but not X
3759 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3760 #include "ASTMatcher.h"
3761 class X {};
3762 ASTMatcher.h:
3763 class Y {};
3765 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;
3767 If the matcher is used in clang-query, RegexFlags parameter
3768 should be passed as a quoted string. e.g: "NoFlags".
3769 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
3770 </pre></td></tr>
3773 <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>
3774 <tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file.
3776 Example matches X but not Y
3777 (matcher = cxxRecordDecl(isExpansionInMainFile())
3778 #include &lt;Y.h&gt;
3779 class X {};
3780 Y.h:
3781 class Y {};
3783 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;
3784 </pre></td></tr>
3787 <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>
3788 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files.
3790 Example matches Y but not X
3791 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3792 #include &lt;SystemHeader.h&gt;
3793 class X {};
3794 SystemHeader.h:
3795 class Y {};
3797 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;
3798 </pre></td></tr>
3801 <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>
3802 <tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a declaration that has been implicitly added
3803 by the compiler (eg. implicit default/copy constructors).
3804 </pre></td></tr>
3807 <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>
3808 <tr><td colspan="4" class="doc" id="isInStdNamespace0"><pre>Matches declarations in the namespace `std`, but not in nested namespaces.
3810 Given
3811 class vector {};
3812 namespace foo {
3813 class vector {};
3814 namespace std {
3815 class vector {};
3818 namespace std {
3819 inline namespace __1 {
3820 class vector {}; // #1
3821 namespace experimental {
3822 class vector {};
3826 cxxRecordDecl(hasName("vector"), isInStdNamespace()) will match only #1.
3827 </pre></td></tr>
3830 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isInstantiated0')"><a name="isInstantiated0Anchor">isInstantiated</a></td><td></td></tr>
3831 <tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
3832 template instantiations.
3834 Given
3835 template&lt;typename T&gt; void A(T t) { T i; }
3836 A(0);
3837 A(0U);
3838 functionDecl(isInstantiated())
3839 matches 'A(int) {...};' and 'A(unsigned) {...}'.
3840 </pre></td></tr>
3843 <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>
3844 <tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations and C++ base specifers that specify private
3845 inheritance.
3847 Examples:
3848 class C {
3849 public: int a;
3850 protected: int b;
3851 private: int c; // fieldDecl(isPrivate()) matches 'c'
3854 struct Base {};
3855 struct Derived1 : private Base {}; // matches 'Base'
3856 class Derived2 : Base {}; // matches 'Base'
3857 </pre></td></tr>
3860 <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>
3861 <tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations and C++ base specifers that specify
3862 protected inheritance.
3864 Examples:
3865 class C {
3866 public: int a;
3867 protected: int b; // fieldDecl(isProtected()) matches 'b'
3868 private: int c;
3871 class Base {};
3872 class Derived : protected Base {}; // matches 'Base'
3873 </pre></td></tr>
3876 <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>
3877 <tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations and C++ base specifers that specify public
3878 inheritance.
3880 Examples:
3881 class C {
3882 public: int a; // fieldDecl(isPublic()) matches 'a'
3883 protected: int b;
3884 private: int c;
3887 class Base {};
3888 class Derived1 : public Base {}; // matches 'Base'
3889 struct Derived2 : Base {}; // matches 'Base'
3890 </pre></td></tr>
3893 <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>
3894 <tr><td colspan="4" class="doc" id="designatorCountIs0"><pre>Matches designated initializer expressions that contain
3895 a specific number of designators.
3897 Example: Given
3898 point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
3899 point ptarray2[10] = { [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 };
3900 designatorCountIs(2)
3901 matches '{ [2].y = 1.0, [0].x = 1.0 }',
3902 but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'.
3903 </pre></td></tr>
3906 <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>
3907 <tr><td colspan="4" class="doc" id="isScoped0"><pre>Matches C++11 scoped enum declaration.
3909 Example matches Y (matcher = enumDecl(isScoped()))
3910 enum X {};
3911 enum class Y {};
3912 </pre></td></tr>
3915 <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>
3916 <tr><td colspan="4" class="doc" id="isInstantiationDependent0"><pre>Matches expressions that are instantiation-dependent even if it is
3917 neither type- nor value-dependent.
3919 In the following example, the expression sizeof(sizeof(T() + T()))
3920 is instantiation-dependent (since it involves a template parameter T),
3921 but is neither type- nor value-dependent, since the type of the inner
3922 sizeof is known (std::size_t) and therefore the size of the outer
3923 sizeof is known.
3924 template&lt;typename T&gt;
3925 void f(T x, T y) { sizeof(sizeof(T() + T()); }
3926 expr(isInstantiationDependent()) matches sizeof(sizeof(T() + T())
3927 </pre></td></tr>
3930 <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>
3931 <tr><td colspan="4" class="doc" id="isTypeDependent0"><pre>Matches expressions that are type-dependent because the template type
3932 is not yet instantiated.
3934 For example, the expressions "x" and "x + y" are type-dependent in
3935 the following code, but "y" is not type-dependent:
3936 template&lt;typename T&gt;
3937 void add(T x, int y) {
3938 x + y;
3940 expr(isTypeDependent()) matches x + y
3941 </pre></td></tr>
3944 <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>
3945 <tr><td colspan="4" class="doc" id="isValueDependent0"><pre>Matches expression that are value-dependent because they contain a
3946 non-type template parameter.
3948 For example, the array bound of "Chars" in the following example is
3949 value-dependent.
3950 template&lt;int Size&gt; int f() { return Size; }
3951 expr(isValueDependent()) matches return Size
3952 </pre></td></tr>
3955 <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>
3956 <tr><td colspan="4" class="doc" id="nullPointerConstant0"><pre>Matches expressions that resolve to a null pointer constant, such as
3957 GNU's __null, C++11's nullptr, or C's NULL macro.
3959 Given:
3960 void *v1 = NULL;
3961 void *v2 = nullptr;
3962 void *v3 = __null; // GNU extension
3963 char *cp = (char *)0;
3964 int *ip = 0;
3965 int i = 0;
3966 expr(nullPointerConstant())
3967 matches the initializer for v1, v2, v3, cp, and ip. Does not match the
3968 initializer for i.
3969 </pre></td></tr>
3972 <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>
3973 <tr><td colspan="4" class="doc" id="hasBitWidth0"><pre>Matches non-static data members that are bit-fields of the specified
3974 bit width.
3976 Given
3977 class C {
3978 int a : 2;
3979 int b : 4;
3980 int c : 2;
3982 fieldDecl(hasBitWidth(2))
3983 matches 'int a;' and 'int c;' but not 'int b;'.
3984 </pre></td></tr>
3987 <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>
3988 <tr><td colspan="4" class="doc" id="isBitField0"><pre>Matches non-static data members that are bit-fields.
3990 Given
3991 class C {
3992 int a : 2;
3993 int b;
3995 fieldDecl(isBitField())
3996 matches 'int a;' but not 'int b;'.
3997 </pre></td></tr>
4000 <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>
4001 <tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value of type ValueT.
4003 Given
4004 f('false, 3.14, 42);
4005 characterLiteral(equals(0))
4006 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
4007 match false
4008 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
4009 match 3.14
4010 integerLiteral(equals(42))
4011 matches 42
4013 Note that you cannot directly match a negative numeric literal because the
4014 minus sign is not part of the literal: It is a unary operator whose operand
4015 is the positive numeric literal. Instead, you must use a unaryOperator()
4016 matcher to match the minus sign:
4018 unaryOperator(hasOperatorName("-"),
4019 hasUnaryOperand(integerLiteral(equals(13))))
4021 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;,
4022 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;
4023 </pre></td></tr>
4026 <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>
4027 <tr><td colspan="4" class="doc" id="equals12"><pre></pre></td></tr>
4030 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyOverloadedOperatorName1')"><a name="hasAnyOverloadedOperatorName1Anchor">hasAnyOverloadedOperatorName</a></td><td>StringRef, ..., StringRef</td></tr>
4031 <tr><td colspan="4" class="doc" id="hasAnyOverloadedOperatorName1"><pre>Matches overloaded operator names.
4033 Matches overloaded operator names specified in strings without the
4034 "operator" prefix: e.g. "&lt;&lt;".
4036 hasAnyOverloadedOperatorName("+", "-")
4037 Is equivalent to
4038 anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-"))
4039 </pre></td></tr>
4042 <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>
4043 <tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec0"><pre>Matches functions that have a dynamic exception specification.
4045 Given:
4046 void f();
4047 void g() noexcept;
4048 void h() noexcept(true);
4049 void i() noexcept(false);
4050 void j() throw();
4051 void k() throw(int);
4052 void l() throw(...);
4053 functionDecl(hasDynamicExceptionSpec()) and
4054 functionProtoType(hasDynamicExceptionSpec())
4055 match the declarations of j, k, and l, but not f, g, h, or i.
4056 </pre></td></tr>
4059 <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>
4060 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names.
4062 Matches overloaded operator names specified in strings without the
4063 "operator" prefix: e.g. "&lt;&lt;".
4065 Given:
4066 class A { int operator*(); };
4067 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
4068 A a;
4069 a &lt;&lt; a; // &lt;-- This matches
4071 cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
4072 specified line and
4073 cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
4074 matches the declaration of A.
4076 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;
4077 </pre></td></tr>
4080 <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>
4081 <tr><td colspan="4" class="doc" id="hasTrailingReturn0"><pre>Matches a function declared with a trailing return type.
4083 Example matches Y (matcher = functionDecl(hasTrailingReturn()))
4084 int X() {}
4085 auto Y() -&gt; int {}
4086 </pre></td></tr>
4089 <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>
4090 <tr><td colspan="4" class="doc" id="isConstexpr1"><pre>Matches constexpr variable and function declarations,
4091 and if constexpr.
4093 Given:
4094 constexpr int foo = 42;
4095 constexpr int bar();
4096 void baz() { if constexpr(1 &gt; 0) {} }
4097 varDecl(isConstexpr())
4098 matches the declaration of foo.
4099 functionDecl(isConstexpr())
4100 matches the declaration of bar.
4101 ifStmt(isConstexpr())
4102 matches the if statement in baz.
4103 </pre></td></tr>
4106 <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>
4107 <tr><td colspan="4" class="doc" id="isDefaulted0"><pre>Matches defaulted function declarations.
4109 Given:
4110 class A { ~A(); };
4111 class B { ~B() = default; };
4112 functionDecl(isDefaulted())
4113 matches the declaration of ~B, but not ~A.
4114 </pre></td></tr>
4117 <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>
4118 <tr><td colspan="4" class="doc" id="isDefinition3"><pre>Matches if a declaration has a body attached.
4120 Example matches A, va, fa
4121 class A {};
4122 class B; // Doesn't match, as it has no body.
4123 int va;
4124 extern int vb; // Doesn't match, as it doesn't define the variable.
4125 void fa() {}
4126 void fb(); // Doesn't match, as it has no body.
4127 @interface X
4128 - (void)ma; // Doesn't match, interface is declaration.
4129 @end
4130 @implementation X
4131 - (void)ma {}
4132 @end
4134 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;,
4135 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
4136 </pre></td></tr>
4139 <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>
4140 <tr><td colspan="4" class="doc" id="isDeleted0"><pre>Matches deleted function declarations.
4142 Given:
4143 void Func();
4144 void DeletedFunc() = delete;
4145 functionDecl(isDeleted())
4146 matches the declaration of DeletedFunc, but not Func.
4147 </pre></td></tr>
4150 <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>
4151 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or
4152 static member variable template instantiations.
4154 Given
4155 template&lt;typename T&gt; void A(T t) { }
4156 template&lt;&gt; void A(int N) { }
4157 functionDecl(isExplicitTemplateSpecialization())
4158 matches the specialization A&lt;int&gt;().
4160 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;
4161 </pre></td></tr>
4164 <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>
4165 <tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function or variable declarations.
4167 Given:
4168 extern "C" void f() {}
4169 extern "C" { void g() {} }
4170 void h() {}
4171 extern "C" int x = 1;
4172 extern "C" int y = 2;
4173 int z = 3;
4174 functionDecl(isExternC())
4175 matches the declaration of f and g, but not the declaration of h.
4176 varDecl(isExternC())
4177 matches the declaration of x and y, but not the declaration of z.
4178 </pre></td></tr>
4181 <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>
4182 <tr><td colspan="4" class="doc" id="isInline1"><pre>Matches function and namespace declarations that are marked with
4183 the inline keyword.
4185 Given
4186 inline void f();
4187 void g();
4188 namespace n {
4189 inline namespace m {}
4191 functionDecl(isInline()) will match ::f().
4192 namespaceDecl(isInline()) will match n::m.
4193 </pre></td></tr>
4196 <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>
4197 <tr><td colspan="4" class="doc" id="isMain0"><pre>Determines whether the function is "main", which is the entry point
4198 into an executable program.
4199 </pre></td></tr>
4202 <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>
4203 <tr><td colspan="4" class="doc" id="isNoReturn0"><pre>Matches FunctionDecls that have a noreturn attribute.
4205 Given
4206 void nope();
4207 [[noreturn]] void a();
4208 __attribute__((noreturn)) void b();
4209 struct c { [[noreturn]] c(); };
4210 functionDecl(isNoReturn())
4211 matches all of those except
4212 void nope();
4213 </pre></td></tr>
4216 <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>
4217 <tr><td colspan="4" class="doc" id="isNoThrow0"><pre>Matches functions that have a non-throwing exception specification.
4219 Given:
4220 void f();
4221 void g() noexcept;
4222 void h() throw();
4223 void i() throw(int);
4224 void j() noexcept(false);
4225 functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
4226 match the declarations of g, and h, but not f, i or j.
4227 </pre></td></tr>
4230 <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>
4231 <tr><td colspan="4" class="doc" id="isStaticStorageClass0"><pre>Matches variable/function declarations that have "static" storage
4232 class specifier ("static" keyword) written in the source.
4234 Given:
4235 static void f() {}
4236 static int i = 0;
4237 extern int j;
4238 int k;
4239 functionDecl(isStaticStorageClass())
4240 matches the function declaration f.
4241 varDecl(isStaticStorageClass())
4242 matches the variable declaration i.
4243 </pre></td></tr>
4246 <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>
4247 <tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static
4248 member variable template instantiations.
4250 Given
4251 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
4253 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
4255 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
4256 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4257 matches the template instantiation of X&lt;A&gt;.
4259 But given
4260 template &lt;typename T&gt; class X {}; class A {};
4261 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
4262 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4263 does not match, as X&lt;A&gt; is an explicit template specialization.
4265 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;
4266 </pre></td></tr>
4269 <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>
4270 <tr><td colspan="4" class="doc" id="isVariadic0"><pre>Matches if a function declaration is variadic.
4272 Example matches f, but not g or h. The function i will not match, even when
4273 compiled in C mode.
4274 void f(...);
4275 void g(int);
4276 template &lt;typename... Ts&gt; void h(Ts...);
4277 void i();
4278 </pre></td></tr>
4281 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isWeak0')"><a name="isWeak0Anchor">isWeak</a></td><td></td></tr>
4282 <tr><td colspan="4" class="doc" id="isWeak0"><pre>Matches weak function declarations.
4284 Given:
4285 void foo() __attribute__((__weakref__("__foo")));
4286 void bar();
4287 functionDecl(isWeak())
4288 matches the weak declaration "foo", but not "bar".
4289 </pre></td></tr>
4292 <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>
4293 <tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
4294 specific parameter count.
4296 Given
4297 void f(int i) {}
4298 void g(int i, int j) {}
4299 void h(int i, int j);
4300 void j(int i);
4301 void k(int x, int y, int z, ...);
4302 functionDecl(parameterCountIs(2))
4303 matches g and h
4304 functionProtoType(parameterCountIs(2))
4305 matches g and h
4306 functionProtoType(parameterCountIs(3))
4307 matches k
4308 </pre></td></tr>
4311 <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>
4312 <tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec1"><pre>Matches functions that have a dynamic exception specification.
4314 Given:
4315 void f();
4316 void g() noexcept;
4317 void h() noexcept(true);
4318 void i() noexcept(false);
4319 void j() throw();
4320 void k() throw(int);
4321 void l() throw(...);
4322 functionDecl(hasDynamicExceptionSpec()) and
4323 functionProtoType(hasDynamicExceptionSpec())
4324 match the declarations of j, k, and l, but not f, g, h, or i.
4325 </pre></td></tr>
4328 <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>
4329 <tr><td colspan="4" class="doc" id="isNoThrow1"><pre>Matches functions that have a non-throwing exception specification.
4331 Given:
4332 void f();
4333 void g() noexcept;
4334 void h() throw();
4335 void i() throw(int);
4336 void j() noexcept(false);
4337 functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
4338 match the declarations of g, and h, but not f, i or j.
4339 </pre></td></tr>
4342 <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>
4343 <tr><td colspan="4" class="doc" id="parameterCountIs1"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
4344 specific parameter count.
4346 Given
4347 void f(int i) {}
4348 void g(int i, int j) {}
4349 void h(int i, int j);
4350 void j(int i);
4351 void k(int x, int y, int z, ...);
4352 functionDecl(parameterCountIs(2))
4353 matches g and h
4354 functionProtoType(parameterCountIs(2))
4355 matches g and h
4356 functionProtoType(parameterCountIs(3))
4357 matches k
4358 </pre></td></tr>
4361 <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>
4362 <tr><td colspan="4" class="doc" id="isConstexpr2"><pre>Matches constexpr variable and function declarations,
4363 and if constexpr.
4365 Given:
4366 constexpr int foo = 42;
4367 constexpr int bar();
4368 void baz() { if constexpr(1 &gt; 0) {} }
4369 varDecl(isConstexpr())
4370 matches the declaration of foo.
4371 functionDecl(isConstexpr())
4372 matches the declaration of bar.
4373 ifStmt(isConstexpr())
4374 matches the if statement in baz.
4375 </pre></td></tr>
4378 <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>
4379 <tr><td colspan="4" class="doc" id="equals6"><pre></pre></td></tr>
4382 <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>
4383 <tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value of type ValueT.
4385 Given
4386 f('false, 3.14, 42);
4387 characterLiteral(equals(0))
4388 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
4389 match false
4390 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
4391 match 3.14
4392 integerLiteral(equals(42))
4393 matches 42
4395 Note that you cannot directly match a negative numeric literal because the
4396 minus sign is not part of the literal: It is a unary operator whose operand
4397 is the positive numeric literal. Instead, you must use a unaryOperator()
4398 matcher to match the minus sign:
4400 unaryOperator(hasOperatorName("-"),
4401 hasUnaryOperand(integerLiteral(equals(13))))
4403 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;,
4404 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;
4405 </pre></td></tr>
4408 <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>
4409 <tr><td colspan="4" class="doc" id="equals13"><pre></pre></td></tr>
4412 <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>
4413 <tr><td colspan="4" class="doc" id="equals9"><pre></pre></td></tr>
4416 <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>
4417 <tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '-&gt;' as opposed
4418 to '.'.
4420 Member calls on the implicit this pointer match as called with '-&gt;'.
4422 Given
4423 class Y {
4424 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
4425 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
4426 int a;
4427 static int b;
4429 template &lt;class T&gt;
4430 class Z {
4431 void x() { this-&gt;m; }
4433 memberExpr(isArrow())
4434 matches this-&gt;x, x, y.x, a, this-&gt;b
4435 cxxDependentScopeMemberExpr(isArrow())
4436 matches this-&gt;m
4437 unresolvedMemberExpr(isArrow())
4438 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
4439 </pre></td></tr>
4442 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyName0')"><a name="hasAnyName0Anchor">hasAnyName</a></td><td>StringRef, ..., StringRef</td></tr>
4443 <tr><td colspan="4" class="doc" id="hasAnyName0"><pre>Matches NamedDecl nodes that have any of the specified names.
4445 This matcher is only provided as a performance optimization of hasName.
4446 hasAnyName(a, b, c)
4447 is equivalent to, but faster than
4448 anyOf(hasName(a), hasName(b), hasName(c))
4449 </pre></td></tr>
4452 <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>
4453 <tr><td colspan="4" class="doc" id="hasExternalFormalLinkage0"><pre>Matches a declaration that has external formal linkage.
4455 Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
4456 void f() {
4457 int x;
4458 static int y;
4460 int z;
4462 Example matches f() because it has external formal linkage despite being
4463 unique to the translation unit as though it has internal likage
4464 (matcher = functionDecl(hasExternalFormalLinkage()))
4466 namespace {
4467 void f() {}
4469 </pre></td></tr>
4472 <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>StringRef Name</td></tr>
4473 <tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name.
4475 Supports specifying enclosing namespaces or classes by prefixing the name
4476 with '&lt;enclosing&gt;::'.
4477 Does not match typedefs of an underlying type with the given name.
4479 Example matches X (Name == "X")
4480 class X;
4482 Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
4483 namespace a { namespace b { class X; } }
4484 </pre></td></tr>
4487 <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>StringRef RegExp, Regex::RegexFlags Flags = NoFlags</td></tr>
4488 <tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain
4489 a substring matched by the given RegExp.
4491 Supports specifying enclosing namespaces or classes by
4492 prefixing the name with '&lt;enclosing&gt;::'. Does not match typedefs
4493 of an underlying type with the given name.
4495 Example matches X (regexp == "::X")
4496 class X;
4498 Example matches X (regexp is one of "::X", "^foo::.*X", among others)
4499 namespace foo { namespace bar { class X; } }
4501 If the matcher is used in clang-query, RegexFlags parameter
4502 should be passed as a quoted string. e.g: "NoFlags".
4503 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
4504 </pre></td></tr>
4507 <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>
4508 <tr><td colspan="4" class="doc" id="isAnonymous0"><pre>Matches anonymous namespace declarations.
4510 Given
4511 namespace n {
4512 namespace {} // #1
4514 namespaceDecl(isAnonymous()) will match #1 but not ::n.
4515 </pre></td></tr>
4518 <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>
4519 <tr><td colspan="4" class="doc" id="isInline0"><pre>Matches function and namespace declarations that are marked with
4520 the inline keyword.
4522 Given
4523 inline void f();
4524 void g();
4525 namespace n {
4526 inline namespace m {}
4528 functionDecl(isInline()) will match ::f().
4529 namespaceDecl(isInline()) will match n::m.
4530 </pre></td></tr>
4533 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPDefaultClause.html">OMPDefaultClause</a>&gt;</td><td class="name" onclick="toggle('isFirstPrivateKind0')"><a name="isFirstPrivateKind0Anchor">isFirstPrivateKind</a></td><td></td></tr>
4534 <tr><td colspan="4" class="doc" id="isFirstPrivateKind0"><pre>Matches if the OpenMP ``default`` clause has ``firstprivate`` kind
4535 specified.
4537 Given
4539 #pragma omp parallel
4540 #pragma omp parallel default(none)
4541 #pragma omp parallel default(shared)
4542 #pragma omp parallel default(firstprivate)
4544 ``ompDefaultClause(isFirstPrivateKind())`` matches only
4545 ``default(firstprivate)``.
4546 </pre></td></tr>
4549 <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>
4550 <tr><td colspan="4" class="doc" id="isNoneKind0"><pre>Matches if the OpenMP ``default`` clause has ``none`` kind specified.
4552 Given
4554 #pragma omp parallel
4555 #pragma omp parallel default(none)
4556 #pragma omp parallel default(shared)
4557 #pragma omp parallel default(firstprivate)
4559 ``ompDefaultClause(isNoneKind())`` matches only ``default(none)``.
4560 </pre></td></tr>
4563 <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>
4564 <tr><td colspan="4" class="doc" id="isSharedKind0"><pre>Matches if the OpenMP ``default`` clause has ``shared`` kind specified.
4566 Given
4568 #pragma omp parallel
4569 #pragma omp parallel default(none)
4570 #pragma omp parallel default(shared)
4571 #pragma omp parallel default(firstprivate)
4573 ``ompDefaultClause(isSharedKind())`` matches only ``default(shared)``.
4574 </pre></td></tr>
4577 <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>
4578 <tr><td colspan="4" class="doc" id="isAllowedToContainClauseKind0"><pre>Matches if the OpenMP directive is allowed to contain the specified OpenMP
4579 clause kind.
4581 Given
4583 #pragma omp parallel
4584 #pragma omp parallel for
4585 #pragma omp for
4587 `ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches
4588 ``omp parallel`` and ``omp parallel for``.
4590 If the matcher is use from clang-query, ``OpenMPClauseKind`` parameter
4591 should be passed as a quoted string. e.g.,
4592 ``isAllowedToContainClauseKind("OMPC_default").``
4593 </pre></td></tr>
4596 <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>
4597 <tr><td colspan="4" class="doc" id="isStandaloneDirective0"><pre>Matches standalone OpenMP directives,
4598 i.e., directives that can't have a structured block.
4600 Given
4602 #pragma omp parallel
4604 #pragma omp taskyield
4606 ``ompExecutableDirective(isStandaloneDirective()))`` matches
4607 ``omp taskyield``.
4608 </pre></td></tr>
4611 <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>
4612 <tr><td colspan="4" class="doc" id="isDerivedFrom3"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
4613 </pre></td></tr>
4616 <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>
4617 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom3"><pre>Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
4618 </pre></td></tr>
4621 <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>
4622 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom3"><pre>Overloaded method as shortcut for
4623 isSameOrDerivedFrom(hasName(...)).
4624 </pre></td></tr>
4627 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountIs3')"><a name="argumentCountIs3Anchor">argumentCountIs</a></td><td>unsigned N</td></tr>
4628 <tr><td colspan="4" class="doc" id="argumentCountIs3"><pre>Checks that a call expression or a constructor call expression has
4629 a specific number of arguments (including absent default arguments).
4631 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
4632 void f(int x, int y);
4633 f(0, 0);
4634 </pre></td></tr>
4637 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnySelector0')"><a name="hasAnySelector0Anchor">hasAnySelector</a></td><td>StringRef, ..., StringRef</td></tr>
4638 <tr><td colspan="4" class="doc" id="hasAnySelector0"><pre>Matches when at least one of the supplied string equals to the
4639 Selector.getAsString()
4641 matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
4642 matches both of the expressions below:
4643 [myObj methodA:argA];
4644 [myObj methodB:argB];
4645 </pre></td></tr>
4648 <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>
4649 <tr><td colspan="4" class="doc" id="hasKeywordSelector0"><pre>Matches when the selector is a keyword selector
4651 objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
4652 message expression in
4654 UIWebView *webView = ...;
4655 CGRect bodyFrame = webView.frame;
4656 bodyFrame.size.height = self.bodyContentHeight;
4657 webView.frame = bodyFrame;
4658 // ^---- matches here
4659 </pre></td></tr>
4662 <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>
4663 <tr><td colspan="4" class="doc" id="hasNullSelector0"><pre>Matches when the selector is the empty selector
4665 Matches only when the selector of the objCMessageExpr is NULL. This may
4666 represent an error condition in the tree!
4667 </pre></td></tr>
4670 <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>
4671 <tr><td colspan="4" class="doc" id="hasSelector0"><pre>Matches when BaseName == Selector.getAsString()
4673 matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:"));
4674 matches the outer message expr in the code below, but NOT the message
4675 invocation for self.bodyView.
4676 [self.bodyView loadHTMLString:html baseURL:NULL];
4677 </pre></td></tr>
4680 <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>
4681 <tr><td colspan="4" class="doc" id="hasUnarySelector0"><pre>Matches when the selector is a Unary Selector
4683 matcher = objCMessageExpr(matchesSelector(hasUnarySelector());
4684 matches self.bodyView in the code below, but NOT the outer message
4685 invocation of "loadHTMLString:baseURL:".
4686 [self.bodyView loadHTMLString:html baseURL:NULL];
4687 </pre></td></tr>
4690 <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>
4691 <tr><td colspan="4" class="doc" id="isClassMessage0"><pre>Returns true when the Objective-C message is sent to a class.
4693 Example
4694 matcher = objcMessageExpr(isClassMessage())
4695 matches
4696 [NSString stringWithFormat:@"format"];
4697 but not
4698 NSString *x = @"hello";
4699 [x containsString:@"h"];
4700 </pre></td></tr>
4703 <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>
4704 <tr><td colspan="4" class="doc" id="isInstanceMessage0"><pre>Returns true when the Objective-C message is sent to an instance.
4706 Example
4707 matcher = objcMessageExpr(isInstanceMessage())
4708 matches
4709 NSString *x = @"hello";
4710 [x containsString:@"h"];
4711 but not
4712 [NSString stringWithFormat:@"format"];
4713 </pre></td></tr>
4716 <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>StringRef RegExp, Regex::RegexFlags Flags = NoFlags</td></tr>
4717 <tr><td colspan="4" class="doc" id="matchesSelector0"><pre>Matches ObjC selectors whose name contains
4718 a substring matched by the given RegExp.
4719 matcher = objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
4720 invocation for self.bodyView.
4721 [self.bodyView loadHTMLString:html baseURL:NULL];
4723 If the matcher is used in clang-query, RegexFlags parameter
4724 should be passed as a quoted string. e.g: "NoFlags".
4725 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
4726 </pre></td></tr>
4729 <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>
4730 <tr><td colspan="4" class="doc" id="numSelectorArgs0"><pre>Matches when the selector has the specified number of arguments
4732 matcher = objCMessageExpr(numSelectorArgs(0));
4733 matches self.bodyView in the code below
4735 matcher = objCMessageExpr(numSelectorArgs(2));
4736 matches the invocation of "loadHTMLString:baseURL:" but not that
4737 of self.bodyView
4738 [self.bodyView loadHTMLString:html baseURL:NULL];
4739 </pre></td></tr>
4742 <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>
4743 <tr><td colspan="4" class="doc" id="isClassMethod0"><pre>Returns true when the Objective-C method declaration is a class method.
4745 Example
4746 matcher = objcMethodDecl(isClassMethod())
4747 matches
4748 @interface I + (void)foo; @end
4749 but not
4750 @interface I - (void)bar; @end
4751 </pre></td></tr>
4754 <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>
4755 <tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached.
4757 Example matches A, va, fa
4758 class A {};
4759 class B; // Doesn't match, as it has no body.
4760 int va;
4761 extern int vb; // Doesn't match, as it doesn't define the variable.
4762 void fa() {}
4763 void fb(); // Doesn't match, as it has no body.
4764 @interface X
4765 - (void)ma; // Doesn't match, interface is declaration.
4766 @end
4767 @implementation X
4768 - (void)ma {}
4769 @end
4771 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;,
4772 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
4773 </pre></td></tr>
4776 <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>
4777 <tr><td colspan="4" class="doc" id="isInstanceMethod0"><pre>Returns true when the Objective-C method declaration is an instance method.
4779 Example
4780 matcher = objcMethodDecl(isInstanceMethod())
4781 matches
4782 @interface I - (void)bar; @end
4783 but not
4784 @interface I + (void)foo; @end
4785 </pre></td></tr>
4788 <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>
4789 <tr><td colspan="4" class="doc" id="hasDefaultArgument0"><pre>Matches a declaration that has default arguments.
4791 Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
4792 void x(int val) {}
4793 void y(int val = 0) {}
4795 Deprecated. Use hasInitializer() instead to be able to
4796 match on the contents of the default argument. For example:
4798 void x(int val = 7) {}
4799 void y(int val = 42) {}
4800 parmVarDecl(hasInitializer(integerLiteral(equals(42))))
4801 matches the parameter of y
4803 A matcher such as
4804 parmVarDecl(hasInitializer(anything()))
4805 is equivalent to parmVarDecl(hasDefaultArgument()).
4806 </pre></td></tr>
4809 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt;</td><td class="name" onclick="toggle('isAtPosition0')"><a name="isAtPosition0Anchor">isAtPosition</a></td><td>unsigned N</td></tr>
4810 <tr><td colspan="4" class="doc" id="isAtPosition0"><pre>Matches the ParmVarDecl nodes that are at the N'th position in the parameter
4811 list. The parameter list could be that of either a block, function, or
4812 objc-method.
4815 Given
4817 void f(int a, int b, int c) {
4820 ``parmVarDecl(isAtPosition(0))`` matches ``int a``.
4822 ``parmVarDecl(isAtPosition(1))`` matches ``int b``.
4823 </pre></td></tr>
4826 <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>
4827 <tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string.
4829 Given
4830 class Y { public: void x(); };
4831 void z() { Y* y; y-&gt;x(); }
4832 cxxMemberCallExpr(on(hasType(asString("class Y *"))))
4833 matches y-&gt;x()
4834 </pre></td></tr>
4837 <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>
4838 <tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node.
4840 Matches a node if it equals the node previously bound to ID.
4842 Given
4843 class X { int a; int b; };
4844 cxxRecordDecl(
4845 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
4846 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
4847 matches the class X, as a and b have the same type.
4849 Note that when multiple matches are involved via forEach* matchers,
4850 equalsBoundNodes acts as a filter.
4851 For example:
4852 compoundStmt(
4853 forEachDescendant(varDecl().bind("d")),
4854 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
4855 will trigger a match for each combination of variable declaration
4856 and reference to that variable declaration within a compound statement.
4857 </pre></td></tr>
4860 <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>
4861 <tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to
4862 the node, not hidden within a typedef.
4864 Given
4865 typedef const int const_int;
4866 const_int i;
4867 int *const j;
4868 int *volatile k;
4869 int m;
4870 varDecl(hasType(hasLocalQualifiers())) matches only j and k.
4871 i is const-qualified but the qualifier is not local.
4872 </pre></td></tr>
4875 <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>
4876 <tr><td colspan="4" class="doc" id="isAnyCharacter0"><pre>Matches QualType nodes that are of character type.
4878 Given
4879 void a(char);
4880 void b(wchar_t);
4881 void c(double);
4882 functionDecl(hasAnyParameter(hasType(isAnyCharacter())))
4883 matches "a(char)", "b(wchar_t)", but not "c(double)".
4884 </pre></td></tr>
4887 <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>
4888 <tr><td colspan="4" class="doc" id="isAnyPointer0"><pre>Matches QualType nodes that are of any pointer type; this includes
4889 the Objective-C object pointer type, which is different despite being
4890 syntactically similar.
4892 Given
4893 int *i = nullptr;
4895 @interface Foo
4896 @end
4897 Foo *f;
4899 int j;
4900 varDecl(hasType(isAnyPointer()))
4901 matches "int *i" and "Foo *f", but not "int j".
4902 </pre></td></tr>
4905 <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>
4906 <tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that
4907 include "top-level" const.
4909 Given
4910 void a(int);
4911 void b(int const);
4912 void c(const int);
4913 void d(const int*);
4914 void e(int const) {};
4915 functionDecl(hasAnyParameter(hasType(isConstQualified())))
4916 matches "void b(int const)", "void c(const int)" and
4917 "void e(int const) {}". It does not match d as there
4918 is no top-level const on the parameter type "const int *".
4919 </pre></td></tr>
4922 <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>
4923 <tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type.
4925 Given
4926 void a(int);
4927 void b(long);
4928 void c(double);
4929 functionDecl(hasAnyParameter(hasType(isInteger())))
4930 matches "a(int)", "b(long)", but not "c(double)".
4931 </pre></td></tr>
4934 <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>
4935 <tr><td colspan="4" class="doc" id="isSignedInteger0"><pre>Matches QualType nodes that are of signed integer type.
4937 Given
4938 void a(int);
4939 void b(unsigned long);
4940 void c(double);
4941 functionDecl(hasAnyParameter(hasType(isSignedInteger())))
4942 matches "a(int)", but not "b(unsigned long)" and "c(double)".
4943 </pre></td></tr>
4946 <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>
4947 <tr><td colspan="4" class="doc" id="isUnsignedInteger0"><pre>Matches QualType nodes that are of unsigned integer type.
4949 Given
4950 void a(int);
4951 void b(unsigned long);
4952 void c(double);
4953 functionDecl(hasAnyParameter(hasType(isUnsignedInteger())))
4954 matches "b(unsigned long)", but not "a(int)" and "c(double)".
4955 </pre></td></tr>
4958 <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>
4959 <tr><td colspan="4" class="doc" id="isVolatileQualified0"><pre>Matches QualType nodes that are volatile-qualified, i.e., that
4960 include "top-level" volatile.
4962 Given
4963 void a(int);
4964 void b(int volatile);
4965 void c(volatile int);
4966 void d(volatile int*);
4967 void e(int volatile) {};
4968 functionDecl(hasAnyParameter(hasType(isVolatileQualified())))
4969 matches "void b(int volatile)", "void c(volatile int)" and
4970 "void e(int volatile) {}". It does not match d as there
4971 is no top-level volatile on the parameter type "volatile int *".
4972 </pre></td></tr>
4975 <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>
4976 <tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node.
4978 Matches a node if it equals the node previously bound to ID.
4980 Given
4981 class X { int a; int b; };
4982 cxxRecordDecl(
4983 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
4984 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
4985 matches the class X, as a and b have the same type.
4987 Note that when multiple matches are involved via forEach* matchers,
4988 equalsBoundNodes acts as a filter.
4989 For example:
4990 compoundStmt(
4991 forEachDescendant(varDecl().bind("d")),
4992 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
4993 will trigger a match for each combination of variable declaration
4994 and reference to that variable declaration within a compound statement.
4995 </pre></td></tr>
4998 <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>
4999 <tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node.
5001 Stmt has pointer identity in the AST.
5002 </pre></td></tr>
5005 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('isExpandedFromMacro1')"><a name="isExpandedFromMacro1Anchor">isExpandedFromMacro</a></td><td>std::string MacroName</td></tr>
5006 <tr><td colspan="4" class="doc" id="isExpandedFromMacro1"><pre>Matches statements that are (transitively) expanded from the named macro.
5007 Does not match if only part of the statement is expanded from that macro or
5008 if different parts of the the statement are expanded from different
5009 appearances of the macro.
5010 </pre></td></tr>
5013 <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>StringRef RegExp, Regex::RegexFlags Flags = NoFlags</td></tr>
5014 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches AST nodes that were expanded within files whose name is
5015 partially matching a given regex.
5017 Example matches Y but not X
5018 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
5019 #include "ASTMatcher.h"
5020 class X {};
5021 ASTMatcher.h:
5022 class Y {};
5024 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;
5026 If the matcher is used in clang-query, RegexFlags parameter
5027 should be passed as a quoted string. e.g: "NoFlags".
5028 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
5029 </pre></td></tr>
5032 <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>
5033 <tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches AST nodes that were expanded within the main-file.
5035 Example matches X but not Y
5036 (matcher = cxxRecordDecl(isExpansionInMainFile())
5037 #include &lt;Y.h&gt;
5038 class X {};
5039 Y.h:
5040 class Y {};
5042 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;
5043 </pre></td></tr>
5046 <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>
5047 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches AST nodes that were expanded within system-header-files.
5049 Example matches Y but not X
5050 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
5051 #include &lt;SystemHeader.h&gt;
5052 class X {};
5053 SystemHeader.h:
5054 class Y {};
5056 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;
5057 </pre></td></tr>
5060 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('isInTemplateInstantiation0')"><a name="isInTemplateInstantiation0Anchor">isInTemplateInstantiation</a></td><td></td></tr>
5061 <tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
5063 Given
5064 int j;
5065 template&lt;typename T&gt; void A(T t) { T i; j += 42;}
5066 A(0);
5067 A(0U);
5068 declStmt(isInTemplateInstantiation())
5069 matches 'int i;' and 'unsigned i'.
5070 unless(stmt(isInTemplateInstantiation()))
5071 will NOT match j += 42; as it's shared between the template definition and
5072 instantiation.
5073 </pre></td></tr>
5076 <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>
5077 <tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
5079 Given
5080 int a[42];
5081 int b[2 * 21];
5082 int c[41], d[43];
5083 char *s = "abcd";
5084 wchar_t *ws = L"abcd";
5085 char *w = "a";
5086 constantArrayType(hasSize(42))
5087 matches "int a[42]" and "int b[2 * 21]"
5088 stringLiteral(hasSize(4))
5089 matches "abcd", L"abcd"
5090 </pre></td></tr>
5093 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;</td><td class="name" onclick="toggle('isClass0')"><a name="isClass0Anchor">isClass</a></td><td></td></tr>
5094 <tr><td colspan="4" class="doc" id="isClass0"><pre>Matches TagDecl object that are spelled with "class."
5096 Example matches C, but not S, U or E.
5097 struct S {};
5098 class C {};
5099 union U {};
5100 enum E {};
5101 </pre></td></tr>
5104 <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>
5105 <tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
5107 Example matches A, va, fa
5108 class A {};
5109 class B; // Doesn't match, as it has no body.
5110 int va;
5111 extern int vb; // Doesn't match, as it doesn't define the variable.
5112 void fa() {}
5113 void fb(); // Doesn't match, as it has no body.
5114 @interface X
5115 - (void)ma; // Doesn't match, interface is declaration.
5116 @end
5117 @implementation X
5118 - (void)ma {}
5119 @end
5121 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;,
5122 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
5123 </pre></td></tr>
5126 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;</td><td class="name" onclick="toggle('isEnum0')"><a name="isEnum0Anchor">isEnum</a></td><td></td></tr>
5127 <tr><td colspan="4" class="doc" id="isEnum0"><pre>Matches TagDecl object that are spelled with "enum."
5129 Example matches E, but not C, S or U.
5130 struct S {};
5131 class C {};
5132 union U {};
5133 enum E {};
5134 </pre></td></tr>
5137 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;</td><td class="name" onclick="toggle('isStruct0')"><a name="isStruct0Anchor">isStruct</a></td><td></td></tr>
5138 <tr><td colspan="4" class="doc" id="isStruct0"><pre>Matches TagDecl object that are spelled with "struct."
5140 Example matches S, but not C, U or E.
5141 struct S {};
5142 class C {};
5143 union U {};
5144 enum E {};
5145 </pre></td></tr>
5148 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;</td><td class="name" onclick="toggle('isUnion0')"><a name="isUnion0Anchor">isUnion</a></td><td></td></tr>
5149 <tr><td colspan="4" class="doc" id="isUnion0"><pre>Matches TagDecl object that are spelled with "union."
5151 Example matches U, but not C, S or E.
5152 struct S {};
5153 class C {};
5154 union U {};
5155 enum E {};
5156 </pre></td></tr>
5159 <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>
5160 <tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value.
5162 Note that 'Value' is a string as the template argument's value is
5163 an arbitrary precision integer. 'Value' must be euqal to the canonical
5164 representation of that integral value in base 10.
5166 Given
5167 template&lt;int T&gt; struct C {};
5168 C&lt;42&gt; c;
5169 classTemplateSpecializationDecl(
5170 hasAnyTemplateArgument(equalsIntegralValue("42")))
5171 matches the implicit instantiation of C in C&lt;42&gt;.
5172 </pre></td></tr>
5175 <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>
5176 <tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value.
5178 Given
5179 template&lt;int T&gt; struct C {};
5180 C&lt;42&gt; c;
5181 classTemplateSpecializationDecl(
5182 hasAnyTemplateArgument(isIntegral()))
5183 matches the implicit instantiation of C in C&lt;42&gt;
5184 with isIntegral() matching 42.
5185 </pre></td></tr>
5188 <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>
5189 <tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N.
5191 Given
5192 template&lt;typename T&gt; struct C {};
5193 C&lt;int&gt; c;
5194 classTemplateSpecializationDecl(templateArgumentCountIs(1))
5195 matches C&lt;int&gt;.
5196 </pre></td></tr>
5199 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('isExpandedFromMacro2')"><a name="isExpandedFromMacro2Anchor">isExpandedFromMacro</a></td><td>std::string MacroName</td></tr>
5200 <tr><td colspan="4" class="doc" id="isExpandedFromMacro2"><pre>Matches statements that are (transitively) expanded from the named macro.
5201 Does not match if only part of the statement is expanded from that macro or
5202 if different parts of the the statement are expanded from different
5203 appearances of the macro.
5204 </pre></td></tr>
5207 <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>StringRef RegExp, Regex::RegexFlags Flags = NoFlags</td></tr>
5208 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is
5209 partially matching a given regex.
5211 Example matches Y but not X
5212 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
5213 #include "ASTMatcher.h"
5214 class X {};
5215 ASTMatcher.h:
5216 class Y {};
5218 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;
5220 If the matcher is used in clang-query, RegexFlags parameter
5221 should be passed as a quoted string. e.g: "NoFlags".
5222 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
5223 </pre></td></tr>
5226 <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>
5227 <tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file.
5229 Example matches X but not Y
5230 (matcher = cxxRecordDecl(isExpansionInMainFile())
5231 #include &lt;Y.h&gt;
5232 class X {};
5233 Y.h:
5234 class Y {};
5236 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;
5237 </pre></td></tr>
5240 <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>
5241 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files.
5243 Example matches Y but not X
5244 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
5245 #include &lt;SystemHeader.h&gt;
5246 class X {};
5247 SystemHeader.h:
5248 class Y {};
5250 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;
5251 </pre></td></tr>
5254 <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>
5255 <tr><td colspan="4" class="doc" id="booleanType0"><pre>Matches type bool.
5257 Given
5258 struct S { bool func(); };
5259 functionDecl(returns(booleanType()))
5260 matches "bool func();"
5261 </pre></td></tr>
5264 <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>
5265 <tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
5267 Matches a node if it equals the node previously bound to ID.
5269 Given
5270 class X { int a; int b; };
5271 cxxRecordDecl(
5272 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
5273 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
5274 matches the class X, as a and b have the same type.
5276 Note that when multiple matches are involved via forEach* matchers,
5277 equalsBoundNodes acts as a filter.
5278 For example:
5279 compoundStmt(
5280 forEachDescendant(varDecl().bind("d")),
5281 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
5282 will trigger a match for each combination of variable declaration
5283 and reference to that variable declaration within a compound statement.
5284 </pre></td></tr>
5287 <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>
5288 <tr><td colspan="4" class="doc" id="equalsNode2"><pre>Matches if a node equals another node.
5290 Type has pointer identity in the AST.
5291 </pre></td></tr>
5294 <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>
5295 <tr><td colspan="4" class="doc" id="realFloatingPointType0"><pre>Matches any real floating-point type (float, double, long double).
5297 Given
5298 int i;
5299 float f;
5300 realFloatingPointType()
5301 matches "float f" but not "int i"
5302 </pre></td></tr>
5305 <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>
5306 <tr><td colspan="4" class="doc" id="voidType0"><pre>Matches type void.
5308 Given
5309 struct S { void func(); };
5310 functionDecl(returns(voidType()))
5311 matches "void func();"
5312 </pre></td></tr>
5315 <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>
5316 <tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
5318 Given
5319 int x;
5320 int s = sizeof(x) + alignof(x)
5321 unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
5322 matches sizeof(x)
5324 If the matcher is use from clang-query, UnaryExprOrTypeTrait parameter
5325 should be passed as a quoted string. e.g., ofKind("UETT_SizeOf").
5326 </pre></td></tr>
5329 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasAnyOperatorName3')"><a name="hasAnyOperatorName3Anchor">hasAnyOperatorName</a></td><td>StringRef, ..., StringRef</td></tr>
5330 <tr><td colspan="4" class="doc" id="hasAnyOperatorName3"><pre>Matches operator expressions (binary or unary) that have any of the
5331 specified names.
5333 hasAnyOperatorName("+", "-")
5334 Is equivalent to
5335 anyOf(hasOperatorName("+"), hasOperatorName("-"))
5336 </pre></td></tr>
5339 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperatorName3')"><a name="hasOperatorName3Anchor">hasOperatorName</a></td><td>std::string Name</td></tr>
5340 <tr><td colspan="4" class="doc" id="hasOperatorName3"><pre>Matches the operator Name of operator expressions (binary or
5341 unary).
5343 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
5344 !(a || b)
5345 </pre></td></tr>
5348 <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>
5349 <tr><td colspan="4" class="doc" id="isArrow1"><pre>Matches member expressions that are called with '-&gt;' as opposed
5350 to '.'.
5352 Member calls on the implicit this pointer match as called with '-&gt;'.
5354 Given
5355 class Y {
5356 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
5357 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
5358 int a;
5359 static int b;
5361 template &lt;class T&gt;
5362 class Z {
5363 void x() { this-&gt;m; }
5365 memberExpr(isArrow())
5366 matches this-&gt;x, x, y.x, a, this-&gt;b
5367 cxxDependentScopeMemberExpr(isArrow())
5368 matches this-&gt;m
5369 unresolvedMemberExpr(isArrow())
5370 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
5371 </pre></td></tr>
5374 <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>
5375 <tr><td colspan="4" class="doc" id="hasAutomaticStorageDuration0"><pre>Matches a variable declaration that has automatic storage duration.
5377 Example matches x, but not y, z, or a.
5378 (matcher = varDecl(hasAutomaticStorageDuration())
5379 void f() {
5380 int x;
5381 static int y;
5382 thread_local int z;
5384 int a;
5385 </pre></td></tr>
5388 <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>
5389 <tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
5391 Example matches y and z (matcher = varDecl(hasGlobalStorage())
5392 void f() {
5393 int x;
5394 static int y;
5396 int z;
5397 </pre></td></tr>
5400 <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>
5401 <tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a
5402 non-static local variable.
5404 Example matches x (matcher = varDecl(hasLocalStorage())
5405 void f() {
5406 int x;
5407 static int y;
5409 int z;
5410 </pre></td></tr>
5413 <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>
5414 <tr><td colspan="4" class="doc" id="hasStaticStorageDuration0"><pre>Matches a variable declaration that has static storage duration.
5415 It includes the variable declared at namespace scope and those declared
5416 with "static" and "extern" storage class specifiers.
5418 void f() {
5419 int x;
5420 static int y;
5421 thread_local int z;
5423 int a;
5424 static int b;
5425 extern int c;
5426 varDecl(hasStaticStorageDuration())
5427 matches the function declaration y, a, b and c.
5428 </pre></td></tr>
5431 <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>
5432 <tr><td colspan="4" class="doc" id="hasThreadStorageDuration0"><pre>Matches a variable declaration that has thread storage duration.
5434 Example matches z, but not x, z, or a.
5435 (matcher = varDecl(hasThreadStorageDuration())
5436 void f() {
5437 int x;
5438 static int y;
5439 thread_local int z;
5441 int a;
5442 </pre></td></tr>
5445 <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>
5446 <tr><td colspan="4" class="doc" id="isConstexpr0"><pre>Matches constexpr variable and function declarations,
5447 and if constexpr.
5449 Given:
5450 constexpr int foo = 42;
5451 constexpr int bar();
5452 void baz() { if constexpr(1 &gt; 0) {} }
5453 varDecl(isConstexpr())
5454 matches the declaration of foo.
5455 functionDecl(isConstexpr())
5456 matches the declaration of bar.
5457 ifStmt(isConstexpr())
5458 matches the if statement in baz.
5459 </pre></td></tr>
5462 <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>
5463 <tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
5465 Example matches A, va, fa
5466 class A {};
5467 class B; // Doesn't match, as it has no body.
5468 int va;
5469 extern int vb; // Doesn't match, as it doesn't define the variable.
5470 void fa() {}
5471 void fb(); // Doesn't match, as it has no body.
5472 @interface X
5473 - (void)ma; // Doesn't match, interface is declaration.
5474 @end
5475 @implementation X
5476 - (void)ma {}
5477 @end
5479 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;,
5480 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
5481 </pre></td></tr>
5484 <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>
5485 <tr><td colspan="4" class="doc" id="isExceptionVariable0"><pre>Matches a variable declaration that is an exception variable from
5486 a C++ catch block, or an Objective-C statement.
5488 Example matches x (matcher = varDecl(isExceptionVariable())
5489 void f(int y) {
5490 try {
5491 } catch (int x) {
5494 </pre></td></tr>
5497 <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>
5498 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
5499 static member variable template instantiations.
5501 Given
5502 template&lt;typename T&gt; void A(T t) { }
5503 template&lt;&gt; void A(int N) { }
5504 functionDecl(isExplicitTemplateSpecialization())
5505 matches the specialization A&lt;int&gt;().
5507 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;
5508 </pre></td></tr>
5511 <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>
5512 <tr><td colspan="4" class="doc" id="isExternC1"><pre>Matches extern "C" function or variable declarations.
5514 Given:
5515 extern "C" void f() {}
5516 extern "C" { void g() {} }
5517 void h() {}
5518 extern "C" int x = 1;
5519 extern "C" int y = 2;
5520 int z = 3;
5521 functionDecl(isExternC())
5522 matches the declaration of f and g, but not the declaration of h.
5523 varDecl(isExternC())
5524 matches the declaration of x and y, but not the declaration of z.
5525 </pre></td></tr>
5528 <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>
5529 <tr><td colspan="4" class="doc" id="isStaticLocal0"><pre>Matches a static variable with local scope.
5531 Example matches y (matcher = varDecl(isStaticLocal()))
5532 void f() {
5533 int x;
5534 static int y;
5536 static int z;
5537 </pre></td></tr>
5540 <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>
5541 <tr><td colspan="4" class="doc" id="isStaticStorageClass1"><pre>Matches variable/function declarations that have "static" storage
5542 class specifier ("static" keyword) written in the source.
5544 Given:
5545 static void f() {}
5546 static int i = 0;
5547 extern int j;
5548 int k;
5549 functionDecl(isStaticStorageClass())
5550 matches the function declaration f.
5551 varDecl(isStaticStorageClass())
5552 matches the variable declaration i.
5553 </pre></td></tr>
5556 <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>
5557 <tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
5558 member variable template instantiations.
5560 Given
5561 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
5563 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
5565 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
5566 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
5567 matches the template instantiation of X&lt;A&gt;.
5569 But given
5570 template &lt;typename T&gt; class X {}; class A {};
5571 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
5572 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
5573 does not match, as X&lt;A&gt; is an explicit template specialization.
5575 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;
5576 </pre></td></tr>
5578 <!--END_NARROWING_MATCHERS -->
5579 </table>
5581 <!-- ======================================================================= -->
5582 <h2 id="traversal-matchers">AST Traversal Matchers</h2>
5583 <!-- ======================================================================= -->
5585 <p>Traversal matchers specify the relationship to other nodes that are
5586 reachable from the current node.</p>
5588 <p>Note that there are special traversal matchers (has, hasDescendant, forEach and
5589 forEachDescendant) which work on all nodes and allow users to write more generic
5590 match expressions.</p>
5592 <table>
5593 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
5594 <!-- START_TRAVERSAL_MATCHERS -->
5596 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('binaryOperation0')"><a name="binaryOperation0Anchor">binaryOperation</a></td><td>Matcher&lt;*&gt;...Matcher&lt;*&gt;</td></tr>
5597 <tr><td colspan="4" class="doc" id="binaryOperation0"><pre>Matches nodes which can be used with binary operators.
5599 The code
5600 var1 != var2;
5601 might be represented in the clang AST as a binaryOperator, a
5602 cxxOperatorCallExpr or a cxxRewrittenBinaryOperator, depending on
5604 * whether the types of var1 and var2 are fundamental (binaryOperator) or at
5605 least one is a class type (cxxOperatorCallExpr)
5606 * whether the code appears in a template declaration, if at least one of the
5607 vars is a dependent-type (binaryOperator)
5608 * whether the code relies on a rewritten binary operator, such as a
5609 spaceship operator or an inverted equality operator
5610 (cxxRewrittenBinaryOperator)
5612 This matcher elides details in places where the matchers for the nodes are
5613 compatible.
5615 Given
5616 binaryOperation(
5617 hasOperatorName("!="),
5618 hasLHS(expr().bind("lhs")),
5619 hasRHS(expr().bind("rhs"))
5621 matches each use of "!=" in:
5622 struct S{
5623 bool operator!=(const S&amp;) const;
5626 void foo()
5628 1 != 2;
5629 S() != S();
5632 template&lt;typename T&gt;
5633 void templ()
5635 1 != 2;
5636 T() != S();
5638 struct HasOpEq
5640 bool operator==(const HasOpEq &amp;) const;
5643 void inverse()
5645 HasOpEq s1;
5646 HasOpEq s2;
5647 if (s1 != s2)
5648 return;
5651 struct HasSpaceship
5653 bool operator&lt;=&gt;(const HasOpEq &amp;) const;
5656 void use_spaceship()
5658 HasSpaceship s1;
5659 HasSpaceship s2;
5660 if (s1 != s2)
5661 return;
5663 </pre></td></tr>
5666 <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>
5667 <tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
5669 Unlike anyOf, eachOf will generate a match result for each
5670 matching submatcher.
5672 For example, in:
5673 class A { int a; int b; };
5674 The matcher:
5675 cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
5676 has(fieldDecl(hasName("b")).bind("v"))))
5677 will generate two results binding "v", the first of which binds
5678 the field declaration of a, the second the field declaration of
5681 Usable as: Any Matcher
5682 </pre></td></tr>
5685 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>Matcher&lt;*&gt; Matcher</td></tr>
5686 <tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
5688 Generates results for each match.
5690 For example, in:
5691 class A { class B {}; class C {}; };
5692 The matcher:
5693 cxxRecordDecl(hasName("::A"),
5694 findAll(cxxRecordDecl(isDefinition()).bind("m")))
5695 will generate results for A, B and C.
5697 Usable as: Any Matcher
5698 </pre></td></tr>
5701 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
5702 <tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
5703 provided matcher.
5705 Example matches X, A, A::X, B, B::C, B::C::X
5706 (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
5707 class X {};
5708 class A { class X {}; }; // Matches A, because A::X is a class of name
5709 // X inside A.
5710 class B { class C { class X {}; }; };
5712 DescendantT must be an AST base type.
5714 As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
5715 each result that matches instead of only on the first one.
5717 Note: Recursively combined ForEachDescendant can cause many matches:
5718 cxxRecordDecl(forEachDescendant(cxxRecordDecl(
5719 forEachDescendant(cxxRecordDecl())
5721 will match 10 times (plus injected class name matches) on:
5722 class A { class B { class C { class D { class E {}; }; }; }; };
5724 Usable as: Any Matcher
5725 </pre></td></tr>
5728 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
5729 <tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
5730 provided matcher.
5732 Example matches X, Y, Y::X, Z::Y, Z::Y::X
5733 (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
5734 class X {};
5735 class Y { class X {}; }; // Matches Y, because Y::X is a class of name X
5736 // inside Y.
5737 class Z { class Y { class X {}; }; }; // Does not match Z.
5739 ChildT must be an AST base type.
5741 As opposed to 'has', 'forEach' will cause a match for each result that
5742 matches instead of only on the first one.
5744 Usable as: Any Matcher
5745 </pre></td></tr>
5748 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
5749 <tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
5750 matcher.
5752 Given
5753 void f() { if (true) { int x = 42; } }
5754 void g() { for (;;) { int x = 43; } }
5755 expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
5757 Usable as: Any Matcher
5758 </pre></td></tr>
5761 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
5762 <tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
5763 provided matcher.
5765 Example matches X, Y, Z
5766 (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
5767 class X {}; // Matches X, because X::X is a class of name X inside X.
5768 class Y { class X {}; };
5769 class Z { class Y { class X {}; }; };
5771 DescendantT must be an AST base type.
5773 Usable as: Any Matcher
5774 </pre></td></tr>
5777 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
5778 <tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
5779 provided matcher.
5781 Example matches X, Y
5782 (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
5783 class X {}; // Matches X, because X::X is a class of name X inside X.
5784 class Y { class X {}; };
5785 class Z { class Y { class X {}; }; }; // Does not match Z.
5787 ChildT must be an AST base type.
5789 Usable as: Any Matcher
5790 Note that has is direct matcher, so it also matches things like implicit
5791 casts and paren casts. If you are matching with expr then you should
5792 probably consider using ignoringParenImpCasts like:
5793 has(ignoringParenImpCasts(expr())).
5794 </pre></td></tr>
5797 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
5798 <tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
5799 matcher.
5801 Given
5802 void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
5803 compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
5805 Usable as: Any Matcher
5806 </pre></td></tr>
5809 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('invocation0')"><a name="invocation0Anchor">invocation</a></td><td>Matcher&lt;*&gt;...Matcher&lt;*&gt;</td></tr>
5810 <tr><td colspan="4" class="doc" id="invocation0"><pre>Matches function calls and constructor calls
5812 Because CallExpr and CXXConstructExpr do not share a common
5813 base class with API accessing arguments etc, AST Matchers for code
5814 which should match both are typically duplicated. This matcher
5815 removes the need for duplication.
5817 Given code
5818 struct ConstructorTakesInt
5820 ConstructorTakesInt(int i) {}
5823 void callTakesInt(int i)
5827 void doCall()
5829 callTakesInt(42);
5832 void doConstruct()
5834 ConstructorTakesInt cti(42);
5837 The matcher
5838 invocation(hasArgument(0, integerLiteral(equals(42))))
5839 matches the expression in both doCall and doConstruct
5840 </pre></td></tr>
5843 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('optionally0')"><a name="optionally0Anchor">optionally</a></td><td>Matcher&lt;*&gt;</td></tr>
5844 <tr><td colspan="4" class="doc" id="optionally0"><pre>Matches any node regardless of the submatcher.
5846 However, optionally will retain any bindings generated by the submatcher.
5847 Useful when additional information which may or may not present about a main
5848 matching node is desired.
5850 For example, in:
5851 class Foo {
5852 int bar;
5854 The matcher:
5855 cxxRecordDecl(
5856 optionally(has(
5857 fieldDecl(hasName("bar")).bind("var")
5858 ))).bind("record")
5859 will produce a result binding for both "record" and "var".
5860 The matcher will produce a "record" binding for even if there is no data
5861 member named "bar" in that class.
5863 Usable as: Any Matcher
5864 </pre></td></tr>
5867 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('traverse0')"><a name="traverse0Anchor">traverse</a></td><td>TraversalKind TK, Matcher&lt;*&gt; InnerMatcher</td></tr>
5868 <tr><td colspan="4" class="doc" id="traverse0"><pre>Causes all nested matchers to be matched with the specified traversal kind.
5870 Given
5871 void foo()
5873 int i = 3.0;
5875 The matcher
5876 traverse(TK_IgnoreUnlessSpelledInSource,
5877 varDecl(hasInitializer(floatLiteral().bind("init")))
5879 matches the variable declaration with "init" bound to the "3.0".
5880 </pre></td></tr>
5883 <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>
5884 <tr><td colspan="4" class="doc" id="hasCondition5"><pre>Matches the condition expression of an if statement, for loop,
5885 switch statement or conditional operator.
5887 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
5888 if (true) {}
5889 </pre></td></tr>
5892 <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>
5893 <tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator
5894 (binary or ternary).
5896 Example matches b
5897 condition ? a : b
5898 condition ?: b
5899 </pre></td></tr>
5902 <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>
5903 <tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
5905 Example 1 (conditional ternary operator): matches a
5906 condition ? a : b
5908 Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
5909 condition ?: b
5910 </pre></td></tr>
5913 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
5914 <tr><td colspan="4" class="doc" id="hasDeclaration15"><pre>Matches a node if the declaration associated with that node
5915 matches the given matcher.
5917 The associated declaration is:
5918 - for type nodes, the declaration of the underlying type
5919 - for CallExpr, the declaration of the callee
5920 - for MemberExpr, the declaration of the referenced member
5921 - for CXXConstructExpr, the declaration of the constructor
5922 - for CXXNewExpr, the declaration of the operator new
5923 - for ObjCIvarExpr, the declaration of the ivar
5925 For type nodes, hasDeclaration will generally match the declaration of the
5926 sugared type. Given
5927 class X {};
5928 typedef X Y;
5929 Y y;
5930 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
5931 typedefDecl. A common use case is to match the underlying, desugared type.
5932 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
5933 varDecl(hasType(hasUnqualifiedDesugaredType(
5934 recordType(hasDeclaration(decl())))))
5935 In this matcher, the decl will match the CXXRecordDecl of class X.
5937 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;,
5938 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;,
5939 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;,
5940 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;,
5941 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;,
5942 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;,
5943 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
5944 </pre></td></tr>
5947 <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>
5948 <tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
5950 Given
5951 int i[5];
5952 void f() { i[1] = 42; }
5953 arraySubscriptExpression(hasBase(implicitCastExpr(
5954 hasSourceExpression(declRefExpr()))))
5955 matches i[1] with the declRefExpr() matching i
5956 </pre></td></tr>
5959 <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>
5960 <tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
5962 Given
5963 int i[5];
5964 void f() { i[1] = 42; }
5965 arraySubscriptExpression(hasIndex(integerLiteral()))
5966 matches i[1] with the integerLiteral() matching 1
5967 </pre></td></tr>
5970 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>&gt;</td><td class="name" onclick="toggle('hasLHS3')"><a name="hasLHS3Anchor">hasLHS</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5971 <tr><td colspan="4" class="doc" id="hasLHS3"><pre>Matches the left hand side of binary operator expressions.
5973 Example matches a (matcher = binaryOperator(hasLHS()))
5974 a || b
5975 </pre></td></tr>
5978 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>&gt;</td><td class="name" onclick="toggle('hasRHS3')"><a name="hasRHS3Anchor">hasRHS</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
5979 <tr><td colspan="4" class="doc" id="hasRHS3"><pre>Matches the right hand side of binary operator expressions.
5981 Example matches b (matcher = binaryOperator(hasRHS()))
5982 a || b
5983 </pre></td></tr>
5986 <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>
5987 <tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
5988 type.
5990 Given
5991 struct A {};
5992 A a[7];
5993 int b[7];
5994 arrayType(hasElementType(builtinType()))
5995 matches "int b[7]"
5997 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;
5998 </pre></td></tr>
6001 <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>
6002 <tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
6004 Given
6005 _Atomic(int) i;
6006 _Atomic(float) f;
6007 atomicType(hasValueType(isInteger()))
6008 matches "_Atomic(int) i"
6010 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
6011 </pre></td></tr>
6014 <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>
6015 <tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
6017 Note: There is no TypeLoc for the deduced type and thus no
6018 getDeducedLoc() matcher.
6020 Given
6021 auto a = 1;
6022 auto b = 2.0;
6023 autoType(hasDeducedType(isInteger()))
6024 matches "auto a"
6026 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
6027 </pre></td></tr>
6030 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6031 <tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
6032 binary operator matches.
6033 </pre></td></tr>
6036 <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>
6037 <tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
6039 Example matches a (matcher = binaryOperator(hasLHS()))
6040 a || b
6041 </pre></td></tr>
6044 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperands0')"><a name="hasOperands0Anchor">hasOperands</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; Matcher1, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; Matcher2</td></tr>
6045 <tr><td colspan="4" class="doc" id="hasOperands0"><pre>Matches if both matchers match with opposite sides of the binary operator.
6047 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
6048 integerLiteral(equals(2)))
6049 1 + 2 // Match
6050 2 + 1 // Match
6051 1 + 1 // No match
6052 2 + 2 // No match
6053 </pre></td></tr>
6056 <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>
6057 <tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
6059 Example matches b (matcher = binaryOperator(hasRHS()))
6060 a || b
6061 </pre></td></tr>
6064 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BindingDecl.html">BindingDecl</a>&gt;</td><td class="name" onclick="toggle('forDecomposition0')"><a name="forDecomposition0Anchor">forDecomposition</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt; InnerMatcher</td></tr>
6065 <tr><td colspan="4" class="doc" id="forDecomposition0"><pre>Matches the DecompositionDecl the binding belongs to.
6067 For example, in:
6068 void foo()
6070 int arr[3];
6071 auto &amp;[f, s, t] = arr;
6073 f = 42;
6075 The matcher:
6076 bindingDecl(hasName("f"),
6077 forDecomposition(decompositionDecl())
6078 matches 'f' in 'auto &amp;[f, s, t]'.
6079 </pre></td></tr>
6082 <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>
6083 <tr><td colspan="4" class="doc" id="hasAnyParameter2"><pre>Matches any parameter of a function or an ObjC method declaration or a
6084 block.
6086 Does not match the 'this' parameter of a method.
6088 Given
6089 class X { void f(int x, int y, int z) {} };
6090 cxxMethodDecl(hasAnyParameter(hasName("y")))
6091 matches f(int x, int y, int z) {}
6092 with hasAnyParameter(...)
6093 matching int y
6095 For ObjectiveC, given
6096 @interface I - (void) f:(int) y; @end
6098 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
6099 matches the declaration of method f with hasParameter
6100 matching y.
6102 For blocks, given
6103 b = ^(int y) { printf("%d", y) };
6105 the matcher blockDecl(hasAnyParameter(hasName("y")))
6106 matches the declaration of the block b with hasParameter
6107 matching y.
6108 </pre></td></tr>
6111 <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>
6112 <tr><td colspan="4" class="doc" id="hasParameter2"><pre>Matches the n'th parameter of a function or an ObjC method
6113 declaration or a block.
6115 Given
6116 class X { void f(int x) {} };
6117 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
6118 matches f(int x) {}
6119 with hasParameter(...)
6120 matching int x
6122 For ObjectiveC, given
6123 @interface I - (void) f:(int) y; @end
6125 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
6126 matches the declaration of method f with hasParameter
6127 matching y.
6128 </pre></td></tr>
6131 <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>
6132 <tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
6133 pointee matches a given matcher.
6135 Given
6136 int *a;
6137 int const *b;
6138 float const *f;
6139 pointerType(pointee(isConstQualified(), isInteger()))
6140 matches "int const *b"
6142 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;,
6143 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;
6144 </pre></td></tr>
6147 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;</td><td class="name" onclick="toggle('hasType7')"><a name="hasType7Anchor">hasType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6148 <tr><td colspan="4" class="doc" id="hasType7"><pre>Overloaded to match the declaration of the expression's or value
6149 declaration's type.
6151 In case of a value declaration (for example a variable declaration),
6152 this resolves one layer of indirection. For example, in the value
6153 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
6154 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
6155 declaration of x.
6157 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6158 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6159 and friend class X (matcher = friendDecl(hasType("X"))
6160 class X {};
6161 void y(X &amp;x) { x; X z; }
6162 class Y { friend class X; };
6164 Example matches class Derived
6165 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
6166 class Base {};
6167 class Derived : Base {};
6169 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_1FriendDecl.html">FriendDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;,
6170 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
6171 </pre></td></tr>
6174 <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>
6175 <tr><td colspan="4" class="doc" id="forEachArgumentWithParam1"><pre>Matches all arguments and their respective ParmVarDecl.
6177 Given
6178 void f(int i);
6179 int y;
6180 f(y);
6181 callExpr(
6182 forEachArgumentWithParam(
6183 declRefExpr(to(varDecl(hasName("y")))),
6184 parmVarDecl(hasType(isInteger()))
6186 matches f(y);
6187 with declRefExpr(...)
6188 matching int y
6189 and parmVarDecl(...)
6190 matching int i
6191 </pre></td></tr>
6194 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('forEachArgumentWithParamType1')"><a name="forEachArgumentWithParamType1Anchor">forEachArgumentWithParamType</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_1QualType.html">QualType</a>&gt; ParamMatcher</td></tr>
6195 <tr><td colspan="4" class="doc" id="forEachArgumentWithParamType1"><pre>Matches all arguments and their respective types for a CallExpr or
6196 CXXConstructExpr. It is very similar to forEachArgumentWithParam but
6197 it works on calls through function pointers as well.
6199 The difference is, that function pointers do not provide access to a
6200 ParmVarDecl, but only the QualType for each argument.
6202 Given
6203 void f(int i);
6204 int y;
6205 f(y);
6206 void (*f_ptr)(int) = f;
6207 f_ptr(y);
6208 callExpr(
6209 forEachArgumentWithParamType(
6210 declRefExpr(to(varDecl(hasName("y")))),
6211 qualType(isInteger()).bind("type)
6213 matches f(y) and f_ptr(y)
6214 with declRefExpr(...)
6215 matching int y
6216 and qualType(...)
6217 matching int
6218 </pre></td></tr>
6221 <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>
6222 <tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
6223 expression, or an ObjC-message-send expression.
6225 Given
6226 void x(int, int, int) { int y; x(1, y, 42); }
6227 callExpr(hasAnyArgument(declRefExpr()))
6228 matches x(1, y, 42)
6229 with hasAnyArgument(...)
6230 matching y
6232 For ObjectiveC, given
6233 @interface I - (void) f:(int) y; @end
6234 void foo(I *i) { [i f:12]; }
6235 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
6236 matches [i f:12]
6237 </pre></td></tr>
6240 <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>
6241 <tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
6242 call expression.
6244 Example matches y in x(y)
6245 (matcher = callExpr(hasArgument(0, declRefExpr())))
6246 void x(int) { int y; x(y); }
6247 </pre></td></tr>
6250 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6251 <tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
6252 matches the given matcher.
6254 The associated declaration is:
6255 - for type nodes, the declaration of the underlying type
6256 - for CallExpr, the declaration of the callee
6257 - for MemberExpr, the declaration of the referenced member
6258 - for CXXConstructExpr, the declaration of the constructor
6259 - for CXXNewExpr, the declaration of the operator new
6260 - for ObjCIvarExpr, the declaration of the ivar
6262 For type nodes, hasDeclaration will generally match the declaration of the
6263 sugared type. Given
6264 class X {};
6265 typedef X Y;
6266 Y y;
6267 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6268 typedefDecl. A common use case is to match the underlying, desugared type.
6269 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6270 varDecl(hasType(hasUnqualifiedDesugaredType(
6271 recordType(hasDeclaration(decl())))))
6272 In this matcher, the decl will match the CXXRecordDecl of class X.
6274 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;,
6275 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;,
6276 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;,
6277 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;,
6278 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;,
6279 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;,
6280 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6281 </pre></td></tr>
6284 <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>
6285 <tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
6287 Given
6288 class A { A() : i(42), j(42) {} int i; int j; };
6289 cxxConstructorDecl(forEachConstructorInitializer(
6290 forField(decl().bind("x"))
6292 will trigger two matches, binding for 'i' and 'j' respectively.
6293 </pre></td></tr>
6296 <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>
6297 <tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
6299 Given
6300 struct Foo {
6301 Foo() : foo_(1) { }
6302 int foo_;
6304 cxxRecordDecl(has(cxxConstructorDecl(
6305 hasAnyConstructorInitializer(anything())
6307 record matches Foo, hasAnyConstructorInitializer matches foo_(1)
6308 </pre></td></tr>
6311 <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>
6312 <tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
6314 Given
6315 struct Foo {
6316 Foo() : foo_(1) { }
6317 int foo_;
6319 cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
6320 forField(hasName("foo_"))))))
6321 matches Foo
6322 with forField matching foo_
6323 </pre></td></tr>
6326 <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>
6327 <tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
6329 Given
6330 struct Foo {
6331 Foo() : foo_(1) { }
6332 int foo_;
6334 cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
6335 withInitializer(integerLiteral(equals(1)))))))
6336 matches Foo
6337 with withInitializer matching (1)
6338 </pre></td></tr>
6341 <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>
6342 <tr><td colspan="4" class="doc" id="hasObjectExpression2"><pre>Matches a member expression where the object expression is matched by a
6343 given matcher. Implicit object expressions are included; that is, it matches
6344 use of implicit `this`.
6346 Given
6347 struct X {
6348 int m;
6349 int f(X x) { x.m; return m; }
6351 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
6352 matches `x.m`, but not `m`; however,
6353 memberExpr(hasObjectExpression(hasType(pointsTo(
6354 cxxRecordDecl(hasName("X"))))))
6355 matches `m` (aka. `this-&gt;m`), but not `x.m`.
6356 </pre></td></tr>
6359 <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>
6360 <tr><td colspan="4" class="doc" id="hasBody3"><pre></pre></td></tr>
6363 <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>
6364 <tr><td colspan="4" class="doc" id="hasInitStatement2"><pre>Matches selection statements with initializer.
6366 Given:
6367 void foo() {
6368 if (int i = foobar(); i &gt; 0) {}
6369 switch (int i = foobar(); i) {}
6370 for (auto&amp; a = get_range(); auto&amp; x : a) {}
6372 void bar() {
6373 if (foobar() &gt; 0) {}
6374 switch (foobar()) {}
6375 for (auto&amp; x : get_range()) {}
6377 ifStmt(hasInitStatement(anything()))
6378 matches the if statement in foo but not in bar.
6379 switchStmt(hasInitStatement(anything()))
6380 matches the switch statement in foo but not in bar.
6381 cxxForRangeStmt(hasInitStatement(anything()))
6382 matches the range for statement in foo but not in bar.
6383 </pre></td></tr>
6386 <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>
6387 <tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
6389 Example:
6390 forStmt(hasLoopVariable(anything()))
6391 matches 'int x' in
6392 for (int x : a) { }
6393 </pre></td></tr>
6396 <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>
6397 <tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
6399 Example:
6400 forStmt(hasRangeInit(anything()))
6401 matches 'a' in
6402 for (int x : a) { }
6403 </pre></td></tr>
6406 <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>
6407 <tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre>Matches on the implicit object argument of a member call expression. Unlike
6408 `on`, matches the argument directly without stripping away anything.
6410 Given
6411 class Y { public: void m(); };
6412 Y g();
6413 class X : public Y { void g(); };
6414 void z(Y y, X x) { y.m(); x.m(); x.g(); (g()).m(); }
6415 cxxMemberCallExpr(onImplicitObjectArgument(hasType(
6416 cxxRecordDecl(hasName("Y")))))
6417 matches `y.m()`, `x.m()` and (g()).m(), but not `x.g()`.
6418 cxxMemberCallExpr(on(callExpr()))
6419 does not match `(g()).m()`, because the parens are not ignored.
6421 FIXME: Overload to allow directly matching types?
6422 </pre></td></tr>
6425 <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>
6426 <tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression, after
6427 stripping off any parentheses or implicit casts.
6429 Given
6430 class Y { public: void m(); };
6431 Y g();
6432 class X : public Y {};
6433 void z(Y y, X x) { y.m(); (g()).m(); x.m(); }
6434 cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y")))))
6435 matches `y.m()` and `(g()).m()`.
6436 cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("X")))))
6437 matches `x.m()`.
6438 cxxMemberCallExpr(on(callExpr()))
6439 matches `(g()).m()`.
6441 FIXME: Overload to allow directly matching types?
6442 </pre></td></tr>
6445 <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>
6446 <tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
6447 </pre></td></tr>
6450 <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>
6451 <tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the type of the expression's implicit object argument either
6452 matches the InnerMatcher, or is a pointer to a type that matches the
6453 InnerMatcher.
6455 Given
6456 class Y { public: void m(); };
6457 class X : public Y { void g(); };
6458 void z() { Y y; y.m(); Y *p; p-&gt;m(); X x; x.m(); x.g(); }
6459 cxxMemberCallExpr(thisPointerType(hasDeclaration(
6460 cxxRecordDecl(hasName("Y")))))
6461 matches `y.m()`, `p-&gt;m()` and `x.m()`.
6462 cxxMemberCallExpr(thisPointerType(hasDeclaration(
6463 cxxRecordDecl(hasName("X")))))
6464 matches `x.g()`.
6465 </pre></td></tr>
6468 <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>
6469 <tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overridden by the given method. This matcher may
6470 produce multiple matches.
6472 Given
6473 class A { virtual void f(); };
6474 class B : public A { void f(); };
6475 class C : public B { void f(); };
6476 cxxMethodDecl(ofClass(hasName("C")),
6477 forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
6478 matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
6479 that B::f is not overridden by C::f).
6481 The check can produce multiple matches in case of multiple inheritance, e.g.
6482 class A1 { virtual void f(); };
6483 class A2 { virtual void f(); };
6484 class C : public A1, public A2 { void f(); };
6485 cxxMethodDecl(ofClass(hasName("C")),
6486 forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
6487 matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
6488 once with "b" binding "A2::f" and "d" binding "C::f".
6489 </pre></td></tr>
6492 <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>
6493 <tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
6494 belongs to.
6496 FIXME: Generalize this for other kinds of declarations.
6497 FIXME: What other kind of declarations would we need to generalize
6498 this to?
6500 Example matches A() in the last line
6501 (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
6502 ofClass(hasName("A"))))))
6503 class A {
6504 public:
6505 A();
6507 A a = A();
6508 </pre></td></tr>
6511 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyPlacementArg0')"><a name="hasAnyPlacementArg0Anchor">hasAnyPlacementArg</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6512 <tr><td colspan="4" class="doc" id="hasAnyPlacementArg0"><pre>Matches any placement new expression arguments.
6514 Given:
6515 MyClass *p1 = new (Storage) MyClass();
6516 cxxNewExpr(hasAnyPlacementArg(anything()))
6517 matches the expression 'new (Storage, 16) MyClass()'.
6518 </pre></td></tr>
6521 <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>
6522 <tr><td colspan="4" class="doc" id="hasArraySize0"><pre>Matches array new expressions with a given array size.
6524 Given:
6525 MyClass *p1 = new MyClass[10];
6526 cxxNewExpr(hasArraySize(integerLiteral(equals(10))))
6527 matches the expression 'new MyClass[10]'.
6528 </pre></td></tr>
6531 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6532 <tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
6533 matches the given matcher.
6535 The associated declaration is:
6536 - for type nodes, the declaration of the underlying type
6537 - for CallExpr, the declaration of the callee
6538 - for MemberExpr, the declaration of the referenced member
6539 - for CXXConstructExpr, the declaration of the constructor
6540 - for CXXNewExpr, the declaration of the operator new
6541 - for ObjCIvarExpr, the declaration of the ivar
6543 For type nodes, hasDeclaration will generally match the declaration of the
6544 sugared type. Given
6545 class X {};
6546 typedef X Y;
6547 Y y;
6548 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6549 typedefDecl. A common use case is to match the underlying, desugared type.
6550 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6551 varDecl(hasType(hasUnqualifiedDesugaredType(
6552 recordType(hasDeclaration(decl())))))
6553 In this matcher, the decl will match the CXXRecordDecl of class X.
6555 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;,
6556 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;,
6557 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;,
6558 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;,
6559 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;,
6560 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;,
6561 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6562 </pre></td></tr>
6565 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('hasPlacementArg0')"><a name="hasPlacementArg0Anchor">hasPlacementArg</a></td><td>unsigned Index, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6566 <tr><td colspan="4" class="doc" id="hasPlacementArg0"><pre>Matches placement new expression arguments.
6568 Given:
6569 MyClass *p1 = new (Storage, 16) MyClass();
6570 cxxNewExpr(hasPlacementArg(1, integerLiteral(equals(16))))
6571 matches the expression 'new (Storage, 16) MyClass()'.
6572 </pre></td></tr>
6575 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('hasEitherOperand1')"><a name="hasEitherOperand1Anchor">hasEitherOperand</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6576 <tr><td colspan="4" class="doc" id="hasEitherOperand1"><pre>Matches if either the left hand side or the right hand side of a
6577 binary operator matches.
6578 </pre></td></tr>
6581 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</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>
6582 <tr><td colspan="4" class="doc" id="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
6584 Example matches a (matcher = binaryOperator(hasLHS()))
6585 a || b
6586 </pre></td></tr>
6589 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('hasOperands1')"><a name="hasOperands1Anchor">hasOperands</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; Matcher1, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; Matcher2</td></tr>
6590 <tr><td colspan="4" class="doc" id="hasOperands1"><pre>Matches if both matchers match with opposite sides of the binary operator.
6592 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
6593 integerLiteral(equals(2)))
6594 1 + 2 // Match
6595 2 + 1 // Match
6596 1 + 1 // No match
6597 2 + 2 // No match
6598 </pre></td></tr>
6601 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</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>
6602 <tr><td colspan="4" class="doc" id="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
6604 Example matches b (matcher = binaryOperator(hasRHS()))
6605 a || b
6606 </pre></td></tr>
6609 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;</td><td class="name" onclick="toggle('hasUnaryOperand1')"><a name="hasUnaryOperand1Anchor">hasUnaryOperand</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6610 <tr><td colspan="4" class="doc" id="hasUnaryOperand1"><pre>Matches if the operand of a unary operator matches.
6612 Example matches true (matcher = hasUnaryOperand(
6613 cxxBoolLiteral(equals(true))))
6614 !true
6615 </pre></td></tr>
6618 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyBase0')"><a name="hasAnyBase0Anchor">hasAnyBase</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt; BaseSpecMatcher</td></tr>
6619 <tr><td colspan="4" class="doc" id="hasAnyBase0"><pre>Matches C++ classes that have a direct or indirect base matching BaseSpecMatcher.
6621 Example:
6622 matcher hasAnyBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
6623 class Foo;
6624 class Bar : Foo {};
6625 class Baz : Bar {};
6626 class SpecialBase;
6627 class Proxy : SpecialBase {}; // matches Proxy
6628 class IndirectlyDerived : Proxy {}; //matches IndirectlyDerived
6630 FIXME: Refactor this and isDerivedFrom to reuse implementation.
6631 </pre></td></tr>
6634 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('hasDirectBase0')"><a name="hasDirectBase0Anchor">hasDirectBase</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt; BaseSpecMatcher</td></tr>
6635 <tr><td colspan="4" class="doc" id="hasDirectBase0"><pre>Matches C++ classes that have a direct base matching BaseSpecMatcher.
6637 Example:
6638 matcher hasDirectBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
6639 class Foo;
6640 class Bar : Foo {};
6641 class Baz : Bar {};
6642 class SpecialBase;
6643 class Proxy : SpecialBase {}; // matches Proxy
6644 class IndirectlyDerived : Proxy {}; // doesn't match
6645 </pre></td></tr>
6648 <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>
6649 <tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
6651 Given:
6652 class A { void func(); };
6653 class B { void member(); };
6655 cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
6656 A but not B.
6657 </pre></td></tr>
6660 <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>
6661 <tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from a class
6662 matching Base, or Objective-C classes that directly or indirectly
6663 subclass a class matching Base.
6665 Note that a class is not considered to be derived from itself.
6667 Example matches Y, Z, C (Base == hasName("X"))
6668 class X;
6669 class Y : public X {}; // directly derived
6670 class Z : public Y {}; // indirectly derived
6671 typedef X A;
6672 typedef A B;
6673 class C : public B {}; // derived from a typedef of X
6675 In the following example, Bar matches isDerivedFrom(hasName("X")):
6676 class Foo;
6677 typedef Foo X;
6678 class Bar : public Foo {}; // derived from a type that X is a typedef of
6680 In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
6681 @interface NSObject @end
6682 @interface Bar : NSObject @end
6684 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;
6685 </pre></td></tr>
6688 <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>
6689 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom0"><pre>Matches C++ or Objective-C classes that are directly derived from a class
6690 matching Base.
6692 Note that a class is not considered to be derived from itself.
6694 Example matches Y, C (Base == hasName("X"))
6695 class X;
6696 class Y : public X {}; // directly derived
6697 class Z : public Y {}; // indirectly derived
6698 typedef X A;
6699 typedef A B;
6700 class C : public B {}; // derived from a typedef of X
6702 In the following example, Bar matches isDerivedFrom(hasName("X")):
6703 class Foo;
6704 typedef Foo X;
6705 class Bar : public Foo {}; // derived from a type that X is a typedef of
6706 </pre></td></tr>
6709 <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>
6710 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
6711 match Base.
6712 </pre></td></tr>
6715 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasEitherOperand2')"><a name="hasEitherOperand2Anchor">hasEitherOperand</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6716 <tr><td colspan="4" class="doc" id="hasEitherOperand2"><pre>Matches if either the left hand side or the right hand side of a
6717 binary operator matches.
6718 </pre></td></tr>
6721 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasLHS2')"><a name="hasLHS2Anchor">hasLHS</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6722 <tr><td colspan="4" class="doc" id="hasLHS2"><pre>Matches the left hand side of binary operator expressions.
6724 Example matches a (matcher = binaryOperator(hasLHS()))
6725 a || b
6726 </pre></td></tr>
6729 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperands2')"><a name="hasOperands2Anchor">hasOperands</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; Matcher1, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; Matcher2</td></tr>
6730 <tr><td colspan="4" class="doc" id="hasOperands2"><pre>Matches if both matchers match with opposite sides of the binary operator.
6732 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
6733 integerLiteral(equals(2)))
6734 1 + 2 // Match
6735 2 + 1 // Match
6736 1 + 1 // No match
6737 2 + 2 // No match
6738 </pre></td></tr>
6741 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasRHS2')"><a name="hasRHS2Anchor">hasRHS</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
6742 <tr><td colspan="4" class="doc" id="hasRHS2"><pre>Matches the right hand side of binary operator expressions.
6744 Example matches b (matcher = binaryOperator(hasRHS()))
6745 a || b
6746 </pre></td></tr>
6749 <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>
6750 <tr><td colspan="4" class="doc" id="hasAnyArgument2"><pre>Matches any argument of a call expression or a constructor call
6751 expression, or an ObjC-message-send expression.
6753 Given
6754 void x(int, int, int) { int y; x(1, y, 42); }
6755 callExpr(hasAnyArgument(declRefExpr()))
6756 matches x(1, y, 42)
6757 with hasAnyArgument(...)
6758 matching y
6760 For ObjectiveC, given
6761 @interface I - (void) f:(int) y; @end
6762 void foo(I *i) { [i f:12]; }
6763 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
6764 matches [i f:12]
6765 </pre></td></tr>
6768 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</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>
6769 <tr><td colspan="4" class="doc" id="hasArgument2"><pre>Matches the n'th argument of a call expression or a constructor
6770 call expression.
6772 Example matches y in x(y)
6773 (matcher = callExpr(hasArgument(0, declRefExpr())))
6774 void x(int) { int y; x(y); }
6775 </pre></td></tr>
6778 <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>
6779 <tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
6780 given matcher.
6782 Example matches y.x() (matcher = callExpr(callee(
6783 cxxMethodDecl(hasName("x")))))
6784 class Y { public: void x(); };
6785 void z() { Y y; y.x(); }
6786 </pre></td></tr>
6789 <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>
6790 <tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches.
6792 Given
6793 class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
6794 void f() { f(); }
6795 callExpr(callee(expr()))
6796 matches this-&gt;x(), x(), y.x(), f()
6797 with callee(...)
6798 matching this-&gt;x, x, y.x, f respectively
6800 Note: Callee cannot take the more general internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
6801 because this introduces ambiguous overloads with calls to Callee taking a
6802 internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
6803 implemented in terms of implicit casts.
6804 </pre></td></tr>
6807 <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>
6808 <tr><td colspan="4" class="doc" id="forEachArgumentWithParam0"><pre>Matches all arguments and their respective ParmVarDecl.
6810 Given
6811 void f(int i);
6812 int y;
6813 f(y);
6814 callExpr(
6815 forEachArgumentWithParam(
6816 declRefExpr(to(varDecl(hasName("y")))),
6817 parmVarDecl(hasType(isInteger()))
6819 matches f(y);
6820 with declRefExpr(...)
6821 matching int y
6822 and parmVarDecl(...)
6823 matching int i
6824 </pre></td></tr>
6827 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('forEachArgumentWithParamType0')"><a name="forEachArgumentWithParamType0Anchor">forEachArgumentWithParamType</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_1QualType.html">QualType</a>&gt; ParamMatcher</td></tr>
6828 <tr><td colspan="4" class="doc" id="forEachArgumentWithParamType0"><pre>Matches all arguments and their respective types for a CallExpr or
6829 CXXConstructExpr. It is very similar to forEachArgumentWithParam but
6830 it works on calls through function pointers as well.
6832 The difference is, that function pointers do not provide access to a
6833 ParmVarDecl, but only the QualType for each argument.
6835 Given
6836 void f(int i);
6837 int y;
6838 f(y);
6839 void (*f_ptr)(int) = f;
6840 f_ptr(y);
6841 callExpr(
6842 forEachArgumentWithParamType(
6843 declRefExpr(to(varDecl(hasName("y")))),
6844 qualType(isInteger()).bind("type)
6846 matches f(y) and f_ptr(y)
6847 with declRefExpr(...)
6848 matching int y
6849 and qualType(...)
6850 matching int
6851 </pre></td></tr>
6854 <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>
6855 <tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
6856 expression, or an ObjC-message-send expression.
6858 Given
6859 void x(int, int, int) { int y; x(1, y, 42); }
6860 callExpr(hasAnyArgument(declRefExpr()))
6861 matches x(1, y, 42)
6862 with hasAnyArgument(...)
6863 matching y
6865 For ObjectiveC, given
6866 @interface I - (void) f:(int) y; @end
6867 void foo(I *i) { [i f:12]; }
6868 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
6869 matches [i f:12]
6870 </pre></td></tr>
6873 <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>
6874 <tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
6875 call expression.
6877 Example matches y in x(y)
6878 (matcher = callExpr(hasArgument(0, declRefExpr())))
6879 void x(int) { int y; x(y); }
6880 </pre></td></tr>
6883 <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>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="hasDeclaration14"><pre>Matches a node if the declaration associated with that node
6885 matches the given matcher.
6887 The associated declaration is:
6888 - for type nodes, the declaration of the underlying type
6889 - for CallExpr, the declaration of the callee
6890 - for MemberExpr, the declaration of the referenced member
6891 - for CXXConstructExpr, the declaration of the constructor
6892 - for CXXNewExpr, the declaration of the operator new
6893 - for ObjCIvarExpr, the declaration of the ivar
6895 For type nodes, hasDeclaration will generally match the declaration of the
6896 sugared type. Given
6897 class X {};
6898 typedef X Y;
6899 Y y;
6900 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6901 typedefDecl. A common use case is to match the underlying, desugared type.
6902 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6903 varDecl(hasType(hasUnqualifiedDesugaredType(
6904 recordType(hasDeclaration(decl())))))
6905 In this matcher, the decl will match the CXXRecordDecl of class X.
6907 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;,
6908 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;,
6909 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;,
6910 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;,
6911 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;,
6912 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;,
6913 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6914 </pre></td></tr>
6917 <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>
6918 <tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
6919 extension, matches the constant given in the statement.
6921 Given
6922 switch (1) { case 1: case 1+1: case 3 ... 4: ; }
6923 caseStmt(hasCaseConstant(integerLiteral()))
6924 matches "case 1:"
6925 </pre></td></tr>
6928 <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>
6929 <tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression
6930 or opaque value's source expression matches the given matcher.
6932 Example 1: matches "a string"
6933 (matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
6934 class URL { URL(string); };
6935 URL url = "a string";
6937 Example 2: matches 'b' (matcher =
6938 opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
6939 int a = b ?: 1;
6940 </pre></td></tr>
6943 <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>
6944 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6945 functionDecl that have at least one TemplateArgument matching the given
6946 InnerMatcher.
6948 Given
6949 template&lt;typename T&gt; class A {};
6950 template&lt;&gt; class A&lt;double&gt; {};
6951 A&lt;int&gt; a;
6953 template&lt;typename T&gt; f() {};
6954 void func() { f&lt;int&gt;(); };
6956 classTemplateSpecializationDecl(hasAnyTemplateArgument(
6957 refersToType(asString("int"))))
6958 matches the specialization A&lt;int&gt;
6960 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
6961 matches the specialization f&lt;int&gt;
6962 </pre></td></tr>
6965 <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>
6966 <tr><td colspan="4" class="doc" id="hasSpecializedTemplate0"><pre>Matches the specialized template of a specialization declaration.
6968 Given
6969 template&lt;typename T&gt; class A {}; #1
6970 template&lt;&gt; class A&lt;int&gt; {}; #2
6971 classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl()))
6972 matches '#2' with classTemplateDecl() matching the class template
6973 declaration of 'A' at #1.
6974 </pre></td></tr>
6977 <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>
6978 <tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
6979 functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
6981 Given
6982 template&lt;typename T, typename U&gt; class A {};
6983 A&lt;bool, int&gt; b;
6984 A&lt;int, bool&gt; c;
6986 template&lt;typename T&gt; void f() {}
6987 void func() { f&lt;int&gt;(); };
6988 classTemplateSpecializationDecl(hasTemplateArgument(
6989 1, refersToType(asString("int"))))
6990 matches the specialization A&lt;bool, int&gt;
6992 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
6993 matches the specialization f&lt;int&gt;
6994 </pre></td></tr>
6997 <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>
6998 <tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
6999 type.
7001 Given
7002 struct A {};
7003 A a[7];
7004 int b[7];
7005 arrayType(hasElementType(builtinType()))
7006 matches "int b[7]"
7008 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;
7009 </pre></td></tr>
7012 <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>
7013 <tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
7014 a given matcher. Also matches StmtExprs that have CompoundStmt as children.
7016 Given
7017 { {}; 1+2; }
7018 hasAnySubstatement(compoundStmt())
7019 matches '{ {}; 1+2; }'
7020 with compoundStmt()
7021 matching '{}'
7022 </pre></td></tr>
7025 <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>
7026 <tr><td colspan="4" class="doc" id="hasDecayedType0"><pre>Matches the decayed type, whoes decayed type matches InnerMatcher
7027 </pre></td></tr>
7030 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
7031 <tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
7032 matches the given matcher.
7034 The associated declaration is:
7035 - for type nodes, the declaration of the underlying type
7036 - for CallExpr, the declaration of the callee
7037 - for MemberExpr, the declaration of the referenced member
7038 - for CXXConstructExpr, the declaration of the constructor
7039 - for CXXNewExpr, the declaration of the operator new
7040 - for ObjCIvarExpr, the declaration of the ivar
7042 For type nodes, hasDeclaration will generally match the declaration of the
7043 sugared type. Given
7044 class X {};
7045 typedef X Y;
7046 Y y;
7047 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7048 typedefDecl. A common use case is to match the underlying, desugared type.
7049 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7050 varDecl(hasType(hasUnqualifiedDesugaredType(
7051 recordType(hasDeclaration(decl())))))
7052 In this matcher, the decl will match the CXXRecordDecl of class X.
7054 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;,
7055 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;,
7056 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;,
7057 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;,
7058 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;,
7059 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;,
7060 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7061 </pre></td></tr>
7064 <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>
7065 <tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a
7066 specific using shadow declaration.
7068 Given
7069 namespace a { void f() {} }
7070 using a::f;
7071 void g() {
7072 f(); // Matches this ..
7073 a::f(); // .. but not this.
7075 declRefExpr(throughUsingDecl(anything()))
7076 matches f()
7077 </pre></td></tr>
7080 <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>
7081 <tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
7082 specified matcher.
7084 Example matches x in if(x)
7085 (matcher = declRefExpr(to(varDecl(hasName("x")))))
7086 bool x;
7087 if (x) {}
7088 </pre></td></tr>
7091 <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>
7092 <tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
7094 Note that this does not work for global declarations because the AST
7095 breaks up multiple-declaration DeclStmt's into multiple single-declaration
7096 DeclStmt's.
7097 Example: Given non-global declarations
7098 int a, b = 0;
7099 int c;
7100 int d = 2, e;
7101 declStmt(containsDeclaration(
7102 0, varDecl(hasInitializer(anything()))))
7103 matches only 'int d = 2, e;', and
7104 declStmt(containsDeclaration(1, varDecl()))
7105 matches 'int a, b = 0' as well as 'int d = 2, e;'
7106 but 'int c;' is not matched.
7107 </pre></td></tr>
7110 <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>
7111 <tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
7113 Given
7114 int a, b;
7115 int c;
7116 declStmt(hasSingleDecl(anything()))
7117 matches 'int c;' but not 'int a, b;'.
7118 </pre></td></tr>
7121 <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>
7122 <tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches
7123 the inner matcher.
7125 Given
7126 int x;
7127 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7128 matches int x
7129 </pre></td></tr>
7132 <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>
7133 <tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
7134 Decl, matches InnerMatcher.
7136 Given
7137 namespace N {
7138 namespace M {
7139 class D {};
7143 cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
7144 declaration of class D.
7145 </pre></td></tr>
7148 <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>
7149 <tr><td colspan="4" class="doc" id="hasUnderlyingType0"><pre>Matches DecltypeType nodes to find out the underlying type.
7151 Given
7152 decltype(1) a = 1;
7153 decltype(2.0) b = 2.0;
7154 decltypeType(hasUnderlyingType(isInteger()))
7155 matches the type of "a"
7157 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;
7158 </pre></td></tr>
7161 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecompositionDecl.html">DecompositionDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyBinding0')"><a name="hasAnyBinding0Anchor">hasAnyBinding</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BindingDecl.html">BindingDecl</a>&gt; InnerMatcher</td></tr>
7162 <tr><td colspan="4" class="doc" id="hasAnyBinding0"><pre>Matches any binding of a DecompositionDecl.
7164 For example, in:
7165 void foo()
7167 int arr[3];
7168 auto &amp;[f, s, t] = arr;
7170 f = 42;
7172 The matcher:
7173 decompositionDecl(hasAnyBinding(bindingDecl(hasName("f").bind("fBinding"))))
7174 matches the decomposition decl with 'f' bound to "fBinding".
7175 </pre></td></tr>
7178 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecompositionDecl.html">DecompositionDecl</a>&gt;</td><td class="name" onclick="toggle('hasBinding0')"><a name="hasBinding0Anchor">hasBinding</a></td><td>unsigned N, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BindingDecl.html">BindingDecl</a>&gt; InnerMatcher</td></tr>
7179 <tr><td colspan="4" class="doc" id="hasBinding0"><pre>Matches the Nth binding of a DecompositionDecl.
7181 For example, in:
7182 void foo()
7184 int arr[3];
7185 auto &amp;[f, s, t] = arr;
7187 f = 42;
7189 The matcher:
7190 decompositionDecl(hasBinding(0,
7191 bindingDecl(hasName("f").bind("fBinding"))))
7192 matches the decomposition decl with 'f' bound to "fBinding".
7193 </pre></td></tr>
7196 <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>
7197 <tr><td colspan="4" class="doc" id="hasBody0"><pre></pre></td></tr>
7200 <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>
7201 <tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
7202 switch statement or conditional operator.
7204 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
7205 if (true) {}
7206 </pre></td></tr>
7209 <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>
7210 <tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
7211 matches InnerMatcher if the qualifier exists.
7213 Given
7214 namespace N {
7215 namespace M {
7216 class D {};
7219 N::M::D d;
7221 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
7222 matches the type of the variable declaration of d.
7223 </pre></td></tr>
7226 <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>
7227 <tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
7229 Given
7230 namespace N {
7231 namespace M {
7232 class D {};
7235 N::M::D d;
7237 elaboratedType(namesType(recordType(
7238 hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
7239 declaration of d.
7240 </pre></td></tr>
7243 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
7244 <tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
7245 matches the given matcher.
7247 The associated declaration is:
7248 - for type nodes, the declaration of the underlying type
7249 - for CallExpr, the declaration of the callee
7250 - for MemberExpr, the declaration of the referenced member
7251 - for CXXConstructExpr, the declaration of the constructor
7252 - for CXXNewExpr, the declaration of the operator new
7253 - for ObjCIvarExpr, the declaration of the ivar
7255 For type nodes, hasDeclaration will generally match the declaration of the
7256 sugared type. Given
7257 class X {};
7258 typedef X Y;
7259 Y y;
7260 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7261 typedefDecl. A common use case is to match the underlying, desugared type.
7262 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7263 varDecl(hasType(hasUnqualifiedDesugaredType(
7264 recordType(hasDeclaration(decl())))))
7265 In this matcher, the decl will match the CXXRecordDecl of class X.
7267 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;,
7268 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;,
7269 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;,
7270 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;,
7271 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;,
7272 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;,
7273 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7274 </pre></td></tr>
7277 <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>
7278 <tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
7280 (Note: Clang's AST refers to other conversions as "casts" too, and calls
7281 actual casts "explicit" casts.)
7282 </pre></td></tr>
7285 <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>
7286 <tr><td colspan="4" class="doc" id="hasType4"><pre>Overloaded to match the declaration of the expression's or value
7287 declaration's type.
7289 In case of a value declaration (for example a variable declaration),
7290 this resolves one layer of indirection. For example, in the value
7291 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
7292 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
7293 declaration of x.
7295 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
7296 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
7297 and friend class X (matcher = friendDecl(hasType("X"))
7298 class X {};
7299 void y(X &amp;x) { x; X z; }
7300 class Y { friend class X; };
7302 Example matches class Derived
7303 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
7304 class Base {};
7305 class Derived : Base {};
7307 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_1FriendDecl.html">FriendDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;,
7308 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
7309 </pre></td></tr>
7312 <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>
7313 <tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
7314 matcher.
7316 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
7317 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
7318 and U (matcher = typedefDecl(hasType(asString("int")))
7319 and friend class X (matcher = friendDecl(hasType("X"))
7320 class X {};
7321 void y(X &amp;x) { x; X z; }
7322 typedef int U;
7323 class Y { friend class X; };
7324 </pre></td></tr>
7327 <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>
7328 <tr><td colspan="4" class="doc" id="ignoringElidableConstructorCall0"><pre>Matches expressions that match InnerMatcher that are possibly wrapped in an
7329 elidable constructor and other corresponding bookkeeping nodes.
7331 In C++17, elidable copy constructors are no longer being generated in the
7332 AST as it is not permitted by the standard. They are, however, part of the
7333 AST in C++14 and earlier. So, a matcher must abstract over these differences
7334 to work in all language modes. This matcher skips elidable constructor-call
7335 AST nodes, `ExprWithCleanups` nodes wrapping elidable constructor-calls and
7336 various implicit nodes inside the constructor calls, all of which will not
7337 appear in the C++17 AST.
7339 Given
7341 struct H {};
7342 H G();
7343 void f() {
7344 H D = G();
7347 ``varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())))``
7348 matches ``H D = G()`` in C++11 through C++17 (and beyond).
7349 </pre></td></tr>
7352 <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>
7353 <tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
7354 are stripped off.
7356 Parentheses and explicit casts are not discarded.
7357 Given
7358 int arr[5];
7359 int a = 0;
7360 char b = 0;
7361 const int c = a;
7362 int *d = arr;
7363 long e = (long) 0l;
7364 The matchers
7365 varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
7366 varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
7367 would match the declarations for a, b, c, and d, but not e.
7368 While
7369 varDecl(hasInitializer(integerLiteral()))
7370 varDecl(hasInitializer(declRefExpr()))
7371 only match the declarations for b, c, and d.
7372 </pre></td></tr>
7375 <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>
7376 <tr><td colspan="4" class="doc" id="ignoringImplicit0"><pre>Matches expressions that match InnerMatcher after any implicit AST
7377 nodes are stripped off.
7379 Parentheses and explicit casts are not discarded.
7380 Given
7381 class C {};
7382 C a = C();
7383 C b;
7384 C c = b;
7385 The matchers
7386 varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr())))
7387 would match the declarations for a, b, and c.
7388 While
7389 varDecl(hasInitializer(cxxConstructExpr()))
7390 only match the declarations for b and c.
7391 </pre></td></tr>
7394 <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>
7395 <tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
7396 casts are stripped off.
7398 Implicit and non-C Style casts are also discarded.
7399 Given
7400 int a = 0;
7401 char b = (0);
7402 void* c = reinterpret_cast&lt;char*&gt;(0);
7403 char d = char(0);
7404 The matcher
7405 varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
7406 would match the declarations for a, b, c, and d.
7407 while
7408 varDecl(hasInitializer(integerLiteral()))
7409 only match the declaration for a.
7410 </pre></td></tr>
7413 <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>
7414 <tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
7415 parentheses are stripped off.
7417 Explicit casts are not discarded.
7418 Given
7419 int arr[5];
7420 int a = 0;
7421 char b = (0);
7422 const int c = a;
7423 int *d = (arr);
7424 long e = ((long) 0l);
7425 The matchers
7426 varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
7427 varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
7428 would match the declarations for a, b, c, and d, but not e.
7429 while
7430 varDecl(hasInitializer(integerLiteral()))
7431 varDecl(hasInitializer(declRefExpr()))
7432 would only match the declaration for a.
7433 </pre></td></tr>
7436 <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>
7437 <tr><td colspan="4" class="doc" id="ignoringParens1"><pre>Overload ignoringParens for Expr.
7439 Given
7440 const char* str = ("my-string");
7441 The matcher
7442 implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral())))
7443 would match the implicit cast resulting from the assignment.
7444 </pre></td></tr>
7447 <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>
7448 <tr><td colspan="4" class="doc" id="hasInClassInitializer0"><pre>Matches non-static data members that have an in-class initializer.
7450 Given
7451 class C {
7452 int a = 2;
7453 int b = 3;
7454 int c;
7456 fieldDecl(hasInClassInitializer(integerLiteral(equals(2))))
7457 matches 'int a;' but not 'int b;'.
7458 fieldDecl(hasInClassInitializer(anything()))
7459 matches 'int a;' and 'int b;' but not 'int c;'.
7460 </pre></td></tr>
7463 <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>
7464 <tr><td colspan="4" class="doc" id="hasBody1"><pre></pre></td></tr>
7467 <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>
7468 <tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
7469 switch statement or conditional operator.
7471 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
7472 if (true) {}
7473 </pre></td></tr>
7476 <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>
7477 <tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
7479 Example:
7480 forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
7481 matches '++x' in
7482 for (x; x &lt; N; ++x) { }
7483 </pre></td></tr>
7486 <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>
7487 <tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
7489 Example:
7490 forStmt(hasLoopInit(declStmt()))
7491 matches 'int x = 0' in
7492 for (int x = 0; x &lt; N; ++x) { }
7493 </pre></td></tr>
7496 <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>
7497 <tr><td colspan="4" class="doc" id="hasType5"><pre>Overloaded to match the declaration of the expression's or value
7498 declaration's type.
7500 In case of a value declaration (for example a variable declaration),
7501 this resolves one layer of indirection. For example, in the value
7502 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
7503 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
7504 declaration of x.
7506 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
7507 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
7508 and friend class X (matcher = friendDecl(hasType("X"))
7509 class X {};
7510 void y(X &amp;x) { x; X z; }
7511 class Y { friend class X; };
7513 Example matches class Derived
7514 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
7515 class Base {};
7516 class Derived : Base {};
7518 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_1FriendDecl.html">FriendDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;,
7519 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
7520 </pre></td></tr>
7523 <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>
7524 <tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
7525 matcher.
7527 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
7528 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
7529 and U (matcher = typedefDecl(hasType(asString("int")))
7530 and friend class X (matcher = friendDecl(hasType("X"))
7531 class X {};
7532 void y(X &amp;x) { x; X z; }
7533 typedef int U;
7534 class Y { friend class X; };
7535 </pre></td></tr>
7538 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyBody0')"><a name="hasAnyBody0Anchor">hasAnyBody</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
7539 <tr><td colspan="4" class="doc" id="hasAnyBody0"><pre>Matches a function declaration that has a given body present in the AST.
7540 Note that this matcher matches all the declarations of a function whose
7541 body is present in the AST.
7543 Given
7544 void f();
7545 void f() {}
7546 void g();
7547 functionDecl(hasAnyBody(compoundStmt()))
7548 matches both 'void f();'
7549 and 'void f() {}'
7550 with compoundStmt()
7551 matching '{}'
7552 but does not match 'void g();'
7553 </pre></td></tr>
7556 <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>
7557 <tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function or an ObjC method declaration or a
7558 block.
7560 Does not match the 'this' parameter of a method.
7562 Given
7563 class X { void f(int x, int y, int z) {} };
7564 cxxMethodDecl(hasAnyParameter(hasName("y")))
7565 matches f(int x, int y, int z) {}
7566 with hasAnyParameter(...)
7567 matching int y
7569 For ObjectiveC, given
7570 @interface I - (void) f:(int) y; @end
7572 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
7573 matches the declaration of method f with hasParameter
7574 matching y.
7576 For blocks, given
7577 b = ^(int y) { printf("%d", y) };
7579 the matcher blockDecl(hasAnyParameter(hasName("y")))
7580 matches the declaration of the block b with hasParameter
7581 matching y.
7582 </pre></td></tr>
7585 <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>
7586 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
7587 functionDecl that have at least one TemplateArgument matching the given
7588 InnerMatcher.
7590 Given
7591 template&lt;typename T&gt; class A {};
7592 template&lt;&gt; class A&lt;double&gt; {};
7593 A&lt;int&gt; a;
7595 template&lt;typename T&gt; f() {};
7596 void func() { f&lt;int&gt;(); };
7598 classTemplateSpecializationDecl(hasAnyTemplateArgument(
7599 refersToType(asString("int"))))
7600 matches the specialization A&lt;int&gt;
7602 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
7603 matches the specialization f&lt;int&gt;
7604 </pre></td></tr>
7607 <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>
7608 <tr><td colspan="4" class="doc" id="hasBody4"><pre></pre></td></tr>
7611 <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>
7612 <tr><td colspan="4" class="doc" id="hasExplicitSpecifier0"><pre>Matches the expression in an explicit specifier if present in the given
7613 declaration.
7615 Given
7616 template&lt;bool b&gt;
7617 struct S {
7618 S(int); // #1
7619 explicit S(double); // #2
7620 operator int(); // #3
7621 explicit operator bool(); // #4
7622 explicit(false) S(bool) // # 7
7623 explicit(true) S(char) // # 8
7624 explicit(b) S(S) // # 9
7626 S(int) -&gt; S&lt;true&gt; // #5
7627 explicit S(double) -&gt; S&lt;false&gt; // #6
7628 cxxConstructorDecl(hasExplicitSpecifier(constantExpr())) will match #7, #8 and #9, but not #1 or #2.
7629 cxxConversionDecl(hasExplicitSpecifier(constantExpr())) will not match #3 or #4.
7630 cxxDeductionGuideDecl(hasExplicitSpecifier(constantExpr())) will not match #5 or #6.
7631 </pre></td></tr>
7634 <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>
7635 <tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function or an ObjC method
7636 declaration or a block.
7638 Given
7639 class X { void f(int x) {} };
7640 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
7641 matches f(int x) {}
7642 with hasParameter(...)
7643 matching int x
7645 For ObjectiveC, given
7646 @interface I - (void) f:(int) y; @end
7648 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
7649 matches the declaration of method f with hasParameter
7650 matching y.
7651 </pre></td></tr>
7654 <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>
7655 <tr><td colspan="4" class="doc" id="hasTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
7656 functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
7658 Given
7659 template&lt;typename T, typename U&gt; class A {};
7660 A&lt;bool, int&gt; b;
7661 A&lt;int, bool&gt; c;
7663 template&lt;typename T&gt; void f() {}
7664 void func() { f&lt;int&gt;(); };
7665 classTemplateSpecializationDecl(hasTemplateArgument(
7666 1, refersToType(asString("int"))))
7667 matches the specialization A&lt;bool, int&gt;
7669 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
7670 matches the specialization f&lt;int&gt;
7671 </pre></td></tr>
7674 <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>
7675 <tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
7677 Given:
7678 class X { int f() { return 1; } };
7679 cxxMethodDecl(returns(asString("int")))
7680 matches int f() { return 1; }
7681 </pre></td></tr>
7684 <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>
7685 <tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
7686 switch statement or conditional operator.
7688 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
7689 if (true) {}
7690 </pre></td></tr>
7693 <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>
7694 <tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
7696 Given
7697 if (A* a = GetAPointer()) {}
7698 hasConditionVariableStatement(...)
7699 matches 'A* a = GetAPointer()'.
7700 </pre></td></tr>
7703 <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>
7704 <tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
7706 Examples matches the if statement
7707 (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
7708 if (false) false; else true;
7709 </pre></td></tr>
7712 <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>
7713 <tr><td colspan="4" class="doc" id="hasInitStatement0"><pre>Matches selection statements with initializer.
7715 Given:
7716 void foo() {
7717 if (int i = foobar(); i &gt; 0) {}
7718 switch (int i = foobar(); i) {}
7719 for (auto&amp; a = get_range(); auto&amp; x : a) {}
7721 void bar() {
7722 if (foobar() &gt; 0) {}
7723 switch (foobar()) {}
7724 for (auto&amp; x : get_range()) {}
7726 ifStmt(hasInitStatement(anything()))
7727 matches the if statement in foo but not in bar.
7728 switchStmt(hasInitStatement(anything()))
7729 matches the switch statement in foo but not in bar.
7730 cxxForRangeStmt(hasInitStatement(anything()))
7731 matches the range for statement in foo but not in bar.
7732 </pre></td></tr>
7735 <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>
7736 <tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
7738 Examples matches the if statement
7739 (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
7740 if (false) true; else false;
7741 </pre></td></tr>
7744 <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>
7745 <tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
7746 matcher.
7748 FIXME: Unit test this matcher
7749 </pre></td></tr>
7752 <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>
7753 <tr><td colspan="4" class="doc" id="hasInit0"><pre>Matches the n'th item of an initializer list expression.
7755 Example matches y.
7756 (matcher = initListExpr(hasInit(0, expr())))
7757 int x{y}.
7758 </pre></td></tr>
7761 <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>
7762 <tr><td colspan="4" class="doc" id="hasSyntacticForm0"><pre>Matches the syntactic form of init list expressions
7763 (if expression have it).
7764 </pre></td></tr>
7767 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
7768 <tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
7769 matches the given matcher.
7771 The associated declaration is:
7772 - for type nodes, the declaration of the underlying type
7773 - for CallExpr, the declaration of the callee
7774 - for MemberExpr, the declaration of the referenced member
7775 - for CXXConstructExpr, the declaration of the constructor
7776 - for CXXNewExpr, the declaration of the operator new
7777 - for ObjCIvarExpr, the declaration of the ivar
7779 For type nodes, hasDeclaration will generally match the declaration of the
7780 sugared type. Given
7781 class X {};
7782 typedef X Y;
7783 Y y;
7784 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7785 typedefDecl. A common use case is to match the underlying, desugared type.
7786 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7787 varDecl(hasType(hasUnqualifiedDesugaredType(
7788 recordType(hasDeclaration(decl())))))
7789 In this matcher, the decl will match the CXXRecordDecl of class X.
7791 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;,
7792 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;,
7793 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;,
7794 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;,
7795 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;,
7796 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;,
7797 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7798 </pre></td></tr>
7801 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
7802 <tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
7803 matches the given matcher.
7805 The associated declaration is:
7806 - for type nodes, the declaration of the underlying type
7807 - for CallExpr, the declaration of the callee
7808 - for MemberExpr, the declaration of the referenced member
7809 - for CXXConstructExpr, the declaration of the constructor
7810 - for CXXNewExpr, the declaration of the operator new
7811 - for ObjCIvarExpr, the declaration of the ivar
7813 For type nodes, hasDeclaration will generally match the declaration of the
7814 sugared type. Given
7815 class X {};
7816 typedef X Y;
7817 Y y;
7818 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7819 typedefDecl. A common use case is to match the underlying, desugared type.
7820 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7821 varDecl(hasType(hasUnqualifiedDesugaredType(
7822 recordType(hasDeclaration(decl())))))
7823 In this matcher, the decl will match the CXXRecordDecl of class X.
7825 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;,
7826 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;,
7827 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;,
7828 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;,
7829 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;,
7830 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;,
7831 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7832 </pre></td></tr>
7835 <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>
7836 <tr><td colspan="4" class="doc" id="hasAnyCapture1"><pre>Matches any capture of 'this' in a lambda expression.
7838 Given
7839 struct foo {
7840 void bar() {
7841 auto f = [this](){};
7844 lambdaExpr(hasAnyCapture(cxxThisExpr()))
7845 matches [this](){};
7846 </pre></td></tr>
7849 <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>
7850 <tr><td colspan="4" class="doc" id="hasAnyCapture0"><pre>Matches any capture of a lambda expression.
7852 Given
7853 void foo() {
7854 int x;
7855 auto f = [x](){};
7857 lambdaExpr(hasAnyCapture(anything()))
7858 matches [x](){};
7859 </pre></td></tr>
7862 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
7863 <tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
7864 matches the given matcher.
7866 The associated declaration is:
7867 - for type nodes, the declaration of the underlying type
7868 - for CallExpr, the declaration of the callee
7869 - for MemberExpr, the declaration of the referenced member
7870 - for CXXConstructExpr, the declaration of the constructor
7871 - for CXXNewExpr, the declaration of the operator new
7872 - for ObjCIvarExpr, the declaration of the ivar
7874 For type nodes, hasDeclaration will generally match the declaration of the
7875 sugared type. Given
7876 class X {};
7877 typedef X Y;
7878 Y y;
7879 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7880 typedefDecl. A common use case is to match the underlying, desugared type.
7881 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7882 varDecl(hasType(hasUnqualifiedDesugaredType(
7883 recordType(hasDeclaration(decl())))))
7884 In this matcher, the decl will match the CXXRecordDecl of class X.
7886 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;,
7887 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;,
7888 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;,
7889 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;,
7890 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;,
7891 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;,
7892 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7893 </pre></td></tr>
7896 <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>
7897 <tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is matched by a
7898 given matcher. Implicit object expressions are included; that is, it matches
7899 use of implicit `this`.
7901 Given
7902 struct X {
7903 int m;
7904 int f(X x) { x.m; return m; }
7906 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
7907 matches `x.m`, but not `m`; however,
7908 memberExpr(hasObjectExpression(hasType(pointsTo(
7909 cxxRecordDecl(hasName("X"))))))
7910 matches `m` (aka. `this-&gt;m`), but not `x.m`.
7911 </pre></td></tr>
7914 <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>
7915 <tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
7916 given matcher.
7918 Given
7919 struct { int first, second; } first, second;
7920 int i(second.first);
7921 int j(first.second);
7922 memberExpr(member(hasName("first")))
7923 matches second.first
7924 but not first.second (because the member name there is "second").
7925 </pre></td></tr>
7928 <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>
7929 <tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
7930 pointee matches a given matcher.
7932 Given
7933 int *a;
7934 int const *b;
7935 float const *f;
7936 pointerType(pointee(isConstQualified(), isInteger()))
7937 matches "int const *b"
7939 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;,
7940 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;
7941 </pre></td></tr>
7944 <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>
7945 <tr><td colspan="4" class="doc" id="hasUnderlyingDecl0"><pre>Matches a NamedDecl whose underlying declaration matches the given
7946 matcher.
7948 Given
7949 namespace N { template&lt;class T&gt; void f(T t); }
7950 template &lt;class T&gt; void g() { using N::f; f(T()); }
7951 unresolvedLookupExpr(hasAnyDeclaration(
7952 namedDecl(hasUnderlyingDecl(hasName("::N::f")))))
7953 matches the use of f in g() .
7954 </pre></td></tr>
7957 <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>
7958 <tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
7960 Given
7961 struct A { struct B { struct C {}; }; };
7962 A::B::C c;
7963 nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
7964 matches "A::"
7965 </pre></td></tr>
7968 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&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>
7969 <tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
7970 NestedNameSpecifier-matcher matches.
7971 </pre></td></tr>
7974 <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>
7975 <tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
7976 given TypeLoc.
7978 Given
7979 struct A { struct B { struct C {}; }; };
7980 A::B::C c;
7981 nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
7982 hasDeclaration(cxxRecordDecl(hasName("A")))))))
7983 matches "A::"
7984 </pre></td></tr>
7987 <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>
7988 <tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
7990 Given
7991 struct A { struct B { struct C {}; }; };
7992 A::B::C c;
7993 nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
7994 matches "A::"
7995 </pre></td></tr>
7998 <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>
7999 <tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
8000 given namespace matcher.
8002 Given
8003 namespace ns { struct A {}; }
8004 ns::A a;
8005 nestedNameSpecifier(specifiesNamespace(hasName("ns")))
8006 matches "ns::"
8007 </pre></td></tr>
8010 <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>
8011 <tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
8012 given QualType matcher without qualifiers.
8014 Given
8015 struct A { struct B { struct C {}; }; };
8016 A::B::C c;
8017 nestedNameSpecifier(specifiesType(
8018 hasDeclaration(cxxRecordDecl(hasName("A")))
8020 matches "A::"
8021 </pre></td></tr>
8024 <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>
8025 <tr><td colspan="4" class="doc" id="hasAnyClause0"><pre>Matches any clause in an OpenMP directive.
8027 Given
8029 #pragma omp parallel
8030 #pragma omp parallel default(none)
8032 ``ompExecutableDirective(hasAnyClause(anything()))`` matches
8033 ``omp parallel default(none)``.
8034 </pre></td></tr>
8037 <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>
8038 <tr><td colspan="4" class="doc" id="hasStructuredBlock0"><pre>Matches the structured-block of the OpenMP executable directive
8040 Prerequisite: the executable directive must not be standalone directive.
8041 If it is, it will never match.
8043 Given
8045 #pragma omp parallel
8047 #pragma omp parallel
8050 ``ompExecutableDirective(hasStructuredBlock(nullStmt()))`` will match ``;``
8051 </pre></td></tr>
8054 <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>
8055 <tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Matches C++ classes that are directly or indirectly derived from a class
8056 matching Base, or Objective-C classes that directly or indirectly
8057 subclass a class matching Base.
8059 Note that a class is not considered to be derived from itself.
8061 Example matches Y, Z, C (Base == hasName("X"))
8062 class X;
8063 class Y : public X {}; // directly derived
8064 class Z : public Y {}; // indirectly derived
8065 typedef X A;
8066 typedef A B;
8067 class C : public B {}; // derived from a typedef of X
8069 In the following example, Bar matches isDerivedFrom(hasName("X")):
8070 class Foo;
8071 typedef Foo X;
8072 class Bar : public Foo {}; // derived from a type that X is a typedef of
8074 In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
8075 @interface NSObject @end
8076 @interface Bar : NSObject @end
8078 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;
8079 </pre></td></tr>
8082 <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>
8083 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom1"><pre>Matches C++ or Objective-C classes that are directly derived from a class
8084 matching Base.
8086 Note that a class is not considered to be derived from itself.
8088 Example matches Y, C (Base == hasName("X"))
8089 class X;
8090 class Y : public X {}; // directly derived
8091 class Z : public Y {}; // indirectly derived
8092 typedef X A;
8093 typedef A B;
8094 class C : public B {}; // derived from a typedef of X
8096 In the following example, Bar matches isDerivedFrom(hasName("X")):
8097 class Foo;
8098 typedef Foo X;
8099 class Bar : public Foo {}; // derived from a type that X is a typedef of
8100 </pre></td></tr>
8103 <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>
8104 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Similar to isDerivedFrom(), but also matches classes that directly
8105 match Base.
8106 </pre></td></tr>
8109 <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>
8110 <tr><td colspan="4" class="doc" id="hasAnyArgument3"><pre>Matches any argument of a call expression or a constructor call
8111 expression, or an ObjC-message-send expression.
8113 Given
8114 void x(int, int, int) { int y; x(1, y, 42); }
8115 callExpr(hasAnyArgument(declRefExpr()))
8116 matches x(1, y, 42)
8117 with hasAnyArgument(...)
8118 matching y
8120 For ObjectiveC, given
8121 @interface I - (void) f:(int) y; @end
8122 void foo(I *i) { [i f:12]; }
8123 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
8124 matches [i f:12]
8125 </pre></td></tr>
8128 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('hasArgument3')"><a name="hasArgument3Anchor">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>
8129 <tr><td colspan="4" class="doc" id="hasArgument3"><pre>Matches the n'th argument of a call expression or a constructor
8130 call expression.
8132 Example matches y in x(y)
8133 (matcher = callExpr(hasArgument(0, declRefExpr())))
8134 void x(int) { int y; x(y); }
8135 </pre></td></tr>
8138 <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>
8139 <tr><td colspan="4" class="doc" id="hasReceiver0"><pre>Matches if the Objective-C message is sent to an instance,
8140 and the inner matcher matches on that instance.
8142 For example the method call in
8143 NSString *x = @"hello";
8144 [x containsString:@"h"];
8145 is matched by
8146 objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
8147 </pre></td></tr>
8150 <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>
8151 <tr><td colspan="4" class="doc" id="hasReceiverType0"><pre>Matches on the receiver of an ObjectiveC Message expression.
8153 Example
8154 matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *")));
8155 matches the [webView ...] message invocation.
8156 NSString *webViewJavaScript = ...
8157 UIWebView *webView = ...
8158 [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
8159 </pre></td></tr>
8162 <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>
8163 <tr><td colspan="4" class="doc" id="hasAnyParameter1"><pre>Matches any parameter of a function or an ObjC method declaration or a
8164 block.
8166 Does not match the 'this' parameter of a method.
8168 Given
8169 class X { void f(int x, int y, int z) {} };
8170 cxxMethodDecl(hasAnyParameter(hasName("y")))
8171 matches f(int x, int y, int z) {}
8172 with hasAnyParameter(...)
8173 matching int y
8175 For ObjectiveC, given
8176 @interface I - (void) f:(int) y; @end
8178 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
8179 matches the declaration of method f with hasParameter
8180 matching y.
8182 For blocks, given
8183 b = ^(int y) { printf("%d", y) };
8185 the matcher blockDecl(hasAnyParameter(hasName("y")))
8186 matches the declaration of the block b with hasParameter
8187 matching y.
8188 </pre></td></tr>
8191 <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>
8192 <tr><td colspan="4" class="doc" id="hasParameter1"><pre>Matches the n'th parameter of a function or an ObjC method
8193 declaration or a block.
8195 Given
8196 class X { void f(int x) {} };
8197 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
8198 matches f(int x) {}
8199 with hasParameter(...)
8200 matching int x
8202 For ObjectiveC, given
8203 @interface I - (void) f:(int) y; @end
8205 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
8206 matches the declaration of method f with hasParameter
8207 matching y.
8208 </pre></td></tr>
8211 <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>
8212 <tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre>Matches if the cast's source expression
8213 or opaque value's source expression matches the given matcher.
8215 Example 1: matches "a string"
8216 (matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
8217 class URL { URL(string); };
8218 URL url = "a string";
8220 Example 2: matches 'b' (matcher =
8221 opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
8222 int a = b ?: 1;
8223 </pre></td></tr>
8226 <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>
8227 <tr><td colspan="4" class="doc" id="hasAnyDeclaration0"><pre>Matches an OverloadExpr if any of the declarations in the set of
8228 overloads matches the given matcher.
8230 Given
8231 template &lt;typename T&gt; void foo(T);
8232 template &lt;typename T&gt; void bar(T);
8233 template &lt;typename T&gt; void baz(T t) {
8234 foo(t);
8235 bar(t);
8237 unresolvedLookupExpr(hasAnyDeclaration(
8238 functionTemplateDecl(hasName("foo"))))
8239 matches foo in foo(t); but not bar in bar(t);
8240 </pre></td></tr>
8243 <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>
8244 <tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
8246 Given
8247 int (*ptr_to_array)[4];
8248 int (*ptr_to_func)(int);
8250 varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
8251 ptr_to_func but not ptr_to_array.
8253 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
8254 </pre></td></tr>
8257 <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>
8258 <tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
8259 pointee matches a given matcher.
8261 Given
8262 int *a;
8263 int const *b;
8264 float const *f;
8265 pointerType(pointee(isConstQualified(), isInteger()))
8266 matches "int const *b"
8268 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;,
8269 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;
8270 </pre></td></tr>
8273 <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>
8274 <tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
8276 Given:
8277 typedef int &amp;int_ref;
8278 int a;
8279 int_ref b = a;
8281 varDecl(hasType(qualType(referenceType()))))) will not match the
8282 declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
8283 </pre></td></tr>
8286 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
8287 <tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
8288 matches the given matcher.
8290 The associated declaration is:
8291 - for type nodes, the declaration of the underlying type
8292 - for CallExpr, the declaration of the callee
8293 - for MemberExpr, the declaration of the referenced member
8294 - for CXXConstructExpr, the declaration of the constructor
8295 - for CXXNewExpr, the declaration of the operator new
8296 - for ObjCIvarExpr, the declaration of the ivar
8298 For type nodes, hasDeclaration will generally match the declaration of the
8299 sugared type. Given
8300 class X {};
8301 typedef X Y;
8302 Y y;
8303 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8304 typedefDecl. A common use case is to match the underlying, desugared type.
8305 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8306 varDecl(hasType(hasUnqualifiedDesugaredType(
8307 recordType(hasDeclaration(decl())))))
8308 In this matcher, the decl will match the CXXRecordDecl of class X.
8310 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;,
8311 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;,
8312 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;,
8313 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;,
8314 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;,
8315 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;,
8316 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8317 </pre></td></tr>
8320 <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>
8321 <tr><td colspan="4" class="doc" id="ignoringParens0"><pre>Matches types that match InnerMatcher after any parens are stripped.
8323 Given
8324 void (*fp)(void);
8325 The matcher
8326 varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
8327 would match the declaration for fp.
8328 </pre></td></tr>
8331 <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>
8332 <tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
8333 </pre></td></tr>
8336 <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>
8337 <tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
8338 matches the specified matcher.
8340 Example matches y-&gt;x()
8341 (matcher = cxxMemberCallExpr(on(hasType(pointsTo
8342 cxxRecordDecl(hasName("Y")))))))
8343 class Y { public: void x(); };
8344 void z() { Y *y; y-&gt;x(); }
8345 </pre></td></tr>
8348 <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>
8349 <tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
8350 </pre></td></tr>
8353 <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>
8354 <tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
8355 type matches the specified matcher.
8357 Example matches X &amp;x and const X &amp;y
8358 (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
8359 class X {
8360 void a(X b) {
8361 X &amp;x = b;
8362 const X &amp;y = b;
8365 </pre></td></tr>
8368 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
8369 <tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
8370 matches the given matcher.
8372 The associated declaration is:
8373 - for type nodes, the declaration of the underlying type
8374 - for CallExpr, the declaration of the callee
8375 - for MemberExpr, the declaration of the referenced member
8376 - for CXXConstructExpr, the declaration of the constructor
8377 - for CXXNewExpr, the declaration of the operator new
8378 - for ObjCIvarExpr, the declaration of the ivar
8380 For type nodes, hasDeclaration will generally match the declaration of the
8381 sugared type. Given
8382 class X {};
8383 typedef X Y;
8384 Y y;
8385 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8386 typedefDecl. A common use case is to match the underlying, desugared type.
8387 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8388 varDecl(hasType(hasUnqualifiedDesugaredType(
8389 recordType(hasDeclaration(decl())))))
8390 In this matcher, the decl will match the CXXRecordDecl of class X.
8392 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;,
8393 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;,
8394 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;,
8395 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;,
8396 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;,
8397 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;,
8398 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8399 </pre></td></tr>
8402 <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>
8403 <tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
8404 pointee matches a given matcher.
8406 Given
8407 int *a;
8408 int const *b;
8409 float const *f;
8410 pointerType(pointee(isConstQualified(), isInteger()))
8411 matches "int const *b"
8413 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;,
8414 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;
8415 </pre></td></tr>
8418 <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>
8419 <tr><td colspan="4" class="doc" id="hasReturnValue0"><pre>Matches the return value expression of a return statement
8421 Given
8422 return a + b;
8423 hasReturnValue(binaryOperator())
8424 matches 'return a + b'
8425 with binaryOperator()
8426 matching 'a + b'
8427 </pre></td></tr>
8430 <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>
8431 <tr><td colspan="4" class="doc" id="hasAnySubstatement1"><pre>Matches compound statements where at least one substatement matches
8432 a given matcher. Also matches StmtExprs that have CompoundStmt as children.
8434 Given
8435 { {}; 1+2; }
8436 hasAnySubstatement(compoundStmt())
8437 matches '{ {}; 1+2; }'
8438 with compoundStmt()
8439 matching '{}'
8440 </pre></td></tr>
8443 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt; InnerMatcher</td></tr>
8444 <tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
8445 alignof.
8446 </pre></td></tr>
8449 <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>
8450 <tr><td colspan="4" class="doc" id="forFunction0"><pre>Matches declaration of the function the statement belongs to
8452 Given:
8453 F&amp; operator=(const F&amp; o) {
8454 std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
8455 return *this;
8457 returnStmt(forFunction(hasName("operator=")))
8458 matches 'return *this'
8459 but does not match 'return v &gt; 0'
8460 </pre></td></tr>
8463 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt; InnerMatcher</td></tr>
8464 <tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
8465 sizeof.
8466 </pre></td></tr>
8469 <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>
8470 <tr><td colspan="4" class="doc" id="hasReplacementType0"><pre>Matches template type parameter substitutions that have a replacement
8471 type that matches the provided matcher.
8473 Given
8474 template &lt;typename T&gt;
8475 double F(T t);
8476 int i;
8477 double j = F(i);
8479 substTemplateTypeParmType(hasReplacementType(type())) matches int
8480 </pre></td></tr>
8483 <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>
8484 <tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
8485 statement. This matcher may produce multiple matches.
8487 Given
8488 switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
8489 switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
8490 matches four times, with "c" binding each of "case 1:", "case 2:",
8491 "case 3:" and "case 4:", and "s" respectively binding "switch (1)",
8492 "switch (1)", "switch (2)" and "switch (2)".
8493 </pre></td></tr>
8496 <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>
8497 <tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
8498 switch statement or conditional operator.
8500 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
8501 if (true) {}
8502 </pre></td></tr>
8505 <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>
8506 <tr><td colspan="4" class="doc" id="hasInitStatement1"><pre>Matches selection statements with initializer.
8508 Given:
8509 void foo() {
8510 if (int i = foobar(); i &gt; 0) {}
8511 switch (int i = foobar(); i) {}
8512 for (auto&amp; a = get_range(); auto&amp; x : a) {}
8514 void bar() {
8515 if (foobar() &gt; 0) {}
8516 switch (foobar()) {}
8517 for (auto&amp; x : get_range()) {}
8519 ifStmt(hasInitStatement(anything()))
8520 matches the if statement in foo but not in bar.
8521 switchStmt(hasInitStatement(anything()))
8522 matches the switch statement in foo but not in bar.
8523 cxxForRangeStmt(hasInitStatement(anything()))
8524 matches the range for statement in foo but not in bar.
8525 </pre></td></tr>
8528 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
8529 <tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
8530 matches the given matcher.
8532 The associated declaration is:
8533 - for type nodes, the declaration of the underlying type
8534 - for CallExpr, the declaration of the callee
8535 - for MemberExpr, the declaration of the referenced member
8536 - for CXXConstructExpr, the declaration of the constructor
8537 - for CXXNewExpr, the declaration of the operator new
8538 - for ObjCIvarExpr, the declaration of the ivar
8540 For type nodes, hasDeclaration will generally match the declaration of the
8541 sugared type. Given
8542 class X {};
8543 typedef X Y;
8544 Y y;
8545 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8546 typedefDecl. A common use case is to match the underlying, desugared type.
8547 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8548 varDecl(hasType(hasUnqualifiedDesugaredType(
8549 recordType(hasDeclaration(decl())))))
8550 In this matcher, the decl will match the CXXRecordDecl of class X.
8552 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;,
8553 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;,
8554 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;,
8555 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;,
8556 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;,
8557 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;,
8558 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8559 </pre></td></tr>
8562 <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>
8563 <tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
8565 Given
8566 struct B { int next; };
8567 template&lt;int(B::*next_ptr)&gt; struct A {};
8568 A&lt;&amp;B::next&gt; a;
8569 templateSpecializationType(hasAnyTemplateArgument(
8570 isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
8571 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
8572 B::next
8573 </pre></td></tr>
8576 <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>
8577 <tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
8578 declaration.
8580 Given
8581 struct B { int next; };
8582 template&lt;int(B::*next_ptr)&gt; struct A {};
8583 A&lt;&amp;B::next&gt; a;
8584 classTemplateSpecializationDecl(hasAnyTemplateArgument(
8585 refersToDeclaration(fieldDecl(hasName("next")))))
8586 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
8587 B::next
8588 </pre></td></tr>
8591 <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>
8592 <tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that refers to an integral type.
8594 Given
8595 template&lt;int T&gt; struct C {};
8596 C&lt;42&gt; c;
8597 classTemplateSpecializationDecl(
8598 hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
8599 matches the implicit instantiation of C in C&lt;42&gt;.
8600 </pre></td></tr>
8603 <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>
8604 <tr><td colspan="4" class="doc" id="refersToTemplate0"><pre>Matches a TemplateArgument that refers to a certain template.
8606 Given
8607 template&lt;template &lt;typename&gt; class S&gt; class X {};
8608 template&lt;typename T&gt; class Y {};
8609 X&lt;Y&gt; xi;
8610 classTemplateSpecializationDecl(hasAnyTemplateArgument(
8611 refersToTemplate(templateName())))
8612 matches the specialization X&lt;Y&gt;
8613 </pre></td></tr>
8616 <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>
8617 <tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
8619 Given
8620 struct X {};
8621 template&lt;typename T&gt; struct A {};
8622 A&lt;X&gt; a;
8623 classTemplateSpecializationDecl(hasAnyTemplateArgument(
8624 refersToType(class(hasName("X")))))
8625 matches the specialization A&lt;X&gt;
8626 </pre></td></tr>
8629 <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>
8630 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
8631 functionDecl that have at least one TemplateArgument matching the given
8632 InnerMatcher.
8634 Given
8635 template&lt;typename T&gt; class A {};
8636 template&lt;&gt; class A&lt;double&gt; {};
8637 A&lt;int&gt; a;
8639 template&lt;typename T&gt; f() {};
8640 void func() { f&lt;int&gt;(); };
8642 classTemplateSpecializationDecl(hasAnyTemplateArgument(
8643 refersToType(asString("int"))))
8644 matches the specialization A&lt;int&gt;
8646 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
8647 matches the specialization f&lt;int&gt;
8648 </pre></td></tr>
8651 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
8652 <tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
8653 matches the given matcher.
8655 The associated declaration is:
8656 - for type nodes, the declaration of the underlying type
8657 - for CallExpr, the declaration of the callee
8658 - for MemberExpr, the declaration of the referenced member
8659 - for CXXConstructExpr, the declaration of the constructor
8660 - for CXXNewExpr, the declaration of the operator new
8661 - for ObjCIvarExpr, the declaration of the ivar
8663 For type nodes, hasDeclaration will generally match the declaration of the
8664 sugared type. Given
8665 class X {};
8666 typedef X Y;
8667 Y y;
8668 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8669 typedefDecl. A common use case is to match the underlying, desugared type.
8670 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8671 varDecl(hasType(hasUnqualifiedDesugaredType(
8672 recordType(hasDeclaration(decl())))))
8673 In this matcher, the decl will match the CXXRecordDecl of class X.
8675 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;,
8676 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;,
8677 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;,
8678 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;,
8679 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;,
8680 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;,
8681 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8682 </pre></td></tr>
8685 <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>
8686 <tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
8687 functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
8689 Given
8690 template&lt;typename T, typename U&gt; class A {};
8691 A&lt;bool, int&gt; b;
8692 A&lt;int, bool&gt; c;
8694 template&lt;typename T&gt; void f() {}
8695 void func() { f&lt;int&gt;(); };
8696 classTemplateSpecializationDecl(hasTemplateArgument(
8697 1, refersToType(asString("int"))))
8698 matches the specialization A&lt;bool, int&gt;
8700 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
8701 matches the specialization f&lt;int&gt;
8702 </pre></td></tr>
8705 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
8706 <tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
8707 matches the given matcher.
8709 The associated declaration is:
8710 - for type nodes, the declaration of the underlying type
8711 - for CallExpr, the declaration of the callee
8712 - for MemberExpr, the declaration of the referenced member
8713 - for CXXConstructExpr, the declaration of the constructor
8714 - for CXXNewExpr, the declaration of the operator new
8715 - for ObjCIvarExpr, the declaration of the ivar
8717 For type nodes, hasDeclaration will generally match the declaration of the
8718 sugared type. Given
8719 class X {};
8720 typedef X Y;
8721 Y y;
8722 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8723 typedefDecl. A common use case is to match the underlying, desugared type.
8724 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8725 varDecl(hasType(hasUnqualifiedDesugaredType(
8726 recordType(hasDeclaration(decl())))))
8727 In this matcher, the decl will match the CXXRecordDecl of class X.
8729 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;,
8730 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;,
8731 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;,
8732 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;,
8733 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;,
8734 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;,
8735 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8736 </pre></td></tr>
8739 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&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>
8740 <tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
8741 QualType-matcher matches.
8742 </pre></td></tr>
8745 <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>
8746 <tr><td colspan="4" class="doc" id="hasType2"><pre>Matches if the expression's or declaration's type matches a type
8747 matcher.
8749 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
8750 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
8751 and U (matcher = typedefDecl(hasType(asString("int")))
8752 and friend class X (matcher = friendDecl(hasType("X"))
8753 class X {};
8754 void y(X &amp;x) { x; X z; }
8755 typedef int U;
8756 class Y { friend class X; };
8757 </pre></td></tr>
8760 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
8761 <tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
8762 matches the given matcher.
8764 The associated declaration is:
8765 - for type nodes, the declaration of the underlying type
8766 - for CallExpr, the declaration of the callee
8767 - for MemberExpr, the declaration of the referenced member
8768 - for CXXConstructExpr, the declaration of the constructor
8769 - for CXXNewExpr, the declaration of the operator new
8770 - for ObjCIvarExpr, the declaration of the ivar
8772 For type nodes, hasDeclaration will generally match the declaration of the
8773 sugared type. Given
8774 class X {};
8775 typedef X Y;
8776 Y y;
8777 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8778 typedefDecl. A common use case is to match the underlying, desugared type.
8779 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8780 varDecl(hasType(hasUnqualifiedDesugaredType(
8781 recordType(hasDeclaration(decl())))))
8782 In this matcher, the decl will match the CXXRecordDecl of class X.
8784 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;,
8785 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;,
8786 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;,
8787 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;,
8788 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;,
8789 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;,
8790 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8791 </pre></td></tr>
8794 <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>
8795 <tr><td colspan="4" class="doc" id="hasUnqualifiedDesugaredType0"><pre>Matches if the matched type matches the unqualified desugared
8796 type of the matched node.
8798 For example, in:
8799 class A {};
8800 using B = A;
8801 The matcher type(hasUnqualifiedDesugaredType(recordType())) matches
8802 both B and A.
8803 </pre></td></tr>
8806 <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>
8807 <tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
8809 Given
8810 int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
8811 unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
8812 matches sizeof(a) and alignof(c)
8813 </pre></td></tr>
8816 <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>
8817 <tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
8819 Example matches true (matcher = hasUnaryOperand(
8820 cxxBoolLiteral(equals(true))))
8821 !true
8822 </pre></td></tr>
8825 <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>
8826 <tr><td colspan="4" class="doc" id="hasObjectExpression1"><pre>Matches a member expression where the object expression is matched by a
8827 given matcher. Implicit object expressions are included; that is, it matches
8828 use of implicit `this`.
8830 Given
8831 struct X {
8832 int m;
8833 int f(X x) { x.m; return m; }
8835 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
8836 matches `x.m`, but not `m`; however,
8837 memberExpr(hasObjectExpression(hasType(pointsTo(
8838 cxxRecordDecl(hasName("X"))))))
8839 matches `m` (aka. `this-&gt;m`), but not `x.m`.
8840 </pre></td></tr>
8843 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
8844 <tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
8845 matches the given matcher.
8847 The associated declaration is:
8848 - for type nodes, the declaration of the underlying type
8849 - for CallExpr, the declaration of the callee
8850 - for MemberExpr, the declaration of the referenced member
8851 - for CXXConstructExpr, the declaration of the constructor
8852 - for CXXNewExpr, the declaration of the operator new
8853 - for ObjCIvarExpr, the declaration of the ivar
8855 For type nodes, hasDeclaration will generally match the declaration of the
8856 sugared type. Given
8857 class X {};
8858 typedef X Y;
8859 Y y;
8860 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8861 typedefDecl. A common use case is to match the underlying, desugared type.
8862 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8863 varDecl(hasType(hasUnqualifiedDesugaredType(
8864 recordType(hasDeclaration(decl())))))
8865 In this matcher, the decl will match the CXXRecordDecl of class X.
8867 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;,
8868 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;,
8869 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;,
8870 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;,
8871 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;,
8872 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;,
8873 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8874 </pre></td></tr>
8877 <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>
8878 <tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
8880 Given
8881 namespace X { void b(); }
8882 using X::b;
8883 usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
8884 matches using X::b </pre></td></tr>
8887 <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>
8888 <tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
8889 matched by the given matcher.
8891 Given
8892 namespace X { int a; void b(); }
8893 using X::a;
8894 using X::b;
8895 usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
8896 matches using X::b but not using X::a </pre></td></tr>
8899 <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>
8900 <tr><td colspan="4" class="doc" id="hasType6"><pre>Overloaded to match the declaration of the expression's or value
8901 declaration's type.
8903 In case of a value declaration (for example a variable declaration),
8904 this resolves one layer of indirection. For example, in the value
8905 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
8906 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
8907 declaration of x.
8909 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
8910 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
8911 and friend class X (matcher = friendDecl(hasType("X"))
8912 class X {};
8913 void y(X &amp;x) { x; X z; }
8914 class Y { friend class X; };
8916 Example matches class Derived
8917 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
8918 class Base {};
8919 class Derived : Base {};
8921 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_1FriendDecl.html">FriendDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;,
8922 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
8923 </pre></td></tr>
8926 <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>
8927 <tr><td colspan="4" class="doc" id="hasType3"><pre>Matches if the expression's or declaration's type matches a type
8928 matcher.
8930 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
8931 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
8932 and U (matcher = typedefDecl(hasType(asString("int")))
8933 and friend class X (matcher = friendDecl(hasType("X"))
8934 class X {};
8935 void y(X &amp;x) { x; X z; }
8936 typedef int U;
8937 class Y { friend class X; };
8938 </pre></td></tr>
8941 <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>
8942 <tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
8943 that matches the given matcher.
8945 Example matches x (matcher = varDecl(hasInitializer(callExpr())))
8946 bool y() { return true; }
8947 bool x = y();
8948 </pre></td></tr>
8951 <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>
8952 <tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
8953 expression.
8955 Given
8956 void f(int b) {
8957 int a[b];
8959 variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
8960 varDecl(hasName("b")))))))
8961 matches "int a[b]"
8962 </pre></td></tr>
8965 <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>
8966 <tr><td colspan="4" class="doc" id="hasBody2"><pre></pre></td></tr>
8969 <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>
8970 <tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
8971 switch statement or conditional operator.
8973 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
8974 if (true) {}
8975 </pre></td></tr>
8977 <!--END_TRAVERSAL_MATCHERS -->
8978 </table>
8980 </div>
8981 </body>
8982 </html>