[TargetVersion] Only enable on RISC-V and AArch64 (#115991)
[llvm-project.git] / clang / docs / LibASTMatchersReference.html
blobc6307954d7f1bb88dbae8cc62833271861fdada9
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(hasReturnValue(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_1Attr.html">Attr</a>&gt;</td><td class="name" onclick="toggle('attr0')"><a name="attr0Anchor">attr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Attr.html">Attr</a>&gt;...</td></tr>
577 <tr><td colspan="4" class="doc" id="attr0"><pre>Matches attributes.
578 Attributes may be attached with a variety of different syntaxes (including
579 keywords, C++11 attributes, GNU ``__attribute``` and MSVC `__declspec``,
580 and ``#pragma``s). They may also be implicit.
582 Given
583 struct [[nodiscard]] Foo{};
584 void bar(int * __attribute__((nonnull)) );
585 __declspec(noinline) void baz();
587 #pragma omp declare simd
588 int min();
589 attr()
590 matches "nodiscard", "nonnull", "noinline", and the whole "#pragma" line.
591 </pre></td></tr>
594 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;</td><td class="name" onclick="toggle('cxxBaseSpecifier0')"><a name="cxxBaseSpecifier0Anchor">cxxBaseSpecifier</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;...</td></tr>
595 <tr><td colspan="4" class="doc" id="cxxBaseSpecifier0"><pre>Matches class bases.
597 Examples matches public virtual B.
598 class B {};
599 class C : public virtual B {};
600 </pre></td></tr>
603 <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>
604 <tr><td colspan="4" class="doc" id="cxxCtorInitializer0"><pre>Matches constructor initializers.
606 Examples matches i(42).
607 class C {
608 C() : i(42) {}
609 int i;
611 </pre></td></tr>
614 <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>
615 <tr><td colspan="4" class="doc" id="accessSpecDecl0"><pre>Matches C++ access specifier declarations.
617 Given
618 class C {
619 public:
620 int a;
622 accessSpecDecl()
623 matches 'public:'
624 </pre></td></tr>
627 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
628 <tr><td colspan="4" class="doc" id="bindingDecl0"><pre>Matches binding declarations
629 Example matches foo and bar
630 (matcher = bindingDecl()
632 auto [foo, bar] = std::make_pair{42, 42};
633 </pre></td></tr>
636 <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>
637 <tr><td colspan="4" class="doc" id="blockDecl0"><pre>Matches block declarations.
639 Example matches the declaration of the nameless block printing an input
640 integer.
642 myFunc(^(int p) {
643 printf("%d", p);
645 </pre></td></tr>
648 <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>
649 <tr><td colspan="4" class="doc" id="classTemplateDecl0"><pre>Matches C++ class template declarations.
651 Example matches Z
652 template&lt;class T&gt; class Z {};
653 </pre></td></tr>
656 <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>
657 <tr><td colspan="4" class="doc" id="classTemplatePartialSpecializationDecl0"><pre>Matches C++ class template partial specializations.
659 Given
660 template&lt;class T1, class T2, int I&gt;
661 class A {};
663 template&lt;class T, int I&gt;
664 class A&lt;T, T*, I&gt; {};
666 template&lt;&gt;
667 class A&lt;int, int, 1&gt; {};
668 classTemplatePartialSpecializationDecl()
669 matches the specialization A&lt;T,T*,I&gt; but not A&lt;int,int,1&gt;
670 </pre></td></tr>
673 <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>
674 <tr><td colspan="4" class="doc" id="classTemplateSpecializationDecl0"><pre>Matches C++ class template specializations.
676 Given
677 template&lt;typename T&gt; class A {};
678 template&lt;&gt; class A&lt;double&gt; {};
679 A&lt;int&gt; a;
680 classTemplateSpecializationDecl()
681 matches the specializations A&lt;int&gt; and A&lt;double&gt;
682 </pre></td></tr>
685 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('conceptDecl0')"><a name="conceptDecl0Anchor">conceptDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ConceptDecl.html">ConceptDecl</a>&gt;...</td></tr>
686 <tr><td colspan="4" class="doc" id="conceptDecl0"><pre>Matches concept declarations.
688 Example matches integral
689 template&lt;typename T&gt;
690 concept integral = std::is_integral_v&lt;T&gt;;
691 </pre></td></tr>
694 <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>
695 <tr><td colspan="4" class="doc" id="cxxConstructorDecl0"><pre>Matches C++ constructor declarations.
697 Example matches Foo::Foo() and Foo::Foo(int)
698 class Foo {
699 public:
700 Foo();
701 Foo(int);
702 int DoSomething();
704 </pre></td></tr>
707 <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>
708 <tr><td colspan="4" class="doc" id="cxxConversionDecl0"><pre>Matches conversion operator declarations.
710 Example matches the operator.
711 class X { operator int() const; };
712 </pre></td></tr>
715 <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>
716 <tr><td colspan="4" class="doc" id="cxxDeductionGuideDecl0"><pre>Matches user-defined and implicitly generated deduction guide.
718 Example matches the deduction guide.
719 template&lt;typename T&gt;
720 class X { X(int) };
721 X(int) -&gt; X&lt;int&gt;;
722 </pre></td></tr>
725 <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>
726 <tr><td colspan="4" class="doc" id="cxxDestructorDecl0"><pre>Matches explicit C++ destructor declarations.
728 Example matches Foo::~Foo()
729 class Foo {
730 public:
731 virtual ~Foo();
733 </pre></td></tr>
736 <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>
737 <tr><td colspan="4" class="doc" id="cxxMethodDecl0"><pre>Matches method declarations.
739 Example matches y
740 class X { void y(); };
741 </pre></td></tr>
744 <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>
745 <tr><td colspan="4" class="doc" id="cxxRecordDecl0"><pre>Matches C++ class declarations.
747 Example matches X, Z
748 class X;
749 template&lt;class T&gt; class Z {};
750 </pre></td></tr>
753 <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>
754 <tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations.
756 Examples matches X, C, and the friend declaration inside C;
757 void X();
758 class C {
759 friend X;
761 </pre></td></tr>
764 <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>
765 <tr><td colspan="4" class="doc" id="declaratorDecl0"><pre>Matches declarator declarations (field, variable, function
766 and non-type template parameter declarations).
768 Given
769 class X { int y; };
770 declaratorDecl()
771 matches int y.
772 </pre></td></tr>
775 <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>
776 <tr><td colspan="4" class="doc" id="decompositionDecl0"><pre>Matches decomposition-declarations.
778 Examples matches the declaration node with foo and bar, but not
779 number.
780 (matcher = declStmt(has(decompositionDecl())))
782 int number = 42;
783 auto [foo, bar] = std::make_pair{42, 42};
784 </pre></td></tr>
787 <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>
788 <tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants.
790 Example matches A, B, C
791 enum X {
792 A, B, C
794 </pre></td></tr>
797 <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>
798 <tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations.
800 Example matches X
801 enum X {
802 A, B, C
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('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>
808 <tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations.
810 Given
811 class X { int m; };
812 fieldDecl()
813 matches 'm'.
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('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>
818 <tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations.
820 Given
821 class X { friend void foo(); };
822 friendDecl()
823 matches 'friend void foo()'.
824 </pre></td></tr>
827 <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>
828 <tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations.
830 Example matches f
831 void f();
832 </pre></td></tr>
835 <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>
836 <tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations.
838 Example matches f
839 template&lt;class T&gt; void f(T t) {}
840 </pre></td></tr>
843 <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>
844 <tr><td colspan="4" class="doc" id="indirectFieldDecl0"><pre>Matches indirect field declarations.
846 Given
847 struct X { struct { int a; }; };
848 indirectFieldDecl()
849 matches 'a'.
850 </pre></td></tr>
853 <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>
854 <tr><td colspan="4" class="doc" id="labelDecl0"><pre>Matches a declaration of label.
856 Given
857 goto FOO;
858 FOO: bar();
859 labelDecl()
860 matches 'FOO:'
861 </pre></td></tr>
864 <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>
865 <tr><td colspan="4" class="doc" id="linkageSpecDecl0"><pre>Matches a declaration of a linkage specification.
867 Given
868 extern "C" {}
869 linkageSpecDecl()
870 matches "extern "C" {}"
871 </pre></td></tr>
874 <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>
875 <tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name.
877 Example matches X, S, the anonymous union type, i, and U;
878 typedef int X;
879 struct S {
880 union {
881 int i;
882 } U;
884 </pre></td></tr>
887 <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>
888 <tr><td colspan="4" class="doc" id="namespaceAliasDecl0"><pre>Matches a declaration of a namespace alias.
890 Given
891 namespace test {}
892 namespace alias = ::test;
893 namespaceAliasDecl()
894 matches "namespace alias" but not "namespace test"
895 </pre></td></tr>
898 <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>
899 <tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace.
901 Given
902 namespace {}
903 namespace test {}
904 namespaceDecl()
905 matches "namespace {}" and "namespace test {}"
906 </pre></td></tr>
909 <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>
910 <tr><td colspan="4" class="doc" id="nonTypeTemplateParmDecl0"><pre>Matches non-type template parameter declarations.
912 Given
913 template &lt;typename T, int N&gt; struct C {};
914 nonTypeTemplateParmDecl()
915 matches 'N', but not 'T'.
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('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>
920 <tr><td colspan="4" class="doc" id="objcCategoryDecl0"><pre>Matches Objective-C category declarations.
922 Example matches Foo (Additions)
923 @interface Foo (Additions)
924 @end
925 </pre></td></tr>
928 <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>
929 <tr><td colspan="4" class="doc" id="objcCategoryImplDecl0"><pre>Matches Objective-C category definitions.
931 Example matches Foo (Additions)
932 @implementation Foo (Additions)
933 @end
934 </pre></td></tr>
937 <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>
938 <tr><td colspan="4" class="doc" id="objcImplementationDecl0"><pre>Matches Objective-C implementation declarations.
940 Example matches Foo
941 @implementation Foo
942 @end
943 </pre></td></tr>
946 <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>
947 <tr><td colspan="4" class="doc" id="objcInterfaceDecl0"><pre>Matches Objective-C interface declarations.
949 Example matches Foo
950 @interface Foo
951 @end
952 </pre></td></tr>
955 <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>
956 <tr><td colspan="4" class="doc" id="objcIvarDecl0"><pre>Matches Objective-C instance variable declarations.
958 Example matches _enabled
959 @implementation Foo {
960 BOOL _enabled;
962 @end
963 </pre></td></tr>
966 <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>
967 <tr><td colspan="4" class="doc" id="objcMethodDecl0"><pre>Matches Objective-C method declarations.
969 Example matches both declaration and definition of -[Foo method]
970 @interface Foo
971 - (void)method;
972 @end
974 @implementation Foo
975 - (void)method {}
976 @end
977 </pre></td></tr>
980 <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>
981 <tr><td colspan="4" class="doc" id="objcPropertyDecl0"><pre>Matches Objective-C property declarations.
983 Example matches enabled
984 @interface Foo
985 @property BOOL enabled;
986 @end
987 </pre></td></tr>
990 <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>
991 <tr><td colspan="4" class="doc" id="objcProtocolDecl0"><pre>Matches Objective-C protocol declarations.
993 Example matches FooDelegate
994 @protocol FooDelegate
995 @end
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('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>
1000 <tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations.
1002 Given
1003 void f(int x);
1004 parmVarDecl()
1005 matches int x.
1006 </pre></td></tr>
1009 <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>
1010 <tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches class, struct, and union declarations.
1012 Example matches X, Z, U, and S
1013 class X;
1014 template&lt;class T&gt; class Z {};
1015 struct S {};
1016 union U {};
1017 </pre></td></tr>
1020 <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>
1021 <tr><td colspan="4" class="doc" id="staticAssertDecl0"><pre>Matches a C++ static_assert declaration.
1023 Example:
1024 staticAssertDecl()
1025 matches
1026 static_assert(sizeof(S) == sizeof(int))
1028 struct S {
1029 int x;
1031 static_assert(sizeof(S) == sizeof(int));
1032 </pre></td></tr>
1035 <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>
1036 <tr><td colspan="4" class="doc" id="tagDecl0"><pre>Matches tag declarations.
1038 Example matches X, Z, U, S, E
1039 class X;
1040 template&lt;class T&gt; class Z {};
1041 struct S {};
1042 union U {};
1043 enum E {
1044 A, B, C
1046 </pre></td></tr>
1049 <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>
1050 <tr><td colspan="4" class="doc" id="templateTemplateParmDecl0"><pre>Matches template template parameter declarations.
1052 Given
1053 template &lt;template &lt;typename&gt; class Z, int N&gt; struct C {};
1054 templateTypeParmDecl()
1055 matches 'Z', but not 'N'.
1056 </pre></td></tr>
1059 <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>
1060 <tr><td colspan="4" class="doc" id="templateTypeParmDecl0"><pre>Matches template type parameter declarations.
1062 Given
1063 template &lt;typename T, int N&gt; struct C {};
1064 templateTypeParmDecl()
1065 matches 'T', but not 'N'.
1066 </pre></td></tr>
1069 <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>
1070 <tr><td colspan="4" class="doc" id="translationUnitDecl0"><pre>Matches the top declaration context.
1072 Given
1073 int X;
1074 namespace NS {
1075 int Y;
1076 } // namespace NS
1077 decl(hasDeclContext(translationUnitDecl()))
1078 matches "int X", but not "int Y".
1079 </pre></td></tr>
1082 <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>
1083 <tr><td colspan="4" class="doc" id="typeAliasDecl0"><pre>Matches type alias declarations.
1085 Given
1086 typedef int X;
1087 using Y = int;
1088 typeAliasDecl()
1089 matches "using Y = int", but not "typedef int X"
1090 </pre></td></tr>
1093 <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>
1094 <tr><td colspan="4" class="doc" id="typeAliasTemplateDecl0"><pre>Matches type alias template declarations.
1096 typeAliasTemplateDecl() matches
1097 template &lt;typename T&gt;
1098 using Y = X&lt;T&gt;;
1099 </pre></td></tr>
1102 <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>
1103 <tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef declarations.
1105 Given
1106 typedef int X;
1107 using Y = int;
1108 typedefDecl()
1109 matches "typedef int X", but not "using Y = int"
1110 </pre></td></tr>
1113 <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>
1114 <tr><td colspan="4" class="doc" id="typedefNameDecl0"><pre>Matches typedef name declarations.
1116 Given
1117 typedef int X;
1118 using Y = int;
1119 typedefNameDecl()
1120 matches "typedef int X" and "using Y = int"
1121 </pre></td></tr>
1124 <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>
1125 <tr><td colspan="4" class="doc" id="unresolvedUsingTypenameDecl0"><pre>Matches unresolved using value declarations that involve the
1126 typename.
1128 Given
1129 template &lt;typename T&gt;
1130 struct Base { typedef T Foo; };
1132 template&lt;typename T&gt;
1133 struct S : private Base&lt;T&gt; {
1134 using typename Base&lt;T&gt;::Foo;
1136 unresolvedUsingTypenameDecl()
1137 matches using Base&lt;T&gt;::Foo </pre></td></tr>
1140 <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>
1141 <tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations.
1143 Given
1144 template&lt;typename X&gt;
1145 class C : private X {
1146 using X::x;
1148 unresolvedUsingValueDecl()
1149 matches using X::x </pre></td></tr>
1152 <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>
1153 <tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations.
1155 Given
1156 namespace X { int x; }
1157 using X::x;
1158 usingDecl()
1159 matches using X::x </pre></td></tr>
1162 <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>
1163 <tr><td colspan="4" class="doc" id="usingDirectiveDecl0"><pre>Matches using namespace declarations.
1165 Given
1166 namespace X { int x; }
1167 using namespace X;
1168 usingDirectiveDecl()
1169 matches using namespace X </pre></td></tr>
1172 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('usingEnumDecl0')"><a name="usingEnumDecl0Anchor">usingEnumDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UsingEnumDecl.html">UsingEnumDecl</a>&gt;...</td></tr>
1173 <tr><td colspan="4" class="doc" id="usingEnumDecl0"><pre>Matches using-enum declarations.
1175 Given
1176 namespace X { enum x {...}; }
1177 using enum X::x;
1178 usingEnumDecl()
1179 matches using enum X::x </pre></td></tr>
1182 <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>
1183 <tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value declaration.
1185 Example matches A, B, C and F
1186 enum X { A, B, C };
1187 void F();
1188 </pre></td></tr>
1191 <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>
1192 <tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations.
1194 Note: this does not match declarations of member variables, which are
1195 "field" declarations in Clang parlance.
1197 Example matches a
1198 int a;
1199 </pre></td></tr>
1202 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaCapture.html">LambdaCapture</a>&gt;</td><td class="name" onclick="toggle('lambdaCapture0')"><a name="lambdaCapture0Anchor">lambdaCapture</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaCapture.html">LambdaCapture</a>&gt;...</td></tr>
1203 <tr><td colspan="4" class="doc" id="lambdaCapture0"><pre>Matches lambda captures.
1205 Given
1206 int main() {
1207 int x;
1208 auto f = [x](){};
1209 auto g = [x = 1](){};
1211 In the matcher `lambdaExpr(hasAnyCapture(lambdaCapture()))`,
1212 `lambdaCapture()` matches `x` and `x=1`.
1213 </pre></td></tr>
1216 <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>
1217 <tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
1218 </pre></td></tr>
1221 <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>
1222 <tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers.
1224 Given
1225 namespace ns {
1226 struct A { static void f(); };
1227 void A::f() {}
1228 void g() { A::f(); }
1230 ns::A a;
1231 nestedNameSpecifier()
1232 matches "ns::" and both "A::"
1233 </pre></td></tr>
1236 <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>
1237 <tr><td colspan="4" class="doc" id="ompDefaultClause0"><pre>Matches OpenMP ``default`` clause.
1239 Given
1241 #pragma omp parallel default(none)
1242 #pragma omp parallel default(shared)
1243 #pragma omp parallel default(private)
1244 #pragma omp parallel default(firstprivate)
1245 #pragma omp parallel
1247 ``ompDefaultClause()`` matches ``default(none)``, ``default(shared)``,
1248 `` default(private)`` and ``default(firstprivate)``
1249 </pre></td></tr>
1252 <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>
1253 <tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST.
1254 </pre></td></tr>
1257 <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>
1258 <tr><td colspan="4" class="doc" id="addrLabelExpr0"><pre>Matches address of label statements (GNU extension).
1260 Given
1261 FOO: bar();
1262 void *ptr = &amp;&amp;FOO;
1263 goto *bar;
1264 addrLabelExpr()
1265 matches '&amp;&amp;FOO'
1266 </pre></td></tr>
1269 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('arrayInitIndexExpr0')"><a name="arrayInitIndexExpr0Anchor">arrayInitIndexExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ArrayInitIndexExpr.html">ArrayInitIndexExpr</a>&gt;...</td></tr>
1270 <tr><td colspan="4" class="doc" id="arrayInitIndexExpr0"><pre>The arrayInitIndexExpr consists of two subexpressions: a common expression
1271 (the source array) that is evaluated once up-front, and a per-element initializer
1272 that runs once for each array element. Within the per-element initializer,
1273 the current index may be obtained via an ArrayInitIndexExpr.
1275 Given
1276 void testStructBinding() {
1277 int a[2] = {1, 2};
1278 auto [x, y] = a;
1280 arrayInitIndexExpr() matches the array index that implicitly iterates
1281 over the array `a` to copy each element to the anonymous array
1282 that backs the structured binding `[x, y]` elements of which are
1283 referred to by their aliases `x` and `y`.
1284 </pre></td></tr>
1287 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('arrayInitLoopExpr0')"><a name="arrayInitLoopExpr0Anchor">arrayInitLoopExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ArrayInitLoopExpr.html">ArrayInitLoopExpr</a>&gt;...</td></tr>
1288 <tr><td colspan="4" class="doc" id="arrayInitLoopExpr0"><pre>Matches a loop initializing the elements of an array in a number of contexts:
1289 * in the implicit copy/move constructor for a class with an array member
1290 * when a lambda-expression captures an array by value
1291 * when a decomposition declaration decomposes an array
1293 Given
1294 void testLambdaCapture() {
1295 int a[10];
1296 auto Lam1 = [a]() {
1297 return;
1300 arrayInitLoopExpr() matches the implicit loop that initializes each element of
1301 the implicit array field inside the lambda object, that represents the array `a`
1302 captured by value.
1303 </pre></td></tr>
1306 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1307 <tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions.
1309 Given
1310 int i = a[1];
1311 arraySubscriptExpr()
1312 matches "a[1]"
1313 </pre></td></tr>
1316 <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>
1317 <tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements.
1319 int i = 100;
1320 __asm("mov al, 2");
1321 asmStmt()
1322 matches '__asm("mov al, 2")'
1323 </pre></td></tr>
1326 <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>
1327 <tr><td colspan="4" class="doc" id="atomicExpr0"><pre>Matches atomic builtins.
1328 Example matches __atomic_load_n(ptr, 1)
1329 void foo() { int *ptr; __atomic_load_n(ptr, 1); }
1330 </pre></td></tr>
1333 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1334 <tr><td colspan="4" class="doc" id="autoreleasePoolStmt0"><pre>Matches an Objective-C autorelease pool statement.
1336 Given
1337 @autoreleasepool {
1338 int x = 0;
1340 autoreleasePoolStmt(stmt()) matches the declaration of "x"
1341 inside the autorelease pool.
1342 </pre></td></tr>
1345 <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>
1346 <tr><td colspan="4" class="doc" id="binaryConditionalOperator0"><pre>Matches binary conditional operator expressions (GNU extension).
1348 Example matches a ?: b
1349 (a ?: b) + 42;
1350 </pre></td></tr>
1353 <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>
1354 <tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions.
1356 Example matches a || b
1357 !(a || b)
1358 See also the binaryOperation() matcher for more-general matching.
1359 </pre></td></tr>
1362 <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>
1363 <tr><td colspan="4" class="doc" id="blockExpr0"><pre>Matches a reference to a block.
1365 Example: matches "^{}":
1366 void f() { ^{}(); }
1367 </pre></td></tr>
1370 <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>
1371 <tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements.
1373 Given
1374 while (true) { break; }
1375 breakStmt()
1376 matches 'break'
1377 </pre></td></tr>
1380 <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>
1381 <tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression.
1383 Example: Matches (int) 2.2f in
1384 int i = (int) 2.2f;
1385 </pre></td></tr>
1388 <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>
1389 <tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions.
1391 Example matches x.y() and y()
1392 X x;
1393 x.y();
1394 y();
1395 </pre></td></tr>
1398 <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>
1399 <tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements.
1401 Given
1402 switch(a) { case 42: break; default: break; }
1403 caseStmt()
1404 matches 'case 42:'.
1405 </pre></td></tr>
1408 <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>
1409 <tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST.
1411 Example: castExpr() matches each of the following:
1412 (int) 3;
1413 const_cast&lt;Expr *&gt;(SubExpr);
1414 char c = 0;
1415 but does not match
1416 int i = (0);
1417 int k = 0;
1418 </pre></td></tr>
1421 <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>
1422 <tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t).
1424 Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
1425 though.
1427 Example matches 'a', L'a'
1428 char ch = 'a';
1429 wchar_t chw = L'a';
1430 </pre></td></tr>
1433 <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>
1434 <tr><td colspan="4" class="doc" id="chooseExpr0"><pre>Matches GNU __builtin_choose_expr.
1435 </pre></td></tr>
1438 <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>
1439 <tr><td colspan="4" class="doc" id="coawaitExpr0"><pre>Matches co_await expressions.
1441 Given
1442 co_await 1;
1443 coawaitExpr()
1444 matches 'co_await 1'
1445 </pre></td></tr>
1448 <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>
1449 <tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
1451 Example match: {1}, (1, 2)
1452 int array[4] = {1};
1453 vector int myvec = (vector int)(1, 2);
1454 </pre></td></tr>
1457 <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>
1458 <tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements.
1460 Example matches '{}' and '{{}}' in 'for (;;) {{}}'
1461 for (;;) {{}}
1462 </pre></td></tr>
1465 <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>
1466 <tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions.
1468 Example matches a ? b : c
1469 (a ? b : c) + 42
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('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>
1474 <tr><td colspan="4" class="doc" id="constantExpr0"><pre>Matches a constant expression wrapper.
1476 Example matches the constant in the case statement:
1477 (matcher = constantExpr())
1478 switch (a) {
1479 case 37: break;
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('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>
1485 <tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements.
1487 Given
1488 while (true) { continue; }
1489 continueStmt()
1490 matches 'continue'
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('convertVectorExpr0')"><a name="convertVectorExpr0Anchor">convertVectorExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ConvertVectorExpr.html">ConvertVectorExpr</a>&gt;...</td></tr>
1495 <tr><td colspan="4" class="doc" id="convertVectorExpr0"><pre>Matches builtin function __builtin_convertvector.
1496 </pre></td></tr>
1499 <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>
1500 <tr><td colspan="4" class="doc" id="coreturnStmt0"><pre>Matches co_return statements.
1502 Given
1503 while (true) { co_return; }
1504 coreturnStmt()
1505 matches 'co_return'
1506 </pre></td></tr>
1509 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('coroutineBodyStmt0')"><a name="coroutineBodyStmt0Anchor">coroutineBodyStmt</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CoroutineBodyStmt.html">CoroutineBodyStmt</a>&gt;...</td></tr>
1510 <tr><td colspan="4" class="doc" id="coroutineBodyStmt0"><pre>Matches coroutine body statements.
1512 coroutineBodyStmt() matches the coroutine below
1513 generator&lt;int&gt; gen() {
1514 co_return;
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('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>
1520 <tr><td colspan="4" class="doc" id="coyieldExpr0"><pre>Matches co_yield expressions.
1522 Given
1523 co_yield 1;
1524 coyieldExpr()
1525 matches 'co_yield 1'
1526 </pre></td></tr>
1529 <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>
1530 <tr><td colspan="4" class="doc" id="cudaKernelCallExpr0"><pre>Matches CUDA kernel call expression.
1532 Example matches,
1533 kernel&lt;&lt;&lt;i,j&gt;&gt;&gt;();
1534 </pre></td></tr>
1537 <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>
1538 <tr><td colspan="4" class="doc" id="cxxBindTemporaryExpr0"><pre>Matches nodes where temporaries are created.
1540 Example matches FunctionTakesString(GetStringByValue())
1541 (matcher = cxxBindTemporaryExpr())
1542 FunctionTakesString(GetStringByValue());
1543 FunctionTakesStringByPointer(GetStringPointer());
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('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>
1548 <tr><td colspan="4" class="doc" id="cxxBoolLiteral0"><pre>Matches bool literals.
1550 Example matches true
1551 true
1552 </pre></td></tr>
1555 <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>
1556 <tr><td colspan="4" class="doc" id="cxxCatchStmt0"><pre>Matches catch statements.
1558 try {} catch(int i) {}
1559 cxxCatchStmt()
1560 matches 'catch(int i)'
1561 </pre></td></tr>
1564 <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>
1565 <tr><td colspan="4" class="doc" id="cxxConstCastExpr0"><pre>Matches a const_cast expression.
1567 Example: Matches const_cast&lt;int*&gt;(&amp;r) in
1568 int n = 42;
1569 const int &amp;r(n);
1570 int* p = const_cast&lt;int*&gt;(&amp;r);
1571 </pre></td></tr>
1574 <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>
1575 <tr><td colspan="4" class="doc" id="cxxConstructExpr0"><pre>Matches constructor call expressions (including implicit ones).
1577 Example matches string(ptr, n) and ptr within arguments of f
1578 (matcher = cxxConstructExpr())
1579 void f(const string &amp;a, const string &amp;b);
1580 char *ptr;
1581 int n;
1582 f(string(ptr, n), ptr);
1583 </pre></td></tr>
1586 <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>
1587 <tr><td colspan="4" class="doc" id="cxxDefaultArgExpr0"><pre>Matches the value of a default argument at the call site.
1589 Example matches the CXXDefaultArgExpr placeholder inserted for the
1590 default value of the second parameter in the call expression f(42)
1591 (matcher = cxxDefaultArgExpr())
1592 void f(int x, int y = 0);
1593 f(42);
1594 </pre></td></tr>
1597 <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>
1598 <tr><td colspan="4" class="doc" id="cxxDeleteExpr0"><pre>Matches delete expressions.
1600 Given
1601 delete X;
1602 cxxDeleteExpr()
1603 matches 'delete X'.
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('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>
1608 <tr><td colspan="4" class="doc" id="cxxDependentScopeMemberExpr0"><pre>Matches member expressions where the actual member referenced could not be
1609 resolved because the base expression or the member name was dependent.
1611 Given
1612 template &lt;class T&gt; void f() { T t; t.g(); }
1613 cxxDependentScopeMemberExpr()
1614 matches t.g
1615 </pre></td></tr>
1618 <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>
1619 <tr><td colspan="4" class="doc" id="cxxDynamicCastExpr0"><pre>Matches a dynamic_cast expression.
1621 Example:
1622 cxxDynamicCastExpr()
1623 matches
1624 dynamic_cast&lt;D*&gt;(&amp;b);
1626 struct B { virtual ~B() {} }; struct D : B {};
1627 B b;
1628 D* p = dynamic_cast&lt;D*&gt;(&amp;b);
1629 </pre></td></tr>
1632 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('cxxFoldExpr0')"><a name="cxxFoldExpr0Anchor">cxxFoldExpr</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;...</td></tr>
1633 <tr><td colspan="4" class="doc" id="cxxFoldExpr0"><pre>Matches C++17 fold expressions.
1635 Example matches `(0 + ... + args)`:
1636 template &lt;typename... Args&gt;
1637 auto sum(Args... args) {
1638 return (0 + ... + args);
1640 </pre></td></tr>
1643 <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>
1644 <tr><td colspan="4" class="doc" id="cxxForRangeStmt0"><pre>Matches range-based for statements.
1646 cxxForRangeStmt() matches 'for (auto a : i)'
1647 int i[] = {1, 2, 3}; for (auto a : i);
1648 for(int j = 0; j &lt; 5; ++j);
1649 </pre></td></tr>
1652 <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>
1653 <tr><td colspan="4" class="doc" id="cxxFunctionalCastExpr0"><pre>Matches functional cast expressions
1655 Example: Matches Foo(bar);
1656 Foo f = bar;
1657 Foo g = (Foo) bar;
1658 Foo h = Foo(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('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>
1663 <tr><td colspan="4" class="doc" id="cxxMemberCallExpr0"><pre>Matches member call expressions.
1665 Example matches x.y()
1666 X x;
1667 x.y();
1668 </pre></td></tr>
1671 <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>
1672 <tr><td colspan="4" class="doc" id="cxxNewExpr0"><pre>Matches new expressions.
1674 Given
1675 new X;
1676 cxxNewExpr()
1677 matches 'new X'.
1678 </pre></td></tr>
1681 <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>
1682 <tr><td colspan="4" class="doc" id="cxxNoexceptExpr0"><pre>Matches noexcept expressions.
1684 Given
1685 bool a() noexcept;
1686 bool b() noexcept(true);
1687 bool c() noexcept(false);
1688 bool d() noexcept(noexcept(a()));
1689 bool e = noexcept(b()) || noexcept(c());
1690 cxxNoexceptExpr()
1691 matches `noexcept(a())`, `noexcept(b())` and `noexcept(c())`.
1692 doesn't match the noexcept specifier in the declarations a, b, c or d.
1693 </pre></td></tr>
1696 <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>
1697 <tr><td colspan="4" class="doc" id="cxxNullPtrLiteralExpr0"><pre>Matches nullptr literal.
1698 </pre></td></tr>
1701 <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>
1702 <tr><td colspan="4" class="doc" id="cxxOperatorCallExpr0"><pre>Matches overloaded operator calls.
1704 Note that if an operator isn't overloaded, it won't match. Instead, use
1705 binaryOperator matcher.
1706 Currently it does not match operators such as new delete.
1707 FIXME: figure out why these do not match?
1709 Example matches both operator&lt;&lt;((o &lt;&lt; b), c) and operator&lt;&lt;(o, b)
1710 (matcher = cxxOperatorCallExpr())
1711 ostream &amp;operator&lt;&lt; (ostream &amp;out, int i) { };
1712 ostream &amp;o; int b = 1, c = 1;
1713 o &lt;&lt; b &lt;&lt; c;
1714 See also the binaryOperation() matcher for more-general matching of binary
1715 uses of this AST node.
1716 </pre></td></tr>
1719 <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>
1720 <tr><td colspan="4" class="doc" id="cxxReinterpretCastExpr0"><pre>Matches a reinterpret_cast expression.
1722 Either the source expression or the destination type can be matched
1723 using has(), but hasDestinationType() is more specific and can be
1724 more readable.
1726 Example matches reinterpret_cast&lt;char*&gt;(&amp;p) in
1727 void* p = reinterpret_cast&lt;char*&gt;(&amp;p);
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('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>
1732 <tr><td colspan="4" class="doc" id="cxxRewrittenBinaryOperator0"><pre>Matches rewritten binary operators
1734 Example matches use of "&lt;":
1735 #include &lt;compare&gt;
1736 struct HasSpaceshipMem {
1737 int a;
1738 constexpr auto operator&lt;=&gt;(const HasSpaceshipMem&amp;) const = default;
1740 void compare() {
1741 HasSpaceshipMem hs1, hs2;
1742 if (hs1 &lt; hs2)
1743 return;
1745 See also the binaryOperation() matcher for more-general matching
1746 of this AST node.
1747 </pre></td></tr>
1750 <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>
1751 <tr><td colspan="4" class="doc" id="cxxStaticCastExpr0"><pre>Matches a C++ static_cast expression.
1753 See also: hasDestinationType
1754 See also: reinterpretCast
1756 Example:
1757 cxxStaticCastExpr()
1758 matches
1759 static_cast&lt;long&gt;(8)
1761 long eight(static_cast&lt;long&gt;(8));
1762 </pre></td></tr>
1765 <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>
1766 <tr><td colspan="4" class="doc" id="cxxStdInitializerListExpr0"><pre>Matches C++ initializer list expressions.
1768 Given
1769 std::vector&lt;int&gt; a({ 1, 2, 3 });
1770 std::vector&lt;int&gt; b = { 4, 5 };
1771 int c[] = { 6, 7 };
1772 std::pair&lt;int, int&gt; d = { 8, 9 };
1773 cxxStdInitializerListExpr()
1774 matches "{ 1, 2, 3 }" and "{ 4, 5 }"
1775 </pre></td></tr>
1778 <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>
1779 <tr><td colspan="4" class="doc" id="cxxTemporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments
1781 Example: Matches Foo(bar, bar)
1782 Foo h = Foo(bar, bar);
1783 </pre></td></tr>
1786 <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>
1787 <tr><td colspan="4" class="doc" id="cxxThisExpr0"><pre>Matches implicit and explicit this expressions.
1789 Example matches the implicit this expression in "return i".
1790 (matcher = cxxThisExpr())
1791 struct foo {
1792 int i;
1793 int f() { return i; }
1795 </pre></td></tr>
1798 <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>
1799 <tr><td colspan="4" class="doc" id="cxxThrowExpr0"><pre>Matches throw expressions.
1801 try { throw 5; } catch(int i) {}
1802 cxxThrowExpr()
1803 matches 'throw 5'
1804 </pre></td></tr>
1807 <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>
1808 <tr><td colspan="4" class="doc" id="cxxTryStmt0"><pre>Matches try statements.
1810 try {} catch(int i) {}
1811 cxxTryStmt()
1812 matches 'try {}'
1813 </pre></td></tr>
1816 <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>
1817 <tr><td colspan="4" class="doc" id="cxxUnresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions.
1819 Example matches T(t) in return statement of f
1820 (matcher = cxxUnresolvedConstructExpr())
1821 template &lt;typename T&gt;
1822 void f(const T&amp; t) { return T(t); }
1823 </pre></td></tr>
1826 <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>
1827 <tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations.
1829 Example matches x in if (x)
1830 bool x;
1831 if (x) {}
1832 </pre></td></tr>
1835 <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>
1836 <tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements.
1838 Given
1839 int a;
1840 declStmt()
1841 matches 'int a'.
1842 </pre></td></tr>
1845 <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>
1846 <tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements.
1848 Given
1849 switch(a) { case 42: break; default: break; }
1850 defaultStmt()
1851 matches 'default:'.
1852 </pre></td></tr>
1855 <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>
1856 <tr><td colspan="4" class="doc" id="dependentCoawaitExpr0"><pre>Matches co_await expressions where the type of the promise is dependent
1857 </pre></td></tr>
1860 <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>
1861 <tr><td colspan="4" class="doc" id="designatedInitExpr0"><pre>Matches C99 designated initializer expressions [C99 6.7.8].
1863 Example: Matches { [2].y = 1.0, [0].x = 1.0 }
1864 point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
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('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>
1869 <tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements.
1871 Given
1872 do {} while (true);
1873 doStmt()
1874 matches 'do {} while(true)'
1875 </pre></td></tr>
1878 <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>
1879 <tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions.
1881 Matches any cast expression written in user code, whether it be a
1882 C-style cast, a functional-style cast, or a keyword cast.
1884 Does not match implicit conversions.
1886 Note: the name "explicitCast" is chosen to match Clang's terminology, as
1887 Clang uses the term "cast" to apply to implicit conversions as well as to
1888 actual cast expressions.
1890 See also: hasDestinationType.
1892 Example: matches all five of the casts in
1893 int((int)(reinterpret_cast&lt;int&gt;(static_cast&lt;int&gt;(const_cast&lt;int&gt;(42)))))
1894 but does not match the implicit conversion in
1895 long ell = 42;
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('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>
1900 <tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions.
1902 Example matches x()
1903 void f() { x(); }
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('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>
1908 <tr><td colspan="4" class="doc" id="exprWithCleanups0"><pre>Matches expressions that introduce cleanups to be run at the end
1909 of the sub-expression's evaluation.
1911 Example matches std::string()
1912 const std::string str = std::string();
1913 </pre></td></tr>
1916 <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>
1917 <tr><td colspan="4" class="doc" id="fixedPointLiteral0"><pre>Matches fixed point literals
1918 </pre></td></tr>
1921 <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>
1922 <tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes / encodings, e.g.
1923 1.0, 1.0f, 1.0L and 1e10.
1925 Does not match implicit conversions such as
1926 float a = 10;
1927 </pre></td></tr>
1930 <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>
1931 <tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements.
1933 Example matches 'for (;;) {}'
1934 for (;;) {}
1935 int i[] = {1, 2, 3}; for (auto a : i);
1936 </pre></td></tr>
1939 <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>
1940 <tr><td colspan="4" class="doc" id="genericSelectionExpr0"><pre>Matches C11 _Generic expression.
1941 </pre></td></tr>
1944 <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>
1945 <tr><td colspan="4" class="doc" id="gnuNullExpr0"><pre>Matches GNU __null expression.
1946 </pre></td></tr>
1949 <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>
1950 <tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements.
1952 Given
1953 goto FOO;
1954 FOO: bar();
1955 gotoStmt()
1956 matches 'goto FOO'
1957 </pre></td></tr>
1960 <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>
1961 <tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements.
1963 Example matches 'if (x) {}'
1964 if (x) {}
1965 </pre></td></tr>
1968 <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>
1969 <tr><td colspan="4" class="doc" id="imaginaryLiteral0"><pre>Matches imaginary literals, which are based on integer and floating
1970 point literals e.g.: 1i, 1.0i
1971 </pre></td></tr>
1974 <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>
1975 <tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST.
1977 This matches many different places, including function call return value
1978 eliding, as well as any type conversions.
1979 </pre></td></tr>
1982 <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>
1983 <tr><td colspan="4" class="doc" id="implicitValueInitExpr0"><pre>Matches implicit initializers of init list expressions.
1985 Given
1986 point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
1987 implicitValueInitExpr()
1988 matches "[0].y" (implicitly)
1989 </pre></td></tr>
1992 <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>
1993 <tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions.
1995 Given
1996 int a[] = { 1, 2 };
1997 struct B { int x, y; };
1998 B b = { 5, 6 };
1999 initListExpr()
2000 matches "{ 1, 2 }" and "{ 5, 6 }"
2001 </pre></td></tr>
2004 <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>
2005 <tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes / encodings, e.g.
2006 1, 1L, 0x1 and 1U.
2008 Does not match character-encoded integers such as L'a'.
2009 </pre></td></tr>
2012 <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>
2013 <tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements.
2015 Given
2016 goto FOO;
2017 FOO: bar();
2018 labelStmt()
2019 matches 'FOO:'
2020 </pre></td></tr>
2023 <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>
2024 <tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions.
2026 Example matches [&amp;](){return 5;}
2027 [&amp;](){return 5;}
2028 </pre></td></tr>
2031 <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>
2032 <tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized.
2034 Example: Given
2035 struct T {void func();};
2036 T f();
2037 void g(T);
2038 materializeTemporaryExpr() matches 'f()' in these statements
2039 T u(f());
2040 g(f());
2041 f().func();
2042 but does not match
2043 f();
2044 </pre></td></tr>
2047 <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>
2048 <tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions.
2050 Given
2051 class Y {
2052 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
2053 int a; static int b;
2055 memberExpr()
2056 matches this-&gt;x, x, y.x, a, this-&gt;b
2057 </pre></td></tr>
2060 <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>
2061 <tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements.
2063 foo();;
2064 nullStmt()
2065 matches the second ';'
2066 </pre></td></tr>
2069 <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>
2070 <tr><td colspan="4" class="doc" id="objcCatchStmt0"><pre>Matches Objective-C @catch statements.
2072 Example matches @catch
2073 @try {}
2074 @catch (...) {}
2075 </pre></td></tr>
2078 <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>
2079 <tr><td colspan="4" class="doc" id="objcFinallyStmt0"><pre>Matches Objective-C @finally statements.
2081 Example matches @finally
2082 @try {}
2083 @finally {}
2084 </pre></td></tr>
2087 <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>
2088 <tr><td colspan="4" class="doc" id="objcIvarRefExpr0"><pre>Matches a reference to an ObjCIvar.
2090 Example: matches "a" in "init" method:
2091 @implementation A {
2092 NSString *a;
2094 - (void) init {
2095 a = @"hello";
2097 </pre></td></tr>
2100 <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>
2101 <tr><td colspan="4" class="doc" id="objcMessageExpr0"><pre>Matches ObjectiveC Message invocation expressions.
2103 The innermost message send invokes the "alloc" class method on the
2104 NSString class, while the outermost message send invokes the
2105 "initWithString" instance method on the object returned from
2106 NSString's "alloc". This matcher should match both message sends.
2107 [[NSString alloc] initWithString:@"Hello"]
2108 </pre></td></tr>
2111 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('objcStringLiteral0')"><a name="objcStringLiteral0Anchor">objcStringLiteral</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCStringLiteral.html">ObjCStringLiteral</a>&gt;...</td></tr>
2112 <tr><td colspan="4" class="doc" id="objcStringLiteral0"><pre>Matches ObjectiveC String literal expressions.
2114 Example matches @"abcd"
2115 NSString *s = @"abcd";
2116 </pre></td></tr>
2119 <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>
2120 <tr><td colspan="4" class="doc" id="objcThrowStmt0"><pre>Matches Objective-C statements.
2122 Example matches @throw obj;
2123 </pre></td></tr>
2126 <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>
2127 <tr><td colspan="4" class="doc" id="objcTryStmt0"><pre>Matches Objective-C @try statements.
2129 Example matches @try
2130 @try {}
2131 @catch (...) {}
2132 </pre></td></tr>
2135 <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>
2136 <tr><td colspan="4" class="doc" id="ompExecutableDirective0"><pre>Matches any ``#pragma omp`` executable directive.
2138 Given
2140 #pragma omp parallel
2141 #pragma omp parallel default(none)
2142 #pragma omp taskyield
2144 ``ompExecutableDirective()`` matches ``omp parallel``,
2145 ``omp parallel default(none)`` and ``omp taskyield``.
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('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>
2150 <tr><td colspan="4" class="doc" id="opaqueValueExpr0"><pre>Matches opaque value expressions. They are used as helpers
2151 to reference another expressions and can be met
2152 in BinaryConditionalOperators, for example.
2154 Example matches 'a'
2155 (a ?: c) + 42;
2156 </pre></td></tr>
2159 <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>
2160 <tr><td colspan="4" class="doc" id="parenExpr0"><pre>Matches parentheses used in expressions.
2162 Example matches (foo() + 1)
2163 int foo() { return 1; }
2164 int a = (foo() + 1);
2165 </pre></td></tr>
2168 <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>
2169 <tr><td colspan="4" class="doc" id="parenListExpr0"><pre>Matches paren list expressions.
2170 ParenListExprs don't have a predefined type and are used for late parsing.
2171 In the final AST, they can be met in template declarations.
2173 Given
2174 template&lt;typename T&gt; class X {
2175 void f() {
2176 X x(*this);
2177 int a = 0, b = 1; int i = (a, b);
2180 parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
2181 has a predefined type and is a ParenExpr, not a ParenListExpr.
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('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>
2186 <tr><td colspan="4" class="doc" id="predefinedExpr0"><pre>Matches predefined identifier expressions [C99 6.4.2.2].
2188 Example: Matches __func__
2189 printf("%s", __func__);
2190 </pre></td></tr>
2193 <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>
2194 <tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements.
2196 Given
2197 return 1;
2198 returnStmt()
2199 matches 'return 1'
2200 </pre></td></tr>
2203 <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>
2204 <tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements.
2206 Given
2207 { ++a; }
2208 stmt()
2209 matches both the compound statement '{ ++a; }' and '++a'.
2210 </pre></td></tr>
2213 <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>
2214 <tr><td colspan="4" class="doc" id="stmtExpr0"><pre>Matches statement expression (GNU extension).
2216 Example match: ({ int X = 4; X; })
2217 int C = ({ int X = 4; X; });
2218 </pre></td></tr>
2221 <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>
2222 <tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
2224 Example matches "abcd", L"abcd"
2225 char *s = "abcd";
2226 wchar_t *ws = L"abcd";
2227 </pre></td></tr>
2230 <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>
2231 <tr><td colspan="4" class="doc" id="substNonTypeTemplateParmExpr0"><pre>Matches substitutions of non-type template parameters.
2233 Given
2234 template &lt;int N&gt;
2235 struct A { static const int n = N; };
2236 struct B : public A&lt;42&gt; {};
2237 substNonTypeTemplateParmExpr()
2238 matches "N" in the right-hand side of "static const int n = N;"
2239 </pre></td></tr>
2242 <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>
2243 <tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements.
2245 Given
2246 switch(a) { case 42: break; default: break; }
2247 switchCase()
2248 matches 'case 42:' and 'default:'.
2249 </pre></td></tr>
2252 <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>
2253 <tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements.
2255 Given
2256 switch(a) { case 42: break; default: break; }
2257 switchStmt()
2258 matches 'switch(a)'.
2259 </pre></td></tr>
2262 <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>
2263 <tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
2265 Given
2266 Foo x = bar;
2267 int y = sizeof(x) + alignof(x);
2268 unaryExprOrTypeTraitExpr()
2269 matches sizeof(x) and alignof(x)
2270 </pre></td></tr>
2273 <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>
2274 <tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions.
2276 Example matches !a
2277 !a || b
2278 </pre></td></tr>
2281 <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>
2282 <tr><td colspan="4" class="doc" id="unresolvedLookupExpr0"><pre>Matches reference to a name that can be looked up during parsing
2283 but could not be resolved to a specific declaration.
2285 Given
2286 template&lt;typename T&gt;
2287 T foo() { T a; return a; }
2288 template&lt;typename T&gt;
2289 void bar() {
2290 foo&lt;T&gt;();
2292 unresolvedLookupExpr()
2293 matches foo&lt;T&gt;() </pre></td></tr>
2296 <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>
2297 <tr><td colspan="4" class="doc" id="unresolvedMemberExpr0"><pre>Matches unresolved member expressions.
2299 Given
2300 struct X {
2301 template &lt;class T&gt; void f();
2302 void g();
2304 template &lt;class T&gt; void h() { X x; x.f&lt;T&gt;(); x.g(); }
2305 unresolvedMemberExpr()
2306 matches x.f&lt;T&gt;
2307 </pre></td></tr>
2310 <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>
2311 <tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call.
2313 Example match: "foo"_suffix
2314 </pre></td></tr>
2317 <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>
2318 <tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements.
2320 Given
2321 while (true) {}
2322 whileStmt()
2323 matches 'while (true) {}'.
2324 </pre></td></tr>
2327 <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>
2328 <tr><td colspan="4" class="doc" id="templateArgumentLoc0"><pre>Matches template arguments (with location info).
2330 Given
2331 template &lt;typename T&gt; struct C {};
2332 C&lt;int&gt; c;
2333 templateArgumentLoc()
2334 matches 'int' in C&lt;int&gt;.
2335 </pre></td></tr>
2338 <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>
2339 <tr><td colspan="4" class="doc" id="templateArgument0"><pre>Matches template arguments.
2341 Given
2342 template &lt;typename T&gt; struct C {};
2343 C&lt;int&gt; c;
2344 templateArgument()
2345 matches 'int' in C&lt;int&gt;.
2346 </pre></td></tr>
2349 <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>
2350 <tr><td colspan="4" class="doc" id="templateName0"><pre>Matches template name.
2352 Given
2353 template &lt;typename T&gt; class X { };
2354 X&lt;int&gt; xi;
2355 templateName()
2356 matches 'X' in X&lt;int&gt;.
2357 </pre></td></tr>
2360 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('elaboratedTypeLoc0')"><a name="elaboratedTypeLoc0Anchor">elaboratedTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ElaboratedTypeLoc.html">ElaboratedTypeLoc</a>&gt;...</td></tr>
2361 <tr><td colspan="4" class="doc" id="elaboratedTypeLoc0"><pre>Matches C or C++ elaborated `TypeLoc`s.
2363 Given
2364 struct s {};
2365 struct s ss;
2366 elaboratedTypeLoc()
2367 matches the `TypeLoc` of the variable declaration of `ss`.
2368 </pre></td></tr>
2371 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointerTypeLoc0')"><a name="pointerTypeLoc0Anchor">pointerTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1PointerTypeLoc.html">PointerTypeLoc</a>&gt;...</td></tr>
2372 <tr><td colspan="4" class="doc" id="pointerTypeLoc0"><pre>Matches pointer `TypeLoc`s.
2374 Given
2375 int* x;
2376 pointerTypeLoc()
2377 matches `int*`.
2378 </pre></td></tr>
2381 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('qualifiedTypeLoc0')"><a name="qualifiedTypeLoc0Anchor">qualifiedTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualifiedTypeLoc.html">QualifiedTypeLoc</a>&gt;...</td></tr>
2382 <tr><td colspan="4" class="doc" id="qualifiedTypeLoc0"><pre>Matches `QualifiedTypeLoc`s in the clang AST.
2384 Given
2385 const int x = 0;
2386 qualifiedTypeLoc()
2387 matches `const int`.
2388 </pre></td></tr>
2391 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('referenceTypeLoc0')"><a name="referenceTypeLoc0Anchor">referenceTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ReferenceTypeLoc.html">ReferenceTypeLoc</a>&gt;...</td></tr>
2392 <tr><td colspan="4" class="doc" id="referenceTypeLoc0"><pre>Matches reference `TypeLoc`s.
2394 Given
2395 int x = 3;
2396 int&amp; l = x;
2397 int&amp;&amp; r = 3;
2398 referenceTypeLoc()
2399 matches `int&amp;` and `int&amp;&amp;`.
2400 </pre></td></tr>
2403 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td><td class="name" onclick="toggle('templateSpecializationTypeLoc0')"><a name="templateSpecializationTypeLoc0Anchor">templateSpecializationTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationTypeLoc.html">TemplateSpecializationTypeLoc</a>&gt;...</td></tr>
2404 <tr><td colspan="4" class="doc" id="templateSpecializationTypeLoc0"><pre>Matches template specialization `TypeLoc`s.
2406 Given
2407 template &lt;typename T&gt; class C {};
2408 C&lt;char&gt; var;
2409 varDecl(hasTypeLoc(templateSpecializationTypeLoc(typeLoc())))
2410 matches `C&lt;char&gt; var`.
2411 </pre></td></tr>
2414 <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>
2415 <tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST.
2416 </pre></td></tr>
2419 <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>
2420 <tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays.
2422 Given
2423 int a[] = { 2, 3 };
2424 int b[4];
2425 void f() { int c[a[0]]; }
2426 arrayType()
2427 matches "int a[]", "int b[4]" and "int c[a[0]]";
2428 </pre></td></tr>
2431 <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>
2432 <tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types.
2434 Given
2435 _Atomic(int) i;
2436 atomicType()
2437 matches "_Atomic(int) i"
2438 </pre></td></tr>
2441 <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>
2442 <tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types.
2444 Given:
2445 auto n = 4;
2446 int v[] = { 2, 3 }
2447 for (auto i : v) { }
2448 autoType()
2449 matches "auto n" and "auto i"
2450 </pre></td></tr>
2453 <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>
2454 <tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as
2455 "void (^)(int)".
2457 The pointee is always required to be a FunctionType.
2458 </pre></td></tr>
2461 <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>
2462 <tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types.
2464 Given
2465 struct A {};
2466 A a;
2467 int b;
2468 float c;
2469 bool d;
2470 builtinType()
2471 matches "int b", "float c" and "bool d"
2472 </pre></td></tr>
2475 <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>
2476 <tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types.
2478 Given
2479 _Complex float f;
2480 complexType()
2481 matches "_Complex float f"
2482 </pre></td></tr>
2485 <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>
2486 <tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size.
2488 Given
2489 void() {
2490 int a[2];
2491 int b[] = { 2, 3 };
2492 int c[b[0]];
2494 constantArrayType()
2495 matches "int a[2]"
2496 </pre></td></tr>
2499 <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>
2500 <tr><td colspan="4" class="doc" id="decayedType0"><pre>Matches decayed type
2501 Example matches i[] in declaration of f.
2502 (matcher = valueDecl(hasType(decayedType(hasDecayedType(pointerType())))))
2503 Example matches i[1].
2504 (matcher = expr(hasType(decayedType(hasDecayedType(pointerType())))))
2505 void f(int i[]) {
2506 i[1] = 0;
2508 </pre></td></tr>
2511 <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>
2512 <tr><td colspan="4" class="doc" id="decltypeType0"><pre>Matches types nodes representing C++11 decltype(&lt;expr&gt;) types.
2514 Given:
2515 short i = 1;
2516 int j = 42;
2517 decltype(i + j) result = i + j;
2518 decltypeType()
2519 matches "decltype(i + j)"
2520 </pre></td></tr>
2523 <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>
2524 <tr><td colspan="4" class="doc" id="deducedTemplateSpecializationType0"><pre>Matches C++17 deduced template specialization types, e.g. deduced class
2525 template types.
2527 Given
2528 template &lt;typename T&gt;
2529 class C { public: C(T); };
2531 C c(123);
2532 deducedTemplateSpecializationType() matches the type in the declaration
2533 of the variable c.
2534 </pre></td></tr>
2537 <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>
2538 <tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression.
2540 Given
2541 template&lt;typename T, int Size&gt;
2542 class array {
2543 T data[Size];
2545 dependentSizedArrayType()
2546 matches "T data[Size]"
2547 </pre></td></tr>
2550 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('dependentSizedExtVectorType0')"><a name="dependentSizedExtVectorType0Anchor">dependentSizedExtVectorType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DependentSizedExtVectorType.html">DependentSizedExtVectorType</a>&gt;...</td></tr>
2551 <tr><td colspan="4" class="doc" id="dependentSizedExtVectorType0"><pre>Matches C++ extended vector type where either the type or size is
2552 dependent.
2554 Given
2555 template&lt;typename T, int Size&gt;
2556 class vector {
2557 typedef T __attribute__((ext_vector_type(Size))) type;
2559 dependentSizedExtVectorType()
2560 matches "T __attribute__((ext_vector_type(Size)))"
2561 </pre></td></tr>
2564 <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>
2565 <tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a
2566 qualified name.
2568 Given
2569 namespace N {
2570 namespace M {
2571 class D {};
2574 class C {};
2576 class C c;
2577 N::M::D d;
2579 elaboratedType() matches the type of the variable declarations of both
2580 c and d.
2581 </pre></td></tr>
2584 <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>
2585 <tr><td colspan="4" class="doc" id="enumType0"><pre>Matches enum types.
2587 Given
2588 enum C { Green };
2589 enum class S { Red };
2591 C c;
2592 S s;
2594 enumType() matches the type of the variable declarations of both c and
2596 </pre></td></tr>
2599 <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>
2600 <tr><td colspan="4" class="doc" id="functionProtoType0"><pre>Matches FunctionProtoType nodes.
2602 Given
2603 int (*f)(int);
2604 void g();
2605 functionProtoType()
2606 matches "int (*f)(int)" and the type of "g" in C++ mode.
2607 In C mode, "g" is not matched because it does not contain a prototype.
2608 </pre></td></tr>
2611 <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>
2612 <tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes.
2614 Given
2615 int (*f)(int);
2616 void g();
2617 functionType()
2618 matches "int (*f)(int)" and the type of "g".
2619 </pre></td></tr>
2622 <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>
2623 <tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size.
2625 Given
2626 int a[] = { 2, 3 };
2627 int b[42];
2628 void f(int c[]) { int d[a[0]]; };
2629 incompleteArrayType()
2630 matches "int a[]" and "int c[]"
2631 </pre></td></tr>
2634 <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>
2635 <tr><td colspan="4" class="doc" id="injectedClassNameType0"><pre>Matches injected class name types.
2637 Example matches S s, but not S&lt;T&gt; s.
2638 (matcher = parmVarDecl(hasType(injectedClassNameType())))
2639 template &lt;typename T&gt; struct S {
2640 void f(S s);
2641 void g(S&lt;T&gt; s);
2643 </pre></td></tr>
2646 <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>
2647 <tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types.
2649 Given:
2650 int *a;
2651 int &amp;b = *a;
2652 int &amp;&amp;c = 1;
2653 auto &amp;d = b;
2654 auto &amp;&amp;e = c;
2655 auto &amp;&amp;f = 2;
2656 int g = 5;
2658 lValueReferenceType() matches the types of b, d, and e. e is
2659 matched since the type is deduced as int&amp; by reference collapsing rules.
2660 </pre></td></tr>
2663 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('macroQualifiedType0')"><a name="macroQualifiedType0Anchor">macroQualifiedType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1MacroQualifiedType.html">MacroQualifiedType</a>&gt;...</td></tr>
2664 <tr><td colspan="4" class="doc" id="macroQualifiedType0"><pre>Matches qualified types when the qualifier is applied via a macro.
2666 Given
2667 #define CDECL __attribute__((cdecl))
2668 typedef void (CDECL *X)();
2669 typedef void (__attribute__((cdecl)) *Y)();
2670 macroQualifiedType()
2671 matches the type of the typedef declaration of X but not Y.
2672 </pre></td></tr>
2675 <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>
2676 <tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types.
2677 Given
2678 struct A { int i; }
2679 A::* ptr = A::i;
2680 memberPointerType()
2681 matches "A::* ptr"
2682 </pre></td></tr>
2685 <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>
2686 <tr><td colspan="4" class="doc" id="objcObjectPointerType0"><pre>Matches an Objective-C object pointer type, which is different from
2687 a pointer type, despite being syntactically similar.
2689 Given
2690 int *a;
2692 @interface Foo
2693 @end
2694 Foo *f;
2695 pointerType()
2696 matches "Foo *f", but does not match "int *a".
2697 </pre></td></tr>
2700 <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>
2701 <tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes.
2703 Given
2704 int (*ptr_to_array)[4];
2705 int *array_of_ptrs[4];
2707 varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
2708 array_of_ptrs.
2709 </pre></td></tr>
2712 <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>
2713 <tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types, but does not match Objective-C object pointer
2714 types.
2716 Given
2717 int *a;
2718 int &amp;b = *a;
2719 int c = 5;
2721 @interface Foo
2722 @end
2723 Foo *f;
2724 pointerType()
2725 matches "int *a", but does not match "Foo *f".
2726 </pre></td></tr>
2729 <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>
2730 <tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types.
2732 Given:
2733 int *a;
2734 int &amp;b = *a;
2735 int &amp;&amp;c = 1;
2736 auto &amp;d = b;
2737 auto &amp;&amp;e = c;
2738 auto &amp;&amp;f = 2;
2739 int g = 5;
2741 rValueReferenceType() matches the types of c and f. e is not
2742 matched as it is deduced to int&amp; by reference collapsing rules.
2743 </pre></td></tr>
2746 <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>
2747 <tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes).
2749 Given
2750 class C {};
2751 struct S {};
2753 C c;
2754 S s;
2756 recordType() matches the type of the variable declarations of both c
2757 and s.
2758 </pre></td></tr>
2761 <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>
2762 <tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types.
2764 Given
2765 int *a;
2766 int &amp;b = *a;
2767 int &amp;&amp;c = 1;
2768 auto &amp;d = b;
2769 auto &amp;&amp;e = c;
2770 auto &amp;&amp;f = 2;
2771 int g = 5;
2773 referenceType() matches the types of b, c, d, e, and f.
2774 </pre></td></tr>
2777 <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>
2778 <tr><td colspan="4" class="doc" id="substTemplateTypeParmType0"><pre>Matches types that represent the result of substituting a type for a
2779 template type parameter.
2781 Given
2782 template &lt;typename T&gt;
2783 void F(T t) {
2784 int i = 1 + t;
2787 substTemplateTypeParmType() matches the type of 't' but not '1'
2788 </pre></td></tr>
2791 <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>
2792 <tr><td colspan="4" class="doc" id="tagType0"><pre>Matches tag types (record and enum types).
2794 Given
2795 enum E {};
2796 class C {};
2798 E e;
2799 C c;
2801 tagType() matches the type of the variable declarations of both e
2802 and c.
2803 </pre></td></tr>
2806 <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>
2807 <tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types.
2809 Given
2810 template &lt;typename T&gt;
2811 class C { };
2813 template class C&lt;int&gt;; // A
2814 C&lt;char&gt; var; // B
2816 templateSpecializationType() matches the type of the explicit
2817 instantiation in A and the type of the variable declaration in B.
2818 </pre></td></tr>
2821 <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>
2822 <tr><td colspan="4" class="doc" id="templateTypeParmType0"><pre>Matches template type parameter types.
2824 Example matches T, but not int.
2825 (matcher = templateTypeParmType())
2826 template &lt;typename T&gt; void f(int i);
2827 </pre></td></tr>
2830 <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>
2831 <tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST.
2832 </pre></td></tr>
2835 <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>
2836 <tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types.
2838 Given
2839 typedef int X;
2840 typedefType()
2841 matches "typedef int X"
2842 </pre></td></tr>
2845 <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>
2846 <tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations.
2848 Given:
2849 typedef __underlying_type(T) type;
2850 unaryTransformType()
2851 matches "__underlying_type(T)"
2852 </pre></td></tr>
2855 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td><td class="name" onclick="toggle('usingType0')"><a name="usingType0Anchor">usingType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UsingType.html">UsingType</a>&gt;...</td></tr>
2856 <tr><td colspan="4" class="doc" id="usingType0"><pre>Matches types specified through a using declaration.
2858 Given
2859 namespace a { struct S {}; }
2860 using a::S;
2861 S s;
2863 usingType() matches the type of the variable declaration of s.
2864 </pre></td></tr>
2867 <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>
2868 <tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an
2869 integer-constant-expression.
2871 Given
2872 void f() {
2873 int a[] = { 2, 3 }
2874 int b[42];
2875 int c[a[0]];
2877 variableArrayType()
2878 matches "int c[a[0]]"
2879 </pre></td></tr>
2881 <!--END_DECL_MATCHERS -->
2882 </table>
2884 <!-- ======================================================================= -->
2885 <h2 id="narrowing-matchers">Narrowing Matchers</h2>
2886 <!-- ======================================================================= -->
2888 <p>Narrowing matchers match certain attributes on the current node, thus
2889 narrowing down the set of nodes of the current type to match on.</p>
2891 <p>There are special logical narrowing matchers (allOf, anyOf, anything and unless)
2892 which allow users to create more powerful match expressions.</p>
2894 <table>
2895 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
2896 <!-- START_NARROWING_MATCHERS -->
2898 <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>
2899 <tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match.
2901 Usable as: Any Matcher
2902 </pre></td></tr>
2905 <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>
2906 <tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches.
2908 Usable as: Any Matcher
2909 </pre></td></tr>
2912 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr>
2913 <tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node.
2915 Useful when another matcher requires a child matcher, but there's no
2916 additional constraint. This will often be used with an explicit conversion
2917 to an internal::Matcher&lt;&gt; type such as TypeMatcher.
2919 Example: DeclarationMatcher(anything()) matches all declarations, e.g.,
2920 "int* p" and "void f()" in
2921 int* p;
2922 void f();
2924 Usable as: Any Matcher
2925 </pre></td></tr>
2928 <tr><td><em>unspecified</em></td><td class="name" onclick="toggle('mapAnyOf0')"><a name="mapAnyOf0Anchor">mapAnyOf</a></td><td>nodeMatcherFunction...</td></tr>
2929 <tr><td colspan="4" class="doc" id="mapAnyOf0"><pre>Matches any of the NodeMatchers with InnerMatchers nested within
2931 Given
2932 if (true);
2933 for (; true; );
2934 with the matcher
2935 mapAnyOf(ifStmt, forStmt).with(
2936 hasCondition(cxxBoolLiteralExpr(equals(true)))
2937 ).bind("trueCond")
2938 matches the if and the for. It is equivalent to:
2939 auto trueCond = hasCondition(cxxBoolLiteralExpr(equals(true)));
2940 anyOf(
2941 ifStmt(trueCond).bind("trueCond"),
2942 forStmt(trueCond).bind("trueCond")
2945 The with() chain-call accepts zero or more matchers which are combined
2946 as-if with allOf() in each of the node matchers.
2947 Usable as: Any Matcher
2948 </pre></td></tr>
2951 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher&lt;*&gt;</td></tr>
2952 <tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match.
2954 Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
2955 class X {};
2956 class Y {};
2958 Usable as: Any Matcher
2959 </pre></td></tr>
2962 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Attr.html">Attr</a>&gt;</td><td class="name" onclick="toggle('isImplicit1')"><a name="isImplicit1Anchor">isImplicit</a></td><td></td></tr>
2963 <tr><td colspan="4" class="doc" id="isImplicit1"><pre>Matches an entity that has been implicitly added by the compiler (e.g.
2964 implicit default/copy constructors).
2965 </pre></td></tr>
2968 <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>
2969 <tr><td colspan="4" class="doc" id="hasAnyOperatorName0"><pre>Matches operator expressions (binary or unary) that have any of the
2970 specified names.
2972 hasAnyOperatorName("+", "-")
2973 Is equivalent to
2974 anyOf(hasOperatorName("+"), hasOperatorName("-"))
2975 </pre></td></tr>
2978 <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>
2979 <tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions and fold expressions
2980 (binary or unary).
2982 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
2983 !(a || b)
2985 Example matches `(0 + ... + args)`
2986 (matcher = cxxFoldExpr(hasOperatorName("+")))
2987 template &lt;typename... Args&gt;
2988 auto sum(Args... args) {
2989 return (0 + ... + args);
2991 </pre></td></tr>
2994 <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>
2995 <tr><td colspan="4" class="doc" id="isAssignmentOperator0"><pre>Matches all kinds of assignment operators.
2997 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2998 if (a == b)
2999 a += b;
3001 Example 2: matches s1 = s2
3002 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
3003 struct S { S&amp; operator=(const S&amp;); };
3004 void x() { S s1, s2; s1 = s2; }
3005 </pre></td></tr>
3008 <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>
3009 <tr><td colspan="4" class="doc" id="isComparisonOperator0"><pre>Matches comparison operators.
3011 Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
3012 if (a == b)
3013 a += b;
3015 Example 2: matches s1 &lt; s2
3016 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
3017 struct S { bool operator&lt;(const S&amp; other); };
3018 void x(S s1, S s2) { bool b1 = s1 &lt; s2; }
3019 </pre></td></tr>
3022 <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>
3023 <tr><td colspan="4" class="doc" id="isPrivate1"><pre>Matches private C++ declarations and C++ base specifers that specify private
3024 inheritance.
3026 Examples:
3027 class C {
3028 public: int a;
3029 protected: int b;
3030 private: int c; // fieldDecl(isPrivate()) matches 'c'
3033 struct Base {};
3034 struct Derived1 : private Base {}; // matches 'Base'
3035 class Derived2 : Base {}; // matches 'Base'
3036 </pre></td></tr>
3039 <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>
3040 <tr><td colspan="4" class="doc" id="isProtected1"><pre>Matches protected C++ declarations and C++ base specifers that specify
3041 protected inheritance.
3043 Examples:
3044 class C {
3045 public: int a;
3046 protected: int b; // fieldDecl(isProtected()) matches 'b'
3047 private: int c;
3050 class Base {};
3051 class Derived : protected Base {}; // matches 'Base'
3052 </pre></td></tr>
3055 <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>
3056 <tr><td colspan="4" class="doc" id="isPublic1"><pre>Matches public C++ declarations and C++ base specifers that specify public
3057 inheritance.
3059 Examples:
3060 class C {
3061 public: int a; // fieldDecl(isPublic()) matches 'a'
3062 protected: int b;
3063 private: int c;
3066 class Base {};
3067 class Derived1 : public Base {}; // matches 'Base'
3068 struct Derived2 : Base {}; // matches 'Base'
3069 </pre></td></tr>
3072 <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>
3073 <tr><td colspan="4" class="doc" id="isVirtual1"><pre>Matches declarations of virtual methods and C++ base specifers that specify
3074 virtual inheritance.
3076 Example:
3077 class A {
3078 public:
3079 virtual void x(); // matches x
3082 Example:
3083 class Base {};
3084 class DirectlyDerived : virtual Base {}; // matches Base
3085 class IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
3087 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;
3088 </pre></td></tr>
3091 <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>
3092 <tr><td colspan="4" class="doc" id="equals5"><pre></pre></td></tr>
3095 <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>
3096 <tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value of type ValueT.
3098 Given
3099 f('false, 3.14, 42);
3100 characterLiteral(equals(0))
3101 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
3102 match false
3103 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
3104 match 3.14
3105 integerLiteral(equals(42))
3106 matches 42
3108 Note that you cannot directly match a negative numeric literal because the
3109 minus sign is not part of the literal: It is a unary operator whose operand
3110 is the positive numeric literal. Instead, you must use a unaryOperator()
3111 matcher to match the minus sign:
3113 unaryOperator(hasOperatorName("-"),
3114 hasUnaryOperand(integerLiteral(equals(13))))
3116 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;,
3117 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;
3118 </pre></td></tr>
3121 <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>
3122 <tr><td colspan="4" class="doc" id="equals11"><pre></pre></td></tr>
3125 <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>
3126 <tr><td colspan="4" class="doc" id="equals8"><pre></pre></td></tr>
3129 <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>
3130 <tr><td colspan="4" class="doc" id="isCatchAll0"><pre>Matches a C++ catch statement that has a catch-all handler.
3132 Given
3133 try {
3134 // ...
3135 } catch (int) {
3136 // ...
3137 } catch (...) {
3138 // ...
3140 cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
3141 </pre></td></tr>
3144 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountAtLeast1')"><a name="argumentCountAtLeast1Anchor">argumentCountAtLeast</a></td><td>unsigned N</td></tr>
3145 <tr><td colspan="4" class="doc" id="argumentCountAtLeast1"><pre>Checks that a call expression or a constructor call expression has at least
3146 the specified number of arguments (including absent default arguments).
3148 Example matches f(0, 0) and g(0, 0, 0)
3149 (matcher = callExpr(argumentCountAtLeast(2)))
3150 void f(int x, int y);
3151 void g(int x, int y, int z);
3152 f(0, 0);
3153 g(0, 0, 0);
3154 </pre></td></tr>
3157 <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>
3158 <tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has
3159 a specific number of arguments (including absent default arguments).
3161 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3162 void f(int x, int y);
3163 f(0, 0);
3164 </pre></td></tr>
3167 <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>
3168 <tr><td colspan="4" class="doc" id="isListInitialization0"><pre>Matches a constructor call expression which uses list initialization.
3169 </pre></td></tr>
3172 <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>
3173 <tr><td colspan="4" class="doc" id="requiresZeroInitialization0"><pre>Matches a constructor call expression which requires
3174 zero initialization.
3176 Given
3177 void foo() {
3178 struct point { double x; double y; };
3179 point pt[2] = { { 1.0, 2.0 } };
3181 initListExpr(has(cxxConstructExpr(requiresZeroInitialization()))
3182 will match the implicit array filler for pt[1].
3183 </pre></td></tr>
3186 <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>
3187 <tr><td colspan="4" class="doc" id="isCopyConstructor0"><pre>Matches constructor declarations that are copy constructors.
3189 Given
3190 struct S {
3191 S(); // #1
3192 S(const S &amp;); // #2
3193 S(S &amp;&amp;); // #3
3195 cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3.
3196 </pre></td></tr>
3199 <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>
3200 <tr><td colspan="4" class="doc" id="isDefaultConstructor0"><pre>Matches constructor declarations that are default constructors.
3202 Given
3203 struct S {
3204 S(); // #1
3205 S(const S &amp;); // #2
3206 S(S &amp;&amp;); // #3
3208 cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3.
3209 </pre></td></tr>
3212 <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>
3213 <tr><td colspan="4" class="doc" id="isDelegatingConstructor0"><pre>Matches constructors that delegate to another constructor.
3215 Given
3216 struct S {
3217 S(); // #1
3218 S(int) {} // #2
3219 S(S &amp;&amp;) : S() {} // #3
3221 S::S() : S(0) {} // #4
3222 cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not
3223 #1 or #2.
3224 </pre></td></tr>
3227 <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>
3228 <tr><td colspan="4" class="doc" id="isExplicit0"><pre>Matches constructor, conversion function, and deduction guide declarations
3229 that have an explicit specifier if this explicit specifier is resolved to
3230 true.
3232 Given
3233 template&lt;bool b&gt;
3234 struct S {
3235 S(int); // #1
3236 explicit S(double); // #2
3237 operator int(); // #3
3238 explicit operator bool(); // #4
3239 explicit(false) S(bool) // # 7
3240 explicit(true) S(char) // # 8
3241 explicit(b) S(S) // # 9
3243 S(int) -&gt; S&lt;true&gt; // #5
3244 explicit S(double) -&gt; S&lt;false&gt; // #6
3245 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
3246 cxxConversionDecl(isExplicit()) will match #4, but not #3.
3247 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
3248 </pre></td></tr>
3251 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;</td><td class="name" onclick="toggle('isInheritingConstructor0')"><a name="isInheritingConstructor0Anchor">isInheritingConstructor</a></td><td></td></tr>
3252 <tr><td colspan="4" class="doc" id="isInheritingConstructor0"><pre></pre></td></tr>
3255 <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>
3256 <tr><td colspan="4" class="doc" id="isMoveConstructor0"><pre>Matches constructor declarations that are move constructors.
3258 Given
3259 struct S {
3260 S(); // #1
3261 S(const S &amp;); // #2
3262 S(S &amp;&amp;); // #3
3264 cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2.
3265 </pre></td></tr>
3268 <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>
3269 <tr><td colspan="4" class="doc" id="isExplicit1"><pre>Matches constructor, conversion function, and deduction guide declarations
3270 that have an explicit specifier if this explicit specifier is resolved to
3271 true.
3273 Given
3274 template&lt;bool b&gt;
3275 struct S {
3276 S(int); // #1
3277 explicit S(double); // #2
3278 operator int(); // #3
3279 explicit operator bool(); // #4
3280 explicit(false) S(bool) // # 7
3281 explicit(true) S(char) // # 8
3282 explicit(b) S(S) // # 9
3284 S(int) -&gt; S&lt;true&gt; // #5
3285 explicit S(double) -&gt; S&lt;false&gt; // #6
3286 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
3287 cxxConversionDecl(isExplicit()) will match #4, but not #3.
3288 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
3289 </pre></td></tr>
3292 <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>
3293 <tr><td colspan="4" class="doc" id="isBaseInitializer0"><pre>Matches a constructor initializer if it is initializing a base, as
3294 opposed to a member.
3296 Given
3297 struct B {};
3298 struct D : B {
3299 int I;
3300 D(int i) : I(i) {}
3302 struct E : B {
3303 E() : B() {}
3305 cxxConstructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
3306 will match E(), but not match D(int).
3307 </pre></td></tr>
3310 <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>
3311 <tr><td colspan="4" class="doc" id="isMemberInitializer0"><pre>Matches a constructor initializer if it is initializing a member, as
3312 opposed to a base.
3314 Given
3315 struct B {};
3316 struct D : B {
3317 int I;
3318 D(int i) : I(i) {}
3320 struct E : B {
3321 E() : B() {}
3323 cxxConstructorDecl(hasAnyConstructorInitializer(isMemberInitializer()))
3324 will match D(int), but not match E().
3325 </pre></td></tr>
3328 <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>
3329 <tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in
3330 code (as opposed to implicitly added by the compiler).
3332 Given
3333 struct Foo {
3334 Foo() { }
3335 Foo(int) : foo_("A") { }
3336 string foo_;
3338 cxxConstructorDecl(hasAnyConstructorInitializer(isWritten()))
3339 will match Foo(int), but not Foo()
3340 </pre></td></tr>
3343 <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>
3344 <tr><td colspan="4" class="doc" id="isExplicit2"><pre>Matches constructor, conversion function, and deduction guide declarations
3345 that have an explicit specifier if this explicit specifier is resolved to
3346 true.
3348 Given
3349 template&lt;bool b&gt;
3350 struct S {
3351 S(int); // #1
3352 explicit S(double); // #2
3353 operator int(); // #3
3354 explicit operator bool(); // #4
3355 explicit(false) S(bool) // # 7
3356 explicit(true) S(char) // # 8
3357 explicit(b) S(S) // # 9
3359 S(int) -&gt; S&lt;true&gt; // #5
3360 explicit S(double) -&gt; S&lt;false&gt; // #6
3361 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
3362 cxxConversionDecl(isExplicit()) will match #4, but not #3.
3363 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
3364 </pre></td></tr>
3367 <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>
3368 <tr><td colspan="4" class="doc" id="hasMemberName0"><pre>Matches template-dependent, but known, member names.
3370 In template declarations, dependent members are not resolved and so can
3371 not be matched to particular named declarations.
3373 This matcher allows to match on the known name of members.
3375 Given
3376 template &lt;typename T&gt;
3377 struct S {
3378 void mem();
3380 template &lt;typename T&gt;
3381 void x() {
3382 S&lt;T&gt; s;
3383 s.mem();
3385 cxxDependentScopeMemberExpr(hasMemberName("mem")) matches `s.mem()`
3386 </pre></td></tr>
3389 <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>
3390 <tr><td colspan="4" class="doc" id="isArrow2"><pre>Matches member expressions that are called with '-&gt;' as opposed
3391 to '.'.
3393 Member calls on the implicit this pointer match as called with '-&gt;'.
3395 Given
3396 class Y {
3397 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
3398 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
3399 int a;
3400 static int b;
3402 template &lt;class T&gt;
3403 class Z {
3404 void x() { this-&gt;m; }
3406 memberExpr(isArrow())
3407 matches this-&gt;x, x, y.x, a, this-&gt;b
3408 cxxDependentScopeMemberExpr(isArrow())
3409 matches this-&gt;m
3410 unresolvedMemberExpr(isArrow())
3411 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
3412 </pre></td></tr>
3415 <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>
3416 <tr><td colspan="4" class="doc" id="memberHasSameNameAsBoundNode0"><pre>Matches template-dependent, but known, member names against an already-bound
3417 node
3419 In template declarations, dependent members are not resolved and so can
3420 not be matched to particular named declarations.
3422 This matcher allows to match on the name of already-bound VarDecl, FieldDecl
3423 and CXXMethodDecl nodes.
3425 Given
3426 template &lt;typename T&gt;
3427 struct S {
3428 void mem();
3430 template &lt;typename T&gt;
3431 void x() {
3432 S&lt;T&gt; s;
3433 s.mem();
3435 The matcher
3436 @code
3437 cxxDependentScopeMemberExpr(
3438 hasObjectExpression(declRefExpr(hasType(templateSpecializationType(
3439 hasDeclaration(classTemplateDecl(has(cxxRecordDecl(has(
3440 cxxMethodDecl(hasName("mem")).bind("templMem")
3441 )))))
3442 )))),
3443 memberHasSameNameAsBoundNode("templMem")
3445 @endcode
3446 first matches and binds the @c mem member of the @c S template, then
3447 compares its name to the usage in @c s.mem() in the @c x function template
3448 </pre></td></tr>
3451 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;</td><td class="name" onclick="toggle('hasOperatorName3')"><a name="hasOperatorName3Anchor">hasOperatorName</a></td><td>std::string Name</td></tr>
3452 <tr><td colspan="4" class="doc" id="hasOperatorName3"><pre>Matches the operator Name of operator expressions and fold expressions
3453 (binary or unary).
3455 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3456 !(a || b)
3458 Example matches `(0 + ... + args)`
3459 (matcher = cxxFoldExpr(hasOperatorName("+")))
3460 template &lt;typename... Args&gt;
3461 auto sum(Args... args) {
3462 return (0 + ... + args);
3464 </pre></td></tr>
3467 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;</td><td class="name" onclick="toggle('isBinaryFold0')"><a name="isBinaryFold0Anchor">isBinaryFold</a></td><td></td></tr>
3468 <tr><td colspan="4" class="doc" id="isBinaryFold0"><pre>Matches binary fold expressions, i.e. fold expressions with an initializer.
3470 Example matches `(0 + ... + args)`
3471 (matcher = cxxFoldExpr(isBinaryFold()))
3472 template &lt;typename... Args&gt;
3473 auto sum(Args... args) {
3474 return (0 + ... + args);
3477 template &lt;typename... Args&gt;
3478 auto multiply(Args... args) {
3479 return (args * ...);
3481 </pre></td></tr>
3484 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;</td><td class="name" onclick="toggle('isLeftFold0')"><a name="isLeftFold0Anchor">isLeftFold</a></td><td></td></tr>
3485 <tr><td colspan="4" class="doc" id="isLeftFold0"><pre>Matches left-folding fold expressions.
3487 Example matches `(0 + ... + args)`
3488 (matcher = cxxFoldExpr(isLeftFold()))
3489 template &lt;typename... Args&gt;
3490 auto sum(Args... args) {
3491 return (0 + ... + args);
3494 template &lt;typename... Args&gt;
3495 auto multiply(Args... args) {
3496 return (args * ... * 1);
3498 </pre></td></tr>
3501 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;</td><td class="name" onclick="toggle('isRightFold0')"><a name="isRightFold0Anchor">isRightFold</a></td><td></td></tr>
3502 <tr><td colspan="4" class="doc" id="isRightFold0"><pre>Matches right-folding fold expressions.
3504 Example matches `(args * ... * 1)`
3505 (matcher = cxxFoldExpr(isRightFold()))
3506 template &lt;typename... Args&gt;
3507 auto sum(Args... args) {
3508 return (0 + ... + args);
3511 template &lt;typename... Args&gt;
3512 auto multiply(Args... args) {
3513 return (args * ... * 1);
3515 </pre></td></tr>
3518 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;</td><td class="name" onclick="toggle('isUnaryFold0')"><a name="isUnaryFold0Anchor">isUnaryFold</a></td><td></td></tr>
3519 <tr><td colspan="4" class="doc" id="isUnaryFold0"><pre>Matches unary fold expressions, i.e. fold expressions without an
3520 initializer.
3522 Example matches `(args * ...)`
3523 (matcher = cxxFoldExpr(isUnaryFold()))
3524 template &lt;typename... Args&gt;
3525 auto sum(Args... args) {
3526 return (0 + ... + args);
3529 template &lt;typename... Args&gt;
3530 auto multiply(Args... args) {
3531 return (args * ...);
3533 </pre></td></tr>
3536 <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>
3537 <tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
3539 Given
3540 struct A {
3541 void foo() const;
3542 void bar();
3545 cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
3546 </pre></td></tr>
3549 <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>
3550 <tr><td colspan="4" class="doc" id="isCopyAssignmentOperator0"><pre>Matches if the given method declaration declares a copy assignment
3551 operator.
3553 Given
3554 struct A {
3555 A &amp;operator=(const A &amp;);
3556 A &amp;operator=(A &amp;&amp;);
3559 cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
3560 the second one.
3561 </pre></td></tr>
3564 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('isExplicitObjectMemberFunction0')"><a name="isExplicitObjectMemberFunction0Anchor">isExplicitObjectMemberFunction</a></td><td></td></tr>
3565 <tr><td colspan="4" class="doc" id="isExplicitObjectMemberFunction0"><pre>Matches if the given method declaration declares a member function with an
3566 explicit object parameter.
3568 Given
3569 struct A {
3570 int operator-(this A, int);
3571 void fun(this A &amp;&amp;self);
3572 static int operator()(int);
3573 int operator+(int);
3576 cxxMethodDecl(isExplicitObjectMemberFunction()) matches the first two
3577 methods but not the last two.
3578 </pre></td></tr>
3581 <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>
3582 <tr><td colspan="4" class="doc" id="isFinal1"><pre>Matches if the given method or class declaration is final.
3584 Given:
3585 class A final {};
3587 struct B {
3588 virtual void f();
3591 struct C : B {
3592 void f() final;
3594 matches A and C::f, but not B, C, or B::f
3595 </pre></td></tr>
3598 <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>
3599 <tr><td colspan="4" class="doc" id="isMoveAssignmentOperator0"><pre>Matches if the given method declaration declares a move assignment
3600 operator.
3602 Given
3603 struct A {
3604 A &amp;operator=(const A &amp;);
3605 A &amp;operator=(A &amp;&amp;);
3608 cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
3609 the first one.
3610 </pre></td></tr>
3613 <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>
3614 <tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
3616 Given
3617 class A {
3618 public:
3619 virtual void x();
3621 class B : public A {
3622 public:
3623 virtual void x();
3625 matches B::x
3626 </pre></td></tr>
3629 <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>
3630 <tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure.
3632 Given
3633 class A {
3634 public:
3635 virtual void x() = 0;
3637 matches A::x
3638 </pre></td></tr>
3641 <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>
3642 <tr><td colspan="4" class="doc" id="isUserProvided0"><pre>Matches method declarations that are user-provided.
3644 Given
3645 struct S {
3646 S(); // #1
3647 S(const S &amp;) = default; // #2
3648 S(S &amp;&amp;) = delete; // #3
3650 cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3.
3651 </pre></td></tr>
3654 <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>
3655 <tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches declarations of virtual methods and C++ base specifers that specify
3656 virtual inheritance.
3658 Example:
3659 class A {
3660 public:
3661 virtual void x(); // matches x
3664 Example:
3665 class Base {};
3666 class DirectlyDerived : virtual Base {}; // matches Base
3667 class IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
3669 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;
3670 </pre></td></tr>
3673 <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>
3674 <tr><td colspan="4" class="doc" id="isVirtualAsWritten0"><pre>Matches if the given method declaration has an explicit "virtual".
3676 Given
3677 class A {
3678 public:
3679 virtual void x();
3681 class B : public A {
3682 public:
3683 void x();
3685 matches A::x but not B::x
3686 </pre></td></tr>
3689 <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>
3690 <tr><td colspan="4" class="doc" id="isArray0"><pre>Matches array new expressions.
3692 Given:
3693 MyClass *p1 = new MyClass[10];
3694 cxxNewExpr(isArray())
3695 matches the expression 'new MyClass[10]'.
3696 </pre></td></tr>
3699 <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>
3700 <tr><td colspan="4" class="doc" id="hasAnyOperatorName1"><pre>Matches operator expressions (binary or unary) that have any of the
3701 specified names.
3703 hasAnyOperatorName("+", "-")
3704 Is equivalent to
3705 anyOf(hasOperatorName("+"), hasOperatorName("-"))
3706 </pre></td></tr>
3709 <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>
3710 <tr><td colspan="4" class="doc" id="hasAnyOverloadedOperatorName0"><pre>Matches overloaded operator names.
3712 Matches overloaded operator names specified in strings without the
3713 "operator" prefix: e.g. "&lt;&lt;".
3715 hasAnyOverloadedOperatorName("+", "-")
3716 Is equivalent to
3717 anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-"))
3718 </pre></td></tr>
3721 <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>
3722 <tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions and fold expressions
3723 (binary or unary).
3725 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3726 !(a || b)
3728 Example matches `(0 + ... + args)`
3729 (matcher = cxxFoldExpr(hasOperatorName("+")))
3730 template &lt;typename... Args&gt;
3731 auto sum(Args... args) {
3732 return (0 + ... + args);
3734 </pre></td></tr>
3737 <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>
3738 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
3740 Matches overloaded operator names specified in strings without the
3741 "operator" prefix: e.g. "&lt;&lt;".
3743 Given:
3744 class A { int operator*(); };
3745 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
3746 A a;
3747 a &lt;&lt; a; // &lt;-- This matches
3749 cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
3750 specified line and
3751 cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
3752 matches the declaration of A.
3754 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;
3755 </pre></td></tr>
3758 <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>
3759 <tr><td colspan="4" class="doc" id="isAssignmentOperator1"><pre>Matches all kinds of assignment operators.
3761 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
3762 if (a == b)
3763 a += b;
3765 Example 2: matches s1 = s2
3766 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
3767 struct S { S&amp; operator=(const S&amp;); };
3768 void x() { S s1, s2; s1 = s2; }
3769 </pre></td></tr>
3772 <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>
3773 <tr><td colspan="4" class="doc" id="isComparisonOperator1"><pre>Matches comparison operators.
3775 Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
3776 if (a == b)
3777 a += b;
3779 Example 2: matches s1 &lt; s2
3780 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
3781 struct S { bool operator&lt;(const S&amp; other); };
3782 void x(S s1, S s2) { bool b1 = s1 &lt; s2; }
3783 </pre></td></tr>
3786 <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>
3787 <tr><td colspan="4" class="doc" id="hasDefinition0"><pre>Matches a class declaration that is defined.
3789 Example matches x (matcher = cxxRecordDecl(hasDefinition()))
3790 class x {};
3791 class y;
3792 </pre></td></tr>
3795 <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>
3796 <tr><td colspan="4" class="doc" id="isDerivedFrom2"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
3797 </pre></td></tr>
3800 <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>
3801 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom2"><pre>Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
3802 </pre></td></tr>
3805 <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>
3806 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
3807 static member variable template instantiations.
3809 Given
3810 template&lt;typename T&gt; void A(T t) { }
3811 template&lt;&gt; void A(int N) { }
3812 functionDecl(isExplicitTemplateSpecialization())
3813 matches the specialization A&lt;int&gt;().
3815 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;
3816 </pre></td></tr>
3819 <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>
3820 <tr><td colspan="4" class="doc" id="isFinal0"><pre>Matches if the given method or class declaration is final.
3822 Given:
3823 class A final {};
3825 struct B {
3826 virtual void f();
3829 struct C : B {
3830 void f() final;
3832 matches A and C::f, but not B, C, or B::f
3833 </pre></td></tr>
3836 <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>
3837 <tr><td colspan="4" class="doc" id="isLambda0"><pre>Matches the generated class of lambda expressions.
3839 Given:
3840 auto x = []{};
3842 cxxRecordDecl(isLambda()) matches the implicit class declaration of
3843 decltype(x)
3844 </pre></td></tr>
3847 <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>
3848 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom2"><pre>Overloaded method as shortcut for
3849 isSameOrDerivedFrom(hasName(...)).
3850 </pre></td></tr>
3853 <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>
3854 <tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
3855 member variable template instantiations.
3857 Given
3858 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
3860 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
3862 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
3863 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3864 matches the template instantiation of X&lt;A&gt;.
3866 But given
3867 template &lt;typename T&gt; class X {}; class A {};
3868 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
3869 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3870 does not match, as X&lt;A&gt; is an explicit template specialization.
3872 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;
3873 </pre></td></tr>
3876 <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>
3877 <tr><td colspan="4" class="doc" id="hasAnyOperatorName2"><pre>Matches operator expressions (binary or unary) that have any of the
3878 specified names.
3880 hasAnyOperatorName("+", "-")
3881 Is equivalent to
3882 anyOf(hasOperatorName("+"), hasOperatorName("-"))
3883 </pre></td></tr>
3886 <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>
3887 <tr><td colspan="4" class="doc" id="hasOperatorName2"><pre>Matches the operator Name of operator expressions and fold expressions
3888 (binary or unary).
3890 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3891 !(a || b)
3893 Example matches `(0 + ... + args)`
3894 (matcher = cxxFoldExpr(hasOperatorName("+")))
3895 template &lt;typename... Args&gt;
3896 auto sum(Args... args) {
3897 return (0 + ... + args);
3899 </pre></td></tr>
3902 <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>
3903 <tr><td colspan="4" class="doc" id="isAssignmentOperator2"><pre>Matches all kinds of assignment operators.
3905 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
3906 if (a == b)
3907 a += b;
3909 Example 2: matches s1 = s2
3910 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
3911 struct S { S&amp; operator=(const S&amp;); };
3912 void x() { S s1, s2; s1 = s2; }
3913 </pre></td></tr>
3916 <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>
3917 <tr><td colspan="4" class="doc" id="isComparisonOperator2"><pre>Matches comparison operators.
3919 Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
3920 if (a == b)
3921 a += b;
3923 Example 2: matches s1 &lt; s2
3924 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
3925 struct S { bool operator&lt;(const S&amp; other); };
3926 void x(S s1, S s2) { bool b1 = s1 &lt; s2; }
3927 </pre></td></tr>
3930 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountAtLeast2')"><a name="argumentCountAtLeast2Anchor">argumentCountAtLeast</a></td><td>unsigned N</td></tr>
3931 <tr><td colspan="4" class="doc" id="argumentCountAtLeast2"><pre>Checks that a call expression or a constructor call expression has at least
3932 the specified number of arguments (including absent default arguments).
3934 Example matches f(0, 0) and g(0, 0, 0)
3935 (matcher = callExpr(argumentCountAtLeast(2)))
3936 void f(int x, int y);
3937 void g(int x, int y, int z);
3938 f(0, 0);
3939 g(0, 0, 0);
3940 </pre></td></tr>
3943 <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>
3944 <tr><td colspan="4" class="doc" id="argumentCountIs2"><pre>Checks that a call expression or a constructor call expression has
3945 a specific number of arguments (including absent default arguments).
3947 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3948 void f(int x, int y);
3949 f(0, 0);
3950 </pre></td></tr>
3953 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountAtLeast0')"><a name="argumentCountAtLeast0Anchor">argumentCountAtLeast</a></td><td>unsigned N</td></tr>
3954 <tr><td colspan="4" class="doc" id="argumentCountAtLeast0"><pre>Checks that a call expression or a constructor call expression has at least
3955 the specified number of arguments (including absent default arguments).
3957 Example matches f(0, 0) and g(0, 0, 0)
3958 (matcher = callExpr(argumentCountAtLeast(2)))
3959 void f(int x, int y);
3960 void g(int x, int y, int z);
3961 f(0, 0);
3962 g(0, 0, 0);
3963 </pre></td></tr>
3966 <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>
3967 <tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
3968 a specific number of arguments (including absent default arguments).
3970 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3971 void f(int x, int y);
3972 f(0, 0);
3973 </pre></td></tr>
3976 <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>
3977 <tr><td colspan="4" class="doc" id="usesADL0"><pre>Matches call expressions which were resolved using ADL.
3979 Example matches y(x) but not y(42) or NS::y(x).
3980 namespace NS {
3981 struct X {};
3982 void y(X);
3985 void y(...);
3987 void test() {
3988 NS::X x;
3989 y(x); // Matches
3990 NS::y(x); // Doesn't match
3991 y(42); // Doesn't match
3992 using NS::y;
3993 y(x); // Found by both unqualified lookup and ADL, doesn't match
3995 </pre></td></tr>
3998 <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>
3999 <tr><td colspan="4" class="doc" id="hasCastKind0"><pre>Matches casts that has a given cast kind.
4001 Example: matches the implicit cast around 0
4002 (matcher = castExpr(hasCastKind(CK_NullToPointer)))
4003 int *p = 0;
4005 If the matcher is use from clang-query, CastKind parameter
4006 should be passed as a quoted string. e.g., hasCastKind("CK_NullToPointer").
4007 </pre></td></tr>
4010 <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>
4011 <tr><td colspan="4" class="doc" id="equals4"><pre></pre></td></tr>
4014 <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>
4015 <tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value of type ValueT.
4017 Given
4018 f('false, 3.14, 42);
4019 characterLiteral(equals(0))
4020 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
4021 match false
4022 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
4023 match 3.14
4024 integerLiteral(equals(42))
4025 matches 42
4027 Note that you cannot directly match a negative numeric literal because the
4028 minus sign is not part of the literal: It is a unary operator whose operand
4029 is the positive numeric literal. Instead, you must use a unaryOperator()
4030 matcher to match the minus sign:
4032 unaryOperator(hasOperatorName("-"),
4033 hasUnaryOperand(integerLiteral(equals(13))))
4035 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;,
4036 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;
4037 </pre></td></tr>
4040 <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>
4041 <tr><td colspan="4" class="doc" id="equals10"><pre></pre></td></tr>
4044 <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>
4045 <tr><td colspan="4" class="doc" id="equals7"><pre></pre></td></tr>
4048 <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>
4049 <tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N.
4051 Given
4052 template&lt;typename T&gt; struct C {};
4053 C&lt;int&gt; c;
4054 classTemplateSpecializationDecl(templateArgumentCountIs(1))
4055 matches C&lt;int&gt;.
4056 </pre></td></tr>
4059 <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>
4060 <tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
4061 child statements.
4063 Example: Given
4064 { for (;;) {} }
4065 compoundStmt(statementCountIs(0)))
4066 matches '{}'
4067 but does not match the outer compound statement.
4068 </pre></td></tr>
4071 <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>
4072 <tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches nodes that have the specified size.
4074 Given
4075 int a[42];
4076 int b[2 * 21];
4077 int c[41], d[43];
4078 char *s = "abcd";
4079 wchar_t *ws = L"abcd";
4080 char *w = "a";
4081 constantArrayType(hasSize(42))
4082 matches "int a[42]" and "int b[2 * 21]"
4083 stringLiteral(hasSize(4))
4084 matches "abcd", L"abcd"
4085 </pre></td></tr>
4088 <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>
4089 <tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
4090 declarations.
4092 Example: Given
4093 int a, b;
4094 int c;
4095 int d = 2, e;
4096 declCountIs(2)
4097 matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
4098 </pre></td></tr>
4101 <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>
4102 <tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
4104 Matches a node if it equals the node previously bound to ID.
4106 Given
4107 class X { int a; int b; };
4108 cxxRecordDecl(
4109 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
4110 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
4111 matches the class X, as a and b have the same type.
4113 Note that when multiple matches are involved via forEach* matchers,
4114 equalsBoundNodes acts as a filter.
4115 For example:
4116 compoundStmt(
4117 forEachDescendant(varDecl().bind("d")),
4118 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
4119 will trigger a match for each combination of variable declaration
4120 and reference to that variable declaration within a compound statement.
4121 </pre></td></tr>
4124 <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>
4125 <tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node.
4127 Decl has pointer identity in the AST.
4128 </pre></td></tr>
4131 <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>
4132 <tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute.
4134 Given
4135 __attribute__((device)) void f() { ... }
4136 decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
4137 f. If the matcher is used from clang-query, attr::Kind parameter should be
4138 passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
4139 </pre></td></tr>
4142 <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>
4143 <tr><td colspan="4" class="doc" id="isExpandedFromMacro0"><pre>Matches statements that are (transitively) expanded from the named macro.
4144 Does not match if only part of the statement is expanded from that macro or
4145 if different parts of the statement are expanded from different
4146 appearances of the macro.
4147 </pre></td></tr>
4150 <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>
4151 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is
4152 partially matching a given regex.
4154 Example matches Y but not X
4155 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
4156 #include "ASTMatcher.h"
4157 class X {};
4158 ASTMatcher.h:
4159 class Y {};
4161 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;
4163 If the matcher is used in clang-query, RegexFlags parameter
4164 should be passed as a quoted string. e.g: "NoFlags".
4165 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
4166 </pre></td></tr>
4169 <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>
4170 <tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file.
4172 Example matches X but not Y
4173 (matcher = cxxRecordDecl(isExpansionInMainFile())
4174 #include &lt;Y.h&gt;
4175 class X {};
4176 Y.h:
4177 class Y {};
4179 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;
4180 </pre></td></tr>
4183 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isExpansionInSystemHeader0')"><a name="isExpansionInSystemHeader0Anchor">isExpansionInSystemHeader</a></td><td></td></tr>
4184 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files.
4186 Example matches Y but not X
4187 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
4188 #include &lt;SystemHeader.h&gt;
4189 class X {};
4190 SystemHeader.h:
4191 class Y {};
4193 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;
4194 </pre></td></tr>
4197 <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>
4198 <tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches an entity that has been implicitly added by the compiler (e.g.
4199 implicit default/copy constructors).
4200 </pre></td></tr>
4203 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('isInAnonymousNamespace0')"><a name="isInAnonymousNamespace0Anchor">isInAnonymousNamespace</a></td><td></td></tr>
4204 <tr><td colspan="4" class="doc" id="isInAnonymousNamespace0"><pre>Matches declarations in an anonymous namespace.
4206 Given
4207 class vector {};
4208 namespace foo {
4209 class vector {};
4210 namespace {
4211 class vector {}; // #1
4214 namespace {
4215 class vector {}; // #2
4216 namespace foo {
4217 class vector{}; // #3
4220 cxxRecordDecl(hasName("vector"), isInAnonymousNamespace()) will match
4221 #1, #2 and #3.
4222 </pre></td></tr>
4225 <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>
4226 <tr><td colspan="4" class="doc" id="isInStdNamespace0"><pre>Matches declarations in the namespace `std`, but not in nested namespaces.
4228 Given
4229 class vector {};
4230 namespace foo {
4231 class vector {};
4232 namespace std {
4233 class vector {};
4236 namespace std {
4237 inline namespace __1 {
4238 class vector {}; // #1
4239 namespace experimental {
4240 class vector {};
4244 cxxRecordDecl(hasName("vector"), isInStdNamespace()) will match only #1.
4245 </pre></td></tr>
4248 <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>
4249 <tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
4250 template instantiations.
4252 Given
4253 template&lt;typename T&gt; void A(T t) { T i; }
4254 A(0);
4255 A(0U);
4256 functionDecl(isInstantiated())
4257 matches 'A(int) {...};' and 'A(unsigned) {...}'.
4258 </pre></td></tr>
4261 <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>
4262 <tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations and C++ base specifers that specify private
4263 inheritance.
4265 Examples:
4266 class C {
4267 public: int a;
4268 protected: int b;
4269 private: int c; // fieldDecl(isPrivate()) matches 'c'
4272 struct Base {};
4273 struct Derived1 : private Base {}; // matches 'Base'
4274 class Derived2 : Base {}; // matches 'Base'
4275 </pre></td></tr>
4278 <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>
4279 <tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations and C++ base specifers that specify
4280 protected inheritance.
4282 Examples:
4283 class C {
4284 public: int a;
4285 protected: int b; // fieldDecl(isProtected()) matches 'b'
4286 private: int c;
4289 class Base {};
4290 class Derived : protected Base {}; // matches 'Base'
4291 </pre></td></tr>
4294 <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>
4295 <tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations and C++ base specifers that specify public
4296 inheritance.
4298 Examples:
4299 class C {
4300 public: int a; // fieldDecl(isPublic()) matches 'a'
4301 protected: int b;
4302 private: int c;
4305 class Base {};
4306 class Derived1 : public Base {}; // matches 'Base'
4307 struct Derived2 : Base {}; // matches 'Base'
4308 </pre></td></tr>
4311 <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>
4312 <tr><td colspan="4" class="doc" id="designatorCountIs0"><pre>Matches designated initializer expressions that contain
4313 a specific number of designators.
4315 Example: Given
4316 point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
4317 point ptarray2[10] = { [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 };
4318 designatorCountIs(2)
4319 matches '{ [2].y = 1.0, [0].x = 1.0 }',
4320 but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'.
4321 </pre></td></tr>
4324 <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>
4325 <tr><td colspan="4" class="doc" id="isScoped0"><pre>Matches C++11 scoped enum declaration.
4327 Example matches Y (matcher = enumDecl(isScoped()))
4328 enum X {};
4329 enum class Y {};
4330 </pre></td></tr>
4333 <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>
4334 <tr><td colspan="4" class="doc" id="isInstantiationDependent0"><pre>Matches expressions that are instantiation-dependent even if it is
4335 neither type- nor value-dependent.
4337 In the following example, the expression sizeof(sizeof(T() + T()))
4338 is instantiation-dependent (since it involves a template parameter T),
4339 but is neither type- nor value-dependent, since the type of the inner
4340 sizeof is known (std::size_t) and therefore the size of the outer
4341 sizeof is known.
4342 template&lt;typename T&gt;
4343 void f(T x, T y) { sizeof(sizeof(T() + T()); }
4344 expr(isInstantiationDependent()) matches sizeof(sizeof(T() + T())
4345 </pre></td></tr>
4348 <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>
4349 <tr><td colspan="4" class="doc" id="isTypeDependent0"><pre>Matches expressions that are type-dependent because the template type
4350 is not yet instantiated.
4352 For example, the expressions "x" and "x + y" are type-dependent in
4353 the following code, but "y" is not type-dependent:
4354 template&lt;typename T&gt;
4355 void add(T x, int y) {
4356 x + y;
4358 expr(isTypeDependent()) matches x + y
4359 </pre></td></tr>
4362 <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>
4363 <tr><td colspan="4" class="doc" id="isValueDependent0"><pre>Matches expression that are value-dependent because they contain a
4364 non-type template parameter.
4366 For example, the array bound of "Chars" in the following example is
4367 value-dependent.
4368 template&lt;int Size&gt; int f() { return Size; }
4369 expr(isValueDependent()) matches return Size
4370 </pre></td></tr>
4373 <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>
4374 <tr><td colspan="4" class="doc" id="nullPointerConstant0"><pre>Matches expressions that resolve to a null pointer constant, such as
4375 GNU's __null, C++11's nullptr, or C's NULL macro.
4377 Given:
4378 void *v1 = NULL;
4379 void *v2 = nullptr;
4380 void *v3 = __null; // GNU extension
4381 char *cp = (char *)0;
4382 int *ip = 0;
4383 int i = 0;
4384 expr(nullPointerConstant())
4385 matches the initializer for v1, v2, v3, cp, and ip. Does not match the
4386 initializer for i.
4387 </pre></td></tr>
4390 <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>
4391 <tr><td colspan="4" class="doc" id="hasBitWidth0"><pre>Matches non-static data members that are bit-fields of the specified
4392 bit width.
4394 Given
4395 class C {
4396 int a : 2;
4397 int b : 4;
4398 int c : 2;
4400 fieldDecl(hasBitWidth(2))
4401 matches 'int a;' and 'int c;' but not 'int b;'.
4402 </pre></td></tr>
4405 <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>
4406 <tr><td colspan="4" class="doc" id="isBitField0"><pre>Matches non-static data members that are bit-fields.
4408 Given
4409 class C {
4410 int a : 2;
4411 int b;
4413 fieldDecl(isBitField())
4414 matches 'int a;' but not 'int b;'.
4415 </pre></td></tr>
4418 <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>
4419 <tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value of type ValueT.
4421 Given
4422 f('false, 3.14, 42);
4423 characterLiteral(equals(0))
4424 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
4425 match false
4426 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
4427 match 3.14
4428 integerLiteral(equals(42))
4429 matches 42
4431 Note that you cannot directly match a negative numeric literal because the
4432 minus sign is not part of the literal: It is a unary operator whose operand
4433 is the positive numeric literal. Instead, you must use a unaryOperator()
4434 matcher to match the minus sign:
4436 unaryOperator(hasOperatorName("-"),
4437 hasUnaryOperand(integerLiteral(equals(13))))
4439 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;,
4440 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;
4441 </pre></td></tr>
4444 <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>
4445 <tr><td colspan="4" class="doc" id="equals12"><pre></pre></td></tr>
4448 <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>
4449 <tr><td colspan="4" class="doc" id="hasAnyOverloadedOperatorName1"><pre>Matches overloaded operator names.
4451 Matches overloaded operator names specified in strings without the
4452 "operator" prefix: e.g. "&lt;&lt;".
4454 hasAnyOverloadedOperatorName("+", "-")
4455 Is equivalent to
4456 anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-"))
4457 </pre></td></tr>
4460 <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>
4461 <tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec0"><pre>Matches functions that have a dynamic exception specification.
4463 Given:
4464 void f();
4465 void g() noexcept;
4466 void h() noexcept(true);
4467 void i() noexcept(false);
4468 void j() throw();
4469 void k() throw(int);
4470 void l() throw(...);
4471 functionDecl(hasDynamicExceptionSpec()) and
4472 functionProtoType(hasDynamicExceptionSpec())
4473 match the declarations of j, k, and l, but not f, g, h, or i.
4474 </pre></td></tr>
4477 <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>
4478 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names.
4480 Matches overloaded operator names specified in strings without the
4481 "operator" prefix: e.g. "&lt;&lt;".
4483 Given:
4484 class A { int operator*(); };
4485 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
4486 A a;
4487 a &lt;&lt; a; // &lt;-- This matches
4489 cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
4490 specified line and
4491 cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
4492 matches the declaration of A.
4494 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;
4495 </pre></td></tr>
4498 <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>
4499 <tr><td colspan="4" class="doc" id="hasTrailingReturn0"><pre>Matches a function declared with a trailing return type.
4501 Example matches Y (matcher = functionDecl(hasTrailingReturn()))
4502 int X() {}
4503 auto Y() -&gt; int {}
4504 </pre></td></tr>
4507 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isConsteval0')"><a name="isConsteval0Anchor">isConsteval</a></td><td></td></tr>
4508 <tr><td colspan="4" class="doc" id="isConsteval0"><pre>Matches consteval function declarations and if consteval/if ! consteval
4509 statements.
4511 Given:
4512 consteval int a();
4513 void b() { if consteval {} }
4514 void c() { if ! consteval {} }
4515 void d() { if ! consteval {} else {} }
4516 functionDecl(isConsteval())
4517 matches the declaration of "int a()".
4518 ifStmt(isConsteval())
4519 matches the if statement in "void b()", "void c()", "void d()".
4520 </pre></td></tr>
4523 <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>
4524 <tr><td colspan="4" class="doc" id="isConstexpr1"><pre>Matches constexpr variable and function declarations,
4525 and if constexpr.
4527 Given:
4528 constexpr int foo = 42;
4529 constexpr int bar();
4530 void baz() { if constexpr(1 &gt; 0) {} }
4531 varDecl(isConstexpr())
4532 matches the declaration of foo.
4533 functionDecl(isConstexpr())
4534 matches the declaration of bar.
4535 ifStmt(isConstexpr())
4536 matches the if statement in baz.
4537 </pre></td></tr>
4540 <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>
4541 <tr><td colspan="4" class="doc" id="isDefaulted0"><pre>Matches defaulted function declarations.
4543 Given:
4544 class A { ~A(); };
4545 class B { ~B() = default; };
4546 functionDecl(isDefaulted())
4547 matches the declaration of ~B, but not ~A.
4548 </pre></td></tr>
4551 <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>
4552 <tr><td colspan="4" class="doc" id="isDefinition3"><pre>Matches if a declaration has a body attached.
4554 Example matches A, va, fa
4555 class A {};
4556 class B; // Doesn't match, as it has no body.
4557 int va;
4558 extern int vb; // Doesn't match, as it doesn't define the variable.
4559 void fa() {}
4560 void fb(); // Doesn't match, as it has no body.
4561 @interface X
4562 - (void)ma; // Doesn't match, interface is declaration.
4563 @end
4564 @implementation X
4565 - (void)ma {}
4566 @end
4568 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;,
4569 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
4570 </pre></td></tr>
4573 <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>
4574 <tr><td colspan="4" class="doc" id="isDeleted0"><pre>Matches deleted function declarations.
4576 Given:
4577 void Func();
4578 void DeletedFunc() = delete;
4579 functionDecl(isDeleted())
4580 matches the declaration of DeletedFunc, but not Func.
4581 </pre></td></tr>
4584 <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>
4585 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or
4586 static member variable template instantiations.
4588 Given
4589 template&lt;typename T&gt; void A(T t) { }
4590 template&lt;&gt; void A(int N) { }
4591 functionDecl(isExplicitTemplateSpecialization())
4592 matches the specialization A&lt;int&gt;().
4594 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;
4595 </pre></td></tr>
4598 <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>
4599 <tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function or variable declarations.
4601 Given:
4602 extern "C" void f() {}
4603 extern "C" { void g() {} }
4604 void h() {}
4605 extern "C" int x = 1;
4606 extern "C" int y = 2;
4607 int z = 3;
4608 functionDecl(isExternC())
4609 matches the declaration of f and g, but not the declaration of h.
4610 varDecl(isExternC())
4611 matches the declaration of x and y, but not the declaration of z.
4612 </pre></td></tr>
4615 <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>
4616 <tr><td colspan="4" class="doc" id="isInline1"><pre>Matches functions, variables and namespace declarations that are marked with
4617 the inline keyword.
4619 Given
4620 inline void f();
4621 void g();
4622 namespace n {
4623 inline namespace m {}
4625 inline int Foo = 5;
4626 functionDecl(isInline()) will match ::f().
4627 namespaceDecl(isInline()) will match n::m.
4628 varDecl(isInline()) will match Foo;
4629 </pre></td></tr>
4632 <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>
4633 <tr><td colspan="4" class="doc" id="isMain0"><pre>Determines whether the function is "main", which is the entry point
4634 into an executable program.
4635 </pre></td></tr>
4638 <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>
4639 <tr><td colspan="4" class="doc" id="isNoReturn0"><pre>Matches FunctionDecls that have a noreturn attribute.
4641 Given
4642 void nope();
4643 [[noreturn]] void a();
4644 __attribute__((noreturn)) void b();
4645 struct c { [[noreturn]] c(); };
4646 functionDecl(isNoReturn())
4647 matches all of those except
4648 void nope();
4649 </pre></td></tr>
4652 <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>
4653 <tr><td colspan="4" class="doc" id="isNoThrow0"><pre>Matches functions that have a non-throwing exception specification.
4655 Given:
4656 void f();
4657 void g() noexcept;
4658 void h() throw();
4659 void i() throw(int);
4660 void j() noexcept(false);
4661 functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
4662 match the declarations of g, and h, but not f, i or j.
4663 </pre></td></tr>
4666 <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>
4667 <tr><td colspan="4" class="doc" id="isStaticStorageClass0"><pre>Matches variable/function declarations that have "static" storage
4668 class specifier ("static" keyword) written in the source.
4670 Given:
4671 static void f() {}
4672 static int i = 0;
4673 extern int j;
4674 int k;
4675 functionDecl(isStaticStorageClass())
4676 matches the function declaration f.
4677 varDecl(isStaticStorageClass())
4678 matches the variable declaration i.
4679 </pre></td></tr>
4682 <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>
4683 <tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static
4684 member variable template instantiations.
4686 Given
4687 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
4689 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
4691 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
4692 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4693 matches the template instantiation of X&lt;A&gt;.
4695 But given
4696 template &lt;typename T&gt; class X {}; class A {};
4697 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
4698 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4699 does not match, as X&lt;A&gt; is an explicit template specialization.
4701 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;
4702 </pre></td></tr>
4705 <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>
4706 <tr><td colspan="4" class="doc" id="isVariadic0"><pre>Matches if a function declaration is variadic.
4708 Example matches f, but not g or h. The function i will not match, even when
4709 compiled in C mode.
4710 void f(...);
4711 void g(int);
4712 template &lt;typename... Ts&gt; void h(Ts...);
4713 void i();
4714 </pre></td></tr>
4717 <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>
4718 <tr><td colspan="4" class="doc" id="isWeak0"><pre>Matches weak function declarations.
4720 Given:
4721 void foo() __attribute__((__weakref__("__foo")));
4722 void bar();
4723 functionDecl(isWeak())
4724 matches the weak declaration "foo", but not "bar".
4725 </pre></td></tr>
4728 <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>
4729 <tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
4730 specific parameter count.
4732 Given
4733 void f(int i) {}
4734 void g(int i, int j) {}
4735 void h(int i, int j);
4736 void j(int i);
4737 void k(int x, int y, int z, ...);
4738 functionDecl(parameterCountIs(2))
4739 matches g and h
4740 functionProtoType(parameterCountIs(2))
4741 matches g and h
4742 functionProtoType(parameterCountIs(3))
4743 matches k
4744 </pre></td></tr>
4747 <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>
4748 <tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec1"><pre>Matches functions that have a dynamic exception specification.
4750 Given:
4751 void f();
4752 void g() noexcept;
4753 void h() noexcept(true);
4754 void i() noexcept(false);
4755 void j() throw();
4756 void k() throw(int);
4757 void l() throw(...);
4758 functionDecl(hasDynamicExceptionSpec()) and
4759 functionProtoType(hasDynamicExceptionSpec())
4760 match the declarations of j, k, and l, but not f, g, h, or i.
4761 </pre></td></tr>
4764 <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>
4765 <tr><td colspan="4" class="doc" id="isNoThrow1"><pre>Matches functions that have a non-throwing exception specification.
4767 Given:
4768 void f();
4769 void g() noexcept;
4770 void h() throw();
4771 void i() throw(int);
4772 void j() noexcept(false);
4773 functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
4774 match the declarations of g, and h, but not f, i or j.
4775 </pre></td></tr>
4778 <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>
4779 <tr><td colspan="4" class="doc" id="parameterCountIs1"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
4780 specific parameter count.
4782 Given
4783 void f(int i) {}
4784 void g(int i, int j) {}
4785 void h(int i, int j);
4786 void j(int i);
4787 void k(int x, int y, int z, ...);
4788 functionDecl(parameterCountIs(2))
4789 matches g and h
4790 functionProtoType(parameterCountIs(2))
4791 matches g and h
4792 functionProtoType(parameterCountIs(3))
4793 matches k
4794 </pre></td></tr>
4797 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;</td><td class="name" onclick="toggle('isConsteval1')"><a name="isConsteval1Anchor">isConsteval</a></td><td></td></tr>
4798 <tr><td colspan="4" class="doc" id="isConsteval1"><pre>Matches consteval function declarations and if consteval/if ! consteval
4799 statements.
4801 Given:
4802 consteval int a();
4803 void b() { if consteval {} }
4804 void c() { if ! consteval {} }
4805 void d() { if ! consteval {} else {} }
4806 functionDecl(isConsteval())
4807 matches the declaration of "int a()".
4808 ifStmt(isConsteval())
4809 matches the if statement in "void b()", "void c()", "void d()".
4810 </pre></td></tr>
4813 <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>
4814 <tr><td colspan="4" class="doc" id="isConstexpr2"><pre>Matches constexpr variable and function declarations,
4815 and if constexpr.
4817 Given:
4818 constexpr int foo = 42;
4819 constexpr int bar();
4820 void baz() { if constexpr(1 &gt; 0) {} }
4821 varDecl(isConstexpr())
4822 matches the declaration of foo.
4823 functionDecl(isConstexpr())
4824 matches the declaration of bar.
4825 ifStmt(isConstexpr())
4826 matches the if statement in baz.
4827 </pre></td></tr>
4830 <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>
4831 <tr><td colspan="4" class="doc" id="equals6"><pre></pre></td></tr>
4834 <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>
4835 <tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value of type ValueT.
4837 Given
4838 f('false, 3.14, 42);
4839 characterLiteral(equals(0))
4840 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
4841 match false
4842 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
4843 match 3.14
4844 integerLiteral(equals(42))
4845 matches 42
4847 Note that you cannot directly match a negative numeric literal because the
4848 minus sign is not part of the literal: It is a unary operator whose operand
4849 is the positive numeric literal. Instead, you must use a unaryOperator()
4850 matcher to match the minus sign:
4852 unaryOperator(hasOperatorName("-"),
4853 hasUnaryOperand(integerLiteral(equals(13))))
4855 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;,
4856 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;
4857 </pre></td></tr>
4860 <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>
4861 <tr><td colspan="4" class="doc" id="equals13"><pre></pre></td></tr>
4864 <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>
4865 <tr><td colspan="4" class="doc" id="equals9"><pre></pre></td></tr>
4868 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaCapture.html">LambdaCapture</a>&gt;</td><td class="name" onclick="toggle('capturesThis0')"><a name="capturesThis0Anchor">capturesThis</a></td><td></td></tr>
4869 <tr><td colspan="4" class="doc" id="capturesThis0"><pre>Matches a `LambdaCapture` that refers to 'this'.
4871 Given
4872 class C {
4873 int cc;
4874 int f() {
4875 auto l = [this]() { return cc; };
4876 return l();
4879 lambdaExpr(hasAnyCapture(lambdaCapture(capturesThis())))
4880 matches `[this]() { return cc; }`.
4881 </pre></td></tr>
4884 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaCapture.html">LambdaCapture</a>&gt;</td><td class="name" onclick="toggle('isImplicit2')"><a name="isImplicit2Anchor">isImplicit</a></td><td></td></tr>
4885 <tr><td colspan="4" class="doc" id="isImplicit2"><pre>Matches an entity that has been implicitly added by the compiler (e.g.
4886 implicit default/copy constructors).
4887 </pre></td></tr>
4890 <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>
4891 <tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '-&gt;' as opposed
4892 to '.'.
4894 Member calls on the implicit this pointer match as called with '-&gt;'.
4896 Given
4897 class Y {
4898 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
4899 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
4900 int a;
4901 static int b;
4903 template &lt;class T&gt;
4904 class Z {
4905 void x() { this-&gt;m; }
4907 memberExpr(isArrow())
4908 matches this-&gt;x, x, y.x, a, this-&gt;b
4909 cxxDependentScopeMemberExpr(isArrow())
4910 matches this-&gt;m
4911 unresolvedMemberExpr(isArrow())
4912 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
4913 </pre></td></tr>
4916 <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>
4917 <tr><td colspan="4" class="doc" id="hasAnyName0"><pre>Matches NamedDecl nodes that have any of the specified names.
4919 This matcher is only provided as a performance optimization of hasName.
4920 hasAnyName(a, b, c)
4921 is equivalent to, but faster than
4922 anyOf(hasName(a), hasName(b), hasName(c))
4923 </pre></td></tr>
4926 <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>
4927 <tr><td colspan="4" class="doc" id="hasExternalFormalLinkage0"><pre>Matches a declaration that has external formal linkage.
4929 Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
4930 void f() {
4931 int x;
4932 static int y;
4934 int z;
4936 Example matches f() because it has external formal linkage despite being
4937 unique to the translation unit as though it has internal likage
4938 (matcher = functionDecl(hasExternalFormalLinkage()))
4940 namespace {
4941 void f() {}
4943 </pre></td></tr>
4946 <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>
4947 <tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name.
4949 Supports specifying enclosing namespaces or classes by prefixing the name
4950 with '&lt;enclosing&gt;::'.
4951 Does not match typedefs of an underlying type with the given name.
4953 Example matches X (Name == "X")
4954 class X;
4956 Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
4957 namespace a { namespace b { class X; } }
4958 </pre></td></tr>
4961 <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>
4962 <tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain
4963 a substring matched by the given RegExp.
4965 Supports specifying enclosing namespaces or classes by
4966 prefixing the name with '&lt;enclosing&gt;::'. Does not match typedefs
4967 of an underlying type with the given name.
4969 Example matches X (regexp == "::X")
4970 class X;
4972 Example matches X (regexp is one of "::X", "^foo::.*X", among others)
4973 namespace foo { namespace bar { class X; } }
4975 If the matcher is used in clang-query, RegexFlags parameter
4976 should be passed as a quoted string. e.g: "NoFlags".
4977 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
4978 </pre></td></tr>
4981 <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>
4982 <tr><td colspan="4" class="doc" id="isAnonymous0"><pre>Matches anonymous namespace declarations.
4984 Given
4985 namespace n {
4986 namespace {} // #1
4988 namespaceDecl(isAnonymous()) will match #1 but not ::n.
4989 </pre></td></tr>
4992 <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>
4993 <tr><td colspan="4" class="doc" id="isInline0"><pre>Matches functions, variables and namespace declarations that are marked with
4994 the inline keyword.
4996 Given
4997 inline void f();
4998 void g();
4999 namespace n {
5000 inline namespace m {}
5002 inline int Foo = 5;
5003 functionDecl(isInline()) will match ::f().
5004 namespaceDecl(isInline()) will match n::m.
5005 varDecl(isInline()) will match Foo;
5006 </pre></td></tr>
5009 <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>
5010 <tr><td colspan="4" class="doc" id="isFirstPrivateKind0"><pre>Matches if the OpenMP ``default`` clause has ``firstprivate`` kind
5011 specified.
5013 Given
5015 #pragma omp parallel
5016 #pragma omp parallel default(none)
5017 #pragma omp parallel default(shared)
5018 #pragma omp parallel default(private)
5019 #pragma omp parallel default(firstprivate)
5021 ``ompDefaultClause(isFirstPrivateKind())`` matches only
5022 ``default(firstprivate)``.
5023 </pre></td></tr>
5026 <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>
5027 <tr><td colspan="4" class="doc" id="isNoneKind0"><pre>Matches if the OpenMP ``default`` clause has ``none`` kind specified.
5029 Given
5031 #pragma omp parallel
5032 #pragma omp parallel default(none)
5033 #pragma omp parallel default(shared)
5034 #pragma omp parallel default(private)
5035 #pragma omp parallel default(firstprivate)
5037 ``ompDefaultClause(isNoneKind())`` matches only ``default(none)``.
5038 </pre></td></tr>
5041 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1OMPDefaultClause.html">OMPDefaultClause</a>&gt;</td><td class="name" onclick="toggle('isPrivateKind0')"><a name="isPrivateKind0Anchor">isPrivateKind</a></td><td></td></tr>
5042 <tr><td colspan="4" class="doc" id="isPrivateKind0"><pre>Matches if the OpenMP ``default`` clause has ``private`` kind
5043 specified.
5045 Given
5047 #pragma omp parallel
5048 #pragma omp parallel default(none)
5049 #pragma omp parallel default(shared)
5050 #pragma omp parallel default(private)
5051 #pragma omp parallel default(firstprivate)
5053 ``ompDefaultClause(isPrivateKind())`` matches only
5054 ``default(private)``.
5055 </pre></td></tr>
5058 <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>
5059 <tr><td colspan="4" class="doc" id="isSharedKind0"><pre>Matches if the OpenMP ``default`` clause has ``shared`` kind specified.
5061 Given
5063 #pragma omp parallel
5064 #pragma omp parallel default(none)
5065 #pragma omp parallel default(shared)
5066 #pragma omp parallel default(private)
5067 #pragma omp parallel default(firstprivate)
5069 ``ompDefaultClause(isSharedKind())`` matches only ``default(shared)``.
5070 </pre></td></tr>
5073 <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>
5074 <tr><td colspan="4" class="doc" id="isAllowedToContainClauseKind0"><pre>Matches if the OpenMP directive is allowed to contain the specified OpenMP
5075 clause kind.
5077 Given
5079 #pragma omp parallel
5080 #pragma omp parallel for
5081 #pragma omp for
5083 `ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches
5084 ``omp parallel`` and ``omp parallel for``.
5086 If the matcher is use from clang-query, ``OpenMPClauseKind`` parameter
5087 should be passed as a quoted string. e.g.,
5088 ``isAllowedToContainClauseKind("OMPC_default").``
5089 </pre></td></tr>
5092 <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>
5093 <tr><td colspan="4" class="doc" id="isStandaloneDirective0"><pre>Matches standalone OpenMP directives,
5094 i.e., directives that can't have a structured block.
5096 Given
5098 #pragma omp parallel
5100 #pragma omp taskyield
5102 ``ompExecutableDirective(isStandaloneDirective()))`` matches
5103 ``omp taskyield``.
5104 </pre></td></tr>
5107 <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>
5108 <tr><td colspan="4" class="doc" id="isDerivedFrom3"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
5109 </pre></td></tr>
5112 <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>
5113 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom3"><pre>Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
5114 </pre></td></tr>
5117 <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>
5118 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom3"><pre>Overloaded method as shortcut for
5119 isSameOrDerivedFrom(hasName(...)).
5120 </pre></td></tr>
5123 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountAtLeast3')"><a name="argumentCountAtLeast3Anchor">argumentCountAtLeast</a></td><td>unsigned N</td></tr>
5124 <tr><td colspan="4" class="doc" id="argumentCountAtLeast3"><pre>Checks that a call expression or a constructor call expression has at least
5125 the specified number of arguments (including absent default arguments).
5127 Example matches f(0, 0) and g(0, 0, 0)
5128 (matcher = callExpr(argumentCountAtLeast(2)))
5129 void f(int x, int y);
5130 void g(int x, int y, int z);
5131 f(0, 0);
5132 g(0, 0, 0);
5133 </pre></td></tr>
5136 <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>
5137 <tr><td colspan="4" class="doc" id="argumentCountIs3"><pre>Checks that a call expression or a constructor call expression has
5138 a specific number of arguments (including absent default arguments).
5140 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
5141 void f(int x, int y);
5142 f(0, 0);
5143 </pre></td></tr>
5146 <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>
5147 <tr><td colspan="4" class="doc" id="hasAnySelector0"><pre>Matches when at least one of the supplied string equals to the
5148 Selector.getAsString()
5150 matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
5151 matches both of the expressions below:
5152 [myObj methodA:argA];
5153 [myObj methodB:argB];
5154 </pre></td></tr>
5157 <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>
5158 <tr><td colspan="4" class="doc" id="hasKeywordSelector0"><pre>Matches when the selector is a keyword selector
5160 objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
5161 message expression in
5163 UIWebView *webView = ...;
5164 CGRect bodyFrame = webView.frame;
5165 bodyFrame.size.height = self.bodyContentHeight;
5166 webView.frame = bodyFrame;
5167 // ^---- matches here
5168 </pre></td></tr>
5171 <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>
5172 <tr><td colspan="4" class="doc" id="hasNullSelector0"><pre>Matches when the selector is the empty selector
5174 Matches only when the selector of the objCMessageExpr is NULL. This may
5175 represent an error condition in the tree!
5176 </pre></td></tr>
5179 <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>
5180 <tr><td colspan="4" class="doc" id="hasSelector0"><pre>Matches when BaseName == Selector.getAsString()
5182 matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:"));
5183 matches the outer message expr in the code below, but NOT the message
5184 invocation for self.bodyView.
5185 [self.bodyView loadHTMLString:html baseURL:NULL];
5186 </pre></td></tr>
5189 <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>
5190 <tr><td colspan="4" class="doc" id="hasUnarySelector0"><pre>Matches when the selector is a Unary Selector
5192 matcher = objCMessageExpr(matchesSelector(hasUnarySelector());
5193 matches self.bodyView in the code below, but NOT the outer message
5194 invocation of "loadHTMLString:baseURL:".
5195 [self.bodyView loadHTMLString:html baseURL:NULL];
5196 </pre></td></tr>
5199 <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>
5200 <tr><td colspan="4" class="doc" id="isClassMessage0"><pre>Returns true when the Objective-C message is sent to a class.
5202 Example
5203 matcher = objcMessageExpr(isClassMessage())
5204 matches
5205 [NSString stringWithFormat:@"format"];
5206 but not
5207 NSString *x = @"hello";
5208 [x containsString:@"h"];
5209 </pre></td></tr>
5212 <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>
5213 <tr><td colspan="4" class="doc" id="isInstanceMessage0"><pre>Returns true when the Objective-C message is sent to an instance.
5215 Example
5216 matcher = objcMessageExpr(isInstanceMessage())
5217 matches
5218 NSString *x = @"hello";
5219 [x containsString:@"h"];
5220 but not
5221 [NSString stringWithFormat:@"format"];
5222 </pre></td></tr>
5225 <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>
5226 <tr><td colspan="4" class="doc" id="matchesSelector0"><pre>Matches ObjC selectors whose name contains
5227 a substring matched by the given RegExp.
5228 matcher = objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
5229 invocation for self.bodyView.
5230 [self.bodyView loadHTMLString:html baseURL:NULL];
5232 If the matcher is used in clang-query, RegexFlags parameter
5233 should be passed as a quoted string. e.g: "NoFlags".
5234 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
5235 </pre></td></tr>
5238 <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>
5239 <tr><td colspan="4" class="doc" id="numSelectorArgs0"><pre>Matches when the selector has the specified number of arguments
5241 matcher = objCMessageExpr(numSelectorArgs(0));
5242 matches self.bodyView in the code below
5244 matcher = objCMessageExpr(numSelectorArgs(2));
5245 matches the invocation of "loadHTMLString:baseURL:" but not that
5246 of self.bodyView
5247 [self.bodyView loadHTMLString:html baseURL:NULL];
5248 </pre></td></tr>
5251 <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>
5252 <tr><td colspan="4" class="doc" id="isClassMethod0"><pre>Returns true when the Objective-C method declaration is a class method.
5254 Example
5255 matcher = objcMethodDecl(isClassMethod())
5256 matches
5257 @interface I + (void)foo; @end
5258 but not
5259 @interface I - (void)bar; @end
5260 </pre></td></tr>
5263 <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>
5264 <tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached.
5266 Example matches A, va, fa
5267 class A {};
5268 class B; // Doesn't match, as it has no body.
5269 int va;
5270 extern int vb; // Doesn't match, as it doesn't define the variable.
5271 void fa() {}
5272 void fb(); // Doesn't match, as it has no body.
5273 @interface X
5274 - (void)ma; // Doesn't match, interface is declaration.
5275 @end
5276 @implementation X
5277 - (void)ma {}
5278 @end
5280 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;,
5281 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
5282 </pre></td></tr>
5285 <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>
5286 <tr><td colspan="4" class="doc" id="isInstanceMethod0"><pre>Returns true when the Objective-C method declaration is an instance method.
5288 Example
5289 matcher = objcMethodDecl(isInstanceMethod())
5290 matches
5291 @interface I - (void)bar; @end
5292 but not
5293 @interface I + (void)foo; @end
5294 </pre></td></tr>
5297 <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>
5298 <tr><td colspan="4" class="doc" id="hasDefaultArgument0"><pre>Matches a declaration that has default arguments.
5300 Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
5301 void x(int val) {}
5302 void y(int val = 0) {}
5304 Deprecated. Use hasInitializer() instead to be able to
5305 match on the contents of the default argument. For example:
5307 void x(int val = 7) {}
5308 void y(int val = 42) {}
5309 parmVarDecl(hasInitializer(integerLiteral(equals(42))))
5310 matches the parameter of y
5312 A matcher such as
5313 parmVarDecl(hasInitializer(anything()))
5314 is equivalent to parmVarDecl(hasDefaultArgument()).
5315 </pre></td></tr>
5318 <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>
5319 <tr><td colspan="4" class="doc" id="isAtPosition0"><pre>Matches the ParmVarDecl nodes that are at the N'th position in the parameter
5320 list. The parameter list could be that of either a block, function, or
5321 objc-method.
5324 Given
5326 void f(int a, int b, int c) {
5329 ``parmVarDecl(isAtPosition(0))`` matches ``int a``.
5331 ``parmVarDecl(isAtPosition(1))`` matches ``int b``.
5332 </pre></td></tr>
5335 <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>
5336 <tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string.
5338 Given
5339 class Y { public: void x(); };
5340 void z() { Y* y; y-&gt;x(); }
5341 cxxMemberCallExpr(on(hasType(asString("class Y *"))))
5342 matches y-&gt;x()
5343 </pre></td></tr>
5346 <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>
5347 <tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node.
5349 Matches a node if it equals the node previously bound to ID.
5351 Given
5352 class X { int a; int b; };
5353 cxxRecordDecl(
5354 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
5355 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
5356 matches the class X, as a and b have the same type.
5358 Note that when multiple matches are involved via forEach* matchers,
5359 equalsBoundNodes acts as a filter.
5360 For example:
5361 compoundStmt(
5362 forEachDescendant(varDecl().bind("d")),
5363 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
5364 will trigger a match for each combination of variable declaration
5365 and reference to that variable declaration within a compound statement.
5366 </pre></td></tr>
5369 <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>
5370 <tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to
5371 the node, not hidden within a typedef.
5373 Given
5374 typedef const int const_int;
5375 const_int i;
5376 int *const j;
5377 int *volatile k;
5378 int m;
5379 varDecl(hasType(hasLocalQualifiers())) matches only j and k.
5380 i is const-qualified but the qualifier is not local.
5381 </pre></td></tr>
5384 <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>
5385 <tr><td colspan="4" class="doc" id="isAnyCharacter0"><pre>Matches QualType nodes that are of character type.
5387 Given
5388 void a(char);
5389 void b(wchar_t);
5390 void c(double);
5391 functionDecl(hasAnyParameter(hasType(isAnyCharacter())))
5392 matches "a(char)", "b(wchar_t)", but not "c(double)".
5393 </pre></td></tr>
5396 <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>
5397 <tr><td colspan="4" class="doc" id="isAnyPointer0"><pre>Matches QualType nodes that are of any pointer type; this includes
5398 the Objective-C object pointer type, which is different despite being
5399 syntactically similar.
5401 Given
5402 int *i = nullptr;
5404 @interface Foo
5405 @end
5406 Foo *f;
5408 int j;
5409 varDecl(hasType(isAnyPointer()))
5410 matches "int *i" and "Foo *f", but not "int j".
5411 </pre></td></tr>
5414 <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>
5415 <tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that
5416 include "top-level" const.
5418 Given
5419 void a(int);
5420 void b(int const);
5421 void c(const int);
5422 void d(const int*);
5423 void e(int const) {};
5424 functionDecl(hasAnyParameter(hasType(isConstQualified())))
5425 matches "void b(int const)", "void c(const int)" and
5426 "void e(int const) {}". It does not match d as there
5427 is no top-level const on the parameter type "const int *".
5428 </pre></td></tr>
5431 <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>
5432 <tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type.
5434 Given
5435 void a(int);
5436 void b(long);
5437 void c(double);
5438 functionDecl(hasAnyParameter(hasType(isInteger())))
5439 matches "a(int)", "b(long)", but not "c(double)".
5440 </pre></td></tr>
5443 <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>
5444 <tr><td colspan="4" class="doc" id="isSignedInteger0"><pre>Matches QualType nodes that are of signed integer type.
5446 Given
5447 void a(int);
5448 void b(unsigned long);
5449 void c(double);
5450 functionDecl(hasAnyParameter(hasType(isSignedInteger())))
5451 matches "a(int)", but not "b(unsigned long)" and "c(double)".
5452 </pre></td></tr>
5455 <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>
5456 <tr><td colspan="4" class="doc" id="isUnsignedInteger0"><pre>Matches QualType nodes that are of unsigned integer type.
5458 Given
5459 void a(int);
5460 void b(unsigned long);
5461 void c(double);
5462 functionDecl(hasAnyParameter(hasType(isUnsignedInteger())))
5463 matches "b(unsigned long)", but not "a(int)" and "c(double)".
5464 </pre></td></tr>
5467 <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>
5468 <tr><td colspan="4" class="doc" id="isVolatileQualified0"><pre>Matches QualType nodes that are volatile-qualified, i.e., that
5469 include "top-level" volatile.
5471 Given
5472 void a(int);
5473 void b(int volatile);
5474 void c(volatile int);
5475 void d(volatile int*);
5476 void e(int volatile) {};
5477 functionDecl(hasAnyParameter(hasType(isVolatileQualified())))
5478 matches "void b(int volatile)", "void c(volatile int)" and
5479 "void e(int volatile) {}". It does not match d as there
5480 is no top-level volatile on the parameter type "volatile int *".
5481 </pre></td></tr>
5484 <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>
5485 <tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node.
5487 Matches a node if it equals the node previously bound to ID.
5489 Given
5490 class X { int a; int b; };
5491 cxxRecordDecl(
5492 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
5493 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
5494 matches the class X, as a and b have the same type.
5496 Note that when multiple matches are involved via forEach* matchers,
5497 equalsBoundNodes acts as a filter.
5498 For example:
5499 compoundStmt(
5500 forEachDescendant(varDecl().bind("d")),
5501 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
5502 will trigger a match for each combination of variable declaration
5503 and reference to that variable declaration within a compound statement.
5504 </pre></td></tr>
5507 <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>
5508 <tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node.
5510 Stmt has pointer identity in the AST.
5511 </pre></td></tr>
5514 <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>
5515 <tr><td colspan="4" class="doc" id="isExpandedFromMacro1"><pre>Matches statements that are (transitively) expanded from the named macro.
5516 Does not match if only part of the statement is expanded from that macro or
5517 if different parts of the statement are expanded from different
5518 appearances of the macro.
5519 </pre></td></tr>
5522 <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>
5523 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches AST nodes that were expanded within files whose name is
5524 partially matching a given regex.
5526 Example matches Y but not X
5527 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
5528 #include "ASTMatcher.h"
5529 class X {};
5530 ASTMatcher.h:
5531 class Y {};
5533 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;
5535 If the matcher is used in clang-query, RegexFlags parameter
5536 should be passed as a quoted string. e.g: "NoFlags".
5537 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
5538 </pre></td></tr>
5541 <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>
5542 <tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches AST nodes that were expanded within the main-file.
5544 Example matches X but not Y
5545 (matcher = cxxRecordDecl(isExpansionInMainFile())
5546 #include &lt;Y.h&gt;
5547 class X {};
5548 Y.h:
5549 class Y {};
5551 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;
5552 </pre></td></tr>
5555 <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>
5556 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches AST nodes that were expanded within system-header-files.
5558 Example matches Y but not X
5559 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
5560 #include &lt;SystemHeader.h&gt;
5561 class X {};
5562 SystemHeader.h:
5563 class Y {};
5565 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;
5566 </pre></td></tr>
5569 <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>
5570 <tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
5572 Given
5573 int j;
5574 template&lt;typename T&gt; void A(T t) { T i; j += 42;}
5575 A(0);
5576 A(0U);
5577 declStmt(isInTemplateInstantiation())
5578 matches 'int i;' and 'unsigned i'.
5579 unless(stmt(isInTemplateInstantiation()))
5580 will NOT match j += 42; as it's shared between the template definition and
5581 instantiation.
5582 </pre></td></tr>
5585 <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>
5586 <tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
5588 Given
5589 int a[42];
5590 int b[2 * 21];
5591 int c[41], d[43];
5592 char *s = "abcd";
5593 wchar_t *ws = L"abcd";
5594 char *w = "a";
5595 constantArrayType(hasSize(42))
5596 matches "int a[42]" and "int b[2 * 21]"
5597 stringLiteral(hasSize(4))
5598 matches "abcd", L"abcd"
5599 </pre></td></tr>
5602 <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>
5603 <tr><td colspan="4" class="doc" id="isClass0"><pre>Matches TagDecl object that are spelled with "class."
5605 Example matches C, but not S, U or E.
5606 struct S {};
5607 class C {};
5608 union U {};
5609 enum E {};
5610 </pre></td></tr>
5613 <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>
5614 <tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
5616 Example matches A, va, fa
5617 class A {};
5618 class B; // Doesn't match, as it has no body.
5619 int va;
5620 extern int vb; // Doesn't match, as it doesn't define the variable.
5621 void fa() {}
5622 void fb(); // Doesn't match, as it has no body.
5623 @interface X
5624 - (void)ma; // Doesn't match, interface is declaration.
5625 @end
5626 @implementation X
5627 - (void)ma {}
5628 @end
5630 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;,
5631 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
5632 </pre></td></tr>
5635 <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>
5636 <tr><td colspan="4" class="doc" id="isEnum0"><pre>Matches TagDecl object that are spelled with "enum."
5638 Example matches E, but not C, S or U.
5639 struct S {};
5640 class C {};
5641 union U {};
5642 enum E {};
5643 </pre></td></tr>
5646 <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>
5647 <tr><td colspan="4" class="doc" id="isStruct0"><pre>Matches TagDecl object that are spelled with "struct."
5649 Example matches S, but not C, U or E.
5650 struct S {};
5651 class C {};
5652 union U {};
5653 enum E {};
5654 </pre></td></tr>
5657 <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>
5658 <tr><td colspan="4" class="doc" id="isUnion0"><pre>Matches TagDecl object that are spelled with "union."
5660 Example matches U, but not C, S or E.
5661 struct S {};
5662 class C {};
5663 union U {};
5664 enum E {};
5665 </pre></td></tr>
5668 <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>
5669 <tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value.
5671 Note that 'Value' is a string as the template argument's value is
5672 an arbitrary precision integer. 'Value' must be euqal to the canonical
5673 representation of that integral value in base 10.
5675 Given
5676 template&lt;int T&gt; struct C {};
5677 C&lt;42&gt; c;
5678 classTemplateSpecializationDecl(
5679 hasAnyTemplateArgument(equalsIntegralValue("42")))
5680 matches the implicit instantiation of C in C&lt;42&gt;.
5681 </pre></td></tr>
5684 <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>
5685 <tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value.
5687 Given
5688 template&lt;int T&gt; struct C {};
5689 C&lt;42&gt; c;
5690 classTemplateSpecializationDecl(
5691 hasAnyTemplateArgument(isIntegral()))
5692 matches the implicit instantiation of C in C&lt;42&gt;
5693 with isIntegral() matching 42.
5694 </pre></td></tr>
5697 <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>
5698 <tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N.
5700 Given
5701 template&lt;typename T&gt; struct C {};
5702 C&lt;int&gt; c;
5703 classTemplateSpecializationDecl(templateArgumentCountIs(1))
5704 matches C&lt;int&gt;.
5705 </pre></td></tr>
5708 <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>
5709 <tr><td colspan="4" class="doc" id="isExpandedFromMacro2"><pre>Matches statements that are (transitively) expanded from the named macro.
5710 Does not match if only part of the statement is expanded from that macro or
5711 if different parts of the statement are expanded from different
5712 appearances of the macro.
5713 </pre></td></tr>
5716 <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>
5717 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is
5718 partially matching a given regex.
5720 Example matches Y but not X
5721 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
5722 #include "ASTMatcher.h"
5723 class X {};
5724 ASTMatcher.h:
5725 class Y {};
5727 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;
5729 If the matcher is used in clang-query, RegexFlags parameter
5730 should be passed as a quoted string. e.g: "NoFlags".
5731 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
5732 </pre></td></tr>
5735 <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>
5736 <tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file.
5738 Example matches X but not Y
5739 (matcher = cxxRecordDecl(isExpansionInMainFile())
5740 #include &lt;Y.h&gt;
5741 class X {};
5742 Y.h:
5743 class Y {};
5745 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;
5746 </pre></td></tr>
5749 <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>
5750 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files.
5752 Example matches Y but not X
5753 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
5754 #include &lt;SystemHeader.h&gt;
5755 class X {};
5756 SystemHeader.h:
5757 class Y {};
5759 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;
5760 </pre></td></tr>
5763 <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>
5764 <tr><td colspan="4" class="doc" id="booleanType0"><pre>Matches type bool.
5766 Given
5767 struct S { bool func(); };
5768 functionDecl(returns(booleanType()))
5769 matches "bool func();"
5770 </pre></td></tr>
5773 <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>
5774 <tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
5776 Matches a node if it equals the node previously bound to ID.
5778 Given
5779 class X { int a; int b; };
5780 cxxRecordDecl(
5781 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
5782 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
5783 matches the class X, as a and b have the same type.
5785 Note that when multiple matches are involved via forEach* matchers,
5786 equalsBoundNodes acts as a filter.
5787 For example:
5788 compoundStmt(
5789 forEachDescendant(varDecl().bind("d")),
5790 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
5791 will trigger a match for each combination of variable declaration
5792 and reference to that variable declaration within a compound statement.
5793 </pre></td></tr>
5796 <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>
5797 <tr><td colspan="4" class="doc" id="equalsNode2"><pre>Matches if a node equals another node.
5799 Type has pointer identity in the AST.
5800 </pre></td></tr>
5803 <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>
5804 <tr><td colspan="4" class="doc" id="realFloatingPointType0"><pre>Matches any real floating-point type (float, double, long double).
5806 Given
5807 int i;
5808 float f;
5809 realFloatingPointType()
5810 matches "float f" but not "int i"
5811 </pre></td></tr>
5814 <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>
5815 <tr><td colspan="4" class="doc" id="voidType0"><pre>Matches type void.
5817 Given
5818 struct S { void func(); };
5819 functionDecl(returns(voidType()))
5820 matches "void func();"
5821 </pre></td></tr>
5824 <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>
5825 <tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
5827 Given
5828 int x;
5829 int s = sizeof(x) + alignof(x)
5830 unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
5831 matches sizeof(x)
5833 If the matcher is use from clang-query, UnaryExprOrTypeTrait parameter
5834 should be passed as a quoted string. e.g., ofKind("UETT_SizeOf").
5835 </pre></td></tr>
5838 <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>
5839 <tr><td colspan="4" class="doc" id="hasAnyOperatorName3"><pre>Matches operator expressions (binary or unary) that have any of the
5840 specified names.
5842 hasAnyOperatorName("+", "-")
5843 Is equivalent to
5844 anyOf(hasOperatorName("+"), hasOperatorName("-"))
5845 </pre></td></tr>
5848 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperatorName4')"><a name="hasOperatorName4Anchor">hasOperatorName</a></td><td>std::string Name</td></tr>
5849 <tr><td colspan="4" class="doc" id="hasOperatorName4"><pre>Matches the operator Name of operator expressions and fold expressions
5850 (binary or unary).
5852 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
5853 !(a || b)
5855 Example matches `(0 + ... + args)`
5856 (matcher = cxxFoldExpr(hasOperatorName("+")))
5857 template &lt;typename... Args&gt;
5858 auto sum(Args... args) {
5859 return (0 + ... + args);
5861 </pre></td></tr>
5864 <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>
5865 <tr><td colspan="4" class="doc" id="isArrow1"><pre>Matches member expressions that are called with '-&gt;' as opposed
5866 to '.'.
5868 Member calls on the implicit this pointer match as called with '-&gt;'.
5870 Given
5871 class Y {
5872 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
5873 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
5874 int a;
5875 static int b;
5877 template &lt;class T&gt;
5878 class Z {
5879 void x() { this-&gt;m; }
5881 memberExpr(isArrow())
5882 matches this-&gt;x, x, y.x, a, this-&gt;b
5883 cxxDependentScopeMemberExpr(isArrow())
5884 matches this-&gt;m
5885 unresolvedMemberExpr(isArrow())
5886 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
5887 </pre></td></tr>
5890 <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>
5891 <tr><td colspan="4" class="doc" id="hasAutomaticStorageDuration0"><pre>Matches a variable declaration that has automatic storage duration.
5893 Example matches x, but not y, z, or a.
5894 (matcher = varDecl(hasAutomaticStorageDuration())
5895 void f() {
5896 int x;
5897 static int y;
5898 thread_local int z;
5900 int a;
5901 </pre></td></tr>
5904 <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>
5905 <tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
5907 Example matches y and z (matcher = varDecl(hasGlobalStorage())
5908 void f() {
5909 int x;
5910 static int y;
5912 int z;
5913 </pre></td></tr>
5916 <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>
5917 <tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a
5918 non-static local variable.
5920 Example matches x (matcher = varDecl(hasLocalStorage())
5921 void f() {
5922 int x;
5923 static int y;
5925 int z;
5926 </pre></td></tr>
5929 <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>
5930 <tr><td colspan="4" class="doc" id="hasStaticStorageDuration0"><pre>Matches a variable declaration that has static storage duration.
5931 It includes the variable declared at namespace scope and those declared
5932 with "static" and "extern" storage class specifiers.
5934 void f() {
5935 int x;
5936 static int y;
5937 thread_local int z;
5939 int a;
5940 static int b;
5941 extern int c;
5942 varDecl(hasStaticStorageDuration())
5943 matches the function declaration y, a, b and c.
5944 </pre></td></tr>
5947 <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>
5948 <tr><td colspan="4" class="doc" id="hasThreadStorageDuration0"><pre>Matches a variable declaration that has thread storage duration.
5950 Example matches z, but not x, z, or a.
5951 (matcher = varDecl(hasThreadStorageDuration())
5952 void f() {
5953 int x;
5954 static int y;
5955 thread_local int z;
5957 int a;
5958 </pre></td></tr>
5961 <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>
5962 <tr><td colspan="4" class="doc" id="isConstexpr0"><pre>Matches constexpr variable and function declarations,
5963 and if constexpr.
5965 Given:
5966 constexpr int foo = 42;
5967 constexpr int bar();
5968 void baz() { if constexpr(1 &gt; 0) {} }
5969 varDecl(isConstexpr())
5970 matches the declaration of foo.
5971 functionDecl(isConstexpr())
5972 matches the declaration of bar.
5973 ifStmt(isConstexpr())
5974 matches the if statement in baz.
5975 </pre></td></tr>
5978 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isConstinit0')"><a name="isConstinit0Anchor">isConstinit</a></td><td></td></tr>
5979 <tr><td colspan="4" class="doc" id="isConstinit0"><pre>Matches constinit variable declarations.
5981 Given:
5982 constinit int foo = 42;
5983 constinit const char* bar = "bar";
5984 int baz = 42;
5985 [[clang::require_constant_initialization]] int xyz = 42;
5986 varDecl(isConstinit())
5987 matches the declaration of `foo` and `bar`, but not `baz` and `xyz`.
5988 </pre></td></tr>
5991 <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>
5992 <tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
5994 Example matches A, va, fa
5995 class A {};
5996 class B; // Doesn't match, as it has no body.
5997 int va;
5998 extern int vb; // Doesn't match, as it doesn't define the variable.
5999 void fa() {}
6000 void fb(); // Doesn't match, as it has no body.
6001 @interface X
6002 - (void)ma; // Doesn't match, interface is declaration.
6003 @end
6004 @implementation X
6005 - (void)ma {}
6006 @end
6008 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;,
6009 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
6010 </pre></td></tr>
6013 <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>
6014 <tr><td colspan="4" class="doc" id="isExceptionVariable0"><pre>Matches a variable declaration that is an exception variable from
6015 a C++ catch block, or an Objective-C statement.
6017 Example matches x (matcher = varDecl(isExceptionVariable())
6018 void f(int y) {
6019 try {
6020 } catch (int x) {
6023 </pre></td></tr>
6026 <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>
6027 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
6028 static member variable template instantiations.
6030 Given
6031 template&lt;typename T&gt; void A(T t) { }
6032 template&lt;&gt; void A(int N) { }
6033 functionDecl(isExplicitTemplateSpecialization())
6034 matches the specialization A&lt;int&gt;().
6036 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;
6037 </pre></td></tr>
6040 <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>
6041 <tr><td colspan="4" class="doc" id="isExternC1"><pre>Matches extern "C" function or variable declarations.
6043 Given:
6044 extern "C" void f() {}
6045 extern "C" { void g() {} }
6046 void h() {}
6047 extern "C" int x = 1;
6048 extern "C" int y = 2;
6049 int z = 3;
6050 functionDecl(isExternC())
6051 matches the declaration of f and g, but not the declaration of h.
6052 varDecl(isExternC())
6053 matches the declaration of x and y, but not the declaration of z.
6054 </pre></td></tr>
6057 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isInitCapture0')"><a name="isInitCapture0Anchor">isInitCapture</a></td><td></td></tr>
6058 <tr><td colspan="4" class="doc" id="isInitCapture0"><pre>Matches a variable serving as the implicit variable for a lambda init-
6059 capture.
6061 Example matches x (matcher = varDecl(isInitCapture()))
6062 auto f = [x=3]() { return x; };
6063 </pre></td></tr>
6066 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;</td><td class="name" onclick="toggle('isInline2')"><a name="isInline2Anchor">isInline</a></td><td></td></tr>
6067 <tr><td colspan="4" class="doc" id="isInline2"><pre>Matches functions, variables and namespace declarations that are marked with
6068 the inline keyword.
6070 Given
6071 inline void f();
6072 void g();
6073 namespace n {
6074 inline namespace m {}
6076 inline int Foo = 5;
6077 functionDecl(isInline()) will match ::f().
6078 namespaceDecl(isInline()) will match n::m.
6079 varDecl(isInline()) will match Foo;
6080 </pre></td></tr>
6083 <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>
6084 <tr><td colspan="4" class="doc" id="isStaticLocal0"><pre>Matches a static variable with local scope.
6086 Example matches y (matcher = varDecl(isStaticLocal()))
6087 void f() {
6088 int x;
6089 static int y;
6091 static int z;
6092 </pre></td></tr>
6095 <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>
6096 <tr><td colspan="4" class="doc" id="isStaticStorageClass1"><pre>Matches variable/function declarations that have "static" storage
6097 class specifier ("static" keyword) written in the source.
6099 Given:
6100 static void f() {}
6101 static int i = 0;
6102 extern int j;
6103 int k;
6104 functionDecl(isStaticStorageClass())
6105 matches the function declaration f.
6106 varDecl(isStaticStorageClass())
6107 matches the variable declaration i.
6108 </pre></td></tr>
6111 <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>
6112 <tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
6113 member variable template instantiations.
6115 Given
6116 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
6118 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
6120 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
6121 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
6122 matches the template instantiation of X&lt;A&gt;.
6124 But given
6125 template &lt;typename T&gt; class X {}; class A {};
6126 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
6127 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
6128 does not match, as X&lt;A&gt; is an explicit template specialization.
6130 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;
6131 </pre></td></tr>
6133 <!--END_NARROWING_MATCHERS -->
6134 </table>
6136 <!-- ======================================================================= -->
6137 <h2 id="traversal-matchers">AST Traversal Matchers</h2>
6138 <!-- ======================================================================= -->
6140 <p>Traversal matchers specify the relationship to other nodes that are
6141 reachable from the current node.</p>
6143 <p>Note that there are special traversal matchers (has, hasDescendant, forEach and
6144 forEachDescendant) which work on all nodes and allow users to write more generic
6145 match expressions.</p>
6147 <table>
6148 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
6149 <!-- START_TRAVERSAL_MATCHERS -->
6151 <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>
6152 <tr><td colspan="4" class="doc" id="binaryOperation0"><pre>Matches nodes which can be used with binary operators.
6154 The code
6155 var1 != var2;
6156 might be represented in the clang AST as a binaryOperator, a
6157 cxxOperatorCallExpr or a cxxRewrittenBinaryOperator, depending on
6159 * whether the types of var1 and var2 are fundamental (binaryOperator) or at
6160 least one is a class type (cxxOperatorCallExpr)
6161 * whether the code appears in a template declaration, if at least one of the
6162 vars is a dependent-type (binaryOperator)
6163 * whether the code relies on a rewritten binary operator, such as a
6164 spaceship operator or an inverted equality operator
6165 (cxxRewrittenBinaryOperator)
6167 This matcher elides details in places where the matchers for the nodes are
6168 compatible.
6170 Given
6171 binaryOperation(
6172 hasOperatorName("!="),
6173 hasLHS(expr().bind("lhs")),
6174 hasRHS(expr().bind("rhs"))
6176 matches each use of "!=" in:
6177 struct S{
6178 bool operator!=(const S&amp;) const;
6181 void foo()
6183 1 != 2;
6184 S() != S();
6187 template&lt;typename T&gt;
6188 void templ()
6190 1 != 2;
6191 T() != S();
6193 struct HasOpEq
6195 bool operator==(const HasOpEq &amp;) const;
6198 void inverse()
6200 HasOpEq s1;
6201 HasOpEq s2;
6202 if (s1 != s2)
6203 return;
6206 struct HasSpaceship
6208 bool operator&lt;=&gt;(const HasOpEq &amp;) const;
6211 void use_spaceship()
6213 HasSpaceship s1;
6214 HasSpaceship s2;
6215 if (s1 != s2)
6216 return;
6218 </pre></td></tr>
6221 <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>
6222 <tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
6224 Unlike anyOf, eachOf will generate a match result for each
6225 matching submatcher.
6227 For example, in:
6228 class A { int a; int b; };
6229 The matcher:
6230 cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
6231 has(fieldDecl(hasName("b")).bind("v"))))
6232 will generate two results binding "v", the first of which binds
6233 the field declaration of a, the second the field declaration of
6236 Usable as: Any Matcher
6237 </pre></td></tr>
6240 <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>
6241 <tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
6243 Generates results for each match.
6245 For example, in:
6246 class A { class B {}; class C {}; };
6247 The matcher:
6248 cxxRecordDecl(hasName("::A"),
6249 findAll(cxxRecordDecl(isDefinition()).bind("m")))
6250 will generate results for A, B and C.
6252 Usable as: Any Matcher
6253 </pre></td></tr>
6256 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
6257 <tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
6258 provided matcher.
6260 Example matches X, A, A::X, B, B::C, B::C::X
6261 (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
6262 class X {};
6263 class A { class X {}; }; // Matches A, because A::X is a class of name
6264 // X inside A.
6265 class B { class C { class X {}; }; };
6267 DescendantT must be an AST base type.
6269 As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
6270 each result that matches instead of only on the first one.
6272 Note: Recursively combined ForEachDescendant can cause many matches:
6273 cxxRecordDecl(forEachDescendant(cxxRecordDecl(
6274 forEachDescendant(cxxRecordDecl())
6276 will match 10 times (plus injected class name matches) on:
6277 class A { class B { class C { class D { class E {}; }; }; }; };
6279 Usable as: Any Matcher
6280 </pre></td></tr>
6283 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
6284 <tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
6285 provided matcher.
6287 Example matches X, Y, Y::X, Z::Y, Z::Y::X
6288 (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
6289 class X {};
6290 class Y { class X {}; }; // Matches Y, because Y::X is a class of name X
6291 // inside Y.
6292 class Z { class Y { class X {}; }; }; // Does not match Z.
6294 ChildT must be an AST base type.
6296 As opposed to 'has', 'forEach' will cause a match for each result that
6297 matches instead of only on the first one.
6299 Usable as: Any Matcher
6300 </pre></td></tr>
6303 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
6304 <tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
6305 matcher.
6307 Given
6308 void f() { if (true) { int x = 42; } }
6309 void g() { for (;;) { int x = 43; } }
6310 expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
6312 Usable as: Any Matcher
6313 </pre></td></tr>
6316 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
6317 <tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
6318 provided matcher.
6320 Example matches X, Y, Z
6321 (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
6322 class X {}; // Matches X, because X::X is a class of name X inside X.
6323 class Y { class X {}; };
6324 class Z { class Y { class X {}; }; };
6326 DescendantT must be an AST base type.
6328 Usable as: Any Matcher
6329 </pre></td></tr>
6332 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
6333 <tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
6334 provided matcher.
6336 Example matches X, Y
6337 (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
6338 class X {}; // Matches X, because X::X is a class of name X inside X.
6339 class Y { class X {}; };
6340 class Z { class Y { class X {}; }; }; // Does not match Z.
6342 ChildT must be an AST base type.
6344 Usable as: Any Matcher
6345 Note that has is direct matcher, so it also matches things like implicit
6346 casts and paren casts. If you are matching with expr then you should
6347 probably consider using ignoringParenImpCasts like:
6348 has(ignoringParenImpCasts(expr())).
6349 </pre></td></tr>
6352 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
6353 <tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
6354 matcher.
6356 Given
6357 void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
6358 compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
6360 Usable as: Any Matcher
6361 </pre></td></tr>
6364 <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>
6365 <tr><td colspan="4" class="doc" id="invocation0"><pre>Matches function calls and constructor calls
6367 Because CallExpr and CXXConstructExpr do not share a common
6368 base class with API accessing arguments etc, AST Matchers for code
6369 which should match both are typically duplicated. This matcher
6370 removes the need for duplication.
6372 Given code
6373 struct ConstructorTakesInt
6375 ConstructorTakesInt(int i) {}
6378 void callTakesInt(int i)
6382 void doCall()
6384 callTakesInt(42);
6387 void doConstruct()
6389 ConstructorTakesInt cti(42);
6392 The matcher
6393 invocation(hasArgument(0, integerLiteral(equals(42))))
6394 matches the expression in both doCall and doConstruct
6395 </pre></td></tr>
6398 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('optionally0')"><a name="optionally0Anchor">optionally</a></td><td>Matcher&lt;*&gt;</td></tr>
6399 <tr><td colspan="4" class="doc" id="optionally0"><pre>Matches any node regardless of the submatcher.
6401 However, optionally will retain any bindings generated by the submatcher.
6402 Useful when additional information which may or may not present about a main
6403 matching node is desired.
6405 For example, in:
6406 class Foo {
6407 int bar;
6409 The matcher:
6410 cxxRecordDecl(
6411 optionally(has(
6412 fieldDecl(hasName("bar")).bind("var")
6413 ))).bind("record")
6414 will produce a result binding for both "record" and "var".
6415 The matcher will produce a "record" binding for even if there is no data
6416 member named "bar" in that class.
6418 Usable as: Any Matcher
6419 </pre></td></tr>
6422 <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>
6423 <tr><td colspan="4" class="doc" id="traverse0"><pre>Causes all nested matchers to be matched with the specified traversal kind.
6425 Given
6426 void foo()
6428 int i = 3.0;
6430 The matcher
6431 traverse(TK_IgnoreUnlessSpelledInSource,
6432 varDecl(hasInitializer(floatLiteral().bind("init")))
6434 matches the variable declaration with "init" bound to the "3.0".
6435 </pre></td></tr>
6438 <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>
6439 <tr><td colspan="4" class="doc" id="hasCondition5"><pre>Matches the condition expression of an if statement, for loop,
6440 switch statement or conditional operator.
6442 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6443 if (true) {}
6444 </pre></td></tr>
6447 <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>
6448 <tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator
6449 (binary or ternary).
6451 Example matches b
6452 condition ? a : b
6453 condition ?: b
6454 </pre></td></tr>
6457 <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>
6458 <tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
6460 Example 1 (conditional ternary operator): matches a
6461 condition ? a : b
6463 Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
6464 condition ?: b
6465 </pre></td></tr>
6468 <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>
6469 <tr><td colspan="4" class="doc" id="hasDeclaration15"><pre>Matches a node if the declaration associated with that node
6470 matches the given matcher.
6472 The associated declaration is:
6473 - for type nodes, the declaration of the underlying type
6474 - for CallExpr, the declaration of the callee
6475 - for MemberExpr, the declaration of the referenced member
6476 - for CXXConstructExpr, the declaration of the constructor
6477 - for CXXNewExpr, the declaration of the operator new
6478 - for ObjCIvarExpr, the declaration of the ivar
6480 For type nodes, hasDeclaration will generally match the declaration of the
6481 sugared type. Given
6482 class X {};
6483 typedef X Y;
6484 Y y;
6485 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6486 typedefDecl. A common use case is to match the underlying, desugared type.
6487 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6488 varDecl(hasType(hasUnqualifiedDesugaredType(
6489 recordType(hasDeclaration(decl())))))
6490 In this matcher, the decl will match the CXXRecordDecl of class X.
6492 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;,
6493 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;,
6494 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;,
6495 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;,
6496 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;,
6497 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;,
6498 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6499 </pre></td></tr>
6502 <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>
6503 <tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
6505 Given
6506 int i[5];
6507 void f() { i[1] = 42; }
6508 arraySubscriptExpression(hasBase(implicitCastExpr(
6509 hasSourceExpression(declRefExpr()))))
6510 matches i[1] with the declRefExpr() matching i
6511 </pre></td></tr>
6514 <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>
6515 <tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
6517 Given
6518 int i[5];
6519 void f() { i[1] = 42; }
6520 arraySubscriptExpression(hasIndex(integerLiteral()))
6521 matches i[1] with the integerLiteral() matching 1
6522 </pre></td></tr>
6525 <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>
6526 <tr><td colspan="4" class="doc" id="hasLHS3"><pre>Matches the left hand side of binary operator expressions.
6528 Example matches a (matcher = binaryOperator(hasLHS()))
6529 a || b
6530 </pre></td></tr>
6533 <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>
6534 <tr><td colspan="4" class="doc" id="hasRHS3"><pre>Matches the right hand side of binary operator expressions.
6536 Example matches b (matcher = binaryOperator(hasRHS()))
6537 a || b
6538 </pre></td></tr>
6541 <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>
6542 <tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
6543 type.
6545 Given
6546 struct A {};
6547 A a[7];
6548 int b[7];
6549 arrayType(hasElementType(builtinType()))
6550 matches "int b[7]"
6552 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;
6553 </pre></td></tr>
6556 <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>
6557 <tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
6559 Given
6560 _Atomic(int) i;
6561 _Atomic(float) f;
6562 atomicType(hasValueType(isInteger()))
6563 matches "_Atomic(int) i"
6565 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
6566 </pre></td></tr>
6569 <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>
6570 <tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
6572 Note: There is no TypeLoc for the deduced type and thus no
6573 getDeducedLoc() matcher.
6575 Given
6576 auto a = 1;
6577 auto b = 2.0;
6578 autoType(hasDeducedType(isInteger()))
6579 matches "auto a"
6581 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
6582 </pre></td></tr>
6585 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BaseUsingDecl.html">BaseUsingDecl</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>
6586 <tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
6588 Given
6589 namespace X { void b(); }
6590 using X::b;
6591 usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
6592 matches using X::b </pre></td></tr>
6595 <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>
6596 <tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
6597 binary operator or fold expression matches.
6598 </pre></td></tr>
6601 <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>
6602 <tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
6604 Example matches a (matcher = binaryOperator(hasLHS()))
6605 a || b
6606 </pre></td></tr>
6609 <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>
6610 <tr><td colspan="4" class="doc" id="hasOperands0"><pre>Matches if both matchers match with opposite sides of the binary operator
6611 or fold expression.
6613 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
6614 integerLiteral(equals(2)))
6615 1 + 2 // Match
6616 2 + 1 // Match
6617 1 + 1 // No match
6618 2 + 2 // No match
6619 </pre></td></tr>
6622 <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>
6623 <tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
6625 Example matches b (matcher = binaryOperator(hasRHS()))
6626 a || b
6627 </pre></td></tr>
6630 <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>
6631 <tr><td colspan="4" class="doc" id="forDecomposition0"><pre>Matches the DecompositionDecl the binding belongs to.
6633 For example, in:
6634 void foo()
6636 int arr[3];
6637 auto &amp;[f, s, t] = arr;
6639 f = 42;
6641 The matcher:
6642 bindingDecl(hasName("f"),
6643 forDecomposition(decompositionDecl())
6644 matches 'f' in 'auto &amp;[f, s, t]'.
6645 </pre></td></tr>
6648 <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>
6649 <tr><td colspan="4" class="doc" id="hasAnyParameter2"><pre>Matches any parameter of a function or an ObjC method declaration or a
6650 block.
6652 Does not match the 'this' parameter of a method.
6654 Given
6655 class X { void f(int x, int y, int z) {} };
6656 cxxMethodDecl(hasAnyParameter(hasName("y")))
6657 matches f(int x, int y, int z) {}
6658 with hasAnyParameter(...)
6659 matching int y
6661 For ObjectiveC, given
6662 @interface I - (void) f:(int) y; @end
6664 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
6665 matches the declaration of method f with hasParameter
6666 matching y.
6668 For blocks, given
6669 b = ^(int y) { printf("%d", y) };
6671 the matcher blockDecl(hasAnyParameter(hasName("y")))
6672 matches the declaration of the block b with hasParameter
6673 matching y.
6674 </pre></td></tr>
6677 <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>
6678 <tr><td colspan="4" class="doc" id="hasParameter2"><pre>Matches the n'th parameter of a function or an ObjC method
6679 declaration or a block.
6681 Given
6682 class X { void f(int x) {} };
6683 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
6684 matches f(int x) {}
6685 with hasParameter(...)
6686 matching int x
6688 For ObjectiveC, given
6689 @interface I - (void) f:(int) y; @end
6691 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
6692 matches the declaration of method f with hasParameter
6693 matching y.
6694 </pre></td></tr>
6697 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</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>
6698 <tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of a node matches the inner matcher.
6700 Examples:
6701 int x;
6702 declaratorDecl(hasTypeLoc(loc(asString("int"))))
6703 matches int x
6705 auto x = int(3);
6706 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
6707 matches int(3)
6709 struct Foo { Foo(int, int); };
6710 auto x = Foo(1, 2);
6711 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
6712 matches Foo(1, 2)
6714 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
6715 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
6716 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
6717 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
6718 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
6719 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
6720 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
6721 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
6722 </pre></td></tr>
6725 <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>
6726 <tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
6727 pointee matches a given matcher.
6729 Given
6730 int *a;
6731 int const *b;
6732 float const *f;
6733 pointerType(pointee(isConstQualified(), isInteger()))
6734 matches "int const *b"
6736 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;,
6737 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;
6738 </pre></td></tr>
6741 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc1')"><a name="hasTypeLoc1Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
6742 <tr><td colspan="4" class="doc" id="hasTypeLoc1"><pre>Matches if the type location of a node matches the inner matcher.
6744 Examples:
6745 int x;
6746 declaratorDecl(hasTypeLoc(loc(asString("int"))))
6747 matches int x
6749 auto x = int(3);
6750 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
6751 matches int(3)
6753 struct Foo { Foo(int, int); };
6754 auto x = Foo(1, 2);
6755 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
6756 matches Foo(1, 2)
6758 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
6759 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
6760 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
6761 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
6762 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
6763 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
6764 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
6765 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
6766 </pre></td></tr>
6769 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;</td><td class="name" onclick="toggle('hasType8')"><a name="hasType8Anchor">hasType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
6770 <tr><td colspan="4" class="doc" id="hasType8"><pre>Overloaded to match the declaration of the expression's or value
6771 declaration's type.
6773 In case of a value declaration (for example a variable declaration),
6774 this resolves one layer of indirection. For example, in the value
6775 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
6776 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
6777 declaration of x.
6779 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6780 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6781 and friend class X (matcher = friendDecl(hasType("X"))
6782 and public virtual X (matcher = cxxBaseSpecifier(hasType(
6783 cxxRecordDecl(hasName("X"))))
6784 class X {};
6785 void y(X &amp;x) { x; X z; }
6786 class Y { friend class X; };
6787 class Z : public virtual X {};
6789 Example matches class Derived
6790 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
6791 class Base {};
6792 class Derived : Base {};
6794 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;,
6795 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
6796 </pre></td></tr>
6799 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</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_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
6800 <tr><td colspan="4" class="doc" id="hasType4"><pre>Matches if the expression's or declaration's type matches a type
6801 matcher.
6803 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6804 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6805 and U (matcher = typedefDecl(hasType(asString("int")))
6806 and friend class X (matcher = friendDecl(hasType("X"))
6807 and public virtual X (matcher = cxxBaseSpecifier(hasType(
6808 asString("class X")))
6809 class X {};
6810 void y(X &amp;x) { x; X z; }
6811 typedef int U;
6812 class Y { friend class X; };
6813 class Z : public virtual X {};
6814 </pre></td></tr>
6817 <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>
6818 <tr><td colspan="4" class="doc" id="forEachArgumentWithParam1"><pre>Matches all arguments and their respective ParmVarDecl.
6820 Given
6821 void f(int i);
6822 int y;
6823 f(y);
6824 callExpr(
6825 forEachArgumentWithParam(
6826 declRefExpr(to(varDecl(hasName("y")))),
6827 parmVarDecl(hasType(isInteger()))
6829 matches f(y);
6830 with declRefExpr(...)
6831 matching int y
6832 and parmVarDecl(...)
6833 matching int i
6834 </pre></td></tr>
6837 <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>
6838 <tr><td colspan="4" class="doc" id="forEachArgumentWithParamType1"><pre>Matches all arguments and their respective types for a CallExpr or
6839 CXXConstructExpr. It is very similar to forEachArgumentWithParam but
6840 it works on calls through function pointers as well.
6842 The difference is, that function pointers do not provide access to a
6843 ParmVarDecl, but only the QualType for each argument.
6845 Given
6846 void f(int i);
6847 int y;
6848 f(y);
6849 void (*f_ptr)(int) = f;
6850 f_ptr(y);
6851 callExpr(
6852 forEachArgumentWithParamType(
6853 declRefExpr(to(varDecl(hasName("y")))),
6854 qualType(isInteger()).bind("type)
6856 matches f(y) and f_ptr(y)
6857 with declRefExpr(...)
6858 matching int y
6859 and qualType(...)
6860 matching int
6861 </pre></td></tr>
6864 <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>
6865 <tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
6866 expression, or an ObjC-message-send expression.
6868 Given
6869 void x(int, int, int) { int y; x(1, y, 42); }
6870 callExpr(hasAnyArgument(declRefExpr()))
6871 matches x(1, y, 42)
6872 with hasAnyArgument(...)
6873 matching y
6875 For ObjectiveC, given
6876 @interface I - (void) f:(int) y; @end
6877 void foo(I *i) { [i f:12]; }
6878 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
6879 matches [i f:12]
6880 </pre></td></tr>
6883 <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>
6884 <tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
6885 call expression.
6887 Example matches y in x(y)
6888 (matcher = callExpr(hasArgument(0, declRefExpr())))
6889 void x(int) { int y; x(y); }
6890 </pre></td></tr>
6893 <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>
6894 <tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
6895 matches the given matcher.
6897 The associated declaration is:
6898 - for type nodes, the declaration of the underlying type
6899 - for CallExpr, the declaration of the callee
6900 - for MemberExpr, the declaration of the referenced member
6901 - for CXXConstructExpr, the declaration of the constructor
6902 - for CXXNewExpr, the declaration of the operator new
6903 - for ObjCIvarExpr, the declaration of the ivar
6905 For type nodes, hasDeclaration will generally match the declaration of the
6906 sugared type. Given
6907 class X {};
6908 typedef X Y;
6909 Y y;
6910 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6911 typedefDecl. A common use case is to match the underlying, desugared type.
6912 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6913 varDecl(hasType(hasUnqualifiedDesugaredType(
6914 recordType(hasDeclaration(decl())))))
6915 In this matcher, the decl will match the CXXRecordDecl of class X.
6917 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;,
6918 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;,
6919 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;,
6920 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;,
6921 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;,
6922 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;,
6923 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6924 </pre></td></tr>
6927 <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>
6928 <tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
6930 Given
6931 class A { A() : i(42), j(42) {} int i; int j; };
6932 cxxConstructorDecl(forEachConstructorInitializer(
6933 forField(decl().bind("x"))
6935 will trigger two matches, binding for 'i' and 'j' respectively.
6936 </pre></td></tr>
6939 <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>
6940 <tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
6942 Given
6943 struct Foo {
6944 Foo() : foo_(1) { }
6945 int foo_;
6947 cxxRecordDecl(has(cxxConstructorDecl(
6948 hasAnyConstructorInitializer(anything())
6950 record matches Foo, hasAnyConstructorInitializer matches foo_(1)
6951 </pre></td></tr>
6954 <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>
6955 <tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
6957 Given
6958 struct Foo {
6959 Foo() : foo_(1) { }
6960 int foo_;
6962 cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
6963 forField(hasName("foo_"))))))
6964 matches Foo
6965 with forField matching foo_
6966 </pre></td></tr>
6969 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc2')"><a name="hasTypeLoc2Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
6970 <tr><td colspan="4" class="doc" id="hasTypeLoc2"><pre>Matches if the type location of a node matches the inner matcher.
6972 Examples:
6973 int x;
6974 declaratorDecl(hasTypeLoc(loc(asString("int"))))
6975 matches int x
6977 auto x = int(3);
6978 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
6979 matches int(3)
6981 struct Foo { Foo(int, int); };
6982 auto x = Foo(1, 2);
6983 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
6984 matches Foo(1, 2)
6986 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
6987 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
6988 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
6989 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
6990 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
6991 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
6992 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
6993 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
6994 </pre></td></tr>
6997 <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>
6998 <tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
7000 Given
7001 struct Foo {
7002 Foo() : foo_(1) { }
7003 int foo_;
7005 cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
7006 withInitializer(integerLiteral(equals(1)))))))
7007 matches Foo
7008 with withInitializer matching (1)
7009 </pre></td></tr>
7012 <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>
7013 <tr><td colspan="4" class="doc" id="hasObjectExpression2"><pre>Matches a member expression where the object expression is matched by a
7014 given matcher. Implicit object expressions are included; that is, it matches
7015 use of implicit `this`.
7017 Given
7018 struct X {
7019 int m;
7020 int f(X x) { x.m; return m; }
7022 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
7023 matches `x.m`, but not `m`; however,
7024 memberExpr(hasObjectExpression(hasType(pointsTo(
7025 cxxRecordDecl(hasName("X"))))))
7026 matches `m` (aka. `this-&gt;m`), but not `x.m`.
7027 </pre></td></tr>
7030 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</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_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
7031 <tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call or fold expression's callee expression matches.
7033 Given
7034 class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
7035 void f() { f(); }
7036 callExpr(callee(expr()))
7037 matches this-&gt;x(), x(), y.x(), f()
7038 with callee(...)
7039 matching this-&gt;x, x, y.x, f respectively
7041 Given
7042 template &lt;typename... Args&gt;
7043 auto sum(Args... args) {
7044 return (0 + ... + args);
7047 template &lt;typename... Args&gt;
7048 auto multiply(Args... args) {
7049 return (args * ... * 1);
7051 cxxFoldExpr(callee(expr()))
7052 matches (args * ... * 1)
7053 with callee(...)
7054 matching *
7056 Note: Callee cannot take the more general internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
7057 because this introduces ambiguous overloads with calls to Callee taking a
7058 internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
7059 implemented in terms of implicit casts.
7060 </pre></td></tr>
7063 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</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>
7064 <tr><td colspan="4" class="doc" id="hasEitherOperand2"><pre>Matches if either the left hand side or the right hand side of a
7065 binary operator or fold expression matches.
7066 </pre></td></tr>
7069 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;</td><td class="name" onclick="toggle('hasFoldInit0')"><a name="hasFoldInit0Anchor">hasFoldInit</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMacher</td></tr>
7070 <tr><td colspan="4" class="doc" id="hasFoldInit0"><pre>Matches the operand that does not contain the parameter pack.
7072 Example matches `(0 + ... + args)` and `(args * ... * 1)`
7073 (matcher = cxxFoldExpr(hasFoldInit(expr())))
7074 with hasFoldInit(...)
7075 matching `0` and `1` respectively
7076 template &lt;typename... Args&gt;
7077 auto sum(Args... args) {
7078 return (0 + ... + args);
7081 template &lt;typename... Args&gt;
7082 auto multiply(Args... args) {
7083 return (args * ... * 1);
7085 </pre></td></tr>
7088 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;</td><td class="name" onclick="toggle('hasLHS4')"><a name="hasLHS4Anchor">hasLHS</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
7089 <tr><td colspan="4" class="doc" id="hasLHS4"><pre>Matches the left hand side of binary operator expressions.
7091 Example matches a (matcher = binaryOperator(hasLHS()))
7092 a || b
7093 </pre></td></tr>
7096 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</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>
7097 <tr><td colspan="4" class="doc" id="hasOperands2"><pre>Matches if both matchers match with opposite sides of the binary operator
7098 or fold expression.
7100 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
7101 integerLiteral(equals(2)))
7102 1 + 2 // Match
7103 2 + 1 // Match
7104 1 + 1 // No match
7105 2 + 2 // No match
7106 </pre></td></tr>
7109 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;</td><td class="name" onclick="toggle('hasPattern0')"><a name="hasPattern0Anchor">hasPattern</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMacher</td></tr>
7110 <tr><td colspan="4" class="doc" id="hasPattern0"><pre>Matches the operand that contains the parameter pack.
7112 Example matches `(0 + ... + args)`
7113 (matcher = cxxFoldExpr(hasPattern(expr())))
7114 with hasPattern(...)
7115 matching `args`
7116 template &lt;typename... Args&gt;
7117 auto sum(Args... args) {
7118 return (0 + ... + args);
7121 template &lt;typename... Args&gt;
7122 auto multiply(Args... args) {
7123 return (args * ... * 1);
7125 </pre></td></tr>
7128 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFoldExpr.html">CXXFoldExpr</a>&gt;</td><td class="name" onclick="toggle('hasRHS4')"><a name="hasRHS4Anchor">hasRHS</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
7129 <tr><td colspan="4" class="doc" id="hasRHS4"><pre>Matches the right hand side of binary operator expressions.
7131 Example matches b (matcher = binaryOperator(hasRHS()))
7132 a || b
7133 </pre></td></tr>
7136 <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>
7137 <tr><td colspan="4" class="doc" id="hasBody3"><pre>Matches a 'for', 'while', 'while' statement or a function or coroutine
7138 definition that has a given body. Note that in case of functions or
7139 coroutines this matcher only matches the definition itself and not the
7140 other declarations of the same function or coroutine.
7142 Given
7143 for (;;) {}
7144 forStmt(hasBody(compoundStmt()))
7145 matches 'for (;;) {}'
7146 with compoundStmt()
7147 matching '{}'
7149 Given
7150 void f();
7151 void f() {}
7152 functionDecl(hasBody(compoundStmt()))
7153 matches 'void f() {}'
7154 with compoundStmt()
7155 matching '{}'
7156 but does not match 'void f();'
7157 </pre></td></tr>
7160 <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>
7161 <tr><td colspan="4" class="doc" id="hasInitStatement2"><pre>Matches selection statements with initializer.
7163 Given:
7164 void foo() {
7165 if (int i = foobar(); i &gt; 0) {}
7166 switch (int i = foobar(); i) {}
7167 for (auto&amp; a = get_range(); auto&amp; x : a) {}
7169 void bar() {
7170 if (foobar() &gt; 0) {}
7171 switch (foobar()) {}
7172 for (auto&amp; x : get_range()) {}
7174 ifStmt(hasInitStatement(anything()))
7175 matches the if statement in foo but not in bar.
7176 switchStmt(hasInitStatement(anything()))
7177 matches the switch statement in foo but not in bar.
7178 cxxForRangeStmt(hasInitStatement(anything()))
7179 matches the range for statement in foo but not in bar.
7180 </pre></td></tr>
7183 <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>
7184 <tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
7186 Example:
7187 forStmt(hasLoopVariable(anything()))
7188 matches 'int x' in
7189 for (int x : a) { }
7190 </pre></td></tr>
7193 <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>
7194 <tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
7196 Example:
7197 forStmt(hasRangeInit(anything()))
7198 matches 'a' in
7199 for (int x : a) { }
7200 </pre></td></tr>
7203 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc3')"><a name="hasTypeLoc3Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
7204 <tr><td colspan="4" class="doc" id="hasTypeLoc3"><pre>Matches if the type location of a node matches the inner matcher.
7206 Examples:
7207 int x;
7208 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7209 matches int x
7211 auto x = int(3);
7212 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7213 matches int(3)
7215 struct Foo { Foo(int, int); };
7216 auto x = Foo(1, 2);
7217 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7218 matches Foo(1, 2)
7220 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
7221 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
7222 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
7223 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7224 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7225 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
7226 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
7227 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7228 </pre></td></tr>
7231 <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>
7232 <tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre>Matches on the implicit object argument of a member call expression. Unlike
7233 `on`, matches the argument directly without stripping away anything.
7235 Given
7236 class Y { public: void m(); };
7237 Y g();
7238 class X : public Y { void g(); };
7239 void z(Y y, X x) { y.m(); x.m(); x.g(); (g()).m(); }
7240 cxxMemberCallExpr(onImplicitObjectArgument(hasType(
7241 cxxRecordDecl(hasName("Y")))))
7242 matches `y.m()`, `x.m()` and (`g()).m()`, but not `x.g()`).
7243 cxxMemberCallExpr(on(callExpr()))
7244 only matches `(g()).m()` (the parens are ignored).
7246 FIXME: Overload to allow directly matching types?
7247 </pre></td></tr>
7250 <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>
7251 <tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression, after
7252 stripping off any parentheses or implicit casts.
7254 Given
7255 class Y { public: void m(); };
7256 Y g();
7257 class X : public Y {};
7258 void z(Y y, X x) { y.m(); (g()).m(); x.m(); }
7259 cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y")))))
7260 matches `y.m()` and `(g()).m()`.
7261 cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("X")))))
7262 matches `x.m()`.
7263 cxxMemberCallExpr(on(callExpr()))
7264 matches `(g()).m()`.
7266 FIXME: Overload to allow directly matching types?
7267 </pre></td></tr>
7270 <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>
7271 <tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
7272 </pre></td></tr>
7275 <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>
7276 <tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the type of the expression's implicit object argument either
7277 matches the InnerMatcher, or is a pointer to a type that matches the
7278 InnerMatcher.
7280 Given
7281 class Y { public: void m(); };
7282 class X : public Y { void g(); };
7283 void z() { Y y; y.m(); Y *p; p-&gt;m(); X x; x.m(); x.g(); }
7284 cxxMemberCallExpr(thisPointerType(hasDeclaration(
7285 cxxRecordDecl(hasName("Y")))))
7286 matches `y.m()`, `p-&gt;m()` and `x.m()`.
7287 cxxMemberCallExpr(thisPointerType(hasDeclaration(
7288 cxxRecordDecl(hasName("X")))))
7289 matches `x.g()`.
7290 </pre></td></tr>
7293 <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>
7294 <tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overridden by the given method. This matcher may
7295 produce multiple matches.
7297 Given
7298 class A { virtual void f(); };
7299 class B : public A { void f(); };
7300 class C : public B { void f(); };
7301 cxxMethodDecl(ofClass(hasName("C")),
7302 forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
7303 matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
7304 that B::f is not overridden by C::f).
7306 The check can produce multiple matches in case of multiple inheritance, e.g.
7307 class A1 { virtual void f(); };
7308 class A2 { virtual void f(); };
7309 class C : public A1, public A2 { void f(); };
7310 cxxMethodDecl(ofClass(hasName("C")),
7311 forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
7312 matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
7313 once with "b" binding "A2::f" and "d" binding "C::f".
7314 </pre></td></tr>
7317 <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>
7318 <tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
7319 belongs to.
7321 FIXME: Generalize this for other kinds of declarations.
7322 FIXME: What other kind of declarations would we need to generalize
7323 this to?
7325 Example matches A() in the last line
7326 (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
7327 ofClass(hasName("A"))))))
7328 class A {
7329 public:
7330 A();
7332 A a = A();
7333 </pre></td></tr>
7336 <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>
7337 <tr><td colspan="4" class="doc" id="hasAnyPlacementArg0"><pre>Matches any placement new expression arguments.
7339 Given:
7340 MyClass *p1 = new (Storage) MyClass();
7341 cxxNewExpr(hasAnyPlacementArg(anything()))
7342 matches the expression 'new (Storage, 16) MyClass()'.
7343 </pre></td></tr>
7346 <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>
7347 <tr><td colspan="4" class="doc" id="hasArraySize0"><pre>Matches array new expressions with a given array size.
7349 Given:
7350 MyClass *p1 = new MyClass[10];
7351 cxxNewExpr(hasArraySize(integerLiteral(equals(10))))
7352 matches the expression 'new MyClass[10]'.
7353 </pre></td></tr>
7356 <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>
7357 <tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
7358 matches the given matcher.
7360 The associated declaration is:
7361 - for type nodes, the declaration of the underlying type
7362 - for CallExpr, the declaration of the callee
7363 - for MemberExpr, the declaration of the referenced member
7364 - for CXXConstructExpr, the declaration of the constructor
7365 - for CXXNewExpr, the declaration of the operator new
7366 - for ObjCIvarExpr, the declaration of the ivar
7368 For type nodes, hasDeclaration will generally match the declaration of the
7369 sugared type. Given
7370 class X {};
7371 typedef X Y;
7372 Y y;
7373 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7374 typedefDecl. A common use case is to match the underlying, desugared type.
7375 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7376 varDecl(hasType(hasUnqualifiedDesugaredType(
7377 recordType(hasDeclaration(decl())))))
7378 In this matcher, the decl will match the CXXRecordDecl of class X.
7380 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;,
7381 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;,
7382 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;,
7383 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;,
7384 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;,
7385 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;,
7386 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7387 </pre></td></tr>
7390 <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>
7391 <tr><td colspan="4" class="doc" id="hasPlacementArg0"><pre>Matches placement new expression arguments.
7393 Given:
7394 MyClass *p1 = new (Storage, 16) MyClass();
7395 cxxNewExpr(hasPlacementArg(1, integerLiteral(equals(16))))
7396 matches the expression 'new (Storage, 16) MyClass()'.
7397 </pre></td></tr>
7400 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc4')"><a name="hasTypeLoc4Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
7401 <tr><td colspan="4" class="doc" id="hasTypeLoc4"><pre>Matches if the type location of a node matches the inner matcher.
7403 Examples:
7404 int x;
7405 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7406 matches int x
7408 auto x = int(3);
7409 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7410 matches int(3)
7412 struct Foo { Foo(int, int); };
7413 auto x = Foo(1, 2);
7414 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7415 matches Foo(1, 2)
7417 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
7418 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
7419 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
7420 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7421 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7422 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
7423 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
7424 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7425 </pre></td></tr>
7428 <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>
7429 <tr><td colspan="4" class="doc" id="hasEitherOperand1"><pre>Matches if either the left hand side or the right hand side of a
7430 binary operator or fold expression matches.
7431 </pre></td></tr>
7434 <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>
7435 <tr><td colspan="4" class="doc" id="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
7437 Example matches a (matcher = binaryOperator(hasLHS()))
7438 a || b
7439 </pre></td></tr>
7442 <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>
7443 <tr><td colspan="4" class="doc" id="hasOperands1"><pre>Matches if both matchers match with opposite sides of the binary operator
7444 or fold expression.
7446 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
7447 integerLiteral(equals(2)))
7448 1 + 2 // Match
7449 2 + 1 // Match
7450 1 + 1 // No match
7451 2 + 2 // No match
7452 </pre></td></tr>
7455 <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>
7456 <tr><td colspan="4" class="doc" id="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
7458 Example matches b (matcher = binaryOperator(hasRHS()))
7459 a || b
7460 </pre></td></tr>
7463 <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>
7464 <tr><td colspan="4" class="doc" id="hasUnaryOperand1"><pre>Matches if the operand of a unary operator matches.
7466 Example matches true (matcher = hasUnaryOperand(
7467 cxxBoolLiteral(equals(true))))
7468 !true
7469 </pre></td></tr>
7472 <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>
7473 <tr><td colspan="4" class="doc" id="hasAnyBase0"><pre>Matches C++ classes that have a direct or indirect base matching BaseSpecMatcher.
7475 Example:
7476 matcher hasAnyBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
7477 class Foo;
7478 class Bar : Foo {};
7479 class Baz : Bar {};
7480 class SpecialBase;
7481 class Proxy : SpecialBase {}; // matches Proxy
7482 class IndirectlyDerived : Proxy {}; //matches IndirectlyDerived
7484 FIXME: Refactor this and isDerivedFrom to reuse implementation.
7485 </pre></td></tr>
7488 <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>
7489 <tr><td colspan="4" class="doc" id="hasDirectBase0"><pre>Matches C++ classes that have a direct base matching BaseSpecMatcher.
7491 Example:
7492 matcher hasDirectBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
7493 class Foo;
7494 class Bar : Foo {};
7495 class Baz : Bar {};
7496 class SpecialBase;
7497 class Proxy : SpecialBase {}; // matches Proxy
7498 class IndirectlyDerived : Proxy {}; // doesn't match
7499 </pre></td></tr>
7502 <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>
7503 <tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
7505 Given:
7506 class A { void func(); };
7507 class B { void member(); };
7509 cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
7510 A but not B.
7511 </pre></td></tr>
7514 <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>
7515 <tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from a class
7516 matching Base, or Objective-C classes that directly or indirectly
7517 subclass a class matching Base.
7519 Note that a class is not considered to be derived from itself.
7521 Example matches Y, Z, C (Base == hasName("X"))
7522 class X;
7523 class Y : public X {}; // directly derived
7524 class Z : public Y {}; // indirectly derived
7525 typedef X A;
7526 typedef A B;
7527 class C : public B {}; // derived from a typedef of X
7529 In the following example, Bar matches isDerivedFrom(hasName("X")):
7530 class Foo;
7531 typedef Foo X;
7532 class Bar : public Foo {}; // derived from a type that X is a typedef of
7534 In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
7535 @interface NSObject @end
7536 @interface Bar : NSObject @end
7538 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;
7539 </pre></td></tr>
7542 <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>
7543 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom0"><pre>Matches C++ or Objective-C classes that are directly derived from a class
7544 matching Base.
7546 Note that a class is not considered to be derived from itself.
7548 Example matches Y, C (Base == hasName("X"))
7549 class X;
7550 class Y : public X {}; // directly derived
7551 class Z : public Y {}; // indirectly derived
7552 typedef X A;
7553 typedef A B;
7554 class C : public B {}; // derived from a typedef of X
7556 In the following example, Bar matches isDerivedFrom(hasName("X")):
7557 class Foo;
7558 typedef Foo X;
7559 class Bar : public Foo {}; // derived from a type that X is a typedef of
7560 </pre></td></tr>
7563 <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>
7564 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
7565 match Base.
7566 </pre></td></tr>
7569 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasEitherOperand3')"><a name="hasEitherOperand3Anchor">hasEitherOperand</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
7570 <tr><td colspan="4" class="doc" id="hasEitherOperand3"><pre>Matches if either the left hand side or the right hand side of a
7571 binary operator or fold expression matches.
7572 </pre></td></tr>
7575 <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>
7576 <tr><td colspan="4" class="doc" id="hasLHS2"><pre>Matches the left hand side of binary operator expressions.
7578 Example matches a (matcher = binaryOperator(hasLHS()))
7579 a || b
7580 </pre></td></tr>
7583 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperands3')"><a name="hasOperands3Anchor">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>
7584 <tr><td colspan="4" class="doc" id="hasOperands3"><pre>Matches if both matchers match with opposite sides of the binary operator
7585 or fold expression.
7587 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
7588 integerLiteral(equals(2)))
7589 1 + 2 // Match
7590 2 + 1 // Match
7591 1 + 1 // No match
7592 2 + 2 // No match
7593 </pre></td></tr>
7596 <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>
7597 <tr><td colspan="4" class="doc" id="hasRHS2"><pre>Matches the right hand side of binary operator expressions.
7599 Example matches b (matcher = binaryOperator(hasRHS()))
7600 a || b
7601 </pre></td></tr>
7604 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc5')"><a name="hasTypeLoc5Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
7605 <tr><td colspan="4" class="doc" id="hasTypeLoc5"><pre>Matches if the type location of a node matches the inner matcher.
7607 Examples:
7608 int x;
7609 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7610 matches int x
7612 auto x = int(3);
7613 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7614 matches int(3)
7616 struct Foo { Foo(int, int); };
7617 auto x = Foo(1, 2);
7618 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7619 matches Foo(1, 2)
7621 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
7622 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
7623 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
7624 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7625 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7626 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
7627 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
7628 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7629 </pre></td></tr>
7632 <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>
7633 <tr><td colspan="4" class="doc" id="hasAnyArgument2"><pre>Matches any argument of a call expression or a constructor call
7634 expression, or an ObjC-message-send expression.
7636 Given
7637 void x(int, int, int) { int y; x(1, y, 42); }
7638 callExpr(hasAnyArgument(declRefExpr()))
7639 matches x(1, y, 42)
7640 with hasAnyArgument(...)
7641 matching y
7643 For ObjectiveC, given
7644 @interface I - (void) f:(int) y; @end
7645 void foo(I *i) { [i f:12]; }
7646 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
7647 matches [i f:12]
7648 </pre></td></tr>
7651 <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>
7652 <tr><td colspan="4" class="doc" id="hasArgument2"><pre>Matches the n'th argument of a call expression or a constructor
7653 call expression.
7655 Example matches y in x(y)
7656 (matcher = callExpr(hasArgument(0, declRefExpr())))
7657 void x(int) { int y; x(y); }
7658 </pre></td></tr>
7661 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc6')"><a name="hasTypeLoc6Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
7662 <tr><td colspan="4" class="doc" id="hasTypeLoc6"><pre>Matches if the type location of a node matches the inner matcher.
7664 Examples:
7665 int x;
7666 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7667 matches int x
7669 auto x = int(3);
7670 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7671 matches int(3)
7673 struct Foo { Foo(int, int); };
7674 auto x = Foo(1, 2);
7675 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7676 matches Foo(1, 2)
7678 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
7679 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
7680 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
7681 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7682 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7683 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
7684 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
7685 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7686 </pre></td></tr>
7689 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('callee3')"><a name="callee3Anchor">callee</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
7690 <tr><td colspan="4" class="doc" id="callee3"><pre>Matches 1) if the call expression's callee's declaration matches the
7691 given matcher; or 2) if the Obj-C message expression's callee's method
7692 declaration matches the given matcher.
7694 Example matches y.x() (matcher = callExpr(callee(
7695 cxxMethodDecl(hasName("x")))))
7696 class Y { public: void x(); };
7697 void z() { Y y; y.x(); }
7699 Example 2. Matches [I foo] with
7700 objcMessageExpr(callee(objcMethodDecl(hasName("foo"))))
7702 @interface I: NSObject
7703 +(void)foo;
7704 @end
7706 [I foo]
7707 </pre></td></tr>
7710 <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>
7711 <tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call or fold expression's callee expression matches.
7713 Given
7714 class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
7715 void f() { f(); }
7716 callExpr(callee(expr()))
7717 matches this-&gt;x(), x(), y.x(), f()
7718 with callee(...)
7719 matching this-&gt;x, x, y.x, f respectively
7721 Given
7722 template &lt;typename... Args&gt;
7723 auto sum(Args... args) {
7724 return (0 + ... + args);
7727 template &lt;typename... Args&gt;
7728 auto multiply(Args... args) {
7729 return (args * ... * 1);
7731 cxxFoldExpr(callee(expr()))
7732 matches (args * ... * 1)
7733 with callee(...)
7734 matching *
7736 Note: Callee cannot take the more general internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
7737 because this introduces ambiguous overloads with calls to Callee taking a
7738 internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
7739 implemented in terms of implicit casts.
7740 </pre></td></tr>
7743 <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>
7744 <tr><td colspan="4" class="doc" id="forEachArgumentWithParam0"><pre>Matches all arguments and their respective ParmVarDecl.
7746 Given
7747 void f(int i);
7748 int y;
7749 f(y);
7750 callExpr(
7751 forEachArgumentWithParam(
7752 declRefExpr(to(varDecl(hasName("y")))),
7753 parmVarDecl(hasType(isInteger()))
7755 matches f(y);
7756 with declRefExpr(...)
7757 matching int y
7758 and parmVarDecl(...)
7759 matching int i
7760 </pre></td></tr>
7763 <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>
7764 <tr><td colspan="4" class="doc" id="forEachArgumentWithParamType0"><pre>Matches all arguments and their respective types for a CallExpr or
7765 CXXConstructExpr. It is very similar to forEachArgumentWithParam but
7766 it works on calls through function pointers as well.
7768 The difference is, that function pointers do not provide access to a
7769 ParmVarDecl, but only the QualType for each argument.
7771 Given
7772 void f(int i);
7773 int y;
7774 f(y);
7775 void (*f_ptr)(int) = f;
7776 f_ptr(y);
7777 callExpr(
7778 forEachArgumentWithParamType(
7779 declRefExpr(to(varDecl(hasName("y")))),
7780 qualType(isInteger()).bind("type)
7782 matches f(y) and f_ptr(y)
7783 with declRefExpr(...)
7784 matching int y
7785 and qualType(...)
7786 matching int
7787 </pre></td></tr>
7790 <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>
7791 <tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
7792 expression, or an ObjC-message-send expression.
7794 Given
7795 void x(int, int, int) { int y; x(1, y, 42); }
7796 callExpr(hasAnyArgument(declRefExpr()))
7797 matches x(1, y, 42)
7798 with hasAnyArgument(...)
7799 matching y
7801 For ObjectiveC, given
7802 @interface I - (void) f:(int) y; @end
7803 void foo(I *i) { [i f:12]; }
7804 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
7805 matches [i f:12]
7806 </pre></td></tr>
7809 <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>
7810 <tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
7811 call expression.
7813 Example matches y in x(y)
7814 (matcher = callExpr(hasArgument(0, declRefExpr())))
7815 void x(int) { int y; x(y); }
7816 </pre></td></tr>
7819 <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>
7820 <tr><td colspan="4" class="doc" id="hasDeclaration14"><pre>Matches a node if the declaration associated with that node
7821 matches the given matcher.
7823 The associated declaration is:
7824 - for type nodes, the declaration of the underlying type
7825 - for CallExpr, the declaration of the callee
7826 - for MemberExpr, the declaration of the referenced member
7827 - for CXXConstructExpr, the declaration of the constructor
7828 - for CXXNewExpr, the declaration of the operator new
7829 - for ObjCIvarExpr, the declaration of the ivar
7831 For type nodes, hasDeclaration will generally match the declaration of the
7832 sugared type. Given
7833 class X {};
7834 typedef X Y;
7835 Y y;
7836 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7837 typedefDecl. A common use case is to match the underlying, desugared type.
7838 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7839 varDecl(hasType(hasUnqualifiedDesugaredType(
7840 recordType(hasDeclaration(decl())))))
7841 In this matcher, the decl will match the CXXRecordDecl of class X.
7843 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;,
7844 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;,
7845 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;,
7846 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;,
7847 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;,
7848 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;,
7849 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7850 </pre></td></tr>
7853 <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>
7854 <tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
7855 extension, matches the constant given in the statement.
7857 Given
7858 switch (1) { case 1: case 1+1: case 3 ... 4: ; }
7859 caseStmt(hasCaseConstant(integerLiteral()))
7860 matches "case 1:"
7861 </pre></td></tr>
7864 <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>
7865 <tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression
7866 or opaque value's source expression matches the given matcher.
7868 Example 1: matches "a string"
7869 (matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
7870 class URL { URL(string); };
7871 URL url = "a string";
7873 Example 2: matches 'b' (matcher =
7874 opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
7875 int a = b ?: 1;
7876 </pre></td></tr>
7879 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('forEachTemplateArgument0')"><a name="forEachTemplateArgument0Anchor">forEachTemplateArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
7880 <tr><td colspan="4" class="doc" id="forEachTemplateArgument0"><pre>Matches templateSpecializationType, class template specialization,
7881 variable template specialization, and function template specialization
7882 nodes where the template argument matches the inner matcher. This matcher
7883 may produce multiple matches.
7885 Given
7886 template &lt;typename T, unsigned N, unsigned M&gt;
7887 struct Matrix {};
7889 constexpr unsigned R = 2;
7890 Matrix&lt;int, R * 2, R * 4&gt; M;
7892 template &lt;typename T, typename U&gt;
7893 void f(T&amp;&amp; t, U&amp;&amp; u) {}
7895 bool B = false;
7896 f(R, B);
7897 templateSpecializationType(forEachTemplateArgument(isExpr(expr())))
7898 matches twice, with expr() matching 'R * 2' and 'R * 4'
7899 functionDecl(forEachTemplateArgument(refersToType(builtinType())))
7900 matches the specialization f&lt;unsigned, bool&gt; twice, for 'unsigned'
7901 and 'bool'
7902 </pre></td></tr>
7905 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgumentLoc0')"><a name="hasAnyTemplateArgumentLoc0Anchor">hasAnyTemplateArgumentLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
7906 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgumentLoc0"><pre>Matches template specialization `TypeLoc`s, class template specializations,
7907 variable template specializations, and function template specializations
7908 that have at least one `TemplateArgumentLoc` matching the given
7909 `InnerMatcher`.
7911 Given
7912 template&lt;typename T&gt; class A {};
7913 A&lt;int&gt; a;
7914 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc(
7915 hasTypeLoc(loc(asString("int")))))))
7916 matches `A&lt;int&gt; a`.
7917 </pre></td></tr>
7920 <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>
7921 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches templateSpecializationTypes, class template specializations,
7922 variable template specializations, and function template specializations
7923 that have at least one TemplateArgument matching the given InnerMatcher.
7925 Given
7926 template&lt;typename T&gt; class A {};
7927 template&lt;&gt; class A&lt;double&gt; {};
7928 A&lt;int&gt; a;
7930 template&lt;typename T&gt; f() {};
7931 void func() { f&lt;int&gt;(); };
7933 classTemplateSpecializationDecl(hasAnyTemplateArgument(
7934 refersToType(asString("int"))))
7935 matches the specialization A&lt;int&gt;
7937 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
7938 matches the specialization f&lt;int&gt;
7939 </pre></td></tr>
7942 <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>
7943 <tr><td colspan="4" class="doc" id="hasSpecializedTemplate0"><pre>Matches the specialized template of a specialization declaration.
7945 Given
7946 template&lt;typename T&gt; class A {}; #1
7947 template&lt;&gt; class A&lt;int&gt; {}; #2
7948 classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl()))
7949 matches '#2' with classTemplateDecl() matching the class template
7950 declaration of 'A' at #1.
7951 </pre></td></tr>
7954 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgumentLoc0')"><a name="hasTemplateArgumentLoc0Anchor">hasTemplateArgumentLoc</a></td><td>unsigned Index, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
7955 <tr><td colspan="4" class="doc" id="hasTemplateArgumentLoc0"><pre>Matches template specialization `TypeLoc`s, class template specializations,
7956 variable template specializations, and function template specializations
7957 where the n'th `TemplateArgumentLoc` matches the given `InnerMatcher`.
7959 Given
7960 template&lt;typename T, typename U&gt; class A {};
7961 A&lt;double, int&gt; b;
7962 A&lt;int, double&gt; c;
7963 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0,
7964 hasTypeLoc(loc(asString("double")))))))
7965 matches `A&lt;double, int&gt; b`, but not `A&lt;int, double&gt; c`.
7966 </pre></td></tr>
7969 <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>
7970 <tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches templateSpecializationType, class template specializations,
7971 variable template specializations, and function template specializations
7972 where the n'th TemplateArgument matches the given InnerMatcher.
7974 Given
7975 template&lt;typename T, typename U&gt; class A {};
7976 A&lt;bool, int&gt; b;
7977 A&lt;int, bool&gt; c;
7979 template&lt;typename T&gt; void f() {}
7980 void func() { f&lt;int&gt;(); };
7981 classTemplateSpecializationDecl(hasTemplateArgument(
7982 1, refersToType(asString("int"))))
7983 matches the specialization A&lt;bool, int&gt;
7985 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
7986 matches the specialization f&lt;int&gt;
7987 </pre></td></tr>
7990 <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>
7991 <tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
7992 type.
7994 Given
7995 struct A {};
7996 A a[7];
7997 int b[7];
7998 arrayType(hasElementType(builtinType()))
7999 matches "int b[7]"
8001 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;
8002 </pre></td></tr>
8005 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc7')"><a name="hasTypeLoc7Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
8006 <tr><td colspan="4" class="doc" id="hasTypeLoc7"><pre>Matches if the type location of a node matches the inner matcher.
8008 Examples:
8009 int x;
8010 declaratorDecl(hasTypeLoc(loc(asString("int"))))
8011 matches int x
8013 auto x = int(3);
8014 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
8015 matches int(3)
8017 struct Foo { Foo(int, int); };
8018 auto x = Foo(1, 2);
8019 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
8020 matches Foo(1, 2)
8022 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
8023 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
8024 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
8025 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
8026 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
8027 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
8028 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
8029 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
8030 </pre></td></tr>
8033 <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>
8034 <tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
8035 a given matcher. Also matches StmtExprs that have CompoundStmt as children.
8037 Given
8038 { {}; 1+2; }
8039 hasAnySubstatement(compoundStmt())
8040 matches '{ {}; 1+2; }'
8041 with compoundStmt()
8042 matching '{}'
8043 </pre></td></tr>
8046 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CoroutineBodyStmt.html">CoroutineBodyStmt</a>&gt;</td><td class="name" onclick="toggle('hasBody5')"><a name="hasBody5Anchor">hasBody</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
8047 <tr><td colspan="4" class="doc" id="hasBody5"><pre>Matches a 'for', 'while', 'while' statement or a function or coroutine
8048 definition that has a given body. Note that in case of functions or
8049 coroutines this matcher only matches the definition itself and not the
8050 other declarations of the same function or coroutine.
8052 Given
8053 for (;;) {}
8054 forStmt(hasBody(compoundStmt()))
8055 matches 'for (;;) {}'
8056 with compoundStmt()
8057 matching '{}'
8059 Given
8060 void f();
8061 void f() {}
8062 functionDecl(hasBody(compoundStmt()))
8063 matches 'void f() {}'
8064 with compoundStmt()
8065 matching '{}'
8066 but does not match 'void f();'
8067 </pre></td></tr>
8070 <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>
8071 <tr><td colspan="4" class="doc" id="hasDecayedType0"><pre>Matches the decayed type, whoes decayed type matches InnerMatcher
8072 </pre></td></tr>
8075 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgumentLoc3')"><a name="hasAnyTemplateArgumentLoc3Anchor">hasAnyTemplateArgumentLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
8076 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgumentLoc3"><pre>Matches template specialization `TypeLoc`s, class template specializations,
8077 variable template specializations, and function template specializations
8078 that have at least one `TemplateArgumentLoc` matching the given
8079 `InnerMatcher`.
8081 Given
8082 template&lt;typename T&gt; class A {};
8083 A&lt;int&gt; a;
8084 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc(
8085 hasTypeLoc(loc(asString("int")))))))
8086 matches `A&lt;int&gt; a`.
8087 </pre></td></tr>
8090 <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>
8091 <tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
8092 matches the given matcher.
8094 The associated declaration is:
8095 - for type nodes, the declaration of the underlying type
8096 - for CallExpr, the declaration of the callee
8097 - for MemberExpr, the declaration of the referenced member
8098 - for CXXConstructExpr, the declaration of the constructor
8099 - for CXXNewExpr, the declaration of the operator new
8100 - for ObjCIvarExpr, the declaration of the ivar
8102 For type nodes, hasDeclaration will generally match the declaration of the
8103 sugared type. Given
8104 class X {};
8105 typedef X Y;
8106 Y y;
8107 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8108 typedefDecl. A common use case is to match the underlying, desugared type.
8109 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8110 varDecl(hasType(hasUnqualifiedDesugaredType(
8111 recordType(hasDeclaration(decl())))))
8112 In this matcher, the decl will match the CXXRecordDecl of class X.
8114 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;,
8115 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;,
8116 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;,
8117 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;,
8118 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;,
8119 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;,
8120 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8121 </pre></td></tr>
8124 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgumentLoc3')"><a name="hasTemplateArgumentLoc3Anchor">hasTemplateArgumentLoc</a></td><td>unsigned Index, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
8125 <tr><td colspan="4" class="doc" id="hasTemplateArgumentLoc3"><pre>Matches template specialization `TypeLoc`s, class template specializations,
8126 variable template specializations, and function template specializations
8127 where the n'th `TemplateArgumentLoc` matches the given `InnerMatcher`.
8129 Given
8130 template&lt;typename T, typename U&gt; class A {};
8131 A&lt;double, int&gt; b;
8132 A&lt;int, double&gt; c;
8133 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0,
8134 hasTypeLoc(loc(asString("double")))))))
8135 matches `A&lt;double, int&gt; b`, but not `A&lt;int, double&gt; c`.
8136 </pre></td></tr>
8139 <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; Inner</td></tr>
8140 <tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches if a node refers to a declaration through a specific
8141 using shadow declaration.
8143 Examples:
8144 namespace a { int f(); }
8145 using a::f;
8146 int x = f();
8147 declRefExpr(throughUsingDecl(anything()))
8148 matches f
8150 namespace a { class X{}; }
8151 using a::X;
8152 X x;
8153 typeLoc(loc(usingType(throughUsingDecl(anything()))))
8154 matches X
8156 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UsingType.html">UsingType</a>&gt;
8157 </pre></td></tr>
8160 <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>
8161 <tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
8162 specified matcher.
8164 Example matches x in if(x)
8165 (matcher = declRefExpr(to(varDecl(hasName("x")))))
8166 bool x;
8167 if (x) {}
8168 </pre></td></tr>
8171 <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>
8172 <tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
8174 Note that this does not work for global declarations because the AST
8175 breaks up multiple-declaration DeclStmt's into multiple single-declaration
8176 DeclStmt's.
8177 Example: Given non-global declarations
8178 int a, b = 0;
8179 int c;
8180 int d = 2, e;
8181 declStmt(containsDeclaration(
8182 0, varDecl(hasInitializer(anything()))))
8183 matches only 'int d = 2, e;', and
8184 declStmt(containsDeclaration(1, varDecl()))
8185 matches 'int a, b = 0' as well as 'int d = 2, e;'
8186 but 'int c;' is not matched.
8187 </pre></td></tr>
8190 <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>
8191 <tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
8193 Given
8194 int a, b;
8195 int c;
8196 declStmt(hasSingleDecl(anything()))
8197 matches 'int c;' but not 'int a, b;'.
8198 </pre></td></tr>
8201 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc8')"><a name="hasTypeLoc8Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
8202 <tr><td colspan="4" class="doc" id="hasTypeLoc8"><pre>Matches if the type location of a node matches the inner matcher.
8204 Examples:
8205 int x;
8206 declaratorDecl(hasTypeLoc(loc(asString("int"))))
8207 matches int x
8209 auto x = int(3);
8210 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
8211 matches int(3)
8213 struct Foo { Foo(int, int); };
8214 auto x = Foo(1, 2);
8215 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
8216 matches Foo(1, 2)
8218 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
8219 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
8220 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
8221 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
8222 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
8223 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
8224 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
8225 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
8226 </pre></td></tr>
8229 <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>
8230 <tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
8231 Decl, matches InnerMatcher.
8233 Given
8234 namespace N {
8235 namespace M {
8236 class D {};
8240 cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
8241 declaration of class D.
8242 </pre></td></tr>
8245 <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>
8246 <tr><td colspan="4" class="doc" id="hasUnderlyingType0"><pre>Matches DecltypeType or UsingType nodes to find the underlying type.
8248 Given
8249 decltype(1) a = 1;
8250 decltype(2.0) b = 2.0;
8251 decltypeType(hasUnderlyingType(isInteger()))
8252 matches the type of "a"
8254 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UsingType.html">UsingType</a>&gt;
8255 </pre></td></tr>
8258 <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>
8259 <tr><td colspan="4" class="doc" id="hasAnyBinding0"><pre>Matches any binding of a DecompositionDecl.
8261 For example, in:
8262 void foo()
8264 int arr[3];
8265 auto &amp;[f, s, t] = arr;
8267 f = 42;
8269 The matcher:
8270 decompositionDecl(hasAnyBinding(bindingDecl(hasName("f").bind("fBinding"))))
8271 matches the decomposition decl with 'f' bound to "fBinding".
8272 </pre></td></tr>
8275 <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>
8276 <tr><td colspan="4" class="doc" id="hasBinding0"><pre>Matches the Nth binding of a DecompositionDecl.
8278 For example, in:
8279 void foo()
8281 int arr[3];
8282 auto &amp;[f, s, t] = arr;
8284 f = 42;
8286 The matcher:
8287 decompositionDecl(hasBinding(0,
8288 bindingDecl(hasName("f").bind("fBinding"))))
8289 matches the decomposition decl with 'f' bound to "fBinding".
8290 </pre></td></tr>
8293 <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>
8294 <tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', 'while' statement or a function or coroutine
8295 definition that has a given body. Note that in case of functions or
8296 coroutines this matcher only matches the definition itself and not the
8297 other declarations of the same function or coroutine.
8299 Given
8300 for (;;) {}
8301 forStmt(hasBody(compoundStmt()))
8302 matches 'for (;;) {}'
8303 with compoundStmt()
8304 matching '{}'
8306 Given
8307 void f();
8308 void f() {}
8309 functionDecl(hasBody(compoundStmt()))
8310 matches 'void f() {}'
8311 with compoundStmt()
8312 matching '{}'
8313 but does not match 'void f();'
8314 </pre></td></tr>
8317 <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>
8318 <tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
8319 switch statement or conditional operator.
8321 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
8322 if (true) {}
8323 </pre></td></tr>
8326 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ElaboratedTypeLoc.html">ElaboratedTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasNamedTypeLoc0')"><a name="hasNamedTypeLoc0Anchor">hasNamedTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; InnerMatcher</td></tr>
8327 <tr><td colspan="4" class="doc" id="hasNamedTypeLoc0"><pre>Matches elaborated `TypeLoc`s that have a named `TypeLoc` matching
8328 `InnerMatcher`.
8330 Given
8331 template &lt;typename T&gt;
8332 class C {};
8333 class C&lt;int&gt; c;
8335 class D {};
8336 class D d;
8337 elaboratedTypeLoc(hasNamedTypeLoc(templateSpecializationTypeLoc()));
8338 matches the `TypeLoc` of the variable declaration of `c`, but not `d`.
8339 </pre></td></tr>
8342 <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>
8343 <tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
8344 matches InnerMatcher if the qualifier exists.
8346 Given
8347 namespace N {
8348 namespace M {
8349 class D {};
8352 N::M::D d;
8354 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
8355 matches the type of the variable declaration of d.
8356 </pre></td></tr>
8359 <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>
8360 <tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
8362 Given
8363 namespace N {
8364 namespace M {
8365 class D {};
8368 N::M::D d;
8370 elaboratedType(namesType(recordType(
8371 hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
8372 declaration of d.
8373 </pre></td></tr>
8376 <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>
8377 <tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
8378 matches the given matcher.
8380 The associated declaration is:
8381 - for type nodes, the declaration of the underlying type
8382 - for CallExpr, the declaration of the callee
8383 - for MemberExpr, the declaration of the referenced member
8384 - for CXXConstructExpr, the declaration of the constructor
8385 - for CXXNewExpr, the declaration of the operator new
8386 - for ObjCIvarExpr, the declaration of the ivar
8388 For type nodes, hasDeclaration will generally match the declaration of the
8389 sugared type. Given
8390 class X {};
8391 typedef X Y;
8392 Y y;
8393 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8394 typedefDecl. A common use case is to match the underlying, desugared type.
8395 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8396 varDecl(hasType(hasUnqualifiedDesugaredType(
8397 recordType(hasDeclaration(decl())))))
8398 In this matcher, the decl will match the CXXRecordDecl of class X.
8400 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;,
8401 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;,
8402 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;,
8403 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;,
8404 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;,
8405 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;,
8406 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8407 </pre></td></tr>
8410 <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>
8411 <tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
8413 (Note: Clang's AST refers to other conversions as "casts" too, and calls
8414 actual casts "explicit" casts.)
8415 </pre></td></tr>
8418 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc9')"><a name="hasTypeLoc9Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
8419 <tr><td colspan="4" class="doc" id="hasTypeLoc9"><pre>Matches if the type location of a node matches the inner matcher.
8421 Examples:
8422 int x;
8423 declaratorDecl(hasTypeLoc(loc(asString("int"))))
8424 matches int x
8426 auto x = int(3);
8427 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
8428 matches int(3)
8430 struct Foo { Foo(int, int); };
8431 auto x = Foo(1, 2);
8432 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
8433 matches Foo(1, 2)
8435 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
8436 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
8437 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
8438 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
8439 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
8440 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
8441 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
8442 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
8443 </pre></td></tr>
8446 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</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>
8447 <tr><td colspan="4" class="doc" id="hasType5"><pre>Overloaded to match the declaration of the expression's or value
8448 declaration's type.
8450 In case of a value declaration (for example a variable declaration),
8451 this resolves one layer of indirection. For example, in the value
8452 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
8453 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
8454 declaration of x.
8456 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
8457 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
8458 and friend class X (matcher = friendDecl(hasType("X"))
8459 and public virtual X (matcher = cxxBaseSpecifier(hasType(
8460 cxxRecordDecl(hasName("X"))))
8461 class X {};
8462 void y(X &amp;x) { x; X z; }
8463 class Y { friend class X; };
8464 class Z : public virtual X {};
8466 Example matches class Derived
8467 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
8468 class Base {};
8469 class Derived : Base {};
8471 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;,
8472 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
8473 </pre></td></tr>
8476 <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>
8477 <tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
8478 matcher.
8480 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
8481 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
8482 and U (matcher = typedefDecl(hasType(asString("int")))
8483 and friend class X (matcher = friendDecl(hasType("X"))
8484 and public virtual X (matcher = cxxBaseSpecifier(hasType(
8485 asString("class X")))
8486 class X {};
8487 void y(X &amp;x) { x; X z; }
8488 typedef int U;
8489 class Y { friend class X; };
8490 class Z : public virtual X {};
8491 </pre></td></tr>
8494 <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>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
8495 <tr><td colspan="4" class="doc" id="ignoringElidableConstructorCall0"><pre>Matches expressions that match InnerMatcher that are possibly wrapped in an
8496 elidable constructor and other corresponding bookkeeping nodes.
8498 In C++17, elidable copy constructors are no longer being generated in the
8499 AST as it is not permitted by the standard. They are, however, part of the
8500 AST in C++14 and earlier. So, a matcher must abstract over these differences
8501 to work in all language modes. This matcher skips elidable constructor-call
8502 AST nodes, `ExprWithCleanups` nodes wrapping elidable constructor-calls and
8503 various implicit nodes inside the constructor calls, all of which will not
8504 appear in the C++17 AST.
8506 Given
8508 struct H {};
8509 H G();
8510 void f() {
8511 H D = G();
8514 ``varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())))``
8515 matches ``H D = G()`` in C++11 through C++17 (and beyond).
8516 </pre></td></tr>
8519 <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>
8520 <tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
8521 are stripped off.
8523 Parentheses and explicit casts are not discarded.
8524 Given
8525 int arr[5];
8526 int a = 0;
8527 char b = 0;
8528 const int c = a;
8529 int *d = arr;
8530 long e = (long) 0l;
8531 The matchers
8532 varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
8533 varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
8534 would match the declarations for a, b, c, and d, but not e.
8535 While
8536 varDecl(hasInitializer(integerLiteral()))
8537 varDecl(hasInitializer(declRefExpr()))
8538 only match the declarations for a.
8539 </pre></td></tr>
8542 <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>
8543 <tr><td colspan="4" class="doc" id="ignoringImplicit0"><pre>Matches expressions that match InnerMatcher after any implicit AST
8544 nodes are stripped off.
8546 Parentheses and explicit casts are not discarded.
8547 Given
8548 class C {};
8549 C a = C();
8550 C b;
8551 C c = b;
8552 The matchers
8553 varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr())))
8554 would match the declarations for a, b, and c.
8555 While
8556 varDecl(hasInitializer(cxxConstructExpr()))
8557 only match the declarations for b and c.
8558 </pre></td></tr>
8561 <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>
8562 <tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
8563 casts are stripped off.
8565 Implicit and non-C Style casts are also discarded.
8566 Given
8567 int a = 0;
8568 char b = (0);
8569 void* c = reinterpret_cast&lt;char*&gt;(0);
8570 char d = char(0);
8571 The matcher
8572 varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
8573 would match the declarations for a, b, c, and d.
8574 while
8575 varDecl(hasInitializer(integerLiteral()))
8576 only match the declaration for a.
8577 </pre></td></tr>
8580 <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>
8581 <tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
8582 parentheses are stripped off.
8584 Explicit casts are not discarded.
8585 Given
8586 int arr[5];
8587 int a = 0;
8588 char b = (0);
8589 const int c = a;
8590 int *d = (arr);
8591 long e = ((long) 0l);
8592 The matchers
8593 varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
8594 varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
8595 would match the declarations for a, b, c, and d, but not e.
8596 while
8597 varDecl(hasInitializer(integerLiteral()))
8598 varDecl(hasInitializer(declRefExpr()))
8599 would only match the declaration for a.
8600 </pre></td></tr>
8603 <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>
8604 <tr><td colspan="4" class="doc" id="ignoringParens1"><pre>Overload ignoringParens for Expr.
8606 Given
8607 const char* str = ("my-string");
8608 The matcher
8609 implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral())))
8610 would match the implicit cast resulting from the assignment.
8611 </pre></td></tr>
8614 <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>
8615 <tr><td colspan="4" class="doc" id="hasInClassInitializer0"><pre>Matches non-static data members that have an in-class initializer.
8617 Given
8618 class C {
8619 int a = 2;
8620 int b = 3;
8621 int c;
8623 fieldDecl(hasInClassInitializer(integerLiteral(equals(2))))
8624 matches 'int a;' but not 'int b;'.
8625 fieldDecl(hasInClassInitializer(anything()))
8626 matches 'int a;' and 'int b;' but not 'int c;'.
8627 </pre></td></tr>
8630 <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>
8631 <tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', 'while' statement or a function or coroutine
8632 definition that has a given body. Note that in case of functions or
8633 coroutines this matcher only matches the definition itself and not the
8634 other declarations of the same function or coroutine.
8636 Given
8637 for (;;) {}
8638 forStmt(hasBody(compoundStmt()))
8639 matches 'for (;;) {}'
8640 with compoundStmt()
8641 matching '{}'
8643 Given
8644 void f();
8645 void f() {}
8646 functionDecl(hasBody(compoundStmt()))
8647 matches 'void f() {}'
8648 with compoundStmt()
8649 matching '{}'
8650 but does not match 'void f();'
8651 </pre></td></tr>
8654 <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>
8655 <tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
8656 switch statement or conditional operator.
8658 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
8659 if (true) {}
8660 </pre></td></tr>
8663 <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>
8664 <tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
8666 Example:
8667 forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
8668 matches '++x' in
8669 for (x; x &lt; N; ++x) { }
8670 </pre></td></tr>
8673 <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>
8674 <tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
8676 Example:
8677 forStmt(hasLoopInit(declStmt()))
8678 matches 'int x = 0' in
8679 for (int x = 0; x &lt; N; ++x) { }
8680 </pre></td></tr>
8683 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FriendDecl.html">FriendDecl</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>
8684 <tr><td colspan="4" class="doc" id="hasType6"><pre>Overloaded to match the declaration of the expression's or value
8685 declaration's type.
8687 In case of a value declaration (for example a variable declaration),
8688 this resolves one layer of indirection. For example, in the value
8689 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
8690 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
8691 declaration of x.
8693 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
8694 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
8695 and friend class X (matcher = friendDecl(hasType("X"))
8696 and public virtual X (matcher = cxxBaseSpecifier(hasType(
8697 cxxRecordDecl(hasName("X"))))
8698 class X {};
8699 void y(X &amp;x) { x; X z; }
8700 class Y { friend class X; };
8701 class Z : public virtual X {};
8703 Example matches class Derived
8704 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
8705 class Base {};
8706 class Derived : Base {};
8708 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;,
8709 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
8710 </pre></td></tr>
8713 <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>
8714 <tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
8715 matcher.
8717 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
8718 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
8719 and U (matcher = typedefDecl(hasType(asString("int")))
8720 and friend class X (matcher = friendDecl(hasType("X"))
8721 and public virtual X (matcher = cxxBaseSpecifier(hasType(
8722 asString("class X")))
8723 class X {};
8724 void y(X &amp;x) { x; X z; }
8725 typedef int U;
8726 class Y { friend class X; };
8727 class Z : public virtual X {};
8728 </pre></td></tr>
8731 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('forEachTemplateArgument2')"><a name="forEachTemplateArgument2Anchor">forEachTemplateArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
8732 <tr><td colspan="4" class="doc" id="forEachTemplateArgument2"><pre>Matches templateSpecializationType, class template specialization,
8733 variable template specialization, and function template specialization
8734 nodes where the template argument matches the inner matcher. This matcher
8735 may produce multiple matches.
8737 Given
8738 template &lt;typename T, unsigned N, unsigned M&gt;
8739 struct Matrix {};
8741 constexpr unsigned R = 2;
8742 Matrix&lt;int, R * 2, R * 4&gt; M;
8744 template &lt;typename T, typename U&gt;
8745 void f(T&amp;&amp; t, U&amp;&amp; u) {}
8747 bool B = false;
8748 f(R, B);
8749 templateSpecializationType(forEachTemplateArgument(isExpr(expr())))
8750 matches twice, with expr() matching 'R * 2' and 'R * 4'
8751 functionDecl(forEachTemplateArgument(refersToType(builtinType())))
8752 matches the specialization f&lt;unsigned, bool&gt; twice, for 'unsigned'
8753 and 'bool'
8754 </pre></td></tr>
8757 <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>
8758 <tr><td colspan="4" class="doc" id="hasAnyBody0"><pre>Matches a function declaration that has a given body present in the AST.
8759 Note that this matcher matches all the declarations of a function whose
8760 body is present in the AST.
8762 Given
8763 void f();
8764 void f() {}
8765 void g();
8766 functionDecl(hasAnyBody(compoundStmt()))
8767 matches both 'void f();'
8768 and 'void f() {}'
8769 with compoundStmt()
8770 matching '{}'
8771 but does not match 'void g();'
8772 </pre></td></tr>
8775 <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>
8776 <tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function or an ObjC method declaration or a
8777 block.
8779 Does not match the 'this' parameter of a method.
8781 Given
8782 class X { void f(int x, int y, int z) {} };
8783 cxxMethodDecl(hasAnyParameter(hasName("y")))
8784 matches f(int x, int y, int z) {}
8785 with hasAnyParameter(...)
8786 matching int y
8788 For ObjectiveC, given
8789 @interface I - (void) f:(int) y; @end
8791 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
8792 matches the declaration of method f with hasParameter
8793 matching y.
8795 For blocks, given
8796 b = ^(int y) { printf("%d", y) };
8798 the matcher blockDecl(hasAnyParameter(hasName("y")))
8799 matches the declaration of the block b with hasParameter
8800 matching y.
8801 </pre></td></tr>
8804 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgumentLoc2')"><a name="hasAnyTemplateArgumentLoc2Anchor">hasAnyTemplateArgumentLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
8805 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgumentLoc2"><pre>Matches template specialization `TypeLoc`s, class template specializations,
8806 variable template specializations, and function template specializations
8807 that have at least one `TemplateArgumentLoc` matching the given
8808 `InnerMatcher`.
8810 Given
8811 template&lt;typename T&gt; class A {};
8812 A&lt;int&gt; a;
8813 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc(
8814 hasTypeLoc(loc(asString("int")))))))
8815 matches `A&lt;int&gt; a`.
8816 </pre></td></tr>
8819 <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>
8820 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument2"><pre>Matches templateSpecializationTypes, class template specializations,
8821 variable template specializations, and function template specializations
8822 that have at least one TemplateArgument matching the given InnerMatcher.
8824 Given
8825 template&lt;typename T&gt; class A {};
8826 template&lt;&gt; class A&lt;double&gt; {};
8827 A&lt;int&gt; a;
8829 template&lt;typename T&gt; f() {};
8830 void func() { f&lt;int&gt;(); };
8832 classTemplateSpecializationDecl(hasAnyTemplateArgument(
8833 refersToType(asString("int"))))
8834 matches the specialization A&lt;int&gt;
8836 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
8837 matches the specialization f&lt;int&gt;
8838 </pre></td></tr>
8841 <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>
8842 <tr><td colspan="4" class="doc" id="hasBody4"><pre>Matches a 'for', 'while', 'while' statement or a function or coroutine
8843 definition that has a given body. Note that in case of functions or
8844 coroutines this matcher only matches the definition itself and not the
8845 other declarations of the same function or coroutine.
8847 Given
8848 for (;;) {}
8849 forStmt(hasBody(compoundStmt()))
8850 matches 'for (;;) {}'
8851 with compoundStmt()
8852 matching '{}'
8854 Given
8855 void f();
8856 void f() {}
8857 functionDecl(hasBody(compoundStmt()))
8858 matches 'void f() {}'
8859 with compoundStmt()
8860 matching '{}'
8861 but does not match 'void f();'
8862 </pre></td></tr>
8865 <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>
8866 <tr><td colspan="4" class="doc" id="hasExplicitSpecifier0"><pre>Matches the expression in an explicit specifier if present in the given
8867 declaration.
8869 Given
8870 template&lt;bool b&gt;
8871 struct S {
8872 S(int); // #1
8873 explicit S(double); // #2
8874 operator int(); // #3
8875 explicit operator bool(); // #4
8876 explicit(false) S(bool) // # 7
8877 explicit(true) S(char) // # 8
8878 explicit(b) S(S) // # 9
8880 S(int) -&gt; S&lt;true&gt; // #5
8881 explicit S(double) -&gt; S&lt;false&gt; // #6
8882 cxxConstructorDecl(hasExplicitSpecifier(constantExpr())) will match #7, #8 and #9, but not #1 or #2.
8883 cxxConversionDecl(hasExplicitSpecifier(constantExpr())) will not match #3 or #4.
8884 cxxDeductionGuideDecl(hasExplicitSpecifier(constantExpr())) will not match #5 or #6.
8885 </pre></td></tr>
8888 <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>
8889 <tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function or an ObjC method
8890 declaration or a block.
8892 Given
8893 class X { void f(int x) {} };
8894 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
8895 matches f(int x) {}
8896 with hasParameter(...)
8897 matching int x
8899 For ObjectiveC, given
8900 @interface I - (void) f:(int) y; @end
8902 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
8903 matches the declaration of method f with hasParameter
8904 matching y.
8905 </pre></td></tr>
8908 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasReturnTypeLoc0')"><a name="hasReturnTypeLoc0Anchor">hasReturnTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; ReturnMatcher</td></tr>
8909 <tr><td colspan="4" class="doc" id="hasReturnTypeLoc0"><pre>Matches a function declared with the specified return `TypeLoc`.
8911 Given
8912 int f() { return 5; }
8913 void g() {}
8914 functionDecl(hasReturnTypeLoc(loc(asString("int"))))
8915 matches the declaration of `f`, but not `g`.
8916 </pre></td></tr>
8919 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgumentLoc2')"><a name="hasTemplateArgumentLoc2Anchor">hasTemplateArgumentLoc</a></td><td>unsigned Index, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
8920 <tr><td colspan="4" class="doc" id="hasTemplateArgumentLoc2"><pre>Matches template specialization `TypeLoc`s, class template specializations,
8921 variable template specializations, and function template specializations
8922 where the n'th `TemplateArgumentLoc` matches the given `InnerMatcher`.
8924 Given
8925 template&lt;typename T, typename U&gt; class A {};
8926 A&lt;double, int&gt; b;
8927 A&lt;int, double&gt; c;
8928 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0,
8929 hasTypeLoc(loc(asString("double")))))))
8930 matches `A&lt;double, int&gt; b`, but not `A&lt;int, double&gt; c`.
8931 </pre></td></tr>
8934 <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>
8935 <tr><td colspan="4" class="doc" id="hasTemplateArgument2"><pre>Matches templateSpecializationType, class template specializations,
8936 variable template specializations, and function template specializations
8937 where the n'th TemplateArgument matches the given InnerMatcher.
8939 Given
8940 template&lt;typename T, typename U&gt; class A {};
8941 A&lt;bool, int&gt; b;
8942 A&lt;int, bool&gt; c;
8944 template&lt;typename T&gt; void f() {}
8945 void func() { f&lt;int&gt;(); };
8946 classTemplateSpecializationDecl(hasTemplateArgument(
8947 1, refersToType(asString("int"))))
8948 matches the specialization A&lt;bool, int&gt;
8950 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
8951 matches the specialization f&lt;int&gt;
8952 </pre></td></tr>
8955 <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>
8956 <tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
8958 Given:
8959 class X { int f() { return 1; } };
8960 cxxMethodDecl(returns(asString("int")))
8961 matches int f() { return 1; }
8962 </pre></td></tr>
8965 <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>
8966 <tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
8967 switch statement or conditional operator.
8969 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
8970 if (true) {}
8971 </pre></td></tr>
8974 <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>
8975 <tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
8977 Given
8978 if (A* a = GetAPointer()) {}
8979 hasConditionVariableStatement(...)
8980 matches 'A* a = GetAPointer()'.
8981 </pre></td></tr>
8984 <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>
8985 <tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
8987 Examples matches the if statement
8988 (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
8989 if (false) false; else true;
8990 </pre></td></tr>
8993 <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>
8994 <tr><td colspan="4" class="doc" id="hasInitStatement0"><pre>Matches selection statements with initializer.
8996 Given:
8997 void foo() {
8998 if (int i = foobar(); i &gt; 0) {}
8999 switch (int i = foobar(); i) {}
9000 for (auto&amp; a = get_range(); auto&amp; x : a) {}
9002 void bar() {
9003 if (foobar() &gt; 0) {}
9004 switch (foobar()) {}
9005 for (auto&amp; x : get_range()) {}
9007 ifStmt(hasInitStatement(anything()))
9008 matches the if statement in foo but not in bar.
9009 switchStmt(hasInitStatement(anything()))
9010 matches the switch statement in foo but not in bar.
9011 cxxForRangeStmt(hasInitStatement(anything()))
9012 matches the range for statement in foo but not in bar.
9013 </pre></td></tr>
9016 <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>
9017 <tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
9019 Examples matches the if statement
9020 (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
9021 if (false) true; else false;
9022 </pre></td></tr>
9025 <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>
9026 <tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
9027 matcher.
9028 </pre></td></tr>
9031 <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, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
9032 <tr><td colspan="4" class="doc" id="hasInit0"><pre>Matches the n'th item of an initializer list expression.
9034 Example matches y.
9035 (matcher = initListExpr(hasInit(0, expr())))
9036 int x{y}.
9037 </pre></td></tr>
9040 <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>
9041 <tr><td colspan="4" class="doc" id="hasSyntacticForm0"><pre>Matches the syntactic form of init list expressions
9042 (if expression have it).
9043 </pre></td></tr>
9046 <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>
9047 <tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
9048 matches the given matcher.
9050 The associated declaration is:
9051 - for type nodes, the declaration of the underlying type
9052 - for CallExpr, the declaration of the callee
9053 - for MemberExpr, the declaration of the referenced member
9054 - for CXXConstructExpr, the declaration of the constructor
9055 - for CXXNewExpr, the declaration of the operator new
9056 - for ObjCIvarExpr, the declaration of the ivar
9058 For type nodes, hasDeclaration will generally match the declaration of the
9059 sugared type. Given
9060 class X {};
9061 typedef X Y;
9062 Y y;
9063 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9064 typedefDecl. A common use case is to match the underlying, desugared type.
9065 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9066 varDecl(hasType(hasUnqualifiedDesugaredType(
9067 recordType(hasDeclaration(decl())))))
9068 In this matcher, the decl will match the CXXRecordDecl of class X.
9070 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;,
9071 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;,
9072 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;,
9073 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;,
9074 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;,
9075 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;,
9076 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9077 </pre></td></tr>
9080 <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>
9081 <tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
9082 matches the given matcher.
9084 The associated declaration is:
9085 - for type nodes, the declaration of the underlying type
9086 - for CallExpr, the declaration of the callee
9087 - for MemberExpr, the declaration of the referenced member
9088 - for CXXConstructExpr, the declaration of the constructor
9089 - for CXXNewExpr, the declaration of the operator new
9090 - for ObjCIvarExpr, the declaration of the ivar
9092 For type nodes, hasDeclaration will generally match the declaration of the
9093 sugared type. Given
9094 class X {};
9095 typedef X Y;
9096 Y y;
9097 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9098 typedefDecl. A common use case is to match the underlying, desugared type.
9099 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9100 varDecl(hasType(hasUnqualifiedDesugaredType(
9101 recordType(hasDeclaration(decl())))))
9102 In this matcher, the decl will match the CXXRecordDecl of class X.
9104 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;,
9105 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;,
9106 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;,
9107 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;,
9108 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;,
9109 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;,
9110 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9111 </pre></td></tr>
9114 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaCapture.html">LambdaCapture</a>&gt;</td><td class="name" onclick="toggle('capturesVar0')"><a name="capturesVar0Anchor">capturesVar</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt; InnerMatcher</td></tr>
9115 <tr><td colspan="4" class="doc" id="capturesVar0"><pre>Matches a `LambdaCapture` that refers to the specified `VarDecl`. The
9116 `VarDecl` can be a separate variable that is captured by value or
9117 reference, or a synthesized variable if the capture has an initializer.
9119 Given
9120 void foo() {
9121 int x;
9122 auto f = [x](){};
9123 auto g = [x = 1](){};
9125 In the matcher
9126 lambdaExpr(hasAnyCapture(lambdaCapture(capturesVar(hasName("x")))),
9127 capturesVar(hasName("x")) matches `x` and `x = 1`.
9128 </pre></td></tr>
9131 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaExpr.html">LambdaExpr</a>&gt;</td><td class="name" onclick="toggle('forEachLambdaCapture0')"><a name="forEachLambdaCapture0Anchor">forEachLambdaCapture</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaCapture.html">LambdaCapture</a>&gt; InnerMatcher</td></tr>
9132 <tr><td colspan="4" class="doc" id="forEachLambdaCapture0"><pre>Matches each lambda capture in a lambda expression.
9134 Given
9135 int main() {
9136 int x, y;
9137 float z;
9138 auto f = [=]() { return x + y + z; };
9140 lambdaExpr(forEachLambdaCapture(
9141 lambdaCapture(capturesVar(varDecl(hasType(isInteger()))))))
9142 will trigger two matches, binding for 'x' and 'y' respectively.
9143 </pre></td></tr>
9146 <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_1LambdaCapture.html">LambdaCapture</a>&gt; InnerMatcher</td></tr>
9147 <tr><td colspan="4" class="doc" id="hasAnyCapture0"><pre>Matches any capture in a lambda expression.
9149 Given
9150 void foo() {
9151 int t = 5;
9152 auto f = [=](){ return t; };
9154 lambdaExpr(hasAnyCapture(lambdaCapture())) and
9155 lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t")))))
9156 both match `[=](){ return t; }`.
9157 </pre></td></tr>
9160 <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>
9161 <tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
9162 matches the given matcher.
9164 The associated declaration is:
9165 - for type nodes, the declaration of the underlying type
9166 - for CallExpr, the declaration of the callee
9167 - for MemberExpr, the declaration of the referenced member
9168 - for CXXConstructExpr, the declaration of the constructor
9169 - for CXXNewExpr, the declaration of the operator new
9170 - for ObjCIvarExpr, the declaration of the ivar
9172 For type nodes, hasDeclaration will generally match the declaration of the
9173 sugared type. Given
9174 class X {};
9175 typedef X Y;
9176 Y y;
9177 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9178 typedefDecl. A common use case is to match the underlying, desugared type.
9179 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9180 varDecl(hasType(hasUnqualifiedDesugaredType(
9181 recordType(hasDeclaration(decl())))))
9182 In this matcher, the decl will match the CXXRecordDecl of class X.
9184 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;,
9185 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;,
9186 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;,
9187 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;,
9188 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;,
9189 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;,
9190 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9191 </pre></td></tr>
9194 <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>
9195 <tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is matched by a
9196 given matcher. Implicit object expressions are included; that is, it matches
9197 use of implicit `this`.
9199 Given
9200 struct X {
9201 int m;
9202 int f(X x) { x.m; return m; }
9204 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
9205 matches `x.m`, but not `m`; however,
9206 memberExpr(hasObjectExpression(hasType(pointsTo(
9207 cxxRecordDecl(hasName("X"))))))
9208 matches `m` (aka. `this-&gt;m`), but not `x.m`.
9209 </pre></td></tr>
9212 <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>
9213 <tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
9214 given matcher.
9216 Given
9217 struct { int first, second; } first, second;
9218 int i(second.first);
9219 int j(first.second);
9220 memberExpr(member(hasName("first")))
9221 matches second.first
9222 but not first.second (because the member name there is "second").
9223 </pre></td></tr>
9226 <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>
9227 <tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
9228 pointee matches a given matcher.
9230 Given
9231 int *a;
9232 int const *b;
9233 float const *f;
9234 pointerType(pointee(isConstQualified(), isInteger()))
9235 matches "int const *b"
9237 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;,
9238 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;
9239 </pre></td></tr>
9242 <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>
9243 <tr><td colspan="4" class="doc" id="hasUnderlyingDecl0"><pre>Matches a NamedDecl whose underlying declaration matches the given
9244 matcher.
9246 Given
9247 namespace N { template&lt;class T&gt; void f(T t); }
9248 template &lt;class T&gt; void g() { using N::f; f(T()); }
9249 unresolvedLookupExpr(hasAnyDeclaration(
9250 namedDecl(hasUnderlyingDecl(hasName("::N::f")))))
9251 matches the use of f in g() .
9252 </pre></td></tr>
9255 <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>
9256 <tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
9258 Given
9259 struct A { struct B { struct C {}; }; };
9260 A::B::C c;
9261 nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
9262 matches "A::"
9263 </pre></td></tr>
9266 <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>
9267 <tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
9268 NestedNameSpecifier-matcher matches.
9269 </pre></td></tr>
9272 <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>
9273 <tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
9274 given TypeLoc.
9276 Given
9277 struct A { struct B { struct C {}; }; };
9278 A::B::C c;
9279 nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
9280 hasDeclaration(cxxRecordDecl(hasName("A")))))))
9281 matches "A::"
9282 </pre></td></tr>
9285 <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>
9286 <tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
9288 Given
9289 struct A { struct B { struct C {}; }; };
9290 A::B::C c;
9291 nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
9292 matches "A::"
9293 </pre></td></tr>
9296 <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>
9297 <tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
9298 given namespace matcher.
9300 Given
9301 namespace ns { struct A {}; }
9302 ns::A a;
9303 nestedNameSpecifier(specifiesNamespace(hasName("ns")))
9304 matches "ns::"
9305 </pre></td></tr>
9308 <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>
9309 <tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
9310 given QualType matcher without qualifiers.
9312 Given
9313 struct A { struct B { struct C {}; }; };
9314 A::B::C c;
9315 nestedNameSpecifier(specifiesType(
9316 hasDeclaration(cxxRecordDecl(hasName("A")))
9318 matches "A::"
9319 </pre></td></tr>
9322 <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>
9323 <tr><td colspan="4" class="doc" id="hasAnyClause0"><pre>Matches any clause in an OpenMP directive.
9325 Given
9327 #pragma omp parallel
9328 #pragma omp parallel default(none)
9330 ``ompExecutableDirective(hasAnyClause(anything()))`` matches
9331 ``omp parallel default(none)``.
9332 </pre></td></tr>
9335 <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>
9336 <tr><td colspan="4" class="doc" id="hasStructuredBlock0"><pre>Matches the structured-block of the OpenMP executable directive
9338 Prerequisite: the executable directive must not be standalone directive.
9339 If it is, it will never match.
9341 Given
9343 #pragma omp parallel
9345 #pragma omp parallel
9348 ``ompExecutableDirective(hasStructuredBlock(nullStmt()))`` will match ``;``
9349 </pre></td></tr>
9352 <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>
9353 <tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Matches C++ classes that are directly or indirectly derived from a class
9354 matching Base, or Objective-C classes that directly or indirectly
9355 subclass a class matching Base.
9357 Note that a class is not considered to be derived from itself.
9359 Example matches Y, Z, C (Base == hasName("X"))
9360 class X;
9361 class Y : public X {}; // directly derived
9362 class Z : public Y {}; // indirectly derived
9363 typedef X A;
9364 typedef A B;
9365 class C : public B {}; // derived from a typedef of X
9367 In the following example, Bar matches isDerivedFrom(hasName("X")):
9368 class Foo;
9369 typedef Foo X;
9370 class Bar : public Foo {}; // derived from a type that X is a typedef of
9372 In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
9373 @interface NSObject @end
9374 @interface Bar : NSObject @end
9376 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;
9377 </pre></td></tr>
9380 <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>
9381 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom1"><pre>Matches C++ or Objective-C classes that are directly derived from a class
9382 matching Base.
9384 Note that a class is not considered to be derived from itself.
9386 Example matches Y, C (Base == hasName("X"))
9387 class X;
9388 class Y : public X {}; // directly derived
9389 class Z : public Y {}; // indirectly derived
9390 typedef X A;
9391 typedef A B;
9392 class C : public B {}; // derived from a typedef of X
9394 In the following example, Bar matches isDerivedFrom(hasName("X")):
9395 class Foo;
9396 typedef Foo X;
9397 class Bar : public Foo {}; // derived from a type that X is a typedef of
9398 </pre></td></tr>
9401 <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>
9402 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Similar to isDerivedFrom(), but also matches classes that directly
9403 match Base.
9404 </pre></td></tr>
9407 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html">ObjCMessageExpr</a>&gt;</td><td class="name" onclick="toggle('callee2')"><a name="callee2Anchor">callee</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
9408 <tr><td colspan="4" class="doc" id="callee2"><pre>Matches 1) if the call expression's callee's declaration matches the
9409 given matcher; or 2) if the Obj-C message expression's callee's method
9410 declaration matches the given matcher.
9412 Example matches y.x() (matcher = callExpr(callee(
9413 cxxMethodDecl(hasName("x")))))
9414 class Y { public: void x(); };
9415 void z() { Y y; y.x(); }
9417 Example 2. Matches [I foo] with
9418 objcMessageExpr(callee(objcMethodDecl(hasName("foo"))))
9420 @interface I: NSObject
9421 +(void)foo;
9422 @end
9424 [I foo]
9425 </pre></td></tr>
9428 <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>
9429 <tr><td colspan="4" class="doc" id="hasAnyArgument3"><pre>Matches any argument of a call expression or a constructor call
9430 expression, or an ObjC-message-send expression.
9432 Given
9433 void x(int, int, int) { int y; x(1, y, 42); }
9434 callExpr(hasAnyArgument(declRefExpr()))
9435 matches x(1, y, 42)
9436 with hasAnyArgument(...)
9437 matching y
9439 For ObjectiveC, given
9440 @interface I - (void) f:(int) y; @end
9441 void foo(I *i) { [i f:12]; }
9442 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
9443 matches [i f:12]
9444 </pre></td></tr>
9447 <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>
9448 <tr><td colspan="4" class="doc" id="hasArgument3"><pre>Matches the n'th argument of a call expression or a constructor
9449 call expression.
9451 Example matches y in x(y)
9452 (matcher = callExpr(hasArgument(0, declRefExpr())))
9453 void x(int) { int y; x(y); }
9454 </pre></td></tr>
9457 <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>
9458 <tr><td colspan="4" class="doc" id="hasReceiver0"><pre>Matches if the Objective-C message is sent to an instance,
9459 and the inner matcher matches on that instance.
9461 For example the method call in
9462 NSString *x = @"hello";
9463 [x containsString:@"h"];
9464 is matched by
9465 objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
9466 </pre></td></tr>
9469 <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>
9470 <tr><td colspan="4" class="doc" id="hasReceiverType0"><pre>Matches on the receiver of an ObjectiveC Message expression.
9472 Example
9473 matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *")));
9474 matches the [webView ...] message invocation.
9475 NSString *webViewJavaScript = ...
9476 UIWebView *webView = ...
9477 [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
9478 </pre></td></tr>
9481 <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>
9482 <tr><td colspan="4" class="doc" id="hasAnyParameter1"><pre>Matches any parameter of a function or an ObjC method declaration or a
9483 block.
9485 Does not match the 'this' parameter of a method.
9487 Given
9488 class X { void f(int x, int y, int z) {} };
9489 cxxMethodDecl(hasAnyParameter(hasName("y")))
9490 matches f(int x, int y, int z) {}
9491 with hasAnyParameter(...)
9492 matching int y
9494 For ObjectiveC, given
9495 @interface I - (void) f:(int) y; @end
9497 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
9498 matches the declaration of method f with hasParameter
9499 matching y.
9501 For blocks, given
9502 b = ^(int y) { printf("%d", y) };
9504 the matcher blockDecl(hasAnyParameter(hasName("y")))
9505 matches the declaration of the block b with hasParameter
9506 matching y.
9507 </pre></td></tr>
9510 <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>
9511 <tr><td colspan="4" class="doc" id="hasParameter1"><pre>Matches the n'th parameter of a function or an ObjC method
9512 declaration or a block.
9514 Given
9515 class X { void f(int x) {} };
9516 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
9517 matches f(int x) {}
9518 with hasParameter(...)
9519 matching int x
9521 For ObjectiveC, given
9522 @interface I - (void) f:(int) y; @end
9524 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
9525 matches the declaration of method f with hasParameter
9526 matching y.
9527 </pre></td></tr>
9530 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc10')"><a name="hasTypeLoc10Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
9531 <tr><td colspan="4" class="doc" id="hasTypeLoc10"><pre>Matches if the type location of a node matches the inner matcher.
9533 Examples:
9534 int x;
9535 declaratorDecl(hasTypeLoc(loc(asString("int"))))
9536 matches int x
9538 auto x = int(3);
9539 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
9540 matches int(3)
9542 struct Foo { Foo(int, int); };
9543 auto x = Foo(1, 2);
9544 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
9545 matches Foo(1, 2)
9547 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
9548 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
9549 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
9550 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
9551 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
9552 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
9553 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
9554 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
9555 </pre></td></tr>
9558 <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>
9559 <tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre>Matches if the cast's source expression
9560 or opaque value's source expression matches the given matcher.
9562 Example 1: matches "a string"
9563 (matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
9564 class URL { URL(string); };
9565 URL url = "a string";
9567 Example 2: matches 'b' (matcher =
9568 opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
9569 int a = b ?: 1;
9570 </pre></td></tr>
9573 <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>
9574 <tr><td colspan="4" class="doc" id="hasAnyDeclaration0"><pre>Matches an OverloadExpr if any of the declarations in the set of
9575 overloads matches the given matcher.
9577 Given
9578 template &lt;typename T&gt; void foo(T);
9579 template &lt;typename T&gt; void bar(T);
9580 template &lt;typename T&gt; void baz(T t) {
9581 foo(t);
9582 bar(t);
9584 unresolvedLookupExpr(hasAnyDeclaration(
9585 functionTemplateDecl(hasName("foo"))))
9586 matches foo in foo(t); but not bar in bar(t);
9587 </pre></td></tr>
9590 <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>
9591 <tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
9593 Given
9594 int (*ptr_to_array)[4];
9595 int (*ptr_to_func)(int);
9597 varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
9598 ptr_to_func but not ptr_to_array.
9600 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
9601 </pre></td></tr>
9604 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1PointerTypeLoc.html">PointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasPointeeLoc0')"><a name="hasPointeeLoc0Anchor">hasPointeeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; PointeeMatcher</td></tr>
9605 <tr><td colspan="4" class="doc" id="hasPointeeLoc0"><pre>Matches pointer `TypeLoc`s that have a pointee `TypeLoc` matching
9606 `PointeeMatcher`.
9608 Given
9609 int* x;
9610 pointerTypeLoc(hasPointeeLoc(loc(asString("int"))))
9611 matches `int*`.
9612 </pre></td></tr>
9615 <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>
9616 <tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
9617 pointee matches a given matcher.
9619 Given
9620 int *a;
9621 int const *b;
9622 float const *f;
9623 pointerType(pointee(isConstQualified(), isInteger()))
9624 matches "int const *b"
9626 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;,
9627 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;
9628 </pre></td></tr>
9631 <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>
9632 <tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
9634 Given:
9635 typedef int &amp;int_ref;
9636 int a;
9637 int_ref b = a;
9639 varDecl(hasType(qualType(referenceType()))))) will not match the
9640 declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
9641 </pre></td></tr>
9644 <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>
9645 <tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
9646 matches the given matcher.
9648 The associated declaration is:
9649 - for type nodes, the declaration of the underlying type
9650 - for CallExpr, the declaration of the callee
9651 - for MemberExpr, the declaration of the referenced member
9652 - for CXXConstructExpr, the declaration of the constructor
9653 - for CXXNewExpr, the declaration of the operator new
9654 - for ObjCIvarExpr, the declaration of the ivar
9656 For type nodes, hasDeclaration will generally match the declaration of the
9657 sugared type. Given
9658 class X {};
9659 typedef X Y;
9660 Y y;
9661 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9662 typedefDecl. A common use case is to match the underlying, desugared type.
9663 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9664 varDecl(hasType(hasUnqualifiedDesugaredType(
9665 recordType(hasDeclaration(decl())))))
9666 In this matcher, the decl will match the CXXRecordDecl of class X.
9668 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;,
9669 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;,
9670 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;,
9671 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;,
9672 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;,
9673 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;,
9674 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9675 </pre></td></tr>
9678 <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>
9679 <tr><td colspan="4" class="doc" id="ignoringParens0"><pre>Matches types that match InnerMatcher after any parens are stripped.
9681 Given
9682 void (*fp)(void);
9683 The matcher
9684 varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
9685 would match the declaration for fp.
9686 </pre></td></tr>
9689 <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>
9690 <tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
9691 </pre></td></tr>
9694 <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>
9695 <tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
9696 matches the specified matcher.
9698 Example matches y-&gt;x()
9699 (matcher = cxxMemberCallExpr(on(hasType(pointsTo
9700 cxxRecordDecl(hasName("Y")))))))
9701 class Y { public: void x(); };
9702 void z() { Y *y; y-&gt;x(); }
9703 </pre></td></tr>
9706 <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>
9707 <tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
9708 </pre></td></tr>
9711 <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>
9712 <tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
9713 type matches the specified matcher.
9715 Example matches X &amp;x and const X &amp;y
9716 (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
9717 class X {
9718 void a(X b) {
9719 X &amp;x = b;
9720 const X &amp;y = b;
9723 </pre></td></tr>
9726 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1QualifiedTypeLoc.html">QualifiedTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasUnqualifiedLoc0')"><a name="hasUnqualifiedLoc0Anchor">hasUnqualifiedLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; InnerMatcher</td></tr>
9727 <tr><td colspan="4" class="doc" id="hasUnqualifiedLoc0"><pre>Matches `QualifiedTypeLoc`s that have an unqualified `TypeLoc` matching
9728 `InnerMatcher`.
9730 Given
9731 int* const x;
9732 const int y;
9733 qualifiedTypeLoc(hasUnqualifiedLoc(pointerTypeLoc()))
9734 matches the `TypeLoc` of the variable declaration of `x`, but not `y`.
9735 </pre></td></tr>
9738 <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>
9739 <tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
9740 matches the given matcher.
9742 The associated declaration is:
9743 - for type nodes, the declaration of the underlying type
9744 - for CallExpr, the declaration of the callee
9745 - for MemberExpr, the declaration of the referenced member
9746 - for CXXConstructExpr, the declaration of the constructor
9747 - for CXXNewExpr, the declaration of the operator new
9748 - for ObjCIvarExpr, the declaration of the ivar
9750 For type nodes, hasDeclaration will generally match the declaration of the
9751 sugared type. Given
9752 class X {};
9753 typedef X Y;
9754 Y y;
9755 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9756 typedefDecl. A common use case is to match the underlying, desugared type.
9757 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9758 varDecl(hasType(hasUnqualifiedDesugaredType(
9759 recordType(hasDeclaration(decl())))))
9760 In this matcher, the decl will match the CXXRecordDecl of class X.
9762 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;,
9763 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;,
9764 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;,
9765 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;,
9766 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;,
9767 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;,
9768 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9769 </pre></td></tr>
9772 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ReferenceTypeLoc.html">ReferenceTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasReferentLoc0')"><a name="hasReferentLoc0Anchor">hasReferentLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; ReferentMatcher</td></tr>
9773 <tr><td colspan="4" class="doc" id="hasReferentLoc0"><pre>Matches reference `TypeLoc`s that have a referent `TypeLoc` matching
9774 `ReferentMatcher`.
9776 Given
9777 int x = 3;
9778 int&amp; xx = x;
9779 referenceTypeLoc(hasReferentLoc(loc(asString("int"))))
9780 matches `int&amp;`.
9781 </pre></td></tr>
9784 <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>
9785 <tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
9786 pointee matches a given matcher.
9788 Given
9789 int *a;
9790 int const *b;
9791 float const *f;
9792 pointerType(pointee(isConstQualified(), isInteger()))
9793 matches "int const *b"
9795 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;,
9796 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;
9797 </pre></td></tr>
9800 <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>
9801 <tr><td colspan="4" class="doc" id="hasReturnValue0"><pre>Matches the return value expression of a return statement
9803 Given
9804 return a + b;
9805 hasReturnValue(binaryOperator())
9806 matches 'return a + b'
9807 with binaryOperator()
9808 matching 'a + b'
9809 </pre></td></tr>
9812 <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>
9813 <tr><td colspan="4" class="doc" id="hasAnySubstatement1"><pre>Matches compound statements where at least one substatement matches
9814 a given matcher. Also matches StmtExprs that have CompoundStmt as children.
9816 Given
9817 { {}; 1+2; }
9818 hasAnySubstatement(compoundStmt())
9819 matches '{ {}; 1+2; }'
9820 with compoundStmt()
9821 matching '{}'
9822 </pre></td></tr>
9825 <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>
9826 <tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
9827 alignof.
9828 </pre></td></tr>
9831 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('forCallable0')"><a name="forCallable0Anchor">forCallable</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
9832 <tr><td colspan="4" class="doc" id="forCallable0"><pre>Matches declaration of the function, method, or block the statement
9833 belongs to.
9835 Given:
9836 F&amp; operator=(const F&amp; o) {
9837 std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
9838 return *this;
9840 returnStmt(forCallable(functionDecl(hasName("operator="))))
9841 matches 'return *this'
9842 but does not match 'return v &gt; 0'
9844 Given:
9845 -(void) foo {
9846 int x = 1;
9847 dispatch_sync(queue, ^{ int y = 2; });
9849 declStmt(forCallable(objcMethodDecl()))
9850 matches 'int x = 1'
9851 but does not match 'int y = 2'.
9852 whereas declStmt(forCallable(blockDecl()))
9853 matches 'int y = 2'
9854 but does not match 'int x = 1'.
9855 </pre></td></tr>
9858 <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>
9859 <tr><td colspan="4" class="doc" id="forFunction0"><pre>Matches declaration of the function the statement belongs to.
9861 Deprecated. Use forCallable() to correctly handle the situation when
9862 the declaration is not a function (but a block or an Objective-C method).
9863 forFunction() not only fails to take non-functions into account but also
9864 may match the wrong declaration in their presence.
9866 Given:
9867 F&amp; operator=(const F&amp; o) {
9868 std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
9869 return *this;
9871 returnStmt(forFunction(hasName("operator=")))
9872 matches 'return *this'
9873 but does not match 'return v &gt; 0'
9874 </pre></td></tr>
9877 <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>
9878 <tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
9879 sizeof.
9880 </pre></td></tr>
9883 <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>
9884 <tr><td colspan="4" class="doc" id="hasReplacementType0"><pre>Matches template type parameter substitutions that have a replacement
9885 type that matches the provided matcher.
9887 Given
9888 template &lt;typename T&gt;
9889 double F(T t);
9890 int i;
9891 double j = F(i);
9893 substTemplateTypeParmType(hasReplacementType(type())) matches int
9894 </pre></td></tr>
9897 <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>
9898 <tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
9899 statement. This matcher may produce multiple matches.
9901 Given
9902 switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
9903 switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
9904 matches four times, with "c" binding each of "case 1:", "case 2:",
9905 "case 3:" and "case 4:", and "s" respectively binding "switch (1)",
9906 "switch (1)", "switch (2)" and "switch (2)".
9907 </pre></td></tr>
9910 <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>
9911 <tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
9912 switch statement or conditional operator.
9914 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
9915 if (true) {}
9916 </pre></td></tr>
9919 <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>
9920 <tr><td colspan="4" class="doc" id="hasInitStatement1"><pre>Matches selection statements with initializer.
9922 Given:
9923 void foo() {
9924 if (int i = foobar(); i &gt; 0) {}
9925 switch (int i = foobar(); i) {}
9926 for (auto&amp; a = get_range(); auto&amp; x : a) {}
9928 void bar() {
9929 if (foobar() &gt; 0) {}
9930 switch (foobar()) {}
9931 for (auto&amp; x : get_range()) {}
9933 ifStmt(hasInitStatement(anything()))
9934 matches the if statement in foo but not in bar.
9935 switchStmt(hasInitStatement(anything()))
9936 matches the switch statement in foo but not in bar.
9937 cxxForRangeStmt(hasInitStatement(anything()))
9938 matches the range for statement in foo but not in bar.
9939 </pre></td></tr>
9942 <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>
9943 <tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
9944 matches the given matcher.
9946 The associated declaration is:
9947 - for type nodes, the declaration of the underlying type
9948 - for CallExpr, the declaration of the callee
9949 - for MemberExpr, the declaration of the referenced member
9950 - for CXXConstructExpr, the declaration of the constructor
9951 - for CXXNewExpr, the declaration of the operator new
9952 - for ObjCIvarExpr, the declaration of the ivar
9954 For type nodes, hasDeclaration will generally match the declaration of the
9955 sugared type. Given
9956 class X {};
9957 typedef X Y;
9958 Y y;
9959 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9960 typedefDecl. A common use case is to match the underlying, desugared type.
9961 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9962 varDecl(hasType(hasUnqualifiedDesugaredType(
9963 recordType(hasDeclaration(decl())))))
9964 In this matcher, the decl will match the CXXRecordDecl of class X.
9966 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;,
9967 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;,
9968 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;,
9969 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;,
9970 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;,
9971 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;,
9972 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9973 </pre></td></tr>
9976 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc11')"><a name="hasTypeLoc11Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
9977 <tr><td colspan="4" class="doc" id="hasTypeLoc11"><pre>Matches if the type location of a node matches the inner matcher.
9979 Examples:
9980 int x;
9981 declaratorDecl(hasTypeLoc(loc(asString("int"))))
9982 matches int x
9984 auto x = int(3);
9985 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
9986 matches int(3)
9988 struct Foo { Foo(int, int); };
9989 auto x = Foo(1, 2);
9990 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
9991 matches Foo(1, 2)
9993 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
9994 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
9995 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
9996 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
9997 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
9998 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
9999 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
10000 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
10001 </pre></td></tr>
10004 <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>
10005 <tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
10007 Given
10008 struct B { int next; };
10009 template&lt;int(B::*next_ptr)&gt; struct A {};
10010 A&lt;&amp;B::next&gt; a;
10011 templateSpecializationType(hasAnyTemplateArgument(
10012 isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
10013 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
10014 B::next
10015 </pre></td></tr>
10018 <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>
10019 <tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
10020 declaration.
10022 Given
10023 struct B { int next; };
10024 template&lt;int(B::*next_ptr)&gt; struct A {};
10025 A&lt;&amp;B::next&gt; a;
10026 classTemplateSpecializationDecl(hasAnyTemplateArgument(
10027 refersToDeclaration(fieldDecl(hasName("next")))))
10028 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
10029 B::next
10030 </pre></td></tr>
10033 <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>
10034 <tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that refers to an integral type.
10036 Given
10037 template&lt;int T&gt; struct C {};
10038 C&lt;42&gt; c;
10039 classTemplateSpecializationDecl(
10040 hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
10041 matches the implicit instantiation of C in C&lt;42&gt;.
10042 </pre></td></tr>
10045 <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>
10046 <tr><td colspan="4" class="doc" id="refersToTemplate0"><pre>Matches a TemplateArgument that refers to a certain template.
10048 Given
10049 template&lt;template &lt;typename&gt; class S&gt; class X {};
10050 template&lt;typename T&gt; class Y {};
10051 X&lt;Y&gt; xi;
10052 classTemplateSpecializationDecl(hasAnyTemplateArgument(
10053 refersToTemplate(templateName())))
10054 matches the specialization X&lt;Y&gt;
10055 </pre></td></tr>
10058 <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>
10059 <tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
10061 Given
10062 struct X {};
10063 template&lt;typename T&gt; struct A {};
10064 A&lt;X&gt; a;
10065 classTemplateSpecializationDecl(hasAnyTemplateArgument(refersToType(
10066 recordType(hasDeclaration(recordDecl(hasName("X")))))))
10067 matches the specialization of struct A generated by A&lt;X&gt;.
10068 </pre></td></tr>
10071 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationTypeLoc.html">TemplateSpecializationTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgumentLoc4')"><a name="hasAnyTemplateArgumentLoc4Anchor">hasAnyTemplateArgumentLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
10072 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgumentLoc4"><pre>Matches template specialization `TypeLoc`s, class template specializations,
10073 variable template specializations, and function template specializations
10074 that have at least one `TemplateArgumentLoc` matching the given
10075 `InnerMatcher`.
10077 Given
10078 template&lt;typename T&gt; class A {};
10079 A&lt;int&gt; a;
10080 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc(
10081 hasTypeLoc(loc(asString("int")))))))
10082 matches `A&lt;int&gt; a`.
10083 </pre></td></tr>
10086 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationTypeLoc.html">TemplateSpecializationTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgumentLoc4')"><a name="hasTemplateArgumentLoc4Anchor">hasTemplateArgumentLoc</a></td><td>unsigned Index, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
10087 <tr><td colspan="4" class="doc" id="hasTemplateArgumentLoc4"><pre>Matches template specialization `TypeLoc`s, class template specializations,
10088 variable template specializations, and function template specializations
10089 where the n'th `TemplateArgumentLoc` matches the given `InnerMatcher`.
10091 Given
10092 template&lt;typename T, typename U&gt; class A {};
10093 A&lt;double, int&gt; b;
10094 A&lt;int, double&gt; c;
10095 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0,
10096 hasTypeLoc(loc(asString("double")))))))
10097 matches `A&lt;double, int&gt; b`, but not `A&lt;int, double&gt; c`.
10098 </pre></td></tr>
10101 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('forEachTemplateArgument3')"><a name="forEachTemplateArgument3Anchor">forEachTemplateArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
10102 <tr><td colspan="4" class="doc" id="forEachTemplateArgument3"><pre>Matches templateSpecializationType, class template specialization,
10103 variable template specialization, and function template specialization
10104 nodes where the template argument matches the inner matcher. This matcher
10105 may produce multiple matches.
10107 Given
10108 template &lt;typename T, unsigned N, unsigned M&gt;
10109 struct Matrix {};
10111 constexpr unsigned R = 2;
10112 Matrix&lt;int, R * 2, R * 4&gt; M;
10114 template &lt;typename T, typename U&gt;
10115 void f(T&amp;&amp; t, U&amp;&amp; u) {}
10117 bool B = false;
10118 f(R, B);
10119 templateSpecializationType(forEachTemplateArgument(isExpr(expr())))
10120 matches twice, with expr() matching 'R * 2' and 'R * 4'
10121 functionDecl(forEachTemplateArgument(refersToType(builtinType())))
10122 matches the specialization f&lt;unsigned, bool&gt; twice, for 'unsigned'
10123 and 'bool'
10124 </pre></td></tr>
10127 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgument3')"><a name="hasAnyTemplateArgument3Anchor">hasAnyTemplateArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
10128 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument3"><pre>Matches templateSpecializationTypes, class template specializations,
10129 variable template specializations, and function template specializations
10130 that have at least one TemplateArgument matching the given InnerMatcher.
10132 Given
10133 template&lt;typename T&gt; class A {};
10134 template&lt;&gt; class A&lt;double&gt; {};
10135 A&lt;int&gt; a;
10137 template&lt;typename T&gt; f() {};
10138 void func() { f&lt;int&gt;(); };
10140 classTemplateSpecializationDecl(hasAnyTemplateArgument(
10141 refersToType(asString("int"))))
10142 matches the specialization A&lt;int&gt;
10144 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
10145 matches the specialization f&lt;int&gt;
10146 </pre></td></tr>
10149 <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>
10150 <tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
10151 matches the given matcher.
10153 The associated declaration is:
10154 - for type nodes, the declaration of the underlying type
10155 - for CallExpr, the declaration of the callee
10156 - for MemberExpr, the declaration of the referenced member
10157 - for CXXConstructExpr, the declaration of the constructor
10158 - for CXXNewExpr, the declaration of the operator new
10159 - for ObjCIvarExpr, the declaration of the ivar
10161 For type nodes, hasDeclaration will generally match the declaration of the
10162 sugared type. Given
10163 class X {};
10164 typedef X Y;
10165 Y y;
10166 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
10167 typedefDecl. A common use case is to match the underlying, desugared type.
10168 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
10169 varDecl(hasType(hasUnqualifiedDesugaredType(
10170 recordType(hasDeclaration(decl())))))
10171 In this matcher, the decl will match the CXXRecordDecl of class X.
10173 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;,
10174 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;,
10175 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;,
10176 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;,
10177 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;,
10178 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;,
10179 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
10180 </pre></td></tr>
10183 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgument3')"><a name="hasTemplateArgument3Anchor">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>
10184 <tr><td colspan="4" class="doc" id="hasTemplateArgument3"><pre>Matches templateSpecializationType, class template specializations,
10185 variable template specializations, and function template specializations
10186 where the n'th TemplateArgument matches the given InnerMatcher.
10188 Given
10189 template&lt;typename T, typename U&gt; class A {};
10190 A&lt;bool, int&gt; b;
10191 A&lt;int, bool&gt; c;
10193 template&lt;typename T&gt; void f() {}
10194 void func() { f&lt;int&gt;(); };
10195 classTemplateSpecializationDecl(hasTemplateArgument(
10196 1, refersToType(asString("int"))))
10197 matches the specialization A&lt;bool, int&gt;
10199 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
10200 matches the specialization f&lt;int&gt;
10201 </pre></td></tr>
10204 <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>
10205 <tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
10206 matches the given matcher.
10208 The associated declaration is:
10209 - for type nodes, the declaration of the underlying type
10210 - for CallExpr, the declaration of the callee
10211 - for MemberExpr, the declaration of the referenced member
10212 - for CXXConstructExpr, the declaration of the constructor
10213 - for CXXNewExpr, the declaration of the operator new
10214 - for ObjCIvarExpr, the declaration of the ivar
10216 For type nodes, hasDeclaration will generally match the declaration of the
10217 sugared type. Given
10218 class X {};
10219 typedef X Y;
10220 Y y;
10221 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
10222 typedefDecl. A common use case is to match the underlying, desugared type.
10223 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
10224 varDecl(hasType(hasUnqualifiedDesugaredType(
10225 recordType(hasDeclaration(decl())))))
10226 In this matcher, the decl will match the CXXRecordDecl of class X.
10228 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;,
10229 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;,
10230 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;,
10231 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;,
10232 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;,
10233 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;,
10234 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
10235 </pre></td></tr>
10238 <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>
10239 <tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
10240 QualType-matcher matches.
10241 </pre></td></tr>
10244 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc12')"><a name="hasTypeLoc12Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
10245 <tr><td colspan="4" class="doc" id="hasTypeLoc12"><pre>Matches if the type location of a node matches the inner matcher.
10247 Examples:
10248 int x;
10249 declaratorDecl(hasTypeLoc(loc(asString("int"))))
10250 matches int x
10252 auto x = int(3);
10253 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
10254 matches int(3)
10256 struct Foo { Foo(int, int); };
10257 auto x = Foo(1, 2);
10258 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
10259 matches Foo(1, 2)
10261 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1BlockDecl.html">BlockDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;,
10262 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;,
10263 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_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;,
10264 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
10265 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
10266 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;,
10267 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt;,
10268 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
10269 </pre></td></tr>
10272 <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>
10273 <tr><td colspan="4" class="doc" id="hasType2"><pre>Matches if the expression's or declaration's type matches a type
10274 matcher.
10276 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
10277 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
10278 and U (matcher = typedefDecl(hasType(asString("int")))
10279 and friend class X (matcher = friendDecl(hasType("X"))
10280 and public virtual X (matcher = cxxBaseSpecifier(hasType(
10281 asString("class X")))
10282 class X {};
10283 void y(X &amp;x) { x; X z; }
10284 typedef int U;
10285 class Y { friend class X; };
10286 class Z : public virtual X {};
10287 </pre></td></tr>
10290 <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>
10291 <tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
10292 matches the given matcher.
10294 The associated declaration is:
10295 - for type nodes, the declaration of the underlying type
10296 - for CallExpr, the declaration of the callee
10297 - for MemberExpr, the declaration of the referenced member
10298 - for CXXConstructExpr, the declaration of the constructor
10299 - for CXXNewExpr, the declaration of the operator new
10300 - for ObjCIvarExpr, the declaration of the ivar
10302 For type nodes, hasDeclaration will generally match the declaration of the
10303 sugared type. Given
10304 class X {};
10305 typedef X Y;
10306 Y y;
10307 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
10308 typedefDecl. A common use case is to match the underlying, desugared type.
10309 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
10310 varDecl(hasType(hasUnqualifiedDesugaredType(
10311 recordType(hasDeclaration(decl())))))
10312 In this matcher, the decl will match the CXXRecordDecl of class X.
10314 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;,
10315 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;,
10316 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;,
10317 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;,
10318 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;,
10319 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;,
10320 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
10321 </pre></td></tr>
10324 <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>
10325 <tr><td colspan="4" class="doc" id="hasUnqualifiedDesugaredType0"><pre>Matches if the matched type matches the unqualified desugared
10326 type of the matched node.
10328 For example, in:
10329 class A {};
10330 using B = A;
10331 The matcher type(hasUnqualifiedDesugaredType(recordType())) matches
10332 both B and A.
10333 </pre></td></tr>
10336 <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>
10337 <tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
10339 Given
10340 int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
10341 unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
10342 matches sizeof(a) and alignof(c)
10343 </pre></td></tr>
10346 <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>
10347 <tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
10349 Example matches true (matcher = hasUnaryOperand(
10350 cxxBoolLiteral(equals(true))))
10351 !true
10352 </pre></td></tr>
10355 <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>
10356 <tr><td colspan="4" class="doc" id="hasObjectExpression1"><pre>Matches a member expression where the object expression is matched by a
10357 given matcher. Implicit object expressions are included; that is, it matches
10358 use of implicit `this`.
10360 Given
10361 struct X {
10362 int m;
10363 int f(X x) { x.m; return m; }
10365 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
10366 matches `x.m`, but not `m`; however,
10367 memberExpr(hasObjectExpression(hasType(pointsTo(
10368 cxxRecordDecl(hasName("X"))))))
10369 matches `m` (aka. `this-&gt;m`), but not `x.m`.
10370 </pre></td></tr>
10373 <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>
10374 <tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
10375 matches the given matcher.
10377 The associated declaration is:
10378 - for type nodes, the declaration of the underlying type
10379 - for CallExpr, the declaration of the callee
10380 - for MemberExpr, the declaration of the referenced member
10381 - for CXXConstructExpr, the declaration of the constructor
10382 - for CXXNewExpr, the declaration of the operator new
10383 - for ObjCIvarExpr, the declaration of the ivar
10385 For type nodes, hasDeclaration will generally match the declaration of the
10386 sugared type. Given
10387 class X {};
10388 typedef X Y;
10389 Y y;
10390 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
10391 typedefDecl. A common use case is to match the underlying, desugared type.
10392 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
10393 varDecl(hasType(hasUnqualifiedDesugaredType(
10394 recordType(hasDeclaration(decl())))))
10395 In this matcher, the decl will match the CXXRecordDecl of class X.
10397 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;,
10398 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;,
10399 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;,
10400 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;,
10401 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;,
10402 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;,
10403 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
10404 </pre></td></tr>
10407 <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>
10408 <tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
10409 matched by the given matcher.
10411 Given
10412 namespace X { int a; void b(); }
10413 using X::a;
10414 using X::b;
10415 usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
10416 matches using X::b but not using X::a </pre></td></tr>
10419 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UsingType.html">UsingType</a>&gt;</td><td class="name" onclick="toggle('hasUnderlyingType1')"><a name="hasUnderlyingType1Anchor">hasUnderlyingType</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
10420 <tr><td colspan="4" class="doc" id="hasUnderlyingType1"><pre>Matches DecltypeType or UsingType nodes to find the underlying type.
10422 Given
10423 decltype(1) a = 1;
10424 decltype(2.0) b = 2.0;
10425 decltypeType(hasUnderlyingType(isInteger()))
10426 matches the type of "a"
10428 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DecltypeType.html">DecltypeType</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UsingType.html">UsingType</a>&gt;
10429 </pre></td></tr>
10432 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UsingType.html">UsingType</a>&gt;</td><td class="name" onclick="toggle('throughUsingDecl1')"><a name="throughUsingDecl1Anchor">throughUsingDecl</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>&gt; Inner</td></tr>
10433 <tr><td colspan="4" class="doc" id="throughUsingDecl1"><pre>Matches if a node refers to a declaration through a specific
10434 using shadow declaration.
10436 Examples:
10437 namespace a { int f(); }
10438 using a::f;
10439 int x = f();
10440 declRefExpr(throughUsingDecl(anything()))
10441 matches f
10443 namespace a { class X{}; }
10444 using a::X;
10445 X x;
10446 typeLoc(loc(usingType(throughUsingDecl(anything()))))
10447 matches X
10449 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UsingType.html">UsingType</a>&gt;
10450 </pre></td></tr>
10453 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</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>
10454 <tr><td colspan="4" class="doc" id="hasType7"><pre>Overloaded to match the declaration of the expression's or value
10455 declaration's type.
10457 In case of a value declaration (for example a variable declaration),
10458 this resolves one layer of indirection. For example, in the value
10459 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
10460 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
10461 declaration of x.
10463 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
10464 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
10465 and friend class X (matcher = friendDecl(hasType("X"))
10466 and public virtual X (matcher = cxxBaseSpecifier(hasType(
10467 cxxRecordDecl(hasName("X"))))
10468 class X {};
10469 void y(X &amp;x) { x; X z; }
10470 class Y { friend class X; };
10471 class Z : public virtual X {};
10473 Example matches class Derived
10474 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
10475 class Base {};
10476 class Derived : Base {};
10478 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;,
10479 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
10480 </pre></td></tr>
10483 <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>
10484 <tr><td colspan="4" class="doc" id="hasType3"><pre>Matches if the expression's or declaration's type matches a type
10485 matcher.
10487 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
10488 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
10489 and U (matcher = typedefDecl(hasType(asString("int")))
10490 and friend class X (matcher = friendDecl(hasType("X"))
10491 and public virtual X (matcher = cxxBaseSpecifier(hasType(
10492 asString("class X")))
10493 class X {};
10494 void y(X &amp;x) { x; X z; }
10495 typedef int U;
10496 class Y { friend class X; };
10497 class Z : public virtual X {};
10498 </pre></td></tr>
10501 <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>
10502 <tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
10503 that matches the given matcher.
10505 Example matches x (matcher = varDecl(hasInitializer(callExpr())))
10506 bool y() { return true; }
10507 bool x = y();
10508 </pre></td></tr>
10511 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarTemplateSpecializationDecl.html">VarTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('forEachTemplateArgument1')"><a name="forEachTemplateArgument1Anchor">forEachTemplateArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
10512 <tr><td colspan="4" class="doc" id="forEachTemplateArgument1"><pre>Matches templateSpecializationType, class template specialization,
10513 variable template specialization, and function template specialization
10514 nodes where the template argument matches the inner matcher. This matcher
10515 may produce multiple matches.
10517 Given
10518 template &lt;typename T, unsigned N, unsigned M&gt;
10519 struct Matrix {};
10521 constexpr unsigned R = 2;
10522 Matrix&lt;int, R * 2, R * 4&gt; M;
10524 template &lt;typename T, typename U&gt;
10525 void f(T&amp;&amp; t, U&amp;&amp; u) {}
10527 bool B = false;
10528 f(R, B);
10529 templateSpecializationType(forEachTemplateArgument(isExpr(expr())))
10530 matches twice, with expr() matching 'R * 2' and 'R * 4'
10531 functionDecl(forEachTemplateArgument(refersToType(builtinType())))
10532 matches the specialization f&lt;unsigned, bool&gt; twice, for 'unsigned'
10533 and 'bool'
10534 </pre></td></tr>
10537 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarTemplateSpecializationDecl.html">VarTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgumentLoc1')"><a name="hasAnyTemplateArgumentLoc1Anchor">hasAnyTemplateArgumentLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
10538 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgumentLoc1"><pre>Matches template specialization `TypeLoc`s, class template specializations,
10539 variable template specializations, and function template specializations
10540 that have at least one `TemplateArgumentLoc` matching the given
10541 `InnerMatcher`.
10543 Given
10544 template&lt;typename T&gt; class A {};
10545 A&lt;int&gt; a;
10546 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc(
10547 hasTypeLoc(loc(asString("int")))))))
10548 matches `A&lt;int&gt; a`.
10549 </pre></td></tr>
10552 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarTemplateSpecializationDecl.html">VarTemplateSpecializationDecl</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>
10553 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches templateSpecializationTypes, class template specializations,
10554 variable template specializations, and function template specializations
10555 that have at least one TemplateArgument matching the given InnerMatcher.
10557 Given
10558 template&lt;typename T&gt; class A {};
10559 template&lt;&gt; class A&lt;double&gt; {};
10560 A&lt;int&gt; a;
10562 template&lt;typename T&gt; f() {};
10563 void func() { f&lt;int&gt;(); };
10565 classTemplateSpecializationDecl(hasAnyTemplateArgument(
10566 refersToType(asString("int"))))
10567 matches the specialization A&lt;int&gt;
10569 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
10570 matches the specialization f&lt;int&gt;
10571 </pre></td></tr>
10574 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarTemplateSpecializationDecl.html">VarTemplateSpecializationDecl</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgumentLoc1')"><a name="hasTemplateArgumentLoc1Anchor">hasTemplateArgumentLoc</a></td><td>unsigned Index, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</a>&gt; InnerMatcher</td></tr>
10575 <tr><td colspan="4" class="doc" id="hasTemplateArgumentLoc1"><pre>Matches template specialization `TypeLoc`s, class template specializations,
10576 variable template specializations, and function template specializations
10577 where the n'th `TemplateArgumentLoc` matches the given `InnerMatcher`.
10579 Given
10580 template&lt;typename T, typename U&gt; class A {};
10581 A&lt;double, int&gt; b;
10582 A&lt;int, double&gt; c;
10583 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0,
10584 hasTypeLoc(loc(asString("double")))))))
10585 matches `A&lt;double, int&gt; b`, but not `A&lt;int, double&gt; c`.
10586 </pre></td></tr>
10589 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1VarTemplateSpecializationDecl.html">VarTemplateSpecializationDecl</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>
10590 <tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches templateSpecializationType, class template specializations,
10591 variable template specializations, and function template specializations
10592 where the n'th TemplateArgument matches the given InnerMatcher.
10594 Given
10595 template&lt;typename T, typename U&gt; class A {};
10596 A&lt;bool, int&gt; b;
10597 A&lt;int, bool&gt; c;
10599 template&lt;typename T&gt; void f() {}
10600 void func() { f&lt;int&gt;(); };
10601 classTemplateSpecializationDecl(hasTemplateArgument(
10602 1, refersToType(asString("int"))))
10603 matches the specialization A&lt;bool, int&gt;
10605 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
10606 matches the specialization f&lt;int&gt;
10607 </pre></td></tr>
10610 <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>
10611 <tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
10612 expression.
10614 Given
10615 void f(int b) {
10616 int a[b];
10618 variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
10619 varDecl(hasName("b")))))))
10620 matches "int a[b]"
10621 </pre></td></tr>
10624 <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>
10625 <tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', 'while' statement or a function or coroutine
10626 definition that has a given body. Note that in case of functions or
10627 coroutines this matcher only matches the definition itself and not the
10628 other declarations of the same function or coroutine.
10630 Given
10631 for (;;) {}
10632 forStmt(hasBody(compoundStmt()))
10633 matches 'for (;;) {}'
10634 with compoundStmt()
10635 matching '{}'
10637 Given
10638 void f();
10639 void f() {}
10640 functionDecl(hasBody(compoundStmt()))
10641 matches 'void f() {}'
10642 with compoundStmt()
10643 matching '{}'
10644 but does not match 'void f();'
10645 </pre></td></tr>
10648 <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>
10649 <tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
10650 switch statement or conditional operator.
10652 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
10653 if (true) {}
10654 </pre></td></tr>
10656 <!--END_TRAVERSAL_MATCHERS -->
10657 </table>
10659 </div>
10660 </body>
10661 </html>