Revert "[clang][extract-api] Use relative includes"
[llvm-project.git] / clang / docs / LibASTMatchersReference.html
blobd552f4ccd7668c07cefd63d28e5ec8dd16b33671
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5 <title>AST Matcher Reference</title>
6 <link type="text/css" rel="stylesheet" href="../menu.css" />
7 <link type="text/css" rel="stylesheet" href="../content.css" />
8 <style type="text/css">
9 td {
10 padding: .33em;
12 td.doc {
13 display: none;
14 border-bottom: 1px solid black;
16 td.name:hover {
17 color: blue;
18 cursor: pointer;
20 span.mono { font-family: monospace; }
22 .traverse_compare, .traverse_compare td, .traverse_compare th {
23 border: 1px solid black;
24 border-collapse: collapse;
26 </style>
27 <script type="text/javascript">
28 function toggle(id) {
29 if (!id) return;
30 row = document.getElementById(id);
31 if (row.style.display != 'table-cell')
32 row.style.display = 'table-cell';
33 else
34 row.style.display = 'none';
36 </script>
37 </head>
38 <body onLoad="toggle(location.hash.substring(1, location.hash.length - 6))">
40 <!--#include virtual="../menu.html.incl"-->
42 <div id="content">
44 <h1>AST Matcher Reference</h1>
46 <p>This document shows all currently implemented matchers. The matchers are grouped
47 by category and node type they match. You can click on matcher names to show the
48 matcher's source documentation.</p>
50 <p>There are three different basic categories of matchers:
51 <ul>
52 <li><a href="#decl-matchers">Node Matchers:</a> Matchers that match a specific type of AST node.</li>
53 <li><a href="#narrowing-matchers">Narrowing Matchers:</a> Matchers that match attributes on AST nodes.</li>
54 <li><a href="#traversal-matchers">Traversal Matchers:</a> Matchers that allow traversal between AST nodes.</li>
55 </ul>
56 </p>
58 <p>Within each category the matchers are ordered by node type they match on.
59 Note that if a matcher can match multiple node types, it will appear
60 multiple times. This means that by searching for Matcher&lt;Stmt&gt; you can
61 find all matchers that can be used to match on Stmt nodes.</p>
63 <p>The exception to that rule are matchers that can match on any node. Those
64 are marked with a * and are listed in the beginning of each category.</p>
66 <p>Note that the categorization of matchers is a great help when you combine
67 them into matcher expressions. You will usually want to form matcher expressions
68 that read like english sentences by alternating between node matchers and
69 narrowing or traversal matchers, like this:
70 <pre>
71 recordDecl(hasDescendant(
72 ifStmt(hasTrueExpression(
73 expr(hasDescendant(
74 ifStmt()))))))
75 </pre>
76 </p>
78 <!-- ======================================================================= -->
79 <h2 id="traverse-mode">Traverse Mode</h2>
80 <!-- ======================================================================= -->
82 <p>The default mode of operation of AST Matchers visits all nodes in the AST,
83 even if they are not spelled in the source. This is
84 <span class="mono">AsIs</span> mode. This mode requires writing AST matchers
85 that explicitly traverse or ignore implicit nodes, such as parentheses
86 surrounding an expression or expressions with cleanups. These implicit
87 nodes are not always obvious from the syntax of the source code, and so this
88 mode requires careful consideration and testing to get the desired behavior
89 from an AST matcher.
90 </p>
92 <p>In addition, because template instantiations are matched in the default mode,
93 transformations can be accidentally made to template declarations. Finally,
94 because implicit nodes are matched by default, transformations can be made on
95 entirely incorrect places in the code.</p>
97 <p>For these reasons, it is possible to ignore AST nodes which are not spelled
98 in the source using the <span class="mono">IgnoreUnlessSpelledInSource</span>
99 mode. This is likely to be far less error-prone for users who are not already
100 very familiar with where implicit nodes appear in the AST. It is also likely
101 to be less error-prone for experienced AST users, as difficult cases do not
102 need to be encountered and matcher expressions adjusted for these cases.</p>
104 <p>In clang-query, the mode can be changed with
105 <pre>
106 set traversal IgnoreUnlessSpelledInSource
107 </pre>
108 </p>
109 This affects both matchers and AST dump output in results.
111 <p>When using the C++ API such as in clang-tidy checks, the
112 <span class="mono">traverse()</span> matcher is used to set the mode:
113 <pre>
114 Finder->addMatcher(traverse(TK_IgnoreUnlessSpelledInSource,
115 returnStmt(hasReturnArgument(integerLiteral(equals(0))))
116 ), this);
117 </pre>
118 </p>
119 <p>The following table compares the <span class="mono">AsIs</span> mode with
120 the <span class="mono">IgnoreUnlessSpelledInSource</span> mode:</p>
122 <table class="traverse_compare">
123 <tr>
124 <th></th>
125 <th><span class="mono">AsIs</span></th>
126 <th><span class="mono">IgnoreUnlessSpelledInSource</span></th>
127 </tr>
128 <tr>
129 <td>AST dump of <span class="mono">func1</span>:
130 <pre>
131 struct B {
132 B(int);
135 B func1() { return 42; }
136 </pre>
138 </td>
139 <td>
140 C++98 dialect:
141 <pre>
142 FunctionDecl
143 `-CompoundStmt
144 `-ReturnStmt
145 `-ExprWithCleanups
146 `-CXXConstructExpr
147 `-MaterializeTemporaryExpr
148 `-ImplicitCastExpr
149 `-ImplicitCastExpr
150 `-CXXConstructExpr
151 `-IntegerLiteral 'int' 42
152 </pre>
153 C++11, C++14 dialect:
154 <pre>
155 FunctionDecl
156 `-CompoundStmt
157 `-ReturnStmt
158 `-ExprWithCleanups
159 `-CXXConstructExpr
160 `-MaterializeTemporaryExpr
161 `-ImplicitCastExpr
162 `-CXXConstructExpr
163 `-IntegerLiteral 'int' 42
164 </pre>
165 C++17, C++20 dialect:
166 <pre>
167 FunctionDecl
168 `-CompoundStmt
169 `-ReturnStmt
170 `-ImplicitCastExpr
171 `-CXXConstructExpr
172 `-IntegerLiteral 'int' 42
173 </pre>
174 </td>
175 <td>
176 All dialects:
177 <pre>
178 FunctionDecl
179 `-CompoundStmt
180 `-ReturnStmt
181 `-IntegerLiteral 'int' 42
182 </pre></td>
183 </tr>
185 <tr>
186 <td>Matcher for returned <span class="mono">42</span>:
187 <pre>
188 struct B {
189 B(int);
192 B func1() { return 42; }
193 </pre>
195 </td>
196 <td>
197 All dialects:
198 <pre>
199 returnStmt(hasReturnValue(
200 ignoringImplicit(
201 ignoringElidableConstructorCall(
202 ignoringImplicit(
203 cxxConstructExpr(hasArgument(0,
204 ignoringImplicit(
205 integerLiteral().bind("returnVal")
212 </pre></td>
213 <td>
214 All dialects:
215 <pre>
216 returnStmt(hasReturnValue(
217 integerLiteral().bind("returnVal")
219 </pre></td>
220 </tr>
221 <tr>
222 <td>Match result for
223 <pre>implicitCastExpr()</pre>
224 given:
225 <pre>
226 struct B {
227 B(int);
230 B func1() { return 42; }
231 </pre>
233 </td>
234 <td>
235 Match found.</td>
236 <td>
237 No match.</td>
238 </tr>
239 <tr>
240 <td>Match result for:
241 <pre>
242 cxxConstructorDecl(
243 isCopyConstructor()
244 ).bind("prepend_explicit")
245 </pre>
246 given:
247 <pre>
248 struct Other {};
249 struct Copyable {
250 Other m_o;
251 Copyable();
253 </pre>
254 </td>
255 <td>
256 Match found. Insertion produces incorrect output:
257 <pre>
258 struct Other {};
259 struct explicit Copyable {
260 Other m_o;
261 Copyable();
263 </pre>
264 </td>
265 <td>
266 No match found. Incorrect replacement not possible.
267 </td>
268 </tr>
269 <tr>
270 <td>Replacement of <span class="mono">begin()</span>
271 with <span class="mono">cbegin()</span>:
272 <pre>
273 cxxMemberCallExpr(
274 on(ConstContainerExpr),
275 callee(cxxMethodDecl(hasName("begin")))
276 ).bind("replace_with_cbegin")
277 </pre>
278 given:
279 <pre>
280 void foo() {
281 const Container c;
282 c.begin();
284 for (auto i : c) {
287 </pre>
288 </td>
289 <td>
290 2 matches found. Replacement produces incorrect output:
291 <pre>
292 void foo() {
293 const Container c;
294 c.cbegin();
296 for (auto i :.cbegin() c) {
299 </pre>
300 </td>
301 <td>
302 1 match found. Replacement produces correct output:
303 <pre>
304 void foo() {
305 const Container c;
306 c.cbegin();
308 for (auto i : c) {
311 </pre>
312 </td>
313 </tr>
314 <tr>
315 <td>Replacement of <span class="mono">int</span> member
316 with <span class="mono">safe_int</span>:
317 <pre>
318 fieldDecl(
319 hasType(asString("int"))
320 ).bind("use_safe_int")
321 </pre>
322 given:
323 <pre>
324 struct S {
325 int m_i;
328 template &lt;typename T&gt; struct TemplStruct {
329 TemplStruct() {}
330 ~TemplStruct() {}
332 private:
333 T m_t;
336 void instantiate() { TemplStruct&lt;int&gt; ti; }
337 </pre>
338 </td>
339 <td>
340 2 matches found. Replacement produces incorrect output:
341 <pre>
342 struct S {
343 safe_int m_i;
346 template &lt;typename T&gt; struct TemplStruct {
347 TemplStruct() {}
348 ~TemplStruct() {}
350 private:
351 safe_int m_t;
354 void instantiate() { TemplStruct&lt;int&gt; ti; }
355 </pre>
356 </td>
357 <td>
358 1 match found. Replacement produces correct output:
359 <pre>
360 struct S {
361 safe_int m_i;
364 template &lt;typename T&gt; struct TemplStruct {
365 TemplStruct() {}
366 ~TemplStruct() {}
368 private:
369 T m_t;
372 void instantiate() { TemplStruct&lt;int&gt; ti; }
373 </pre>
374 </td>
375 </tr>
376 <tr>
377 <td>Add prefix to member initializer
378 <pre>
379 cxxCtorInitializer(
380 forField(fieldDecl())
381 ).bind("add_prefix")
382 </pre>
383 given:
384 <pre>
385 struct Simple {};
387 struct Record {
388 Record() : i(42) {}
389 private:
390 int i;
391 Simple s;
393 </pre>
394 </td>
395 <td>
396 2 matches found. Replacement produces incorrect output:
397 <pre>
398 struct Simple {};
400 struct Record {
401 m_Record() : m_i(42) {}
402 private:
403 int i;
404 Simple s;
406 </pre>
407 </td>
408 <td>
409 1 match found. Replacement produces correct output:
410 <pre>
411 struct Simple {};
413 struct Record {
414 Record() : m_i(42) {}
415 private:
416 int i;
417 Simple s;
419 </pre>
420 </td>
421 </tr>
422 <tr>
423 <td>Ignored default arguments
424 <pre>
425 callExpr(
426 callee(functionDecl(
427 hasName("hasDefaultArg")
429 argumentCountIs(1)
430 ).bind("add_prefix")
431 </pre>
432 given:
433 <pre>
434 void hasDefaultArg(int i, int j = 0) {}
435 void callDefaultArg() { hasDefaultArg(42); }
436 </pre>
437 </td>
438 <td>
439 No match.
440 </td>
441 <td>
442 1 match found.
443 </td>
444 </tr>
445 <tr>
446 <td>Lambda fields
447 <pre>
448 fieldDecl(
449 hasType(asString("int"))
450 ).bind("make_safe")
451 </pre>
452 given:
453 <pre>
454 struct S {
455 int m_i;
458 void func() {
459 int a = 0;
460 int c = 0;
462 auto l = [a, b = c](int d) { int e = d; };
463 l(43);
465 </pre>
466 </td>
467 <td>
468 2 matches found. Replacement produces incorrect output:
469 <pre>
470 struct S {
471 safe_int m_i;
474 void func() {
475 int a = 0;
476 int c = 0;
478 auto l = [safe_a, safe_b = c](int d) { int e = d; };
479 l(43);
481 </pre>
482 </td>
483 <td>
484 1 match found. Replacement produces correct output:
485 <pre>
486 struct S {
487 safe_int m_i;
490 void func() {
491 int a = 0;
492 int c = 0;
494 auto l = [a, b = c](int d) { int e = d; };
495 l(43);
497 </pre>
498 </td>
500 </tr>
506 <tr>
507 <td>Rewritten binary operators
508 <pre>
509 binaryOperator(
510 hasOperatorName("&lt;"),
511 hasRHS(hasDescendant(integerLiteral(equals(0))))
513 </pre>
514 given:
515 <pre>
516 #include &lt;compare&gt;
518 class HasSpaceship {
519 public:
520 int x;
521 bool operator==(const HasSpaceship&) const = default;
522 std::strong_ordering operator<=>(const HasSpaceship&) const = default;
525 bool isLess(const HasSpaceship& a, const HasSpaceship& b) {
526 return a < b;
528 </pre>
529 </td>
530 <td>
531 1 match found.
533 <pre>
534 return a < b;
535 ^~~~~
536 </pre>
538 </td>
539 <td>
540 No match found.
541 </td>
542 </tr>
543 </table>
545 <!-- ======================================================================= -->
546 <h2 id="decl-matchers">Node Matchers</h2>
547 <!-- ======================================================================= -->
549 <p>Node matchers are at the core of matcher expressions - they specify the type
550 of node that is expected. Every match expression starts with a node matcher,
551 which can then be further refined with a narrowing or traversal matcher. All
552 traversal matchers take node matchers as their arguments.</p>
554 <p>For convenience, all node matchers take an arbitrary number of arguments
555 and implicitly act as allOf matchers.</p>
557 <p>Node matchers are the only matchers that support the bind("id") call to
558 bind the matched node to the given string, to be later retrieved from the
559 match callback.</p>
561 <p>It is important to remember that the arguments to node matchers are
562 predicates on the same node, just with additional information about the type.
563 This is often useful to make matcher expression more readable by inlining bind
564 calls into redundant node matchers inside another node matcher:
565 <pre>
566 // This binds the CXXRecordDecl to "id", as the decl() matcher will stay on
567 // the same node.
568 recordDecl(decl().bind("id"), hasName("::MyClass"))
569 </pre>
570 </p>
572 <table>
573 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
574 <!-- START_DECL_MATCHERS -->
576 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_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('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>
686 <tr><td colspan="4" class="doc" id="cxxConstructorDecl0"><pre>Matches C++ constructor declarations.
688 Example matches Foo::Foo() and Foo::Foo(int)
689 class Foo {
690 public:
691 Foo();
692 Foo(int);
693 int DoSomething();
695 </pre></td></tr>
698 <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>
699 <tr><td colspan="4" class="doc" id="cxxConversionDecl0"><pre>Matches conversion operator declarations.
701 Example matches the operator.
702 class X { operator int() const; };
703 </pre></td></tr>
706 <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>
707 <tr><td colspan="4" class="doc" id="cxxDeductionGuideDecl0"><pre>Matches user-defined and implicitly generated deduction guide.
709 Example matches the deduction guide.
710 template&lt;typename T&gt;
711 class X { X(int) };
712 X(int) -&gt; X&lt;int&gt;;
713 </pre></td></tr>
716 <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>
717 <tr><td colspan="4" class="doc" id="cxxDestructorDecl0"><pre>Matches explicit C++ destructor declarations.
719 Example matches Foo::~Foo()
720 class Foo {
721 public:
722 virtual ~Foo();
724 </pre></td></tr>
727 <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>
728 <tr><td colspan="4" class="doc" id="cxxMethodDecl0"><pre>Matches method declarations.
730 Example matches y
731 class X { void y(); };
732 </pre></td></tr>
735 <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>
736 <tr><td colspan="4" class="doc" id="cxxRecordDecl0"><pre>Matches C++ class declarations.
738 Example matches X, Z
739 class X;
740 template&lt;class T&gt; class Z {};
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('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>
745 <tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations.
747 Examples matches X, C, and the friend declaration inside C;
748 void X();
749 class C {
750 friend X;
752 </pre></td></tr>
755 <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>
756 <tr><td colspan="4" class="doc" id="declaratorDecl0"><pre>Matches declarator declarations (field, variable, function
757 and non-type template parameter declarations).
759 Given
760 class X { int y; };
761 declaratorDecl()
762 matches int y.
763 </pre></td></tr>
766 <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>
767 <tr><td colspan="4" class="doc" id="decompositionDecl0"><pre>Matches decomposition-declarations.
769 Examples matches the declaration node with foo and bar, but not
770 number.
771 (matcher = declStmt(has(decompositionDecl())))
773 int number = 42;
774 auto [foo, bar] = std::make_pair{42, 42};
775 </pre></td></tr>
778 <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>
779 <tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants.
781 Example matches A, B, C
782 enum X {
783 A, B, C
785 </pre></td></tr>
788 <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>
789 <tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations.
791 Example matches X
792 enum X {
793 A, B, C
795 </pre></td></tr>
798 <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>
799 <tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations.
801 Given
802 class X { int m; };
803 fieldDecl()
804 matches 'm'.
805 </pre></td></tr>
808 <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>
809 <tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations.
811 Given
812 class X { friend void foo(); };
813 friendDecl()
814 matches 'friend void foo()'.
815 </pre></td></tr>
818 <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>
819 <tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations.
821 Example matches f
822 void f();
823 </pre></td></tr>
826 <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>
827 <tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations.
829 Example matches f
830 template&lt;class T&gt; void f(T t) {}
831 </pre></td></tr>
834 <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>
835 <tr><td colspan="4" class="doc" id="indirectFieldDecl0"><pre>Matches indirect field declarations.
837 Given
838 struct X { struct { int a; }; };
839 indirectFieldDecl()
840 matches 'a'.
841 </pre></td></tr>
844 <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>
845 <tr><td colspan="4" class="doc" id="labelDecl0"><pre>Matches a declaration of label.
847 Given
848 goto FOO;
849 FOO: bar();
850 labelDecl()
851 matches 'FOO:'
852 </pre></td></tr>
855 <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>
856 <tr><td colspan="4" class="doc" id="linkageSpecDecl0"><pre>Matches a declaration of a linkage specification.
858 Given
859 extern "C" {}
860 linkageSpecDecl()
861 matches "extern "C" {}"
862 </pre></td></tr>
865 <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>
866 <tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name.
868 Example matches X, S, the anonymous union type, i, and U;
869 typedef int X;
870 struct S {
871 union {
872 int i;
873 } U;
875 </pre></td></tr>
878 <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>
879 <tr><td colspan="4" class="doc" id="namespaceAliasDecl0"><pre>Matches a declaration of a namespace alias.
881 Given
882 namespace test {}
883 namespace alias = ::test;
884 namespaceAliasDecl()
885 matches "namespace alias" but not "namespace test"
886 </pre></td></tr>
889 <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>
890 <tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace.
892 Given
893 namespace {}
894 namespace test {}
895 namespaceDecl()
896 matches "namespace {}" and "namespace test {}"
897 </pre></td></tr>
900 <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>
901 <tr><td colspan="4" class="doc" id="nonTypeTemplateParmDecl0"><pre>Matches non-type template parameter declarations.
903 Given
904 template &lt;typename T, int N&gt; struct C {};
905 nonTypeTemplateParmDecl()
906 matches 'N', but not 'T'.
907 </pre></td></tr>
910 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
911 <tr><td colspan="4" class="doc" id="objcCategoryDecl0"><pre>Matches Objective-C category declarations.
913 Example matches Foo (Additions)
914 @interface Foo (Additions)
915 @end
916 </pre></td></tr>
919 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
920 <tr><td colspan="4" class="doc" id="objcCategoryImplDecl0"><pre>Matches Objective-C category definitions.
922 Example matches Foo (Additions)
923 @implementation 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('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>
929 <tr><td colspan="4" class="doc" id="objcImplementationDecl0"><pre>Matches Objective-C implementation declarations.
931 Example matches Foo
932 @implementation Foo
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('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>
938 <tr><td colspan="4" class="doc" id="objcInterfaceDecl0"><pre>Matches Objective-C interface declarations.
940 Example matches Foo
941 @interface 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('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>
947 <tr><td colspan="4" class="doc" id="objcIvarDecl0"><pre>Matches Objective-C instance variable declarations.
949 Example matches _enabled
950 @implementation Foo {
951 BOOL _enabled;
953 @end
954 </pre></td></tr>
957 <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>
958 <tr><td colspan="4" class="doc" id="objcMethodDecl0"><pre>Matches Objective-C method declarations.
960 Example matches both declaration and definition of -[Foo method]
961 @interface Foo
962 - (void)method;
963 @end
965 @implementation Foo
966 - (void)method {}
967 @end
968 </pre></td></tr>
971 <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>
972 <tr><td colspan="4" class="doc" id="objcPropertyDecl0"><pre>Matches Objective-C property declarations.
974 Example matches enabled
975 @interface Foo
976 @property BOOL enabled;
977 @end
978 </pre></td></tr>
981 <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>
982 <tr><td colspan="4" class="doc" id="objcProtocolDecl0"><pre>Matches Objective-C protocol declarations.
984 Example matches FooDelegate
985 @protocol FooDelegate
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('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>
991 <tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations.
993 Given
994 void f(int x);
995 parmVarDecl()
996 matches int x.
997 </pre></td></tr>
1000 <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>
1001 <tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches class, struct, and union declarations.
1003 Example matches X, Z, U, and S
1004 class X;
1005 template&lt;class T&gt; class Z {};
1006 struct S {};
1007 union U {};
1008 </pre></td></tr>
1011 <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>
1012 <tr><td colspan="4" class="doc" id="staticAssertDecl0"><pre>Matches a C++ static_assert declaration.
1014 Example:
1015 staticAssertExpr()
1016 matches
1017 static_assert(sizeof(S) == sizeof(int))
1019 struct S {
1020 int x;
1022 static_assert(sizeof(S) == sizeof(int));
1023 </pre></td></tr>
1026 <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>
1027 <tr><td colspan="4" class="doc" id="tagDecl0"><pre>Matches tag declarations.
1029 Example matches X, Z, U, S, E
1030 class X;
1031 template&lt;class T&gt; class Z {};
1032 struct S {};
1033 union U {};
1034 enum E {
1035 A, B, C
1037 </pre></td></tr>
1040 <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>
1041 <tr><td colspan="4" class="doc" id="templateTemplateParmDecl0"><pre>Matches template template parameter declarations.
1043 Given
1044 template &lt;template &lt;typename&gt; class Z, int N&gt; struct C {};
1045 templateTypeParmDecl()
1046 matches 'Z', but not 'N'.
1047 </pre></td></tr>
1050 <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>
1051 <tr><td colspan="4" class="doc" id="templateTypeParmDecl0"><pre>Matches template type parameter declarations.
1053 Given
1054 template &lt;typename T, int N&gt; struct C {};
1055 templateTypeParmDecl()
1056 matches 'T', but not 'N'.
1057 </pre></td></tr>
1060 <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>
1061 <tr><td colspan="4" class="doc" id="translationUnitDecl0"><pre>Matches the top declaration context.
1063 Given
1064 int X;
1065 namespace NS {
1066 int Y;
1067 } // namespace NS
1068 decl(hasDeclContext(translationUnitDecl()))
1069 matches "int X", but not "int Y".
1070 </pre></td></tr>
1073 <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>
1074 <tr><td colspan="4" class="doc" id="typeAliasDecl0"><pre>Matches type alias declarations.
1076 Given
1077 typedef int X;
1078 using Y = int;
1079 typeAliasDecl()
1080 matches "using Y = int", but not "typedef int X"
1081 </pre></td></tr>
1084 <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>
1085 <tr><td colspan="4" class="doc" id="typeAliasTemplateDecl0"><pre>Matches type alias template declarations.
1087 typeAliasTemplateDecl() matches
1088 template &lt;typename T&gt;
1089 using Y = X&lt;T&gt;;
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('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>
1094 <tr><td colspan="4" class="doc" id="typedefDecl0"><pre>Matches typedef declarations.
1096 Given
1097 typedef int X;
1098 using Y = int;
1099 typedefDecl()
1100 matches "typedef int X", but not "using Y = int"
1101 </pre></td></tr>
1104 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('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>
1105 <tr><td colspan="4" class="doc" id="typedefNameDecl0"><pre>Matches typedef name declarations.
1107 Given
1108 typedef int X;
1109 using Y = int;
1110 typedefNameDecl()
1111 matches "typedef int X" and "using Y = int"
1112 </pre></td></tr>
1115 <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>
1116 <tr><td colspan="4" class="doc" id="unresolvedUsingTypenameDecl0"><pre>Matches unresolved using value declarations that involve the
1117 typename.
1119 Given
1120 template &lt;typename T&gt;
1121 struct Base { typedef T Foo; };
1123 template&lt;typename T&gt;
1124 struct S : private Base&lt;T&gt; {
1125 using typename Base&lt;T&gt;::Foo;
1127 unresolvedUsingTypenameDecl()
1128 matches using Base&lt;T&gt;::Foo </pre></td></tr>
1131 <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>
1132 <tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations.
1134 Given
1135 template&lt;typename X&gt;
1136 class C : private X {
1137 using X::x;
1139 unresolvedUsingValueDecl()
1140 matches using X::x </pre></td></tr>
1143 <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>
1144 <tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations.
1146 Given
1147 namespace X { int x; }
1148 using X::x;
1149 usingDecl()
1150 matches using X::x </pre></td></tr>
1153 <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>
1154 <tr><td colspan="4" class="doc" id="usingDirectiveDecl0"><pre>Matches using namespace declarations.
1156 Given
1157 namespace X { int x; }
1158 using namespace X;
1159 usingDirectiveDecl()
1160 matches using namespace X </pre></td></tr>
1163 <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>
1164 <tr><td colspan="4" class="doc" id="usingEnumDecl0"><pre>Matches using-enum declarations.
1166 Given
1167 namespace X { enum x {...}; }
1168 using enum X::x;
1169 usingEnumDecl()
1170 matches using enum X::x </pre></td></tr>
1173 <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>
1174 <tr><td colspan="4" class="doc" id="valueDecl0"><pre>Matches any value declaration.
1176 Example matches A, B, C and F
1177 enum X { A, B, C };
1178 void F();
1179 </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('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>
1183 <tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations.
1185 Note: this does not match declarations of member variables, which are
1186 "field" declarations in Clang parlance.
1188 Example matches a
1189 int a;
1190 </pre></td></tr>
1193 <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>
1194 <tr><td colspan="4" class="doc" id="lambdaCapture0"><pre>Matches lambda captures.
1196 Given
1197 int main() {
1198 int x;
1199 auto f = [x](){};
1200 auto g = [x = 1](){};
1202 In the matcher `lambdaExpr(hasAnyCapture(lambdaCapture()))`,
1203 `lambdaCapture()` matches `x` and `x=1`.
1204 </pre></td></tr>
1207 <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>
1208 <tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
1209 </pre></td></tr>
1212 <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>
1213 <tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers.
1215 Given
1216 namespace ns {
1217 struct A { static void f(); };
1218 void A::f() {}
1219 void g() { A::f(); }
1221 ns::A a;
1222 nestedNameSpecifier()
1223 matches "ns::" and both "A::"
1224 </pre></td></tr>
1227 <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>
1228 <tr><td colspan="4" class="doc" id="ompDefaultClause0"><pre>Matches OpenMP ``default`` clause.
1230 Given
1232 #pragma omp parallel default(none)
1233 #pragma omp parallel default(shared)
1234 #pragma omp parallel default(firstprivate)
1235 #pragma omp parallel
1237 ``ompDefaultClause()`` matches ``default(none)``, ``default(shared)``, and
1238 ``default(firstprivate)``
1239 </pre></td></tr>
1242 <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>
1243 <tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST.
1244 </pre></td></tr>
1247 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1248 <tr><td colspan="4" class="doc" id="addrLabelExpr0"><pre>Matches address of label statements (GNU extension).
1250 Given
1251 FOO: bar();
1252 void *ptr = &amp;&amp;FOO;
1253 goto *bar;
1254 addrLabelExpr()
1255 matches '&amp;&amp;FOO'
1256 </pre></td></tr>
1259 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1260 <tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions.
1262 Given
1263 int i = a[1];
1264 arraySubscriptExpr()
1265 matches "a[1]"
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('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>
1270 <tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements.
1272 int i = 100;
1273 __asm("mov al, 2");
1274 asmStmt()
1275 matches '__asm("mov al, 2")'
1276 </pre></td></tr>
1279 <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>
1280 <tr><td colspan="4" class="doc" id="atomicExpr0"><pre>Matches atomic builtins.
1281 Example matches __atomic_load_n(ptr, 1)
1282 void foo() { int *ptr; __atomic_load_n(ptr, 1); }
1283 </pre></td></tr>
1286 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1287 <tr><td colspan="4" class="doc" id="autoreleasePoolStmt0"><pre>Matches an Objective-C autorelease pool statement.
1289 Given
1290 @autoreleasepool {
1291 int x = 0;
1293 autoreleasePoolStmt(stmt()) matches the declaration of "x"
1294 inside the autorelease pool.
1295 </pre></td></tr>
1298 <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>
1299 <tr><td colspan="4" class="doc" id="binaryConditionalOperator0"><pre>Matches binary conditional operator expressions (GNU extension).
1301 Example matches a ?: b
1302 (a ?: b) + 42;
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('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>
1307 <tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions.
1309 Example matches a || b
1310 !(a || b)
1311 See also the binaryOperation() matcher for more-general matching.
1312 </pre></td></tr>
1315 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1316 <tr><td colspan="4" class="doc" id="blockExpr0"><pre>Matches a reference to a block.
1318 Example: matches "^{}":
1319 void f() { ^{}(); }
1320 </pre></td></tr>
1323 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1324 <tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements.
1326 Given
1327 while (true) { break; }
1328 breakStmt()
1329 matches 'break'
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('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>
1334 <tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression.
1336 Example: Matches (int) 2.2f in
1337 int i = (int) 2.2f;
1338 </pre></td></tr>
1341 <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>
1342 <tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions.
1344 Example matches x.y() and y()
1345 X x;
1346 x.y();
1347 y();
1348 </pre></td></tr>
1351 <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>
1352 <tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements.
1354 Given
1355 switch(a) { case 42: break; default: break; }
1356 caseStmt()
1357 matches 'case 42:'.
1358 </pre></td></tr>
1361 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1362 <tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST.
1364 Example: castExpr() matches each of the following:
1365 (int) 3;
1366 const_cast&lt;Expr *&gt;(SubExpr);
1367 char c = 0;
1368 but does not match
1369 int i = (0);
1370 int k = 0;
1371 </pre></td></tr>
1374 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1375 <tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t).
1377 Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
1378 though.
1380 Example matches 'a', L'a'
1381 char ch = 'a';
1382 wchar_t chw = L'a';
1383 </pre></td></tr>
1386 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1387 <tr><td colspan="4" class="doc" id="chooseExpr0"><pre>Matches GNU __builtin_choose_expr.
1388 </pre></td></tr>
1391 <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>
1392 <tr><td colspan="4" class="doc" id="coawaitExpr0"><pre>Matches co_await expressions.
1394 Given
1395 co_await 1;
1396 coawaitExpr()
1397 matches 'co_await 1'
1398 </pre></td></tr>
1401 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1402 <tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
1404 Example match: {1}, (1, 2)
1405 int array[4] = {1};
1406 vector int myvec = (vector int)(1, 2);
1407 </pre></td></tr>
1410 <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>
1411 <tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements.
1413 Example matches '{}' and '{{}}' in 'for (;;) {{}}'
1414 for (;;) {{}}
1415 </pre></td></tr>
1418 <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>
1419 <tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions.
1421 Example matches a ? b : c
1422 (a ? b : c) + 42
1423 </pre></td></tr>
1426 <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>
1427 <tr><td colspan="4" class="doc" id="constantExpr0"><pre>Matches a constant expression wrapper.
1429 Example matches the constant in the case statement:
1430 (matcher = constantExpr())
1431 switch (a) {
1432 case 37: break;
1434 </pre></td></tr>
1437 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1438 <tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements.
1440 Given
1441 while (true) { continue; }
1442 continueStmt()
1443 matches 'continue'
1444 </pre></td></tr>
1447 <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>
1448 <tr><td colspan="4" class="doc" id="coreturnStmt0"><pre>Matches co_return statements.
1450 Given
1451 while (true) { co_return; }
1452 coreturnStmt()
1453 matches 'co_return'
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('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>
1458 <tr><td colspan="4" class="doc" id="coyieldExpr0"><pre>Matches co_yield expressions.
1460 Given
1461 co_yield 1;
1462 coyieldExpr()
1463 matches 'co_yield 1'
1464 </pre></td></tr>
1467 <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>
1468 <tr><td colspan="4" class="doc" id="cudaKernelCallExpr0"><pre>Matches CUDA kernel call expression.
1470 Example matches,
1471 kernel&lt;&lt;&lt;i,j&gt;&gt;&gt;();
1472 </pre></td></tr>
1475 <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>
1476 <tr><td colspan="4" class="doc" id="cxxBindTemporaryExpr0"><pre>Matches nodes where temporaries are created.
1478 Example matches FunctionTakesString(GetStringByValue())
1479 (matcher = cxxBindTemporaryExpr())
1480 FunctionTakesString(GetStringByValue());
1481 FunctionTakesStringByPointer(GetStringPointer());
1482 </pre></td></tr>
1485 <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>
1486 <tr><td colspan="4" class="doc" id="cxxBoolLiteral0"><pre>Matches bool literals.
1488 Example matches true
1489 true
1490 </pre></td></tr>
1493 <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>
1494 <tr><td colspan="4" class="doc" id="cxxCatchStmt0"><pre>Matches catch statements.
1496 try {} catch(int i) {}
1497 cxxCatchStmt()
1498 matches 'catch(int i)'
1499 </pre></td></tr>
1502 <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>
1503 <tr><td colspan="4" class="doc" id="cxxConstCastExpr0"><pre>Matches a const_cast expression.
1505 Example: Matches const_cast&lt;int*&gt;(&amp;r) in
1506 int n = 42;
1507 const int &amp;r(n);
1508 int* p = const_cast&lt;int*&gt;(&amp;r);
1509 </pre></td></tr>
1512 <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>
1513 <tr><td colspan="4" class="doc" id="cxxConstructExpr0"><pre>Matches constructor call expressions (including implicit ones).
1515 Example matches string(ptr, n) and ptr within arguments of f
1516 (matcher = cxxConstructExpr())
1517 void f(const string &amp;a, const string &amp;b);
1518 char *ptr;
1519 int n;
1520 f(string(ptr, n), ptr);
1521 </pre></td></tr>
1524 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1525 <tr><td colspan="4" class="doc" id="cxxDefaultArgExpr0"><pre>Matches the value of a default argument at the call site.
1527 Example matches the CXXDefaultArgExpr placeholder inserted for the
1528 default value of the second parameter in the call expression f(42)
1529 (matcher = cxxDefaultArgExpr())
1530 void f(int x, int y = 0);
1531 f(42);
1532 </pre></td></tr>
1535 <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>
1536 <tr><td colspan="4" class="doc" id="cxxDeleteExpr0"><pre>Matches delete expressions.
1538 Given
1539 delete X;
1540 cxxDeleteExpr()
1541 matches 'delete X'.
1542 </pre></td></tr>
1545 <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>
1546 <tr><td colspan="4" class="doc" id="cxxDependentScopeMemberExpr0"><pre>Matches member expressions where the actual member referenced could not be
1547 resolved because the base expression or the member name was dependent.
1549 Given
1550 template &lt;class T&gt; void f() { T t; t.g(); }
1551 cxxDependentScopeMemberExpr()
1552 matches t.g
1553 </pre></td></tr>
1556 <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>
1557 <tr><td colspan="4" class="doc" id="cxxDynamicCastExpr0"><pre>Matches a dynamic_cast expression.
1559 Example:
1560 cxxDynamicCastExpr()
1561 matches
1562 dynamic_cast&lt;D*&gt;(&amp;b);
1564 struct B { virtual ~B() {} }; struct D : B {};
1565 B b;
1566 D* p = dynamic_cast&lt;D*&gt;(&amp;b);
1567 </pre></td></tr>
1570 <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>
1571 <tr><td colspan="4" class="doc" id="cxxForRangeStmt0"><pre>Matches range-based for statements.
1573 cxxForRangeStmt() matches 'for (auto a : i)'
1574 int i[] = {1, 2, 3}; for (auto a : i);
1575 for(int j = 0; j &lt; 5; ++j);
1576 </pre></td></tr>
1579 <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>
1580 <tr><td colspan="4" class="doc" id="cxxFunctionalCastExpr0"><pre>Matches functional cast expressions
1582 Example: Matches Foo(bar);
1583 Foo f = bar;
1584 Foo g = (Foo) bar;
1585 Foo h = Foo(bar);
1586 </pre></td></tr>
1589 <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>
1590 <tr><td colspan="4" class="doc" id="cxxMemberCallExpr0"><pre>Matches member call expressions.
1592 Example matches x.y()
1593 X x;
1594 x.y();
1595 </pre></td></tr>
1598 <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>
1599 <tr><td colspan="4" class="doc" id="cxxNewExpr0"><pre>Matches new expressions.
1601 Given
1602 new X;
1603 cxxNewExpr()
1604 matches 'new X'.
1605 </pre></td></tr>
1608 <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>
1609 <tr><td colspan="4" class="doc" id="cxxNoexceptExpr0"><pre>Matches noexcept expressions.
1611 Given
1612 bool a() noexcept;
1613 bool b() noexcept(true);
1614 bool c() noexcept(false);
1615 bool d() noexcept(noexcept(a()));
1616 bool e = noexcept(b()) || noexcept(c());
1617 cxxNoexceptExpr()
1618 matches `noexcept(a())`, `noexcept(b())` and `noexcept(c())`.
1619 doesn't match the noexcept specifier in the declarations a, b, c or d.
1620 </pre></td></tr>
1623 <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>
1624 <tr><td colspan="4" class="doc" id="cxxNullPtrLiteralExpr0"><pre>Matches nullptr literal.
1625 </pre></td></tr>
1628 <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>
1629 <tr><td colspan="4" class="doc" id="cxxOperatorCallExpr0"><pre>Matches overloaded operator calls.
1631 Note that if an operator isn't overloaded, it won't match. Instead, use
1632 binaryOperator matcher.
1633 Currently it does not match operators such as new delete.
1634 FIXME: figure out why these do not match?
1636 Example matches both operator&lt;&lt;((o &lt;&lt; b), c) and operator&lt;&lt;(o, b)
1637 (matcher = cxxOperatorCallExpr())
1638 ostream &amp;operator&lt;&lt; (ostream &amp;out, int i) { };
1639 ostream &amp;o; int b = 1, c = 1;
1640 o &lt;&lt; b &lt;&lt; c;
1641 See also the binaryOperation() matcher for more-general matching of binary
1642 uses of this AST node.
1643 </pre></td></tr>
1646 <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>
1647 <tr><td colspan="4" class="doc" id="cxxReinterpretCastExpr0"><pre>Matches a reinterpret_cast expression.
1649 Either the source expression or the destination type can be matched
1650 using has(), but hasDestinationType() is more specific and can be
1651 more readable.
1653 Example matches reinterpret_cast&lt;char*&gt;(&amp;p) in
1654 void* p = reinterpret_cast&lt;char*&gt;(&amp;p);
1655 </pre></td></tr>
1658 <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>
1659 <tr><td colspan="4" class="doc" id="cxxRewrittenBinaryOperator0"><pre>Matches rewritten binary operators
1661 Example matches use of "&lt;":
1662 #include &lt;compare&gt;
1663 struct HasSpaceshipMem {
1664 int a;
1665 constexpr auto operator&lt;=&gt;(const HasSpaceshipMem&amp;) const = default;
1667 void compare() {
1668 HasSpaceshipMem hs1, hs2;
1669 if (hs1 &lt; hs2)
1670 return;
1672 See also the binaryOperation() matcher for more-general matching
1673 of this AST node.
1674 </pre></td></tr>
1677 <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>
1678 <tr><td colspan="4" class="doc" id="cxxStaticCastExpr0"><pre>Matches a C++ static_cast expression.
1680 See also: hasDestinationType
1681 See also: reinterpretCast
1683 Example:
1684 cxxStaticCastExpr()
1685 matches
1686 static_cast&lt;long&gt;(8)
1688 long eight(static_cast&lt;long&gt;(8));
1689 </pre></td></tr>
1692 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1693 <tr><td colspan="4" class="doc" id="cxxStdInitializerListExpr0"><pre>Matches C++ initializer list expressions.
1695 Given
1696 std::vector&lt;int&gt; a({ 1, 2, 3 });
1697 std::vector&lt;int&gt; b = { 4, 5 };
1698 int c[] = { 6, 7 };
1699 std::pair&lt;int, int&gt; d = { 8, 9 };
1700 cxxStdInitializerListExpr()
1701 matches "{ 1, 2, 3 }" and "{ 4, 5 }"
1702 </pre></td></tr>
1705 <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>
1706 <tr><td colspan="4" class="doc" id="cxxTemporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments
1708 Example: Matches Foo(bar, bar)
1709 Foo h = Foo(bar, bar);
1710 </pre></td></tr>
1713 <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>
1714 <tr><td colspan="4" class="doc" id="cxxThisExpr0"><pre>Matches implicit and explicit this expressions.
1716 Example matches the implicit this expression in "return i".
1717 (matcher = cxxThisExpr())
1718 struct foo {
1719 int i;
1720 int f() { return i; }
1722 </pre></td></tr>
1725 <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>
1726 <tr><td colspan="4" class="doc" id="cxxThrowExpr0"><pre>Matches throw expressions.
1728 try { throw 5; } catch(int i) {}
1729 cxxThrowExpr()
1730 matches 'throw 5'
1731 </pre></td></tr>
1734 <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>
1735 <tr><td colspan="4" class="doc" id="cxxTryStmt0"><pre>Matches try statements.
1737 try {} catch(int i) {}
1738 cxxTryStmt()
1739 matches 'try {}'
1740 </pre></td></tr>
1743 <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>
1744 <tr><td colspan="4" class="doc" id="cxxUnresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions.
1746 Example matches T(t) in return statement of f
1747 (matcher = cxxUnresolvedConstructExpr())
1748 template &lt;typename T&gt;
1749 void f(const T&amp; t) { return T(t); }
1750 </pre></td></tr>
1753 <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>
1754 <tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations.
1756 Example matches x in if (x)
1757 bool x;
1758 if (x) {}
1759 </pre></td></tr>
1762 <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>
1763 <tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements.
1765 Given
1766 int a;
1767 declStmt()
1768 matches 'int a'.
1769 </pre></td></tr>
1772 <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>
1773 <tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements.
1775 Given
1776 switch(a) { case 42: break; default: break; }
1777 defaultStmt()
1778 matches 'default:'.
1779 </pre></td></tr>
1782 <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>
1783 <tr><td colspan="4" class="doc" id="dependentCoawaitExpr0"><pre>Matches co_await expressions where the type of the promise is dependent
1784 </pre></td></tr>
1787 <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>
1788 <tr><td colspan="4" class="doc" id="designatedInitExpr0"><pre>Matches C99 designated initializer expressions [C99 6.7.8].
1790 Example: Matches { [2].y = 1.0, [0].x = 1.0 }
1791 point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
1792 </pre></td></tr>
1795 <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>
1796 <tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements.
1798 Given
1799 do {} while (true);
1800 doStmt()
1801 matches 'do {} while(true)'
1802 </pre></td></tr>
1805 <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>
1806 <tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions.
1808 Matches any cast expression written in user code, whether it be a
1809 C-style cast, a functional-style cast, or a keyword cast.
1811 Does not match implicit conversions.
1813 Note: the name "explicitCast" is chosen to match Clang's terminology, as
1814 Clang uses the term "cast" to apply to implicit conversions as well as to
1815 actual cast expressions.
1817 See also: hasDestinationType.
1819 Example: matches all five of the casts in
1820 int((int)(reinterpret_cast&lt;int&gt;(static_cast&lt;int&gt;(const_cast&lt;int&gt;(42)))))
1821 but does not match the implicit conversion in
1822 long ell = 42;
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('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>
1827 <tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions.
1829 Example matches x()
1830 void f() { x(); }
1831 </pre></td></tr>
1834 <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>
1835 <tr><td colspan="4" class="doc" id="exprWithCleanups0"><pre>Matches expressions that introduce cleanups to be run at the end
1836 of the sub-expression's evaluation.
1838 Example matches std::string()
1839 const std::string str = std::string();
1840 </pre></td></tr>
1843 <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>
1844 <tr><td colspan="4" class="doc" id="fixedPointLiteral0"><pre>Matches fixed point literals
1845 </pre></td></tr>
1848 <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>
1849 <tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes / encodings, e.g.
1850 1.0, 1.0f, 1.0L and 1e10.
1852 Does not match implicit conversions such as
1853 float a = 10;
1854 </pre></td></tr>
1857 <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>
1858 <tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements.
1860 Example matches 'for (;;) {}'
1861 for (;;) {}
1862 int i[] = {1, 2, 3}; for (auto a : i);
1863 </pre></td></tr>
1866 <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>
1867 <tr><td colspan="4" class="doc" id="genericSelectionExpr0"><pre>Matches C11 _Generic expression.
1868 </pre></td></tr>
1871 <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>
1872 <tr><td colspan="4" class="doc" id="gnuNullExpr0"><pre>Matches GNU __null expression.
1873 </pre></td></tr>
1876 <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>
1877 <tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements.
1879 Given
1880 goto FOO;
1881 FOO: bar();
1882 gotoStmt()
1883 matches 'goto FOO'
1884 </pre></td></tr>
1887 <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>
1888 <tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements.
1890 Example matches 'if (x) {}'
1891 if (x) {}
1892 </pre></td></tr>
1895 <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>
1896 <tr><td colspan="4" class="doc" id="imaginaryLiteral0"><pre>Matches imaginary literals, which are based on integer and floating
1897 point literals e.g.: 1i, 1.0i
1898 </pre></td></tr>
1901 <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>
1902 <tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST.
1904 This matches many different places, including function call return value
1905 eliding, as well as any type conversions.
1906 </pre></td></tr>
1909 <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>
1910 <tr><td colspan="4" class="doc" id="implicitValueInitExpr0"><pre>Matches implicit initializers of init list expressions.
1912 Given
1913 point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
1914 implicitValueInitExpr()
1915 matches "[0].y" (implicitly)
1916 </pre></td></tr>
1919 <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>
1920 <tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions.
1922 Given
1923 int a[] = { 1, 2 };
1924 struct B { int x, y; };
1925 B b = { 5, 6 };
1926 initListExpr()
1927 matches "{ 1, 2 }" and "{ 5, 6 }"
1928 </pre></td></tr>
1931 <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>
1932 <tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes / encodings, e.g.
1933 1, 1L, 0x1 and 1U.
1935 Does not match character-encoded integers such as L'a'.
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('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>
1940 <tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements.
1942 Given
1943 goto FOO;
1944 FOO: bar();
1945 labelStmt()
1946 matches 'FOO:'
1947 </pre></td></tr>
1950 <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>
1951 <tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions.
1953 Example matches [&amp;](){return 5;}
1954 [&amp;](){return 5;}
1955 </pre></td></tr>
1958 <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>
1959 <tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized.
1961 Example: Given
1962 struct T {void func();};
1963 T f();
1964 void g(T);
1965 materializeTemporaryExpr() matches 'f()' in these statements
1966 T u(f());
1967 g(f());
1968 f().func();
1969 but does not match
1970 f();
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('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>
1975 <tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions.
1977 Given
1978 class Y {
1979 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
1980 int a; static int b;
1982 memberExpr()
1983 matches this-&gt;x, x, y.x, a, this-&gt;b
1984 </pre></td></tr>
1987 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
1988 <tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements.
1990 foo();;
1991 nullStmt()
1992 matches the second ';'
1993 </pre></td></tr>
1996 <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>
1997 <tr><td colspan="4" class="doc" id="objcCatchStmt0"><pre>Matches Objective-C @catch statements.
1999 Example matches @catch
2000 @try {}
2001 @catch (...) {}
2002 </pre></td></tr>
2005 <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>
2006 <tr><td colspan="4" class="doc" id="objcFinallyStmt0"><pre>Matches Objective-C @finally statements.
2008 Example matches @finally
2009 @try {}
2010 @finally {}
2011 </pre></td></tr>
2014 <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>
2015 <tr><td colspan="4" class="doc" id="objcIvarRefExpr0"><pre>Matches a reference to an ObjCIvar.
2017 Example: matches "a" in "init" method:
2018 @implementation A {
2019 NSString *a;
2021 - (void) init {
2022 a = @"hello";
2024 </pre></td></tr>
2027 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('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>
2028 <tr><td colspan="4" class="doc" id="objcMessageExpr0"><pre>Matches ObjectiveC Message invocation expressions.
2030 The innermost message send invokes the "alloc" class method on the
2031 NSString class, while the outermost message send invokes the
2032 "initWithString" instance method on the object returned from
2033 NSString's "alloc". This matcher should match both message sends.
2034 [[NSString alloc] initWithString:@"Hello"]
2035 </pre></td></tr>
2038 <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>
2039 <tr><td colspan="4" class="doc" id="objcThrowStmt0"><pre>Matches Objective-C statements.
2041 Example matches @throw obj;
2042 </pre></td></tr>
2045 <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>
2046 <tr><td colspan="4" class="doc" id="objcTryStmt0"><pre>Matches Objective-C @try statements.
2048 Example matches @try
2049 @try {}
2050 @catch (...) {}
2051 </pre></td></tr>
2054 <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>
2055 <tr><td colspan="4" class="doc" id="ompExecutableDirective0"><pre>Matches any ``#pragma omp`` executable directive.
2057 Given
2059 #pragma omp parallel
2060 #pragma omp parallel default(none)
2061 #pragma omp taskyield
2063 ``ompExecutableDirective()`` matches ``omp parallel``,
2064 ``omp parallel default(none)`` and ``omp taskyield``.
2065 </pre></td></tr>
2068 <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>
2069 <tr><td colspan="4" class="doc" id="opaqueValueExpr0"><pre>Matches opaque value expressions. They are used as helpers
2070 to reference another expressions and can be met
2071 in BinaryConditionalOperators, for example.
2073 Example matches 'a'
2074 (a ?: c) + 42;
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('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>
2079 <tr><td colspan="4" class="doc" id="parenExpr0"><pre>Matches parentheses used in expressions.
2081 Example matches (foo() + 1)
2082 int foo() { return 1; }
2083 int a = (foo() + 1);
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('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>
2088 <tr><td colspan="4" class="doc" id="parenListExpr0"><pre>Matches paren list expressions.
2089 ParenListExprs don't have a predefined type and are used for late parsing.
2090 In the final AST, they can be met in template declarations.
2092 Given
2093 template&lt;typename T&gt; class X {
2094 void f() {
2095 X x(*this);
2096 int a = 0, b = 1; int i = (a, b);
2099 parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
2100 has a predefined type and is a ParenExpr, not a ParenListExpr.
2101 </pre></td></tr>
2104 <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>
2105 <tr><td colspan="4" class="doc" id="predefinedExpr0"><pre>Matches predefined identifier expressions [C99 6.4.2.2].
2107 Example: Matches __func__
2108 printf("%s", __func__);
2109 </pre></td></tr>
2112 <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>
2113 <tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements.
2115 Given
2116 return 1;
2117 returnStmt()
2118 matches 'return 1'
2119 </pre></td></tr>
2122 <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>
2123 <tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements.
2125 Given
2126 { ++a; }
2127 stmt()
2128 matches both the compound statement '{ ++a; }' and '++a'.
2129 </pre></td></tr>
2132 <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>
2133 <tr><td colspan="4" class="doc" id="stmtExpr0"><pre>Matches statement expression (GNU extension).
2135 Example match: ({ int X = 4; X; })
2136 int C = ({ int X = 4; X; });
2137 </pre></td></tr>
2140 <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>
2141 <tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
2143 Example matches "abcd", L"abcd"
2144 char *s = "abcd";
2145 wchar_t *ws = L"abcd";
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('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>
2150 <tr><td colspan="4" class="doc" id="substNonTypeTemplateParmExpr0"><pre>Matches substitutions of non-type template parameters.
2152 Given
2153 template &lt;int N&gt;
2154 struct A { static const int n = N; };
2155 struct B : public A&lt;42&gt; {};
2156 substNonTypeTemplateParmExpr()
2157 matches "N" in the right-hand side of "static const int n = N;"
2158 </pre></td></tr>
2161 <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>
2162 <tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements.
2164 Given
2165 switch(a) { case 42: break; default: break; }
2166 switchCase()
2167 matches 'case 42:' and 'default:'.
2168 </pre></td></tr>
2171 <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>
2172 <tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements.
2174 Given
2175 switch(a) { case 42: break; default: break; }
2176 switchStmt()
2177 matches 'switch(a)'.
2178 </pre></td></tr>
2181 <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>
2182 <tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
2184 Given
2185 Foo x = bar;
2186 int y = sizeof(x) + alignof(x);
2187 unaryExprOrTypeTraitExpr()
2188 matches sizeof(x) and alignof(x)
2189 </pre></td></tr>
2192 <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>
2193 <tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions.
2195 Example matches !a
2196 !a || b
2197 </pre></td></tr>
2200 <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>
2201 <tr><td colspan="4" class="doc" id="unresolvedLookupExpr0"><pre>Matches reference to a name that can be looked up during parsing
2202 but could not be resolved to a specific declaration.
2204 Given
2205 template&lt;typename T&gt;
2206 T foo() { T a; return a; }
2207 template&lt;typename T&gt;
2208 void bar() {
2209 foo&lt;T&gt;();
2211 unresolvedLookupExpr()
2212 matches foo&lt;T&gt;() </pre></td></tr>
2215 <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>
2216 <tr><td colspan="4" class="doc" id="unresolvedMemberExpr0"><pre>Matches unresolved member expressions.
2218 Given
2219 struct X {
2220 template &lt;class T&gt; void f();
2221 void g();
2223 template &lt;class T&gt; void h() { X x; x.f&lt;T&gt;(); x.g(); }
2224 unresolvedMemberExpr()
2225 matches x.f&lt;T&gt;
2226 </pre></td></tr>
2229 <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>
2230 <tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call.
2232 Example match: "foo"_suffix
2233 </pre></td></tr>
2236 <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>
2237 <tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements.
2239 Given
2240 while (true) {}
2241 whileStmt()
2242 matches 'while (true) {}'.
2243 </pre></td></tr>
2246 <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>
2247 <tr><td colspan="4" class="doc" id="templateArgumentLoc0"><pre>Matches template arguments (with location info).
2249 Given
2250 template &lt;typename T&gt; struct C {};
2251 C&lt;int&gt; c;
2252 templateArgumentLoc()
2253 matches 'int' in C&lt;int&gt;.
2254 </pre></td></tr>
2257 <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>
2258 <tr><td colspan="4" class="doc" id="templateArgument0"><pre>Matches template arguments.
2260 Given
2261 template &lt;typename T&gt; struct C {};
2262 C&lt;int&gt; c;
2263 templateArgument()
2264 matches 'int' in C&lt;int&gt;.
2265 </pre></td></tr>
2268 <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>
2269 <tr><td colspan="4" class="doc" id="templateName0"><pre>Matches template name.
2271 Given
2272 template &lt;typename T&gt; class X { };
2273 X&lt;int&gt; xi;
2274 templateName()
2275 matches 'X' in X&lt;int&gt;.
2276 </pre></td></tr>
2279 <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>
2280 <tr><td colspan="4" class="doc" id="elaboratedTypeLoc0"><pre>Matches C or C++ elaborated `TypeLoc`s.
2282 Given
2283 struct s {};
2284 struct s ss;
2285 elaboratedTypeLoc()
2286 matches the `TypeLoc` of the variable declaration of `ss`.
2287 </pre></td></tr>
2290 <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>
2291 <tr><td colspan="4" class="doc" id="pointerTypeLoc0"><pre>Matches pointer `TypeLoc`s.
2293 Given
2294 int* x;
2295 pointerTypeLoc()
2296 matches `int*`.
2297 </pre></td></tr>
2300 <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>
2301 <tr><td colspan="4" class="doc" id="qualifiedTypeLoc0"><pre>Matches `QualifiedTypeLoc`s in the clang AST.
2303 Given
2304 const int x = 0;
2305 qualifiedTypeLoc()
2306 matches `const int`.
2307 </pre></td></tr>
2310 <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>
2311 <tr><td colspan="4" class="doc" id="referenceTypeLoc0"><pre>Matches reference `TypeLoc`s.
2313 Given
2314 int x = 3;
2315 int&amp; l = x;
2316 int&amp;&amp; r = 3;
2317 referenceTypeLoc()
2318 matches `int&amp;` and `int&amp;&amp;`.
2319 </pre></td></tr>
2322 <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>
2323 <tr><td colspan="4" class="doc" id="templateSpecializationTypeLoc0"><pre>Matches template specialization `TypeLoc`s.
2325 Given
2326 template &lt;typename T&gt; class C {};
2327 C&lt;char&gt; var;
2328 varDecl(hasTypeLoc(templateSpecializationTypeLoc(typeLoc())))
2329 matches `C&lt;char&gt; var`.
2330 </pre></td></tr>
2333 <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>
2334 <tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST.
2335 </pre></td></tr>
2338 <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>
2339 <tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays.
2341 Given
2342 int a[] = { 2, 3 };
2343 int b[4];
2344 void f() { int c[a[0]]; }
2345 arrayType()
2346 matches "int a[]", "int b[4]" and "int c[a[0]]";
2347 </pre></td></tr>
2350 <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>
2351 <tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types.
2353 Given
2354 _Atomic(int) i;
2355 atomicType()
2356 matches "_Atomic(int) i"
2357 </pre></td></tr>
2360 <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>
2361 <tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types.
2363 Given:
2364 auto n = 4;
2365 int v[] = { 2, 3 }
2366 for (auto i : v) { }
2367 autoType()
2368 matches "auto n" and "auto i"
2369 </pre></td></tr>
2372 <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>
2373 <tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as
2374 "void (^)(int)".
2376 The pointee is always required to be a FunctionType.
2377 </pre></td></tr>
2380 <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>
2381 <tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types.
2383 Given
2384 struct A {};
2385 A a;
2386 int b;
2387 float c;
2388 bool d;
2389 builtinType()
2390 matches "int b", "float c" and "bool d"
2391 </pre></td></tr>
2394 <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>
2395 <tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types.
2397 Given
2398 _Complex float f;
2399 complexType()
2400 matches "_Complex float f"
2401 </pre></td></tr>
2404 <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>
2405 <tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size.
2407 Given
2408 void() {
2409 int a[2];
2410 int b[] = { 2, 3 };
2411 int c[b[0]];
2413 constantArrayType()
2414 matches "int a[2]"
2415 </pre></td></tr>
2418 <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>
2419 <tr><td colspan="4" class="doc" id="decayedType0"><pre>Matches decayed type
2420 Example matches i[] in declaration of f.
2421 (matcher = valueDecl(hasType(decayedType(hasDecayedType(pointerType())))))
2422 Example matches i[1].
2423 (matcher = expr(hasType(decayedType(hasDecayedType(pointerType())))))
2424 void f(int i[]) {
2425 i[1] = 0;
2427 </pre></td></tr>
2430 <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>
2431 <tr><td colspan="4" class="doc" id="decltypeType0"><pre>Matches types nodes representing C++11 decltype(&lt;expr&gt;) types.
2433 Given:
2434 short i = 1;
2435 int j = 42;
2436 decltype(i + j) result = i + j;
2437 decltypeType()
2438 matches "decltype(i + j)"
2439 </pre></td></tr>
2442 <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>
2443 <tr><td colspan="4" class="doc" id="deducedTemplateSpecializationType0"><pre>Matches C++17 deduced template specialization types, e.g. deduced class
2444 template types.
2446 Given
2447 template &lt;typename T&gt;
2448 class C { public: C(T); };
2450 C c(123);
2451 deducedTemplateSpecializationType() matches the type in the declaration
2452 of the variable c.
2453 </pre></td></tr>
2456 <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>
2457 <tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression.
2459 Given
2460 template&lt;typename T, int Size&gt;
2461 class array {
2462 T data[Size];
2464 dependentSizedArrayType
2465 matches "T data[Size]"
2466 </pre></td></tr>
2469 <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>
2470 <tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a
2471 qualified name.
2473 Given
2474 namespace N {
2475 namespace M {
2476 class D {};
2479 class C {};
2481 class C c;
2482 N::M::D d;
2484 elaboratedType() matches the type of the variable declarations of both
2485 c and d.
2486 </pre></td></tr>
2489 <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>
2490 <tr><td colspan="4" class="doc" id="enumType0"><pre>Matches enum types.
2492 Given
2493 enum C { Green };
2494 enum class S { Red };
2496 C c;
2497 S s;
2499 enumType() matches the type of the variable declarations of both c and
2501 </pre></td></tr>
2504 <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>
2505 <tr><td colspan="4" class="doc" id="functionProtoType0"><pre>Matches FunctionProtoType nodes.
2507 Given
2508 int (*f)(int);
2509 void g();
2510 functionProtoType()
2511 matches "int (*f)(int)" and the type of "g" in C++ mode.
2512 In C mode, "g" is not matched because it does not contain a prototype.
2513 </pre></td></tr>
2516 <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>
2517 <tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes.
2519 Given
2520 int (*f)(int);
2521 void g();
2522 functionType()
2523 matches "int (*f)(int)" and the type of "g".
2524 </pre></td></tr>
2527 <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>
2528 <tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size.
2530 Given
2531 int a[] = { 2, 3 };
2532 int b[42];
2533 void f(int c[]) { int d[a[0]]; };
2534 incompleteArrayType()
2535 matches "int a[]" and "int c[]"
2536 </pre></td></tr>
2539 <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>
2540 <tr><td colspan="4" class="doc" id="injectedClassNameType0"><pre>Matches injected class name types.
2542 Example matches S s, but not S&lt;T&gt; s.
2543 (matcher = parmVarDecl(hasType(injectedClassNameType())))
2544 template &lt;typename T&gt; struct S {
2545 void f(S s);
2546 void g(S&lt;T&gt; s);
2548 </pre></td></tr>
2551 <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>
2552 <tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types.
2554 Given:
2555 int *a;
2556 int &amp;b = *a;
2557 int &amp;&amp;c = 1;
2558 auto &amp;d = b;
2559 auto &amp;&amp;e = c;
2560 auto &amp;&amp;f = 2;
2561 int g = 5;
2563 lValueReferenceType() matches the types of b, d, and e. e is
2564 matched since the type is deduced as int&amp; by reference collapsing rules.
2565 </pre></td></tr>
2568 <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>
2569 <tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types.
2570 Given
2571 struct A { int i; }
2572 A::* ptr = A::i;
2573 memberPointerType()
2574 matches "A::* ptr"
2575 </pre></td></tr>
2578 <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>
2579 <tr><td colspan="4" class="doc" id="objcObjectPointerType0"><pre>Matches an Objective-C object pointer type, which is different from
2580 a pointer type, despite being syntactically similar.
2582 Given
2583 int *a;
2585 @interface Foo
2586 @end
2587 Foo *f;
2588 pointerType()
2589 matches "Foo *f", but does not match "int *a".
2590 </pre></td></tr>
2593 <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>
2594 <tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes.
2596 Given
2597 int (*ptr_to_array)[4];
2598 int *array_of_ptrs[4];
2600 varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
2601 array_of_ptrs.
2602 </pre></td></tr>
2605 <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>
2606 <tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types, but does not match Objective-C object pointer
2607 types.
2609 Given
2610 int *a;
2611 int &amp;b = *a;
2612 int c = 5;
2614 @interface Foo
2615 @end
2616 Foo *f;
2617 pointerType()
2618 matches "int *a", but does not match "Foo *f".
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('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>
2623 <tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types.
2625 Given:
2626 int *a;
2627 int &amp;b = *a;
2628 int &amp;&amp;c = 1;
2629 auto &amp;d = b;
2630 auto &amp;&amp;e = c;
2631 auto &amp;&amp;f = 2;
2632 int g = 5;
2634 rValueReferenceType() matches the types of c and f. e is not
2635 matched as it is deduced to int&amp; by reference collapsing rules.
2636 </pre></td></tr>
2639 <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>
2640 <tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes).
2642 Given
2643 class C {};
2644 struct S {};
2646 C c;
2647 S s;
2649 recordType() matches the type of the variable declarations of both c
2650 and s.
2651 </pre></td></tr>
2654 <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>
2655 <tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types.
2657 Given
2658 int *a;
2659 int &amp;b = *a;
2660 int &amp;&amp;c = 1;
2661 auto &amp;d = b;
2662 auto &amp;&amp;e = c;
2663 auto &amp;&amp;f = 2;
2664 int g = 5;
2666 referenceType() matches the types of b, c, d, e, and f.
2667 </pre></td></tr>
2670 <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>
2671 <tr><td colspan="4" class="doc" id="substTemplateTypeParmType0"><pre>Matches types that represent the result of substituting a type for a
2672 template type parameter.
2674 Given
2675 template &lt;typename T&gt;
2676 void F(T t) {
2677 int i = 1 + t;
2680 substTemplateTypeParmType() matches the type of 't' but not '1'
2681 </pre></td></tr>
2684 <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>
2685 <tr><td colspan="4" class="doc" id="tagType0"><pre>Matches tag types (record and enum types).
2687 Given
2688 enum E {};
2689 class C {};
2691 E e;
2692 C c;
2694 tagType() matches the type of the variable declarations of both e
2695 and c.
2696 </pre></td></tr>
2699 <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>
2700 <tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types.
2702 Given
2703 template &lt;typename T&gt;
2704 class C { };
2706 template class C&lt;int&gt;; // A
2707 C&lt;char&gt; var; // B
2709 templateSpecializationType() matches the type of the explicit
2710 instantiation in A and the type of the variable declaration in B.
2711 </pre></td></tr>
2714 <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>
2715 <tr><td colspan="4" class="doc" id="templateTypeParmType0"><pre>Matches template type parameter types.
2717 Example matches T, but not int.
2718 (matcher = templateTypeParmType())
2719 template &lt;typename T&gt; void f(int i);
2720 </pre></td></tr>
2723 <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>
2724 <tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST.
2725 </pre></td></tr>
2728 <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>
2729 <tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types.
2731 Given
2732 typedef int X;
2733 typedefType()
2734 matches "typedef int X"
2735 </pre></td></tr>
2738 <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>
2739 <tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations.
2741 Given:
2742 typedef __underlying_type(T) type;
2743 unaryTransformType()
2744 matches "__underlying_type(T)"
2745 </pre></td></tr>
2748 <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>
2749 <tr><td colspan="4" class="doc" id="usingType0"><pre>Matches types specified through a using declaration.
2751 Given
2752 namespace a { struct S {}; }
2753 using a::S;
2754 S s;
2756 usingType() matches the type of the variable declaration of s.
2757 </pre></td></tr>
2760 <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>
2761 <tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an
2762 integer-constant-expression.
2764 Given
2765 void f() {
2766 int a[] = { 2, 3 }
2767 int b[42];
2768 int c[a[0]];
2770 variableArrayType()
2771 matches "int c[a[0]]"
2772 </pre></td></tr>
2774 <!--END_DECL_MATCHERS -->
2775 </table>
2777 <!-- ======================================================================= -->
2778 <h2 id="narrowing-matchers">Narrowing Matchers</h2>
2779 <!-- ======================================================================= -->
2781 <p>Narrowing matchers match certain attributes on the current node, thus
2782 narrowing down the set of nodes of the current type to match on.</p>
2784 <p>There are special logical narrowing matchers (allOf, anyOf, anything and unless)
2785 which allow users to create more powerful match expressions.</p>
2787 <table>
2788 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
2789 <!-- START_NARROWING_MATCHERS -->
2791 <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>
2792 <tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match.
2794 Usable as: Any Matcher
2795 </pre></td></tr>
2798 <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>
2799 <tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches.
2801 Usable as: Any Matcher
2802 </pre></td></tr>
2805 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr>
2806 <tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node.
2808 Useful when another matcher requires a child matcher, but there's no
2809 additional constraint. This will often be used with an explicit conversion
2810 to an internal::Matcher&lt;&gt; type such as TypeMatcher.
2812 Example: DeclarationMatcher(anything()) matches all declarations, e.g.,
2813 "int* p" and "void f()" in
2814 int* p;
2815 void f();
2817 Usable as: Any Matcher
2818 </pre></td></tr>
2821 <tr><td><em>unspecified</em></td><td class="name" onclick="toggle('mapAnyOf0')"><a name="mapAnyOf0Anchor">mapAnyOf</a></td><td>nodeMatcherFunction...</td></tr>
2822 <tr><td colspan="4" class="doc" id="mapAnyOf0"><pre>Matches any of the NodeMatchers with InnerMatchers nested within
2824 Given
2825 if (true);
2826 for (; true; );
2827 with the matcher
2828 mapAnyOf(ifStmt, forStmt).with(
2829 hasCondition(cxxBoolLiteralExpr(equals(true)))
2830 ).bind("trueCond")
2831 matches the if and the for. It is equivalent to:
2832 auto trueCond = hasCondition(cxxBoolLiteralExpr(equals(true)));
2833 anyOf(
2834 ifStmt(trueCond).bind("trueCond"),
2835 forStmt(trueCond).bind("trueCond")
2838 The with() chain-call accepts zero or more matchers which are combined
2839 as-if with allOf() in each of the node matchers.
2840 Usable as: Any Matcher
2841 </pre></td></tr>
2844 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher&lt;*&gt;</td></tr>
2845 <tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match.
2847 Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
2848 class X {};
2849 class Y {};
2851 Usable as: Any Matcher
2852 </pre></td></tr>
2855 <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>
2856 <tr><td colspan="4" class="doc" id="isImplicit1"><pre>Matches an entity that has been implicitly added by the compiler (e.g.
2857 implicit default/copy constructors).
2858 </pre></td></tr>
2861 <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>
2862 <tr><td colspan="4" class="doc" id="hasAnyOperatorName0"><pre>Matches operator expressions (binary or unary) that have any of the
2863 specified names.
2865 hasAnyOperatorName("+", "-")
2866 Is equivalent to
2867 anyOf(hasOperatorName("+"), hasOperatorName("-"))
2868 </pre></td></tr>
2871 <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>
2872 <tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions (binary or
2873 unary).
2875 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
2876 !(a || b)
2877 </pre></td></tr>
2880 <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>
2881 <tr><td colspan="4" class="doc" id="isAssignmentOperator0"><pre>Matches all kinds of assignment operators.
2883 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
2884 if (a == b)
2885 a += b;
2887 Example 2: matches s1 = s2
2888 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
2889 struct S { S&amp; operator=(const S&amp;); };
2890 void x() { S s1, s2; s1 = s2; }
2891 </pre></td></tr>
2894 <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>
2895 <tr><td colspan="4" class="doc" id="isComparisonOperator0"><pre>Matches comparison operators.
2897 Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
2898 if (a == b)
2899 a += b;
2901 Example 2: matches s1 &lt; s2
2902 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
2903 struct S { bool operator&lt;(const S&amp; other); };
2904 void x(S s1, S s2) { bool b1 = s1 &lt; s2; }
2905 </pre></td></tr>
2908 <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>
2909 <tr><td colspan="4" class="doc" id="isPrivate1"><pre>Matches private C++ declarations and C++ base specifers that specify private
2910 inheritance.
2912 Examples:
2913 class C {
2914 public: int a;
2915 protected: int b;
2916 private: int c; // fieldDecl(isPrivate()) matches 'c'
2919 struct Base {};
2920 struct Derived1 : private Base {}; // matches 'Base'
2921 class Derived2 : Base {}; // matches 'Base'
2922 </pre></td></tr>
2925 <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>
2926 <tr><td colspan="4" class="doc" id="isProtected1"><pre>Matches protected C++ declarations and C++ base specifers that specify
2927 protected inheritance.
2929 Examples:
2930 class C {
2931 public: int a;
2932 protected: int b; // fieldDecl(isProtected()) matches 'b'
2933 private: int c;
2936 class Base {};
2937 class Derived : protected Base {}; // matches 'Base'
2938 </pre></td></tr>
2941 <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>
2942 <tr><td colspan="4" class="doc" id="isPublic1"><pre>Matches public C++ declarations and C++ base specifers that specify public
2943 inheritance.
2945 Examples:
2946 class C {
2947 public: int a; // fieldDecl(isPublic()) matches 'a'
2948 protected: int b;
2949 private: int c;
2952 class Base {};
2953 class Derived1 : public Base {}; // matches 'Base'
2954 struct Derived2 : Base {}; // matches 'Base'
2955 </pre></td></tr>
2958 <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>
2959 <tr><td colspan="4" class="doc" id="isVirtual1"><pre>Matches declarations of virtual methods and C++ base specifers that specify
2960 virtual inheritance.
2962 Example:
2963 class A {
2964 public:
2965 virtual void x(); // matches x
2968 Example:
2969 class Base {};
2970 class DirectlyDerived : virtual Base {}; // matches Base
2971 class IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
2973 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;
2974 </pre></td></tr>
2977 <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>
2978 <tr><td colspan="4" class="doc" id="equals5"><pre></pre></td></tr>
2981 <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>
2982 <tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value of type ValueT.
2984 Given
2985 f('false, 3.14, 42);
2986 characterLiteral(equals(0))
2987 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
2988 match false
2989 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
2990 match 3.14
2991 integerLiteral(equals(42))
2992 matches 42
2994 Note that you cannot directly match a negative numeric literal because the
2995 minus sign is not part of the literal: It is a unary operator whose operand
2996 is the positive numeric literal. Instead, you must use a unaryOperator()
2997 matcher to match the minus sign:
2999 unaryOperator(hasOperatorName("-"),
3000 hasUnaryOperand(integerLiteral(equals(13))))
3002 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;,
3003 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;
3004 </pre></td></tr>
3007 <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>
3008 <tr><td colspan="4" class="doc" id="equals11"><pre></pre></td></tr>
3011 <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>
3012 <tr><td colspan="4" class="doc" id="equals8"><pre></pre></td></tr>
3015 <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>
3016 <tr><td colspan="4" class="doc" id="isCatchAll0"><pre>Matches a C++ catch statement that has a catch-all handler.
3018 Given
3019 try {
3020 // ...
3021 } catch (int) {
3022 // ...
3023 } catch (...) {
3024 // ...
3026 cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
3027 </pre></td></tr>
3030 <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>
3031 <tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has
3032 a specific number of arguments (including absent default arguments).
3034 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3035 void f(int x, int y);
3036 f(0, 0);
3037 </pre></td></tr>
3040 <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>
3041 <tr><td colspan="4" class="doc" id="isListInitialization0"><pre>Matches a constructor call expression which uses list initialization.
3042 </pre></td></tr>
3045 <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>
3046 <tr><td colspan="4" class="doc" id="requiresZeroInitialization0"><pre>Matches a constructor call expression which requires
3047 zero initialization.
3049 Given
3050 void foo() {
3051 struct point { double x; double y; };
3052 point pt[2] = { { 1.0, 2.0 } };
3054 initListExpr(has(cxxConstructExpr(requiresZeroInitialization()))
3055 will match the implicit array filler for pt[1].
3056 </pre></td></tr>
3059 <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>
3060 <tr><td colspan="4" class="doc" id="isCopyConstructor0"><pre>Matches constructor declarations that are copy constructors.
3062 Given
3063 struct S {
3064 S(); // #1
3065 S(const S &amp;); // #2
3066 S(S &amp;&amp;); // #3
3068 cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3.
3069 </pre></td></tr>
3072 <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>
3073 <tr><td colspan="4" class="doc" id="isDefaultConstructor0"><pre>Matches constructor declarations that are default constructors.
3075 Given
3076 struct S {
3077 S(); // #1
3078 S(const S &amp;); // #2
3079 S(S &amp;&amp;); // #3
3081 cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3.
3082 </pre></td></tr>
3085 <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>
3086 <tr><td colspan="4" class="doc" id="isDelegatingConstructor0"><pre>Matches constructors that delegate to another constructor.
3088 Given
3089 struct S {
3090 S(); // #1
3091 S(int) {} // #2
3092 S(S &amp;&amp;) : S() {} // #3
3094 S::S() : S(0) {} // #4
3095 cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not
3096 #1 or #2.
3097 </pre></td></tr>
3100 <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>
3101 <tr><td colspan="4" class="doc" id="isExplicit0"><pre>Matches constructor, conversion function, and deduction guide declarations
3102 that have an explicit specifier if this explicit specifier is resolved to
3103 true.
3105 Given
3106 template&lt;bool b&gt;
3107 struct S {
3108 S(int); // #1
3109 explicit S(double); // #2
3110 operator int(); // #3
3111 explicit operator bool(); // #4
3112 explicit(false) S(bool) // # 7
3113 explicit(true) S(char) // # 8
3114 explicit(b) S(S) // # 9
3116 S(int) -&gt; S&lt;true&gt; // #5
3117 explicit S(double) -&gt; S&lt;false&gt; // #6
3118 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
3119 cxxConversionDecl(isExplicit()) will match #4, but not #3.
3120 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
3121 </pre></td></tr>
3124 <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>
3125 <tr><td colspan="4" class="doc" id="isInheritingConstructor0"><pre></pre></td></tr>
3128 <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>
3129 <tr><td colspan="4" class="doc" id="isMoveConstructor0"><pre>Matches constructor declarations that are move constructors.
3131 Given
3132 struct S {
3133 S(); // #1
3134 S(const S &amp;); // #2
3135 S(S &amp;&amp;); // #3
3137 cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2.
3138 </pre></td></tr>
3141 <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>
3142 <tr><td colspan="4" class="doc" id="isExplicit1"><pre>Matches constructor, conversion function, and deduction guide declarations
3143 that have an explicit specifier if this explicit specifier is resolved to
3144 true.
3146 Given
3147 template&lt;bool b&gt;
3148 struct S {
3149 S(int); // #1
3150 explicit S(double); // #2
3151 operator int(); // #3
3152 explicit operator bool(); // #4
3153 explicit(false) S(bool) // # 7
3154 explicit(true) S(char) // # 8
3155 explicit(b) S(S) // # 9
3157 S(int) -&gt; S&lt;true&gt; // #5
3158 explicit S(double) -&gt; S&lt;false&gt; // #6
3159 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
3160 cxxConversionDecl(isExplicit()) will match #4, but not #3.
3161 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
3162 </pre></td></tr>
3165 <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>
3166 <tr><td colspan="4" class="doc" id="isBaseInitializer0"><pre>Matches a constructor initializer if it is initializing a base, as
3167 opposed to a member.
3169 Given
3170 struct B {};
3171 struct D : B {
3172 int I;
3173 D(int i) : I(i) {}
3175 struct E : B {
3176 E() : B() {}
3178 cxxConstructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
3179 will match E(), but not match D(int).
3180 </pre></td></tr>
3183 <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>
3184 <tr><td colspan="4" class="doc" id="isMemberInitializer0"><pre>Matches a constructor initializer if it is initializing a member, as
3185 opposed to a base.
3187 Given
3188 struct B {};
3189 struct D : B {
3190 int I;
3191 D(int i) : I(i) {}
3193 struct E : B {
3194 E() : B() {}
3196 cxxConstructorDecl(hasAnyConstructorInitializer(isMemberInitializer()))
3197 will match D(int), but not match E().
3198 </pre></td></tr>
3201 <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>
3202 <tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in
3203 code (as opposed to implicitly added by the compiler).
3205 Given
3206 struct Foo {
3207 Foo() { }
3208 Foo(int) : foo_("A") { }
3209 string foo_;
3211 cxxConstructorDecl(hasAnyConstructorInitializer(isWritten()))
3212 will match Foo(int), but not Foo()
3213 </pre></td></tr>
3216 <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>
3217 <tr><td colspan="4" class="doc" id="isExplicit2"><pre>Matches constructor, conversion function, and deduction guide declarations
3218 that have an explicit specifier if this explicit specifier is resolved to
3219 true.
3221 Given
3222 template&lt;bool b&gt;
3223 struct S {
3224 S(int); // #1
3225 explicit S(double); // #2
3226 operator int(); // #3
3227 explicit operator bool(); // #4
3228 explicit(false) S(bool) // # 7
3229 explicit(true) S(char) // # 8
3230 explicit(b) S(S) // # 9
3232 S(int) -&gt; S&lt;true&gt; // #5
3233 explicit S(double) -&gt; S&lt;false&gt; // #6
3234 cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9.
3235 cxxConversionDecl(isExplicit()) will match #4, but not #3.
3236 cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
3237 </pre></td></tr>
3240 <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>
3241 <tr><td colspan="4" class="doc" id="hasMemberName0"><pre>Matches template-dependent, but known, member names.
3243 In template declarations, dependent members are not resolved and so can
3244 not be matched to particular named declarations.
3246 This matcher allows to match on the known name of members.
3248 Given
3249 template &lt;typename T&gt;
3250 struct S {
3251 void mem();
3253 template &lt;typename T&gt;
3254 void x() {
3255 S&lt;T&gt; s;
3256 s.mem();
3258 cxxDependentScopeMemberExpr(hasMemberName("mem")) matches `s.mem()`
3259 </pre></td></tr>
3262 <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>
3263 <tr><td colspan="4" class="doc" id="isArrow2"><pre>Matches member expressions that are called with '-&gt;' as opposed
3264 to '.'.
3266 Member calls on the implicit this pointer match as called with '-&gt;'.
3268 Given
3269 class Y {
3270 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
3271 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
3272 int a;
3273 static int b;
3275 template &lt;class T&gt;
3276 class Z {
3277 void x() { this-&gt;m; }
3279 memberExpr(isArrow())
3280 matches this-&gt;x, x, y.x, a, this-&gt;b
3281 cxxDependentScopeMemberExpr(isArrow())
3282 matches this-&gt;m
3283 unresolvedMemberExpr(isArrow())
3284 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
3285 </pre></td></tr>
3288 <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>
3289 <tr><td colspan="4" class="doc" id="memberHasSameNameAsBoundNode0"><pre>Matches template-dependent, but known, member names against an already-bound
3290 node
3292 In template declarations, dependent members are not resolved and so can
3293 not be matched to particular named declarations.
3295 This matcher allows to match on the name of already-bound VarDecl, FieldDecl
3296 and CXXMethodDecl nodes.
3298 Given
3299 template &lt;typename T&gt;
3300 struct S {
3301 void mem();
3303 template &lt;typename T&gt;
3304 void x() {
3305 S&lt;T&gt; s;
3306 s.mem();
3308 The matcher
3309 @code
3310 cxxDependentScopeMemberExpr(
3311 hasObjectExpression(declRefExpr(hasType(templateSpecializationType(
3312 hasDeclaration(classTemplateDecl(has(cxxRecordDecl(has(
3313 cxxMethodDecl(hasName("mem")).bind("templMem")
3314 )))))
3315 )))),
3316 memberHasSameNameAsBoundNode("templMem")
3318 @endcode
3319 first matches and binds the @c mem member of the @c S template, then
3320 compares its name to the usage in @c s.mem() in the @c x function template
3321 </pre></td></tr>
3324 <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>
3325 <tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
3327 Given
3328 struct A {
3329 void foo() const;
3330 void bar();
3333 cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
3334 </pre></td></tr>
3337 <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>
3338 <tr><td colspan="4" class="doc" id="isCopyAssignmentOperator0"><pre>Matches if the given method declaration declares a copy assignment
3339 operator.
3341 Given
3342 struct A {
3343 A &amp;operator=(const A &amp;);
3344 A &amp;operator=(A &amp;&amp;);
3347 cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
3348 the second one.
3349 </pre></td></tr>
3352 <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>
3353 <tr><td colspan="4" class="doc" id="isFinal1"><pre>Matches if the given method or class declaration is final.
3355 Given:
3356 class A final {};
3358 struct B {
3359 virtual void f();
3362 struct C : B {
3363 void f() final;
3365 matches A and C::f, but not B, C, or B::f
3366 </pre></td></tr>
3369 <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>
3370 <tr><td colspan="4" class="doc" id="isMoveAssignmentOperator0"><pre>Matches if the given method declaration declares a move assignment
3371 operator.
3373 Given
3374 struct A {
3375 A &amp;operator=(const A &amp;);
3376 A &amp;operator=(A &amp;&amp;);
3379 cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
3380 the first one.
3381 </pre></td></tr>
3384 <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>
3385 <tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
3387 Given
3388 class A {
3389 public:
3390 virtual void x();
3392 class B : public A {
3393 public:
3394 virtual void x();
3396 matches B::x
3397 </pre></td></tr>
3400 <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>
3401 <tr><td colspan="4" class="doc" id="isPure0"><pre>Matches if the given method declaration is pure.
3403 Given
3404 class A {
3405 public:
3406 virtual void x() = 0;
3408 matches A::x
3409 </pre></td></tr>
3412 <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>
3413 <tr><td colspan="4" class="doc" id="isUserProvided0"><pre>Matches method declarations that are user-provided.
3415 Given
3416 struct S {
3417 S(); // #1
3418 S(const S &amp;) = default; // #2
3419 S(S &amp;&amp;) = delete; // #3
3421 cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3.
3422 </pre></td></tr>
3425 <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>
3426 <tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches declarations of virtual methods and C++ base specifers that specify
3427 virtual inheritance.
3429 Example:
3430 class A {
3431 public:
3432 virtual void x(); // matches x
3435 Example:
3436 class Base {};
3437 class DirectlyDerived : virtual Base {}; // matches Base
3438 class IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
3440 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;
3441 </pre></td></tr>
3444 <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>
3445 <tr><td colspan="4" class="doc" id="isVirtualAsWritten0"><pre>Matches if the given method declaration has an explicit "virtual".
3447 Given
3448 class A {
3449 public:
3450 virtual void x();
3452 class B : public A {
3453 public:
3454 void x();
3456 matches A::x but not B::x
3457 </pre></td></tr>
3460 <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>
3461 <tr><td colspan="4" class="doc" id="isArray0"><pre>Matches array new expressions.
3463 Given:
3464 MyClass *p1 = new MyClass[10];
3465 cxxNewExpr(isArray())
3466 matches the expression 'new MyClass[10]'.
3467 </pre></td></tr>
3470 <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>
3471 <tr><td colspan="4" class="doc" id="hasAnyOperatorName1"><pre>Matches operator expressions (binary or unary) that have any of the
3472 specified names.
3474 hasAnyOperatorName("+", "-")
3475 Is equivalent to
3476 anyOf(hasOperatorName("+"), hasOperatorName("-"))
3477 </pre></td></tr>
3480 <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>
3481 <tr><td colspan="4" class="doc" id="hasAnyOverloadedOperatorName0"><pre>Matches overloaded operator names.
3483 Matches overloaded operator names specified in strings without the
3484 "operator" prefix: e.g. "&lt;&lt;".
3486 hasAnyOverloadedOperatorName("+", "-")
3487 Is equivalent to
3488 anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-"))
3489 </pre></td></tr>
3492 <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>
3493 <tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or
3494 unary).
3496 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3497 !(a || b)
3498 </pre></td></tr>
3501 <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>
3502 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
3504 Matches overloaded operator names specified in strings without the
3505 "operator" prefix: e.g. "&lt;&lt;".
3507 Given:
3508 class A { int operator*(); };
3509 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
3510 A a;
3511 a &lt;&lt; a; // &lt;-- This matches
3513 cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
3514 specified line and
3515 cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
3516 matches the declaration of A.
3518 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;
3519 </pre></td></tr>
3522 <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>
3523 <tr><td colspan="4" class="doc" id="isAssignmentOperator1"><pre>Matches all kinds of assignment operators.
3525 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
3526 if (a == b)
3527 a += b;
3529 Example 2: matches s1 = s2
3530 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
3531 struct S { S&amp; operator=(const S&amp;); };
3532 void x() { S s1, s2; s1 = s2; }
3533 </pre></td></tr>
3536 <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>
3537 <tr><td colspan="4" class="doc" id="isComparisonOperator1"><pre>Matches comparison operators.
3539 Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
3540 if (a == b)
3541 a += b;
3543 Example 2: matches s1 &lt; s2
3544 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
3545 struct S { bool operator&lt;(const S&amp; other); };
3546 void x(S s1, S s2) { bool b1 = s1 &lt; s2; }
3547 </pre></td></tr>
3550 <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>
3551 <tr><td colspan="4" class="doc" id="hasDefinition0"><pre>Matches a class declaration that is defined.
3553 Example matches x (matcher = cxxRecordDecl(hasDefinition()))
3554 class x {};
3555 class y;
3556 </pre></td></tr>
3559 <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>
3560 <tr><td colspan="4" class="doc" id="isDerivedFrom2"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
3561 </pre></td></tr>
3564 <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>
3565 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom2"><pre>Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
3566 </pre></td></tr>
3569 <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>
3570 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
3571 static member variable template instantiations.
3573 Given
3574 template&lt;typename T&gt; void A(T t) { }
3575 template&lt;&gt; void A(int N) { }
3576 functionDecl(isExplicitTemplateSpecialization())
3577 matches the specialization A&lt;int&gt;().
3579 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;
3580 </pre></td></tr>
3583 <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>
3584 <tr><td colspan="4" class="doc" id="isFinal0"><pre>Matches if the given method or class declaration is final.
3586 Given:
3587 class A final {};
3589 struct B {
3590 virtual void f();
3593 struct C : B {
3594 void f() final;
3596 matches A and C::f, but not B, C, or B::f
3597 </pre></td></tr>
3600 <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>
3601 <tr><td colspan="4" class="doc" id="isLambda0"><pre>Matches the generated class of lambda expressions.
3603 Given:
3604 auto x = []{};
3606 cxxRecordDecl(isLambda()) matches the implicit class declaration of
3607 decltype(x)
3608 </pre></td></tr>
3611 <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>
3612 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom2"><pre>Overloaded method as shortcut for
3613 isSameOrDerivedFrom(hasName(...)).
3614 </pre></td></tr>
3617 <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>
3618 <tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
3619 member variable template instantiations.
3621 Given
3622 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
3624 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
3626 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
3627 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3628 matches the template instantiation of X&lt;A&gt;.
3630 But given
3631 template &lt;typename T&gt; class X {}; class A {};
3632 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
3633 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
3634 does not match, as X&lt;A&gt; is an explicit template specialization.
3636 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;
3637 </pre></td></tr>
3640 <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>
3641 <tr><td colspan="4" class="doc" id="hasAnyOperatorName2"><pre>Matches operator expressions (binary or unary) that have any of the
3642 specified names.
3644 hasAnyOperatorName("+", "-")
3645 Is equivalent to
3646 anyOf(hasOperatorName("+"), hasOperatorName("-"))
3647 </pre></td></tr>
3650 <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>
3651 <tr><td colspan="4" class="doc" id="hasOperatorName2"><pre>Matches the operator Name of operator expressions (binary or
3652 unary).
3654 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3655 !(a || b)
3656 </pre></td></tr>
3659 <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>
3660 <tr><td colspan="4" class="doc" id="isAssignmentOperator2"><pre>Matches all kinds of assignment operators.
3662 Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
3663 if (a == b)
3664 a += b;
3666 Example 2: matches s1 = s2
3667 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
3668 struct S { S&amp; operator=(const S&amp;); };
3669 void x() { S s1, s2; s1 = s2; }
3670 </pre></td></tr>
3673 <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>
3674 <tr><td colspan="4" class="doc" id="isComparisonOperator2"><pre>Matches comparison operators.
3676 Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
3677 if (a == b)
3678 a += b;
3680 Example 2: matches s1 &lt; s2
3681 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
3682 struct S { bool operator&lt;(const S&amp; other); };
3683 void x(S s1, S s2) { bool b1 = s1 &lt; s2; }
3684 </pre></td></tr>
3687 <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>
3688 <tr><td colspan="4" class="doc" id="argumentCountIs2"><pre>Checks that a call expression or a constructor call expression has
3689 a specific number of arguments (including absent default arguments).
3691 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3692 void f(int x, int y);
3693 f(0, 0);
3694 </pre></td></tr>
3697 <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>
3698 <tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
3699 a specific number of arguments (including absent default arguments).
3701 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3702 void f(int x, int y);
3703 f(0, 0);
3704 </pre></td></tr>
3707 <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>
3708 <tr><td colspan="4" class="doc" id="usesADL0"><pre>Matches call expressions which were resolved using ADL.
3710 Example matches y(x) but not y(42) or NS::y(x).
3711 namespace NS {
3712 struct X {};
3713 void y(X);
3716 void y(...);
3718 void test() {
3719 NS::X x;
3720 y(x); // Matches
3721 NS::y(x); // Doesn't match
3722 y(42); // Doesn't match
3723 using NS::y;
3724 y(x); // Found by both unqualified lookup and ADL, doesn't match
3726 </pre></td></tr>
3729 <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>
3730 <tr><td colspan="4" class="doc" id="hasCastKind0"><pre>Matches casts that has a given cast kind.
3732 Example: matches the implicit cast around 0
3733 (matcher = castExpr(hasCastKind(CK_NullToPointer)))
3734 int *p = 0;
3736 If the matcher is use from clang-query, CastKind parameter
3737 should be passed as a quoted string. e.g., hasCastKind("CK_NullToPointer").
3738 </pre></td></tr>
3741 <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>
3742 <tr><td colspan="4" class="doc" id="equals4"><pre></pre></td></tr>
3745 <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>
3746 <tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value of type ValueT.
3748 Given
3749 f('false, 3.14, 42);
3750 characterLiteral(equals(0))
3751 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
3752 match false
3753 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
3754 match 3.14
3755 integerLiteral(equals(42))
3756 matches 42
3758 Note that you cannot directly match a negative numeric literal because the
3759 minus sign is not part of the literal: It is a unary operator whose operand
3760 is the positive numeric literal. Instead, you must use a unaryOperator()
3761 matcher to match the minus sign:
3763 unaryOperator(hasOperatorName("-"),
3764 hasUnaryOperand(integerLiteral(equals(13))))
3766 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;,
3767 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;
3768 </pre></td></tr>
3771 <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>
3772 <tr><td colspan="4" class="doc" id="equals10"><pre></pre></td></tr>
3775 <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>
3776 <tr><td colspan="4" class="doc" id="equals7"><pre></pre></td></tr>
3779 <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>
3780 <tr><td colspan="4" class="doc" id="templateArgumentCountIs0"><pre>Matches if the number of template arguments equals N.
3782 Given
3783 template&lt;typename T&gt; struct C {};
3784 C&lt;int&gt; c;
3785 classTemplateSpecializationDecl(templateArgumentCountIs(1))
3786 matches C&lt;int&gt;.
3787 </pre></td></tr>
3790 <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>
3791 <tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
3792 child statements.
3794 Example: Given
3795 { for (;;) {} }
3796 compoundStmt(statementCountIs(0)))
3797 matches '{}'
3798 but does not match the outer compound statement.
3799 </pre></td></tr>
3802 <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>
3803 <tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches nodes that have the specified size.
3805 Given
3806 int a[42];
3807 int b[2 * 21];
3808 int c[41], d[43];
3809 char *s = "abcd";
3810 wchar_t *ws = L"abcd";
3811 char *w = "a";
3812 constantArrayType(hasSize(42))
3813 matches "int a[42]" and "int b[2 * 21]"
3814 stringLiteral(hasSize(4))
3815 matches "abcd", L"abcd"
3816 </pre></td></tr>
3819 <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>
3820 <tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
3821 declarations.
3823 Example: Given
3824 int a, b;
3825 int c;
3826 int d = 2, e;
3827 declCountIs(2)
3828 matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
3829 </pre></td></tr>
3832 <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>
3833 <tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
3835 Matches a node if it equals the node previously bound to ID.
3837 Given
3838 class X { int a; int b; };
3839 cxxRecordDecl(
3840 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
3841 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
3842 matches the class X, as a and b have the same type.
3844 Note that when multiple matches are involved via forEach* matchers,
3845 equalsBoundNodes acts as a filter.
3846 For example:
3847 compoundStmt(
3848 forEachDescendant(varDecl().bind("d")),
3849 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
3850 will trigger a match for each combination of variable declaration
3851 and reference to that variable declaration within a compound statement.
3852 </pre></td></tr>
3855 <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>
3856 <tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node.
3858 Decl has pointer identity in the AST.
3859 </pre></td></tr>
3862 <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>
3863 <tr><td colspan="4" class="doc" id="hasAttr0"><pre>Matches declaration that has a given attribute.
3865 Given
3866 __attribute__((device)) void f() { ... }
3867 decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
3868 f. If the matcher is used from clang-query, attr::Kind parameter should be
3869 passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
3870 </pre></td></tr>
3873 <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>
3874 <tr><td colspan="4" class="doc" id="isExpandedFromMacro0"><pre>Matches statements that are (transitively) expanded from the named macro.
3875 Does not match if only part of the statement is expanded from that macro or
3876 if different parts of the statement are expanded from different
3877 appearances of the macro.
3878 </pre></td></tr>
3881 <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>
3882 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching0"><pre>Matches AST nodes that were expanded within files whose name is
3883 partially matching a given regex.
3885 Example matches Y but not X
3886 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
3887 #include "ASTMatcher.h"
3888 class X {};
3889 ASTMatcher.h:
3890 class Y {};
3892 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;
3894 If the matcher is used in clang-query, RegexFlags parameter
3895 should be passed as a quoted string. e.g: "NoFlags".
3896 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
3897 </pre></td></tr>
3900 <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>
3901 <tr><td colspan="4" class="doc" id="isExpansionInMainFile0"><pre>Matches AST nodes that were expanded within the main-file.
3903 Example matches X but not Y
3904 (matcher = cxxRecordDecl(isExpansionInMainFile())
3905 #include &lt;Y.h&gt;
3906 class X {};
3907 Y.h:
3908 class Y {};
3910 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;
3911 </pre></td></tr>
3914 <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>
3915 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader0"><pre>Matches AST nodes that were expanded within system-header-files.
3917 Example matches Y but not X
3918 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
3919 #include &lt;SystemHeader.h&gt;
3920 class X {};
3921 SystemHeader.h:
3922 class Y {};
3924 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;
3925 </pre></td></tr>
3928 <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>
3929 <tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches an entity that has been implicitly added by the compiler (e.g.
3930 implicit default/copy constructors).
3931 </pre></td></tr>
3934 <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>
3935 <tr><td colspan="4" class="doc" id="isInStdNamespace0"><pre>Matches declarations in the namespace `std`, but not in nested namespaces.
3937 Given
3938 class vector {};
3939 namespace foo {
3940 class vector {};
3941 namespace std {
3942 class vector {};
3945 namespace std {
3946 inline namespace __1 {
3947 class vector {}; // #1
3948 namespace experimental {
3949 class vector {};
3953 cxxRecordDecl(hasName("vector"), isInStdNamespace()) will match only #1.
3954 </pre></td></tr>
3957 <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>
3958 <tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
3959 template instantiations.
3961 Given
3962 template&lt;typename T&gt; void A(T t) { T i; }
3963 A(0);
3964 A(0U);
3965 functionDecl(isInstantiated())
3966 matches 'A(int) {...};' and 'A(unsigned) {...}'.
3967 </pre></td></tr>
3970 <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>
3971 <tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations and C++ base specifers that specify private
3972 inheritance.
3974 Examples:
3975 class C {
3976 public: int a;
3977 protected: int b;
3978 private: int c; // fieldDecl(isPrivate()) matches 'c'
3981 struct Base {};
3982 struct Derived1 : private Base {}; // matches 'Base'
3983 class Derived2 : Base {}; // matches 'Base'
3984 </pre></td></tr>
3987 <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>
3988 <tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations and C++ base specifers that specify
3989 protected inheritance.
3991 Examples:
3992 class C {
3993 public: int a;
3994 protected: int b; // fieldDecl(isProtected()) matches 'b'
3995 private: int c;
3998 class Base {};
3999 class Derived : protected Base {}; // matches 'Base'
4000 </pre></td></tr>
4003 <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>
4004 <tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations and C++ base specifers that specify public
4005 inheritance.
4007 Examples:
4008 class C {
4009 public: int a; // fieldDecl(isPublic()) matches 'a'
4010 protected: int b;
4011 private: int c;
4014 class Base {};
4015 class Derived1 : public Base {}; // matches 'Base'
4016 struct Derived2 : Base {}; // matches 'Base'
4017 </pre></td></tr>
4020 <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>
4021 <tr><td colspan="4" class="doc" id="designatorCountIs0"><pre>Matches designated initializer expressions that contain
4022 a specific number of designators.
4024 Example: Given
4025 point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
4026 point ptarray2[10] = { [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 };
4027 designatorCountIs(2)
4028 matches '{ [2].y = 1.0, [0].x = 1.0 }',
4029 but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'.
4030 </pre></td></tr>
4033 <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>
4034 <tr><td colspan="4" class="doc" id="isScoped0"><pre>Matches C++11 scoped enum declaration.
4036 Example matches Y (matcher = enumDecl(isScoped()))
4037 enum X {};
4038 enum class Y {};
4039 </pre></td></tr>
4042 <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>
4043 <tr><td colspan="4" class="doc" id="isInstantiationDependent0"><pre>Matches expressions that are instantiation-dependent even if it is
4044 neither type- nor value-dependent.
4046 In the following example, the expression sizeof(sizeof(T() + T()))
4047 is instantiation-dependent (since it involves a template parameter T),
4048 but is neither type- nor value-dependent, since the type of the inner
4049 sizeof is known (std::size_t) and therefore the size of the outer
4050 sizeof is known.
4051 template&lt;typename T&gt;
4052 void f(T x, T y) { sizeof(sizeof(T() + T()); }
4053 expr(isInstantiationDependent()) matches sizeof(sizeof(T() + T())
4054 </pre></td></tr>
4057 <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>
4058 <tr><td colspan="4" class="doc" id="isTypeDependent0"><pre>Matches expressions that are type-dependent because the template type
4059 is not yet instantiated.
4061 For example, the expressions "x" and "x + y" are type-dependent in
4062 the following code, but "y" is not type-dependent:
4063 template&lt;typename T&gt;
4064 void add(T x, int y) {
4065 x + y;
4067 expr(isTypeDependent()) matches x + y
4068 </pre></td></tr>
4071 <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>
4072 <tr><td colspan="4" class="doc" id="isValueDependent0"><pre>Matches expression that are value-dependent because they contain a
4073 non-type template parameter.
4075 For example, the array bound of "Chars" in the following example is
4076 value-dependent.
4077 template&lt;int Size&gt; int f() { return Size; }
4078 expr(isValueDependent()) matches return Size
4079 </pre></td></tr>
4082 <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>
4083 <tr><td colspan="4" class="doc" id="nullPointerConstant0"><pre>Matches expressions that resolve to a null pointer constant, such as
4084 GNU's __null, C++11's nullptr, or C's NULL macro.
4086 Given:
4087 void *v1 = NULL;
4088 void *v2 = nullptr;
4089 void *v3 = __null; // GNU extension
4090 char *cp = (char *)0;
4091 int *ip = 0;
4092 int i = 0;
4093 expr(nullPointerConstant())
4094 matches the initializer for v1, v2, v3, cp, and ip. Does not match the
4095 initializer for i.
4096 </pre></td></tr>
4099 <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>
4100 <tr><td colspan="4" class="doc" id="hasBitWidth0"><pre>Matches non-static data members that are bit-fields of the specified
4101 bit width.
4103 Given
4104 class C {
4105 int a : 2;
4106 int b : 4;
4107 int c : 2;
4109 fieldDecl(hasBitWidth(2))
4110 matches 'int a;' and 'int c;' but not 'int b;'.
4111 </pre></td></tr>
4114 <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>
4115 <tr><td colspan="4" class="doc" id="isBitField0"><pre>Matches non-static data members that are bit-fields.
4117 Given
4118 class C {
4119 int a : 2;
4120 int b;
4122 fieldDecl(isBitField())
4123 matches 'int a;' but not 'int b;'.
4124 </pre></td></tr>
4127 <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>
4128 <tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value of type ValueT.
4130 Given
4131 f('false, 3.14, 42);
4132 characterLiteral(equals(0))
4133 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
4134 match false
4135 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
4136 match 3.14
4137 integerLiteral(equals(42))
4138 matches 42
4140 Note that you cannot directly match a negative numeric literal because the
4141 minus sign is not part of the literal: It is a unary operator whose operand
4142 is the positive numeric literal. Instead, you must use a unaryOperator()
4143 matcher to match the minus sign:
4145 unaryOperator(hasOperatorName("-"),
4146 hasUnaryOperand(integerLiteral(equals(13))))
4148 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;,
4149 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;
4150 </pre></td></tr>
4153 <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>
4154 <tr><td colspan="4" class="doc" id="equals12"><pre></pre></td></tr>
4157 <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>
4158 <tr><td colspan="4" class="doc" id="hasAnyOverloadedOperatorName1"><pre>Matches overloaded operator names.
4160 Matches overloaded operator names specified in strings without the
4161 "operator" prefix: e.g. "&lt;&lt;".
4163 hasAnyOverloadedOperatorName("+", "-")
4164 Is equivalent to
4165 anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-"))
4166 </pre></td></tr>
4169 <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>
4170 <tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec0"><pre>Matches functions that have a dynamic exception specification.
4172 Given:
4173 void f();
4174 void g() noexcept;
4175 void h() noexcept(true);
4176 void i() noexcept(false);
4177 void j() throw();
4178 void k() throw(int);
4179 void l() throw(...);
4180 functionDecl(hasDynamicExceptionSpec()) and
4181 functionProtoType(hasDynamicExceptionSpec())
4182 match the declarations of j, k, and l, but not f, g, h, or i.
4183 </pre></td></tr>
4186 <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>
4187 <tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names.
4189 Matches overloaded operator names specified in strings without the
4190 "operator" prefix: e.g. "&lt;&lt;".
4192 Given:
4193 class A { int operator*(); };
4194 const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
4195 A a;
4196 a &lt;&lt; a; // &lt;-- This matches
4198 cxxOperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the
4199 specified line and
4200 cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")))
4201 matches the declaration of A.
4203 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;
4204 </pre></td></tr>
4207 <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>
4208 <tr><td colspan="4" class="doc" id="hasTrailingReturn0"><pre>Matches a function declared with a trailing return type.
4210 Example matches Y (matcher = functionDecl(hasTrailingReturn()))
4211 int X() {}
4212 auto Y() -&gt; int {}
4213 </pre></td></tr>
4216 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isConsteval0')"><a name="isConsteval0Anchor">isConsteval</a></td><td></td></tr>
4217 <tr><td colspan="4" class="doc" id="isConsteval0"><pre>Matches consteval function declarations and if consteval/if ! consteval
4218 statements.
4220 Given:
4221 consteval int a();
4222 void b() { if consteval {} }
4223 void c() { if ! consteval {} }
4224 void d() { if ! consteval {} else {} }
4225 functionDecl(isConsteval())
4226 matches the declaration of "int a()".
4227 ifStmt(isConsteval())
4228 matches the if statement in "void b()", "void c()", "void d()".
4229 </pre></td></tr>
4232 <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>
4233 <tr><td colspan="4" class="doc" id="isConstexpr1"><pre>Matches constexpr variable and function declarations,
4234 and if constexpr.
4236 Given:
4237 constexpr int foo = 42;
4238 constexpr int bar();
4239 void baz() { if constexpr(1 &gt; 0) {} }
4240 varDecl(isConstexpr())
4241 matches the declaration of foo.
4242 functionDecl(isConstexpr())
4243 matches the declaration of bar.
4244 ifStmt(isConstexpr())
4245 matches the if statement in baz.
4246 </pre></td></tr>
4249 <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>
4250 <tr><td colspan="4" class="doc" id="isDefaulted0"><pre>Matches defaulted function declarations.
4252 Given:
4253 class A { ~A(); };
4254 class B { ~B() = default; };
4255 functionDecl(isDefaulted())
4256 matches the declaration of ~B, but not ~A.
4257 </pre></td></tr>
4260 <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>
4261 <tr><td colspan="4" class="doc" id="isDefinition3"><pre>Matches if a declaration has a body attached.
4263 Example matches A, va, fa
4264 class A {};
4265 class B; // Doesn't match, as it has no body.
4266 int va;
4267 extern int vb; // Doesn't match, as it doesn't define the variable.
4268 void fa() {}
4269 void fb(); // Doesn't match, as it has no body.
4270 @interface X
4271 - (void)ma; // Doesn't match, interface is declaration.
4272 @end
4273 @implementation X
4274 - (void)ma {}
4275 @end
4277 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;,
4278 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
4279 </pre></td></tr>
4282 <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>
4283 <tr><td colspan="4" class="doc" id="isDeleted0"><pre>Matches deleted function declarations.
4285 Given:
4286 void Func();
4287 void DeletedFunc() = delete;
4288 functionDecl(isDeleted())
4289 matches the declaration of DeletedFunc, but not Func.
4290 </pre></td></tr>
4293 <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>
4294 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or
4295 static member variable template instantiations.
4297 Given
4298 template&lt;typename T&gt; void A(T t) { }
4299 template&lt;&gt; void A(int N) { }
4300 functionDecl(isExplicitTemplateSpecialization())
4301 matches the specialization A&lt;int&gt;().
4303 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;
4304 </pre></td></tr>
4307 <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>
4308 <tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function or variable declarations.
4310 Given:
4311 extern "C" void f() {}
4312 extern "C" { void g() {} }
4313 void h() {}
4314 extern "C" int x = 1;
4315 extern "C" int y = 2;
4316 int z = 3;
4317 functionDecl(isExternC())
4318 matches the declaration of f and g, but not the declaration of h.
4319 varDecl(isExternC())
4320 matches the declaration of x and y, but not the declaration of z.
4321 </pre></td></tr>
4324 <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>
4325 <tr><td colspan="4" class="doc" id="isInline1"><pre>Matches functions, variables and namespace declarations that are marked with
4326 the inline keyword.
4328 Given
4329 inline void f();
4330 void g();
4331 namespace n {
4332 inline namespace m {}
4334 inline int Foo = 5;
4335 functionDecl(isInline()) will match ::f().
4336 namespaceDecl(isInline()) will match n::m.
4337 varDecl(isInline()) will match Foo;
4338 </pre></td></tr>
4341 <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>
4342 <tr><td colspan="4" class="doc" id="isMain0"><pre>Determines whether the function is "main", which is the entry point
4343 into an executable program.
4344 </pre></td></tr>
4347 <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>
4348 <tr><td colspan="4" class="doc" id="isNoReturn0"><pre>Matches FunctionDecls that have a noreturn attribute.
4350 Given
4351 void nope();
4352 [[noreturn]] void a();
4353 __attribute__((noreturn)) void b();
4354 struct c { [[noreturn]] c(); };
4355 functionDecl(isNoReturn())
4356 matches all of those except
4357 void nope();
4358 </pre></td></tr>
4361 <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>
4362 <tr><td colspan="4" class="doc" id="isNoThrow0"><pre>Matches functions that have a non-throwing exception specification.
4364 Given:
4365 void f();
4366 void g() noexcept;
4367 void h() throw();
4368 void i() throw(int);
4369 void j() noexcept(false);
4370 functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
4371 match the declarations of g, and h, but not f, i or j.
4372 </pre></td></tr>
4375 <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>
4376 <tr><td colspan="4" class="doc" id="isStaticStorageClass0"><pre>Matches variable/function declarations that have "static" storage
4377 class specifier ("static" keyword) written in the source.
4379 Given:
4380 static void f() {}
4381 static int i = 0;
4382 extern int j;
4383 int k;
4384 functionDecl(isStaticStorageClass())
4385 matches the function declaration f.
4386 varDecl(isStaticStorageClass())
4387 matches the variable declaration i.
4388 </pre></td></tr>
4391 <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>
4392 <tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static
4393 member variable template instantiations.
4395 Given
4396 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
4398 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
4400 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
4401 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4402 matches the template instantiation of X&lt;A&gt;.
4404 But given
4405 template &lt;typename T&gt; class X {}; class A {};
4406 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
4407 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
4408 does not match, as X&lt;A&gt; is an explicit template specialization.
4410 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;
4411 </pre></td></tr>
4414 <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>
4415 <tr><td colspan="4" class="doc" id="isVariadic0"><pre>Matches if a function declaration is variadic.
4417 Example matches f, but not g or h. The function i will not match, even when
4418 compiled in C mode.
4419 void f(...);
4420 void g(int);
4421 template &lt;typename... Ts&gt; void h(Ts...);
4422 void i();
4423 </pre></td></tr>
4426 <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>
4427 <tr><td colspan="4" class="doc" id="isWeak0"><pre>Matches weak function declarations.
4429 Given:
4430 void foo() __attribute__((__weakref__("__foo")));
4431 void bar();
4432 functionDecl(isWeak())
4433 matches the weak declaration "foo", but not "bar".
4434 </pre></td></tr>
4437 <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>
4438 <tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
4439 specific parameter count.
4441 Given
4442 void f(int i) {}
4443 void g(int i, int j) {}
4444 void h(int i, int j);
4445 void j(int i);
4446 void k(int x, int y, int z, ...);
4447 functionDecl(parameterCountIs(2))
4448 matches g and h
4449 functionProtoType(parameterCountIs(2))
4450 matches g and h
4451 functionProtoType(parameterCountIs(3))
4452 matches k
4453 </pre></td></tr>
4456 <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>
4457 <tr><td colspan="4" class="doc" id="hasDynamicExceptionSpec1"><pre>Matches functions that have a dynamic exception specification.
4459 Given:
4460 void f();
4461 void g() noexcept;
4462 void h() noexcept(true);
4463 void i() noexcept(false);
4464 void j() throw();
4465 void k() throw(int);
4466 void l() throw(...);
4467 functionDecl(hasDynamicExceptionSpec()) and
4468 functionProtoType(hasDynamicExceptionSpec())
4469 match the declarations of j, k, and l, but not f, g, h, or i.
4470 </pre></td></tr>
4473 <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>
4474 <tr><td colspan="4" class="doc" id="isNoThrow1"><pre>Matches functions that have a non-throwing exception specification.
4476 Given:
4477 void f();
4478 void g() noexcept;
4479 void h() throw();
4480 void i() throw(int);
4481 void j() noexcept(false);
4482 functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
4483 match the declarations of g, and h, but not f, i or j.
4484 </pre></td></tr>
4487 <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>
4488 <tr><td colspan="4" class="doc" id="parameterCountIs1"><pre>Matches FunctionDecls and FunctionProtoTypes that have a
4489 specific parameter count.
4491 Given
4492 void f(int i) {}
4493 void g(int i, int j) {}
4494 void h(int i, int j);
4495 void j(int i);
4496 void k(int x, int y, int z, ...);
4497 functionDecl(parameterCountIs(2))
4498 matches g and h
4499 functionProtoType(parameterCountIs(2))
4500 matches g and h
4501 functionProtoType(parameterCountIs(3))
4502 matches k
4503 </pre></td></tr>
4506 <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>
4507 <tr><td colspan="4" class="doc" id="isConsteval1"><pre>Matches consteval function declarations and if consteval/if ! consteval
4508 statements.
4510 Given:
4511 consteval int a();
4512 void b() { if consteval {} }
4513 void c() { if ! consteval {} }
4514 void d() { if ! consteval {} else {} }
4515 functionDecl(isConsteval())
4516 matches the declaration of "int a()".
4517 ifStmt(isConsteval())
4518 matches the if statement in "void b()", "void c()", "void d()".
4519 </pre></td></tr>
4522 <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>
4523 <tr><td colspan="4" class="doc" id="isConstexpr2"><pre>Matches constexpr variable and function declarations,
4524 and if constexpr.
4526 Given:
4527 constexpr int foo = 42;
4528 constexpr int bar();
4529 void baz() { if constexpr(1 &gt; 0) {} }
4530 varDecl(isConstexpr())
4531 matches the declaration of foo.
4532 functionDecl(isConstexpr())
4533 matches the declaration of bar.
4534 ifStmt(isConstexpr())
4535 matches the if statement in baz.
4536 </pre></td></tr>
4539 <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>
4540 <tr><td colspan="4" class="doc" id="equals6"><pre></pre></td></tr>
4543 <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>
4544 <tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value of type ValueT.
4546 Given
4547 f('false, 3.14, 42);
4548 characterLiteral(equals(0))
4549 matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
4550 match false
4551 floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
4552 match 3.14
4553 integerLiteral(equals(42))
4554 matches 42
4556 Note that you cannot directly match a negative numeric literal because the
4557 minus sign is not part of the literal: It is a unary operator whose operand
4558 is the positive numeric literal. Instead, you must use a unaryOperator()
4559 matcher to match the minus sign:
4561 unaryOperator(hasOperatorName("-"),
4562 hasUnaryOperand(integerLiteral(equals(13))))
4564 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;,
4565 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;
4566 </pre></td></tr>
4569 <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>
4570 <tr><td colspan="4" class="doc" id="equals13"><pre></pre></td></tr>
4573 <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>
4574 <tr><td colspan="4" class="doc" id="equals9"><pre></pre></td></tr>
4577 <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>
4578 <tr><td colspan="4" class="doc" id="capturesThis0"><pre>Matches a `LambdaCapture` that refers to 'this'.
4580 Given
4581 class C {
4582 int cc;
4583 int f() {
4584 auto l = [this]() { return cc; };
4585 return l();
4588 lambdaExpr(hasAnyCapture(lambdaCapture(capturesThis())))
4589 matches `[this]() { return cc; }`.
4590 </pre></td></tr>
4593 <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>
4594 <tr><td colspan="4" class="doc" id="isImplicit2"><pre>Matches an entity that has been implicitly added by the compiler (e.g.
4595 implicit default/copy constructors).
4596 </pre></td></tr>
4599 <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>
4600 <tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '-&gt;' as opposed
4601 to '.'.
4603 Member calls on the implicit this pointer match as called with '-&gt;'.
4605 Given
4606 class Y {
4607 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
4608 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
4609 int a;
4610 static int b;
4612 template &lt;class T&gt;
4613 class Z {
4614 void x() { this-&gt;m; }
4616 memberExpr(isArrow())
4617 matches this-&gt;x, x, y.x, a, this-&gt;b
4618 cxxDependentScopeMemberExpr(isArrow())
4619 matches this-&gt;m
4620 unresolvedMemberExpr(isArrow())
4621 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
4622 </pre></td></tr>
4625 <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>
4626 <tr><td colspan="4" class="doc" id="hasAnyName0"><pre>Matches NamedDecl nodes that have any of the specified names.
4628 This matcher is only provided as a performance optimization of hasName.
4629 hasAnyName(a, b, c)
4630 is equivalent to, but faster than
4631 anyOf(hasName(a), hasName(b), hasName(c))
4632 </pre></td></tr>
4635 <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>
4636 <tr><td colspan="4" class="doc" id="hasExternalFormalLinkage0"><pre>Matches a declaration that has external formal linkage.
4638 Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
4639 void f() {
4640 int x;
4641 static int y;
4643 int z;
4645 Example matches f() because it has external formal linkage despite being
4646 unique to the translation unit as though it has internal likage
4647 (matcher = functionDecl(hasExternalFormalLinkage()))
4649 namespace {
4650 void f() {}
4652 </pre></td></tr>
4655 <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>
4656 <tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name.
4658 Supports specifying enclosing namespaces or classes by prefixing the name
4659 with '&lt;enclosing&gt;::'.
4660 Does not match typedefs of an underlying type with the given name.
4662 Example matches X (Name == "X")
4663 class X;
4665 Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
4666 namespace a { namespace b { class X; } }
4667 </pre></td></tr>
4670 <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>
4671 <tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain
4672 a substring matched by the given RegExp.
4674 Supports specifying enclosing namespaces or classes by
4675 prefixing the name with '&lt;enclosing&gt;::'. Does not match typedefs
4676 of an underlying type with the given name.
4678 Example matches X (regexp == "::X")
4679 class X;
4681 Example matches X (regexp is one of "::X", "^foo::.*X", among others)
4682 namespace foo { namespace bar { class X; } }
4684 If the matcher is used in clang-query, RegexFlags parameter
4685 should be passed as a quoted string. e.g: "NoFlags".
4686 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
4687 </pre></td></tr>
4690 <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>
4691 <tr><td colspan="4" class="doc" id="isAnonymous0"><pre>Matches anonymous namespace declarations.
4693 Given
4694 namespace n {
4695 namespace {} // #1
4697 namespaceDecl(isAnonymous()) will match #1 but not ::n.
4698 </pre></td></tr>
4701 <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>
4702 <tr><td colspan="4" class="doc" id="isInline0"><pre>Matches functions, variables and namespace declarations that are marked with
4703 the inline keyword.
4705 Given
4706 inline void f();
4707 void g();
4708 namespace n {
4709 inline namespace m {}
4711 inline int Foo = 5;
4712 functionDecl(isInline()) will match ::f().
4713 namespaceDecl(isInline()) will match n::m.
4714 varDecl(isInline()) will match Foo;
4715 </pre></td></tr>
4718 <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>
4719 <tr><td colspan="4" class="doc" id="isFirstPrivateKind0"><pre>Matches if the OpenMP ``default`` clause has ``firstprivate`` kind
4720 specified.
4722 Given
4724 #pragma omp parallel
4725 #pragma omp parallel default(none)
4726 #pragma omp parallel default(shared)
4727 #pragma omp parallel default(firstprivate)
4729 ``ompDefaultClause(isFirstPrivateKind())`` matches only
4730 ``default(firstprivate)``.
4731 </pre></td></tr>
4734 <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>
4735 <tr><td colspan="4" class="doc" id="isNoneKind0"><pre>Matches if the OpenMP ``default`` clause has ``none`` kind specified.
4737 Given
4739 #pragma omp parallel
4740 #pragma omp parallel default(none)
4741 #pragma omp parallel default(shared)
4742 #pragma omp parallel default(firstprivate)
4744 ``ompDefaultClause(isNoneKind())`` matches only ``default(none)``.
4745 </pre></td></tr>
4748 <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>
4749 <tr><td colspan="4" class="doc" id="isSharedKind0"><pre>Matches if the OpenMP ``default`` clause has ``shared`` kind specified.
4751 Given
4753 #pragma omp parallel
4754 #pragma omp parallel default(none)
4755 #pragma omp parallel default(shared)
4756 #pragma omp parallel default(firstprivate)
4758 ``ompDefaultClause(isSharedKind())`` matches only ``default(shared)``.
4759 </pre></td></tr>
4762 <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>
4763 <tr><td colspan="4" class="doc" id="isAllowedToContainClauseKind0"><pre>Matches if the OpenMP directive is allowed to contain the specified OpenMP
4764 clause kind.
4766 Given
4768 #pragma omp parallel
4769 #pragma omp parallel for
4770 #pragma omp for
4772 `ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches
4773 ``omp parallel`` and ``omp parallel for``.
4775 If the matcher is use from clang-query, ``OpenMPClauseKind`` parameter
4776 should be passed as a quoted string. e.g.,
4777 ``isAllowedToContainClauseKind("OMPC_default").``
4778 </pre></td></tr>
4781 <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>
4782 <tr><td colspan="4" class="doc" id="isStandaloneDirective0"><pre>Matches standalone OpenMP directives,
4783 i.e., directives that can't have a structured block.
4785 Given
4787 #pragma omp parallel
4789 #pragma omp taskyield
4791 ``ompExecutableDirective(isStandaloneDirective()))`` matches
4792 ``omp taskyield``.
4793 </pre></td></tr>
4796 <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>
4797 <tr><td colspan="4" class="doc" id="isDerivedFrom3"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
4798 </pre></td></tr>
4801 <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>
4802 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom3"><pre>Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
4803 </pre></td></tr>
4806 <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>
4807 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom3"><pre>Overloaded method as shortcut for
4808 isSameOrDerivedFrom(hasName(...)).
4809 </pre></td></tr>
4812 <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>
4813 <tr><td colspan="4" class="doc" id="argumentCountIs3"><pre>Checks that a call expression or a constructor call expression has
4814 a specific number of arguments (including absent default arguments).
4816 Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
4817 void f(int x, int y);
4818 f(0, 0);
4819 </pre></td></tr>
4822 <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>
4823 <tr><td colspan="4" class="doc" id="hasAnySelector0"><pre>Matches when at least one of the supplied string equals to the
4824 Selector.getAsString()
4826 matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
4827 matches both of the expressions below:
4828 [myObj methodA:argA];
4829 [myObj methodB:argB];
4830 </pre></td></tr>
4833 <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>
4834 <tr><td colspan="4" class="doc" id="hasKeywordSelector0"><pre>Matches when the selector is a keyword selector
4836 objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
4837 message expression in
4839 UIWebView *webView = ...;
4840 CGRect bodyFrame = webView.frame;
4841 bodyFrame.size.height = self.bodyContentHeight;
4842 webView.frame = bodyFrame;
4843 // ^---- matches here
4844 </pre></td></tr>
4847 <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>
4848 <tr><td colspan="4" class="doc" id="hasNullSelector0"><pre>Matches when the selector is the empty selector
4850 Matches only when the selector of the objCMessageExpr is NULL. This may
4851 represent an error condition in the tree!
4852 </pre></td></tr>
4855 <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>
4856 <tr><td colspan="4" class="doc" id="hasSelector0"><pre>Matches when BaseName == Selector.getAsString()
4858 matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:"));
4859 matches the outer message expr in the code below, but NOT the message
4860 invocation for self.bodyView.
4861 [self.bodyView loadHTMLString:html baseURL:NULL];
4862 </pre></td></tr>
4865 <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>
4866 <tr><td colspan="4" class="doc" id="hasUnarySelector0"><pre>Matches when the selector is a Unary Selector
4868 matcher = objCMessageExpr(matchesSelector(hasUnarySelector());
4869 matches self.bodyView in the code below, but NOT the outer message
4870 invocation of "loadHTMLString:baseURL:".
4871 [self.bodyView loadHTMLString:html baseURL:NULL];
4872 </pre></td></tr>
4875 <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>
4876 <tr><td colspan="4" class="doc" id="isClassMessage0"><pre>Returns true when the Objective-C message is sent to a class.
4878 Example
4879 matcher = objcMessageExpr(isClassMessage())
4880 matches
4881 [NSString stringWithFormat:@"format"];
4882 but not
4883 NSString *x = @"hello";
4884 [x containsString:@"h"];
4885 </pre></td></tr>
4888 <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>
4889 <tr><td colspan="4" class="doc" id="isInstanceMessage0"><pre>Returns true when the Objective-C message is sent to an instance.
4891 Example
4892 matcher = objcMessageExpr(isInstanceMessage())
4893 matches
4894 NSString *x = @"hello";
4895 [x containsString:@"h"];
4896 but not
4897 [NSString stringWithFormat:@"format"];
4898 </pre></td></tr>
4901 <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>
4902 <tr><td colspan="4" class="doc" id="matchesSelector0"><pre>Matches ObjC selectors whose name contains
4903 a substring matched by the given RegExp.
4904 matcher = objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
4905 invocation for self.bodyView.
4906 [self.bodyView loadHTMLString:html baseURL:NULL];
4908 If the matcher is used in clang-query, RegexFlags parameter
4909 should be passed as a quoted string. e.g: "NoFlags".
4910 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
4911 </pre></td></tr>
4914 <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>
4915 <tr><td colspan="4" class="doc" id="numSelectorArgs0"><pre>Matches when the selector has the specified number of arguments
4917 matcher = objCMessageExpr(numSelectorArgs(0));
4918 matches self.bodyView in the code below
4920 matcher = objCMessageExpr(numSelectorArgs(2));
4921 matches the invocation of "loadHTMLString:baseURL:" but not that
4922 of self.bodyView
4923 [self.bodyView loadHTMLString:html baseURL:NULL];
4924 </pre></td></tr>
4927 <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>
4928 <tr><td colspan="4" class="doc" id="isClassMethod0"><pre>Returns true when the Objective-C method declaration is a class method.
4930 Example
4931 matcher = objcMethodDecl(isClassMethod())
4932 matches
4933 @interface I + (void)foo; @end
4934 but not
4935 @interface I - (void)bar; @end
4936 </pre></td></tr>
4939 <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>
4940 <tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached.
4942 Example matches A, va, fa
4943 class A {};
4944 class B; // Doesn't match, as it has no body.
4945 int va;
4946 extern int vb; // Doesn't match, as it doesn't define the variable.
4947 void fa() {}
4948 void fb(); // Doesn't match, as it has no body.
4949 @interface X
4950 - (void)ma; // Doesn't match, interface is declaration.
4951 @end
4952 @implementation X
4953 - (void)ma {}
4954 @end
4956 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;,
4957 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
4958 </pre></td></tr>
4961 <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>
4962 <tr><td colspan="4" class="doc" id="isInstanceMethod0"><pre>Returns true when the Objective-C method declaration is an instance method.
4964 Example
4965 matcher = objcMethodDecl(isInstanceMethod())
4966 matches
4967 @interface I - (void)bar; @end
4968 but not
4969 @interface I + (void)foo; @end
4970 </pre></td></tr>
4973 <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>
4974 <tr><td colspan="4" class="doc" id="hasDefaultArgument0"><pre>Matches a declaration that has default arguments.
4976 Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
4977 void x(int val) {}
4978 void y(int val = 0) {}
4980 Deprecated. Use hasInitializer() instead to be able to
4981 match on the contents of the default argument. For example:
4983 void x(int val = 7) {}
4984 void y(int val = 42) {}
4985 parmVarDecl(hasInitializer(integerLiteral(equals(42))))
4986 matches the parameter of y
4988 A matcher such as
4989 parmVarDecl(hasInitializer(anything()))
4990 is equivalent to parmVarDecl(hasDefaultArgument()).
4991 </pre></td></tr>
4994 <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>
4995 <tr><td colspan="4" class="doc" id="isAtPosition0"><pre>Matches the ParmVarDecl nodes that are at the N'th position in the parameter
4996 list. The parameter list could be that of either a block, function, or
4997 objc-method.
5000 Given
5002 void f(int a, int b, int c) {
5005 ``parmVarDecl(isAtPosition(0))`` matches ``int a``.
5007 ``parmVarDecl(isAtPosition(1))`` matches ``int b``.
5008 </pre></td></tr>
5011 <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>
5012 <tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string.
5014 Given
5015 class Y { public: void x(); };
5016 void z() { Y* y; y-&gt;x(); }
5017 cxxMemberCallExpr(on(hasType(asString("class Y *"))))
5018 matches y-&gt;x()
5019 </pre></td></tr>
5022 <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>
5023 <tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node.
5025 Matches a node if it equals the node previously bound to ID.
5027 Given
5028 class X { int a; int b; };
5029 cxxRecordDecl(
5030 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
5031 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
5032 matches the class X, as a and b have the same type.
5034 Note that when multiple matches are involved via forEach* matchers,
5035 equalsBoundNodes acts as a filter.
5036 For example:
5037 compoundStmt(
5038 forEachDescendant(varDecl().bind("d")),
5039 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
5040 will trigger a match for each combination of variable declaration
5041 and reference to that variable declaration within a compound statement.
5042 </pre></td></tr>
5045 <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>
5046 <tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to
5047 the node, not hidden within a typedef.
5049 Given
5050 typedef const int const_int;
5051 const_int i;
5052 int *const j;
5053 int *volatile k;
5054 int m;
5055 varDecl(hasType(hasLocalQualifiers())) matches only j and k.
5056 i is const-qualified but the qualifier is not local.
5057 </pre></td></tr>
5060 <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>
5061 <tr><td colspan="4" class="doc" id="isAnyCharacter0"><pre>Matches QualType nodes that are of character type.
5063 Given
5064 void a(char);
5065 void b(wchar_t);
5066 void c(double);
5067 functionDecl(hasAnyParameter(hasType(isAnyCharacter())))
5068 matches "a(char)", "b(wchar_t)", but not "c(double)".
5069 </pre></td></tr>
5072 <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>
5073 <tr><td colspan="4" class="doc" id="isAnyPointer0"><pre>Matches QualType nodes that are of any pointer type; this includes
5074 the Objective-C object pointer type, which is different despite being
5075 syntactically similar.
5077 Given
5078 int *i = nullptr;
5080 @interface Foo
5081 @end
5082 Foo *f;
5084 int j;
5085 varDecl(hasType(isAnyPointer()))
5086 matches "int *i" and "Foo *f", but not "int j".
5087 </pre></td></tr>
5090 <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>
5091 <tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that
5092 include "top-level" const.
5094 Given
5095 void a(int);
5096 void b(int const);
5097 void c(const int);
5098 void d(const int*);
5099 void e(int const) {};
5100 functionDecl(hasAnyParameter(hasType(isConstQualified())))
5101 matches "void b(int const)", "void c(const int)" and
5102 "void e(int const) {}". It does not match d as there
5103 is no top-level const on the parameter type "const int *".
5104 </pre></td></tr>
5107 <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>
5108 <tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type.
5110 Given
5111 void a(int);
5112 void b(long);
5113 void c(double);
5114 functionDecl(hasAnyParameter(hasType(isInteger())))
5115 matches "a(int)", "b(long)", but not "c(double)".
5116 </pre></td></tr>
5119 <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>
5120 <tr><td colspan="4" class="doc" id="isSignedInteger0"><pre>Matches QualType nodes that are of signed integer type.
5122 Given
5123 void a(int);
5124 void b(unsigned long);
5125 void c(double);
5126 functionDecl(hasAnyParameter(hasType(isSignedInteger())))
5127 matches "a(int)", but not "b(unsigned long)" and "c(double)".
5128 </pre></td></tr>
5131 <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>
5132 <tr><td colspan="4" class="doc" id="isUnsignedInteger0"><pre>Matches QualType nodes that are of unsigned integer type.
5134 Given
5135 void a(int);
5136 void b(unsigned long);
5137 void c(double);
5138 functionDecl(hasAnyParameter(hasType(isUnsignedInteger())))
5139 matches "b(unsigned long)", but not "a(int)" and "c(double)".
5140 </pre></td></tr>
5143 <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>
5144 <tr><td colspan="4" class="doc" id="isVolatileQualified0"><pre>Matches QualType nodes that are volatile-qualified, i.e., that
5145 include "top-level" volatile.
5147 Given
5148 void a(int);
5149 void b(int volatile);
5150 void c(volatile int);
5151 void d(volatile int*);
5152 void e(int volatile) {};
5153 functionDecl(hasAnyParameter(hasType(isVolatileQualified())))
5154 matches "void b(int volatile)", "void c(volatile int)" and
5155 "void e(int volatile) {}". It does not match d as there
5156 is no top-level volatile on the parameter type "volatile int *".
5157 </pre></td></tr>
5160 <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>
5161 <tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node.
5163 Matches a node if it equals the node previously bound to ID.
5165 Given
5166 class X { int a; int b; };
5167 cxxRecordDecl(
5168 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
5169 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
5170 matches the class X, as a and b have the same type.
5172 Note that when multiple matches are involved via forEach* matchers,
5173 equalsBoundNodes acts as a filter.
5174 For example:
5175 compoundStmt(
5176 forEachDescendant(varDecl().bind("d")),
5177 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
5178 will trigger a match for each combination of variable declaration
5179 and reference to that variable declaration within a compound statement.
5180 </pre></td></tr>
5183 <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>
5184 <tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node.
5186 Stmt has pointer identity in the AST.
5187 </pre></td></tr>
5190 <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>
5191 <tr><td colspan="4" class="doc" id="isExpandedFromMacro1"><pre>Matches statements that are (transitively) expanded from the named macro.
5192 Does not match if only part of the statement is expanded from that macro or
5193 if different parts of the statement are expanded from different
5194 appearances of the macro.
5195 </pre></td></tr>
5198 <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>
5199 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching1"><pre>Matches AST nodes that were expanded within files whose name is
5200 partially matching a given regex.
5202 Example matches Y but not X
5203 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
5204 #include "ASTMatcher.h"
5205 class X {};
5206 ASTMatcher.h:
5207 class Y {};
5209 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;
5211 If the matcher is used in clang-query, RegexFlags parameter
5212 should be passed as a quoted string. e.g: "NoFlags".
5213 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
5214 </pre></td></tr>
5217 <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>
5218 <tr><td colspan="4" class="doc" id="isExpansionInMainFile1"><pre>Matches AST nodes that were expanded within the main-file.
5220 Example matches X but not Y
5221 (matcher = cxxRecordDecl(isExpansionInMainFile())
5222 #include &lt;Y.h&gt;
5223 class X {};
5224 Y.h:
5225 class Y {};
5227 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;
5228 </pre></td></tr>
5231 <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>
5232 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader1"><pre>Matches AST nodes that were expanded within system-header-files.
5234 Example matches Y but not X
5235 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
5236 #include &lt;SystemHeader.h&gt;
5237 class X {};
5238 SystemHeader.h:
5239 class Y {};
5241 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;
5242 </pre></td></tr>
5245 <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>
5246 <tr><td colspan="4" class="doc" id="isInTemplateInstantiation0"><pre>Matches statements inside of a template instantiation.
5248 Given
5249 int j;
5250 template&lt;typename T&gt; void A(T t) { T i; j += 42;}
5251 A(0);
5252 A(0U);
5253 declStmt(isInTemplateInstantiation())
5254 matches 'int i;' and 'unsigned i'.
5255 unless(stmt(isInTemplateInstantiation()))
5256 will NOT match j += 42; as it's shared between the template definition and
5257 instantiation.
5258 </pre></td></tr>
5261 <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>
5262 <tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
5264 Given
5265 int a[42];
5266 int b[2 * 21];
5267 int c[41], d[43];
5268 char *s = "abcd";
5269 wchar_t *ws = L"abcd";
5270 char *w = "a";
5271 constantArrayType(hasSize(42))
5272 matches "int a[42]" and "int b[2 * 21]"
5273 stringLiteral(hasSize(4))
5274 matches "abcd", L"abcd"
5275 </pre></td></tr>
5278 <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>
5279 <tr><td colspan="4" class="doc" id="isClass0"><pre>Matches TagDecl object that are spelled with "class."
5281 Example matches C, but not S, U or E.
5282 struct S {};
5283 class C {};
5284 union U {};
5285 enum E {};
5286 </pre></td></tr>
5289 <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>
5290 <tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
5292 Example matches A, va, fa
5293 class A {};
5294 class B; // Doesn't match, as it has no body.
5295 int va;
5296 extern int vb; // Doesn't match, as it doesn't define the variable.
5297 void fa() {}
5298 void fb(); // Doesn't match, as it has no body.
5299 @interface X
5300 - (void)ma; // Doesn't match, interface is declaration.
5301 @end
5302 @implementation X
5303 - (void)ma {}
5304 @end
5306 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;,
5307 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
5308 </pre></td></tr>
5311 <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>
5312 <tr><td colspan="4" class="doc" id="isEnum0"><pre>Matches TagDecl object that are spelled with "enum."
5314 Example matches E, but not C, S or U.
5315 struct S {};
5316 class C {};
5317 union U {};
5318 enum E {};
5319 </pre></td></tr>
5322 <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>
5323 <tr><td colspan="4" class="doc" id="isStruct0"><pre>Matches TagDecl object that are spelled with "struct."
5325 Example matches S, but not C, U or E.
5326 struct S {};
5327 class C {};
5328 union U {};
5329 enum E {};
5330 </pre></td></tr>
5333 <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>
5334 <tr><td colspan="4" class="doc" id="isUnion0"><pre>Matches TagDecl object that are spelled with "union."
5336 Example matches U, but not C, S or E.
5337 struct S {};
5338 class C {};
5339 union U {};
5340 enum E {};
5341 </pre></td></tr>
5344 <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>
5345 <tr><td colspan="4" class="doc" id="equalsIntegralValue0"><pre>Matches a TemplateArgument of integral type with a given value.
5347 Note that 'Value' is a string as the template argument's value is
5348 an arbitrary precision integer. 'Value' must be euqal to the canonical
5349 representation of that integral value in base 10.
5351 Given
5352 template&lt;int T&gt; struct C {};
5353 C&lt;42&gt; c;
5354 classTemplateSpecializationDecl(
5355 hasAnyTemplateArgument(equalsIntegralValue("42")))
5356 matches the implicit instantiation of C in C&lt;42&gt;.
5357 </pre></td></tr>
5360 <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>
5361 <tr><td colspan="4" class="doc" id="isIntegral0"><pre>Matches a TemplateArgument that is an integral value.
5363 Given
5364 template&lt;int T&gt; struct C {};
5365 C&lt;42&gt; c;
5366 classTemplateSpecializationDecl(
5367 hasAnyTemplateArgument(isIntegral()))
5368 matches the implicit instantiation of C in C&lt;42&gt;
5369 with isIntegral() matching 42.
5370 </pre></td></tr>
5373 <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>
5374 <tr><td colspan="4" class="doc" id="templateArgumentCountIs1"><pre>Matches if the number of template arguments equals N.
5376 Given
5377 template&lt;typename T&gt; struct C {};
5378 C&lt;int&gt; c;
5379 classTemplateSpecializationDecl(templateArgumentCountIs(1))
5380 matches C&lt;int&gt;.
5381 </pre></td></tr>
5384 <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>
5385 <tr><td colspan="4" class="doc" id="isExpandedFromMacro2"><pre>Matches statements that are (transitively) expanded from the named macro.
5386 Does not match if only part of the statement is expanded from that macro or
5387 if different parts of the statement are expanded from different
5388 appearances of the macro.
5389 </pre></td></tr>
5392 <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>
5393 <tr><td colspan="4" class="doc" id="isExpansionInFileMatching2"><pre>Matches AST nodes that were expanded within files whose name is
5394 partially matching a given regex.
5396 Example matches Y but not X
5397 (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
5398 #include "ASTMatcher.h"
5399 class X {};
5400 ASTMatcher.h:
5401 class Y {};
5403 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;
5405 If the matcher is used in clang-query, RegexFlags parameter
5406 should be passed as a quoted string. e.g: "NoFlags".
5407 Flags can be combined with '|' example "IgnoreCase | BasicRegex"
5408 </pre></td></tr>
5411 <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>
5412 <tr><td colspan="4" class="doc" id="isExpansionInMainFile2"><pre>Matches AST nodes that were expanded within the main-file.
5414 Example matches X but not Y
5415 (matcher = cxxRecordDecl(isExpansionInMainFile())
5416 #include &lt;Y.h&gt;
5417 class X {};
5418 Y.h:
5419 class Y {};
5421 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;
5422 </pre></td></tr>
5425 <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>
5426 <tr><td colspan="4" class="doc" id="isExpansionInSystemHeader2"><pre>Matches AST nodes that were expanded within system-header-files.
5428 Example matches Y but not X
5429 (matcher = cxxRecordDecl(isExpansionInSystemHeader())
5430 #include &lt;SystemHeader.h&gt;
5431 class X {};
5432 SystemHeader.h:
5433 class Y {};
5435 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;
5436 </pre></td></tr>
5439 <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>
5440 <tr><td colspan="4" class="doc" id="booleanType0"><pre>Matches type bool.
5442 Given
5443 struct S { bool func(); };
5444 functionDecl(returns(booleanType()))
5445 matches "bool func();"
5446 </pre></td></tr>
5449 <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>
5450 <tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
5452 Matches a node if it equals the node previously bound to ID.
5454 Given
5455 class X { int a; int b; };
5456 cxxRecordDecl(
5457 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
5458 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
5459 matches the class X, as a and b have the same type.
5461 Note that when multiple matches are involved via forEach* matchers,
5462 equalsBoundNodes acts as a filter.
5463 For example:
5464 compoundStmt(
5465 forEachDescendant(varDecl().bind("d")),
5466 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
5467 will trigger a match for each combination of variable declaration
5468 and reference to that variable declaration within a compound statement.
5469 </pre></td></tr>
5472 <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>
5473 <tr><td colspan="4" class="doc" id="equalsNode2"><pre>Matches if a node equals another node.
5475 Type has pointer identity in the AST.
5476 </pre></td></tr>
5479 <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>
5480 <tr><td colspan="4" class="doc" id="realFloatingPointType0"><pre>Matches any real floating-point type (float, double, long double).
5482 Given
5483 int i;
5484 float f;
5485 realFloatingPointType()
5486 matches "float f" but not "int i"
5487 </pre></td></tr>
5490 <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>
5491 <tr><td colspan="4" class="doc" id="voidType0"><pre>Matches type void.
5493 Given
5494 struct S { void func(); };
5495 functionDecl(returns(voidType()))
5496 matches "void func();"
5497 </pre></td></tr>
5500 <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>
5501 <tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
5503 Given
5504 int x;
5505 int s = sizeof(x) + alignof(x)
5506 unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
5507 matches sizeof(x)
5509 If the matcher is use from clang-query, UnaryExprOrTypeTrait parameter
5510 should be passed as a quoted string. e.g., ofKind("UETT_SizeOf").
5511 </pre></td></tr>
5514 <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>
5515 <tr><td colspan="4" class="doc" id="hasAnyOperatorName3"><pre>Matches operator expressions (binary or unary) that have any of the
5516 specified names.
5518 hasAnyOperatorName("+", "-")
5519 Is equivalent to
5520 anyOf(hasOperatorName("+"), hasOperatorName("-"))
5521 </pre></td></tr>
5524 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperatorName3')"><a name="hasOperatorName3Anchor">hasOperatorName</a></td><td>std::string Name</td></tr>
5525 <tr><td colspan="4" class="doc" id="hasOperatorName3"><pre>Matches the operator Name of operator expressions (binary or
5526 unary).
5528 Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
5529 !(a || b)
5530 </pre></td></tr>
5533 <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>
5534 <tr><td colspan="4" class="doc" id="isArrow1"><pre>Matches member expressions that are called with '-&gt;' as opposed
5535 to '.'.
5537 Member calls on the implicit this pointer match as called with '-&gt;'.
5539 Given
5540 class Y {
5541 void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
5542 template &lt;class T&gt; void f() { this-&gt;f&lt;T&gt;(); f&lt;T&gt;(); }
5543 int a;
5544 static int b;
5546 template &lt;class T&gt;
5547 class Z {
5548 void x() { this-&gt;m; }
5550 memberExpr(isArrow())
5551 matches this-&gt;x, x, y.x, a, this-&gt;b
5552 cxxDependentScopeMemberExpr(isArrow())
5553 matches this-&gt;m
5554 unresolvedMemberExpr(isArrow())
5555 matches this-&gt;f&lt;T&gt;, f&lt;T&gt;
5556 </pre></td></tr>
5559 <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>
5560 <tr><td colspan="4" class="doc" id="hasAutomaticStorageDuration0"><pre>Matches a variable declaration that has automatic storage duration.
5562 Example matches x, but not y, z, or a.
5563 (matcher = varDecl(hasAutomaticStorageDuration())
5564 void f() {
5565 int x;
5566 static int y;
5567 thread_local int z;
5569 int a;
5570 </pre></td></tr>
5573 <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>
5574 <tr><td colspan="4" class="doc" id="hasGlobalStorage0"><pre>Matches a variable declaration that does not have local storage.
5576 Example matches y and z (matcher = varDecl(hasGlobalStorage())
5577 void f() {
5578 int x;
5579 static int y;
5581 int z;
5582 </pre></td></tr>
5585 <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>
5586 <tr><td colspan="4" class="doc" id="hasLocalStorage0"><pre>Matches a variable declaration that has function scope and is a
5587 non-static local variable.
5589 Example matches x (matcher = varDecl(hasLocalStorage())
5590 void f() {
5591 int x;
5592 static int y;
5594 int z;
5595 </pre></td></tr>
5598 <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>
5599 <tr><td colspan="4" class="doc" id="hasStaticStorageDuration0"><pre>Matches a variable declaration that has static storage duration.
5600 It includes the variable declared at namespace scope and those declared
5601 with "static" and "extern" storage class specifiers.
5603 void f() {
5604 int x;
5605 static int y;
5606 thread_local int z;
5608 int a;
5609 static int b;
5610 extern int c;
5611 varDecl(hasStaticStorageDuration())
5612 matches the function declaration y, a, b and c.
5613 </pre></td></tr>
5616 <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>
5617 <tr><td colspan="4" class="doc" id="hasThreadStorageDuration0"><pre>Matches a variable declaration that has thread storage duration.
5619 Example matches z, but not x, z, or a.
5620 (matcher = varDecl(hasThreadStorageDuration())
5621 void f() {
5622 int x;
5623 static int y;
5624 thread_local int z;
5626 int a;
5627 </pre></td></tr>
5630 <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>
5631 <tr><td colspan="4" class="doc" id="isConstexpr0"><pre>Matches constexpr variable and function declarations,
5632 and if constexpr.
5634 Given:
5635 constexpr int foo = 42;
5636 constexpr int bar();
5637 void baz() { if constexpr(1 &gt; 0) {} }
5638 varDecl(isConstexpr())
5639 matches the declaration of foo.
5640 functionDecl(isConstexpr())
5641 matches the declaration of bar.
5642 ifStmt(isConstexpr())
5643 matches the if statement in baz.
5644 </pre></td></tr>
5647 <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>
5648 <tr><td colspan="4" class="doc" id="isConstinit0"><pre>Matches constinit variable declarations.
5650 Given:
5651 constinit int foo = 42;
5652 constinit const char* bar = "bar";
5653 int baz = 42;
5654 [[clang::require_constant_initialization]] int xyz = 42;
5655 varDecl(isConstinit())
5656 matches the declaration of `foo` and `bar`, but not `baz` and `xyz`.
5657 </pre></td></tr>
5660 <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>
5661 <tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
5663 Example matches A, va, fa
5664 class A {};
5665 class B; // Doesn't match, as it has no body.
5666 int va;
5667 extern int vb; // Doesn't match, as it doesn't define the variable.
5668 void fa() {}
5669 void fb(); // Doesn't match, as it has no body.
5670 @interface X
5671 - (void)ma; // Doesn't match, interface is declaration.
5672 @end
5673 @implementation X
5674 - (void)ma {}
5675 @end
5677 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;,
5678 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html">ObjCMethodDecl</a>&gt;
5679 </pre></td></tr>
5682 <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>
5683 <tr><td colspan="4" class="doc" id="isExceptionVariable0"><pre>Matches a variable declaration that is an exception variable from
5684 a C++ catch block, or an Objective-C statement.
5686 Example matches x (matcher = varDecl(isExceptionVariable())
5687 void f(int y) {
5688 try {
5689 } catch (int x) {
5692 </pre></td></tr>
5695 <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>
5696 <tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
5697 static member variable template instantiations.
5699 Given
5700 template&lt;typename T&gt; void A(T t) { }
5701 template&lt;&gt; void A(int N) { }
5702 functionDecl(isExplicitTemplateSpecialization())
5703 matches the specialization A&lt;int&gt;().
5705 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;
5706 </pre></td></tr>
5709 <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>
5710 <tr><td colspan="4" class="doc" id="isExternC1"><pre>Matches extern "C" function or variable declarations.
5712 Given:
5713 extern "C" void f() {}
5714 extern "C" { void g() {} }
5715 void h() {}
5716 extern "C" int x = 1;
5717 extern "C" int y = 2;
5718 int z = 3;
5719 functionDecl(isExternC())
5720 matches the declaration of f and g, but not the declaration of h.
5721 varDecl(isExternC())
5722 matches the declaration of x and y, but not the declaration of z.
5723 </pre></td></tr>
5726 <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>
5727 <tr><td colspan="4" class="doc" id="isInitCapture0"><pre>Matches a variable serving as the implicit variable for a lambda init-
5728 capture.
5730 Example matches x (matcher = varDecl(isInitCapture()))
5731 auto f = [x=3]() { return x; };
5732 </pre></td></tr>
5735 <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>
5736 <tr><td colspan="4" class="doc" id="isInline2"><pre>Matches functions, variables and namespace declarations that are marked with
5737 the inline keyword.
5739 Given
5740 inline void f();
5741 void g();
5742 namespace n {
5743 inline namespace m {}
5745 inline int Foo = 5;
5746 functionDecl(isInline()) will match ::f().
5747 namespaceDecl(isInline()) will match n::m.
5748 varDecl(isInline()) will match Foo;
5749 </pre></td></tr>
5752 <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>
5753 <tr><td colspan="4" class="doc" id="isStaticLocal0"><pre>Matches a static variable with local scope.
5755 Example matches y (matcher = varDecl(isStaticLocal()))
5756 void f() {
5757 int x;
5758 static int y;
5760 static int z;
5761 </pre></td></tr>
5764 <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>
5765 <tr><td colspan="4" class="doc" id="isStaticStorageClass1"><pre>Matches variable/function declarations that have "static" storage
5766 class specifier ("static" keyword) written in the source.
5768 Given:
5769 static void f() {}
5770 static int i = 0;
5771 extern int j;
5772 int k;
5773 functionDecl(isStaticStorageClass())
5774 matches the function declaration f.
5775 varDecl(isStaticStorageClass())
5776 matches the variable declaration i.
5777 </pre></td></tr>
5780 <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>
5781 <tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
5782 member variable template instantiations.
5784 Given
5785 template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
5787 template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
5789 template &lt;typename T&gt; class X {}; class A {}; extern template class X&lt;A&gt;;
5790 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
5791 matches the template instantiation of X&lt;A&gt;.
5793 But given
5794 template &lt;typename T&gt; class X {}; class A {};
5795 template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
5796 cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
5797 does not match, as X&lt;A&gt; is an explicit template specialization.
5799 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;
5800 </pre></td></tr>
5802 <!--END_NARROWING_MATCHERS -->
5803 </table>
5805 <!-- ======================================================================= -->
5806 <h2 id="traversal-matchers">AST Traversal Matchers</h2>
5807 <!-- ======================================================================= -->
5809 <p>Traversal matchers specify the relationship to other nodes that are
5810 reachable from the current node.</p>
5812 <p>Note that there are special traversal matchers (has, hasDescendant, forEach and
5813 forEachDescendant) which work on all nodes and allow users to write more generic
5814 match expressions.</p>
5816 <table>
5817 <tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
5818 <!-- START_TRAVERSAL_MATCHERS -->
5820 <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>
5821 <tr><td colspan="4" class="doc" id="binaryOperation0"><pre>Matches nodes which can be used with binary operators.
5823 The code
5824 var1 != var2;
5825 might be represented in the clang AST as a binaryOperator, a
5826 cxxOperatorCallExpr or a cxxRewrittenBinaryOperator, depending on
5828 * whether the types of var1 and var2 are fundamental (binaryOperator) or at
5829 least one is a class type (cxxOperatorCallExpr)
5830 * whether the code appears in a template declaration, if at least one of the
5831 vars is a dependent-type (binaryOperator)
5832 * whether the code relies on a rewritten binary operator, such as a
5833 spaceship operator or an inverted equality operator
5834 (cxxRewrittenBinaryOperator)
5836 This matcher elides details in places where the matchers for the nodes are
5837 compatible.
5839 Given
5840 binaryOperation(
5841 hasOperatorName("!="),
5842 hasLHS(expr().bind("lhs")),
5843 hasRHS(expr().bind("rhs"))
5845 matches each use of "!=" in:
5846 struct S{
5847 bool operator!=(const S&amp;) const;
5850 void foo()
5852 1 != 2;
5853 S() != S();
5856 template&lt;typename T&gt;
5857 void templ()
5859 1 != 2;
5860 T() != S();
5862 struct HasOpEq
5864 bool operator==(const HasOpEq &amp;) const;
5867 void inverse()
5869 HasOpEq s1;
5870 HasOpEq s2;
5871 if (s1 != s2)
5872 return;
5875 struct HasSpaceship
5877 bool operator&lt;=&gt;(const HasOpEq &amp;) const;
5880 void use_spaceship()
5882 HasSpaceship s1;
5883 HasSpaceship s2;
5884 if (s1 != s2)
5885 return;
5887 </pre></td></tr>
5890 <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>
5891 <tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
5893 Unlike anyOf, eachOf will generate a match result for each
5894 matching submatcher.
5896 For example, in:
5897 class A { int a; int b; };
5898 The matcher:
5899 cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
5900 has(fieldDecl(hasName("b")).bind("v"))))
5901 will generate two results binding "v", the first of which binds
5902 the field declaration of a, the second the field declaration of
5905 Usable as: Any Matcher
5906 </pre></td></tr>
5909 <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>
5910 <tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
5912 Generates results for each match.
5914 For example, in:
5915 class A { class B {}; class C {}; };
5916 The matcher:
5917 cxxRecordDecl(hasName("::A"),
5918 findAll(cxxRecordDecl(isDefinition()).bind("m")))
5919 will generate results for A, B and C.
5921 Usable as: Any Matcher
5922 </pre></td></tr>
5925 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
5926 <tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
5927 provided matcher.
5929 Example matches X, A, A::X, B, B::C, B::C::X
5930 (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
5931 class X {};
5932 class A { class X {}; }; // Matches A, because A::X is a class of name
5933 // X inside A.
5934 class B { class C { class X {}; }; };
5936 DescendantT must be an AST base type.
5938 As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
5939 each result that matches instead of only on the first one.
5941 Note: Recursively combined ForEachDescendant can cause many matches:
5942 cxxRecordDecl(forEachDescendant(cxxRecordDecl(
5943 forEachDescendant(cxxRecordDecl())
5945 will match 10 times (plus injected class name matches) on:
5946 class A { class B { class C { class D { class E {}; }; }; }; };
5948 Usable as: Any Matcher
5949 </pre></td></tr>
5952 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
5953 <tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
5954 provided matcher.
5956 Example matches X, Y, Y::X, Z::Y, Z::Y::X
5957 (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
5958 class X {};
5959 class Y { class X {}; }; // Matches Y, because Y::X is a class of name X
5960 // inside Y.
5961 class Z { class Y { class X {}; }; }; // Does not match Z.
5963 ChildT must be an AST base type.
5965 As opposed to 'has', 'forEach' will cause a match for each result that
5966 matches instead of only on the first one.
5968 Usable as: Any Matcher
5969 </pre></td></tr>
5972 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
5973 <tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
5974 matcher.
5976 Given
5977 void f() { if (true) { int x = 42; } }
5978 void g() { for (;;) { int x = 43; } }
5979 expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
5981 Usable as: Any Matcher
5982 </pre></td></tr>
5985 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
5986 <tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
5987 provided matcher.
5989 Example matches X, Y, Z
5990 (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
5991 class X {}; // Matches X, because X::X is a class of name X inside X.
5992 class Y { class X {}; };
5993 class Z { class Y { class X {}; }; };
5995 DescendantT must be an AST base type.
5997 Usable as: Any Matcher
5998 </pre></td></tr>
6001 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
6002 <tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
6003 provided matcher.
6005 Example matches X, Y
6006 (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
6007 class X {}; // Matches X, because X::X is a class of name X inside X.
6008 class Y { class X {}; };
6009 class Z { class Y { class X {}; }; }; // Does not match Z.
6011 ChildT must be an AST base type.
6013 Usable as: Any Matcher
6014 Note that has is direct matcher, so it also matches things like implicit
6015 casts and paren casts. If you are matching with expr then you should
6016 probably consider using ignoringParenImpCasts like:
6017 has(ignoringParenImpCasts(expr())).
6018 </pre></td></tr>
6021 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
6022 <tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
6023 matcher.
6025 Given
6026 void f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
6027 compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
6029 Usable as: Any Matcher
6030 </pre></td></tr>
6033 <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>
6034 <tr><td colspan="4" class="doc" id="invocation0"><pre>Matches function calls and constructor calls
6036 Because CallExpr and CXXConstructExpr do not share a common
6037 base class with API accessing arguments etc, AST Matchers for code
6038 which should match both are typically duplicated. This matcher
6039 removes the need for duplication.
6041 Given code
6042 struct ConstructorTakesInt
6044 ConstructorTakesInt(int i) {}
6047 void callTakesInt(int i)
6051 void doCall()
6053 callTakesInt(42);
6056 void doConstruct()
6058 ConstructorTakesInt cti(42);
6061 The matcher
6062 invocation(hasArgument(0, integerLiteral(equals(42))))
6063 matches the expression in both doCall and doConstruct
6064 </pre></td></tr>
6067 <tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('optionally0')"><a name="optionally0Anchor">optionally</a></td><td>Matcher&lt;*&gt;</td></tr>
6068 <tr><td colspan="4" class="doc" id="optionally0"><pre>Matches any node regardless of the submatcher.
6070 However, optionally will retain any bindings generated by the submatcher.
6071 Useful when additional information which may or may not present about a main
6072 matching node is desired.
6074 For example, in:
6075 class Foo {
6076 int bar;
6078 The matcher:
6079 cxxRecordDecl(
6080 optionally(has(
6081 fieldDecl(hasName("bar")).bind("var")
6082 ))).bind("record")
6083 will produce a result binding for both "record" and "var".
6084 The matcher will produce a "record" binding for even if there is no data
6085 member named "bar" in that class.
6087 Usable as: Any Matcher
6088 </pre></td></tr>
6091 <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>
6092 <tr><td colspan="4" class="doc" id="traverse0"><pre>Causes all nested matchers to be matched with the specified traversal kind.
6094 Given
6095 void foo()
6097 int i = 3.0;
6099 The matcher
6100 traverse(TK_IgnoreUnlessSpelledInSource,
6101 varDecl(hasInitializer(floatLiteral().bind("init")))
6103 matches the variable declaration with "init" bound to the "3.0".
6104 </pre></td></tr>
6107 <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>
6108 <tr><td colspan="4" class="doc" id="hasCondition5"><pre>Matches the condition expression of an if statement, for loop,
6109 switch statement or conditional operator.
6111 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
6112 if (true) {}
6113 </pre></td></tr>
6116 <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>
6117 <tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator
6118 (binary or ternary).
6120 Example matches b
6121 condition ? a : b
6122 condition ?: b
6123 </pre></td></tr>
6126 <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>
6127 <tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
6129 Example 1 (conditional ternary operator): matches a
6130 condition ? a : b
6132 Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
6133 condition ?: b
6134 </pre></td></tr>
6137 <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>
6138 <tr><td colspan="4" class="doc" id="hasDeclaration15"><pre>Matches a node if the declaration associated with that node
6139 matches the given matcher.
6141 The associated declaration is:
6142 - for type nodes, the declaration of the underlying type
6143 - for CallExpr, the declaration of the callee
6144 - for MemberExpr, the declaration of the referenced member
6145 - for CXXConstructExpr, the declaration of the constructor
6146 - for CXXNewExpr, the declaration of the operator new
6147 - for ObjCIvarExpr, the declaration of the ivar
6149 For type nodes, hasDeclaration will generally match the declaration of the
6150 sugared type. Given
6151 class X {};
6152 typedef X Y;
6153 Y y;
6154 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6155 typedefDecl. A common use case is to match the underlying, desugared type.
6156 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6157 varDecl(hasType(hasUnqualifiedDesugaredType(
6158 recordType(hasDeclaration(decl())))))
6159 In this matcher, the decl will match the CXXRecordDecl of class X.
6161 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;,
6162 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;,
6163 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;,
6164 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;,
6165 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;,
6166 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;,
6167 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6168 </pre></td></tr>
6171 <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>
6172 <tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
6174 Given
6175 int i[5];
6176 void f() { i[1] = 42; }
6177 arraySubscriptExpression(hasBase(implicitCastExpr(
6178 hasSourceExpression(declRefExpr()))))
6179 matches i[1] with the declRefExpr() matching i
6180 </pre></td></tr>
6183 <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>
6184 <tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
6186 Given
6187 int i[5];
6188 void f() { i[1] = 42; }
6189 arraySubscriptExpression(hasIndex(integerLiteral()))
6190 matches i[1] with the integerLiteral() matching 1
6191 </pre></td></tr>
6194 <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>
6195 <tr><td colspan="4" class="doc" id="hasLHS3"><pre>Matches the left hand side of binary operator expressions.
6197 Example matches a (matcher = binaryOperator(hasLHS()))
6198 a || b
6199 </pre></td></tr>
6202 <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>
6203 <tr><td colspan="4" class="doc" id="hasRHS3"><pre>Matches the right hand side of binary operator expressions.
6205 Example matches b (matcher = binaryOperator(hasRHS()))
6206 a || b
6207 </pre></td></tr>
6210 <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>
6211 <tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
6212 type.
6214 Given
6215 struct A {};
6216 A a[7];
6217 int b[7];
6218 arrayType(hasElementType(builtinType()))
6219 matches "int b[7]"
6221 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;
6222 </pre></td></tr>
6225 <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>
6226 <tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
6228 Given
6229 _Atomic(int) i;
6230 _Atomic(float) f;
6231 atomicType(hasValueType(isInteger()))
6232 matches "_Atomic(int) i"
6234 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
6235 </pre></td></tr>
6238 <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>
6239 <tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
6241 Note: There is no TypeLoc for the deduced type and thus no
6242 getDeducedLoc() matcher.
6244 Given
6245 auto a = 1;
6246 auto b = 2.0;
6247 autoType(hasDeducedType(isInteger()))
6248 matches "auto a"
6250 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
6251 </pre></td></tr>
6254 <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>
6255 <tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
6257 Given
6258 namespace X { void b(); }
6259 using X::b;
6260 usingDecl(hasAnyUsingShadowDecl(hasName("b"))))
6261 matches using X::b </pre></td></tr>
6264 <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>
6265 <tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
6266 binary operator matches.
6267 </pre></td></tr>
6270 <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>
6271 <tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
6273 Example matches a (matcher = binaryOperator(hasLHS()))
6274 a || b
6275 </pre></td></tr>
6278 <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>
6279 <tr><td colspan="4" class="doc" id="hasOperands0"><pre>Matches if both matchers match with opposite sides of the binary operator.
6281 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
6282 integerLiteral(equals(2)))
6283 1 + 2 // Match
6284 2 + 1 // Match
6285 1 + 1 // No match
6286 2 + 2 // No match
6287 </pre></td></tr>
6290 <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>
6291 <tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
6293 Example matches b (matcher = binaryOperator(hasRHS()))
6294 a || b
6295 </pre></td></tr>
6298 <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>
6299 <tr><td colspan="4" class="doc" id="forDecomposition0"><pre>Matches the DecompositionDecl the binding belongs to.
6301 For example, in:
6302 void foo()
6304 int arr[3];
6305 auto &amp;[f, s, t] = arr;
6307 f = 42;
6309 The matcher:
6310 bindingDecl(hasName("f"),
6311 forDecomposition(decompositionDecl())
6312 matches 'f' in 'auto &amp;[f, s, t]'.
6313 </pre></td></tr>
6316 <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>
6317 <tr><td colspan="4" class="doc" id="hasAnyParameter2"><pre>Matches any parameter of a function or an ObjC method declaration or a
6318 block.
6320 Does not match the 'this' parameter of a method.
6322 Given
6323 class X { void f(int x, int y, int z) {} };
6324 cxxMethodDecl(hasAnyParameter(hasName("y")))
6325 matches f(int x, int y, int z) {}
6326 with hasAnyParameter(...)
6327 matching int y
6329 For ObjectiveC, given
6330 @interface I - (void) f:(int) y; @end
6332 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
6333 matches the declaration of method f with hasParameter
6334 matching y.
6336 For blocks, given
6337 b = ^(int y) { printf("%d", y) };
6339 the matcher blockDecl(hasAnyParameter(hasName("y")))
6340 matches the declaration of the block b with hasParameter
6341 matching y.
6342 </pre></td></tr>
6345 <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>
6346 <tr><td colspan="4" class="doc" id="hasParameter2"><pre>Matches the n'th parameter of a function or an ObjC method
6347 declaration or a block.
6349 Given
6350 class X { void f(int x) {} };
6351 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
6352 matches f(int x) {}
6353 with hasParameter(...)
6354 matching int x
6356 For ObjectiveC, given
6357 @interface I - (void) f:(int) y; @end
6359 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
6360 matches the declaration of method f with hasParameter
6361 matching y.
6362 </pre></td></tr>
6365 <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>
6366 <tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of a node matches the inner matcher.
6368 Examples:
6369 int x;
6370 declaratorDecl(hasTypeLoc(loc(asString("int"))))
6371 matches int x
6373 auto x = int(3);
6374 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
6375 matches int(3)
6377 struct Foo { Foo(int, int); };
6378 auto x = Foo(1, 2);
6379 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
6380 matches Foo(1, 2)
6382 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;,
6383 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;,
6384 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;,
6385 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
6386 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
6387 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;,
6388 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;,
6389 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
6390 </pre></td></tr>
6393 <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>
6394 <tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
6395 pointee matches a given matcher.
6397 Given
6398 int *a;
6399 int const *b;
6400 float const *f;
6401 pointerType(pointee(isConstQualified(), isInteger()))
6402 matches "int const *b"
6404 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;,
6405 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;
6406 </pre></td></tr>
6409 <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>
6410 <tr><td colspan="4" class="doc" id="hasTypeLoc1"><pre>Matches if the type location of a node matches the inner matcher.
6412 Examples:
6413 int x;
6414 declaratorDecl(hasTypeLoc(loc(asString("int"))))
6415 matches int x
6417 auto x = int(3);
6418 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
6419 matches int(3)
6421 struct Foo { Foo(int, int); };
6422 auto x = Foo(1, 2);
6423 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
6424 matches Foo(1, 2)
6426 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;,
6427 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;,
6428 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;,
6429 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
6430 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
6431 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;,
6432 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;,
6433 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
6434 </pre></td></tr>
6437 <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>
6438 <tr><td colspan="4" class="doc" id="hasType8"><pre>Overloaded to match the declaration of the expression's or value
6439 declaration's type.
6441 In case of a value declaration (for example a variable declaration),
6442 this resolves one layer of indirection. For example, in the value
6443 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
6444 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
6445 declaration of x.
6447 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6448 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6449 and friend class X (matcher = friendDecl(hasType("X"))
6450 and public virtual X (matcher = cxxBaseSpecifier(hasType(
6451 cxxRecordDecl(hasName("X"))))
6452 class X {};
6453 void y(X &amp;x) { x; X z; }
6454 class Y { friend class X; };
6455 class Z : public virtual X {};
6457 Example matches class Derived
6458 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
6459 class Base {};
6460 class Derived : Base {};
6462 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;,
6463 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
6464 </pre></td></tr>
6467 <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>
6468 <tr><td colspan="4" class="doc" id="hasType4"><pre>Matches if the expression's or declaration's type matches a type
6469 matcher.
6471 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
6472 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
6473 and U (matcher = typedefDecl(hasType(asString("int")))
6474 and friend class X (matcher = friendDecl(hasType("X"))
6475 and public virtual X (matcher = cxxBaseSpecifier(hasType(
6476 asString("class X")))
6477 class X {};
6478 void y(X &amp;x) { x; X z; }
6479 typedef int U;
6480 class Y { friend class X; };
6481 class Z : public virtual X {};
6482 </pre></td></tr>
6485 <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>
6486 <tr><td colspan="4" class="doc" id="forEachArgumentWithParam1"><pre>Matches all arguments and their respective ParmVarDecl.
6488 Given
6489 void f(int i);
6490 int y;
6491 f(y);
6492 callExpr(
6493 forEachArgumentWithParam(
6494 declRefExpr(to(varDecl(hasName("y")))),
6495 parmVarDecl(hasType(isInteger()))
6497 matches f(y);
6498 with declRefExpr(...)
6499 matching int y
6500 and parmVarDecl(...)
6501 matching int i
6502 </pre></td></tr>
6505 <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>
6506 <tr><td colspan="4" class="doc" id="forEachArgumentWithParamType1"><pre>Matches all arguments and their respective types for a CallExpr or
6507 CXXConstructExpr. It is very similar to forEachArgumentWithParam but
6508 it works on calls through function pointers as well.
6510 The difference is, that function pointers do not provide access to a
6511 ParmVarDecl, but only the QualType for each argument.
6513 Given
6514 void f(int i);
6515 int y;
6516 f(y);
6517 void (*f_ptr)(int) = f;
6518 f_ptr(y);
6519 callExpr(
6520 forEachArgumentWithParamType(
6521 declRefExpr(to(varDecl(hasName("y")))),
6522 qualType(isInteger()).bind("type)
6524 matches f(y) and f_ptr(y)
6525 with declRefExpr(...)
6526 matching int y
6527 and qualType(...)
6528 matching int
6529 </pre></td></tr>
6532 <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>
6533 <tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
6534 expression, or an ObjC-message-send expression.
6536 Given
6537 void x(int, int, int) { int y; x(1, y, 42); }
6538 callExpr(hasAnyArgument(declRefExpr()))
6539 matches x(1, y, 42)
6540 with hasAnyArgument(...)
6541 matching y
6543 For ObjectiveC, given
6544 @interface I - (void) f:(int) y; @end
6545 void foo(I *i) { [i f:12]; }
6546 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
6547 matches [i f:12]
6548 </pre></td></tr>
6551 <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>
6552 <tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
6553 call expression.
6555 Example matches y in x(y)
6556 (matcher = callExpr(hasArgument(0, declRefExpr())))
6557 void x(int) { int y; x(y); }
6558 </pre></td></tr>
6561 <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>
6562 <tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
6563 matches the given matcher.
6565 The associated declaration is:
6566 - for type nodes, the declaration of the underlying type
6567 - for CallExpr, the declaration of the callee
6568 - for MemberExpr, the declaration of the referenced member
6569 - for CXXConstructExpr, the declaration of the constructor
6570 - for CXXNewExpr, the declaration of the operator new
6571 - for ObjCIvarExpr, the declaration of the ivar
6573 For type nodes, hasDeclaration will generally match the declaration of the
6574 sugared type. Given
6575 class X {};
6576 typedef X Y;
6577 Y y;
6578 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6579 typedefDecl. A common use case is to match the underlying, desugared type.
6580 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6581 varDecl(hasType(hasUnqualifiedDesugaredType(
6582 recordType(hasDeclaration(decl())))))
6583 In this matcher, the decl will match the CXXRecordDecl of class X.
6585 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;,
6586 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;,
6587 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;,
6588 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;,
6589 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;,
6590 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;,
6591 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6592 </pre></td></tr>
6595 <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>
6596 <tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
6598 Given
6599 class A { A() : i(42), j(42) {} int i; int j; };
6600 cxxConstructorDecl(forEachConstructorInitializer(
6601 forField(decl().bind("x"))
6603 will trigger two matches, binding for 'i' and 'j' respectively.
6604 </pre></td></tr>
6607 <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>
6608 <tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
6610 Given
6611 struct Foo {
6612 Foo() : foo_(1) { }
6613 int foo_;
6615 cxxRecordDecl(has(cxxConstructorDecl(
6616 hasAnyConstructorInitializer(anything())
6618 record matches Foo, hasAnyConstructorInitializer matches foo_(1)
6619 </pre></td></tr>
6622 <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>
6623 <tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
6625 Given
6626 struct Foo {
6627 Foo() : foo_(1) { }
6628 int foo_;
6630 cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
6631 forField(hasName("foo_"))))))
6632 matches Foo
6633 with forField matching foo_
6634 </pre></td></tr>
6637 <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>
6638 <tr><td colspan="4" class="doc" id="hasTypeLoc2"><pre>Matches if the type location of a node matches the inner matcher.
6640 Examples:
6641 int x;
6642 declaratorDecl(hasTypeLoc(loc(asString("int"))))
6643 matches int x
6645 auto x = int(3);
6646 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
6647 matches int(3)
6649 struct Foo { Foo(int, int); };
6650 auto x = Foo(1, 2);
6651 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
6652 matches Foo(1, 2)
6654 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;,
6655 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;,
6656 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;,
6657 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
6658 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
6659 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;,
6660 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;,
6661 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
6662 </pre></td></tr>
6665 <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>
6666 <tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
6668 Given
6669 struct Foo {
6670 Foo() : foo_(1) { }
6671 int foo_;
6673 cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
6674 withInitializer(integerLiteral(equals(1)))))))
6675 matches Foo
6676 with withInitializer matching (1)
6677 </pre></td></tr>
6680 <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>
6681 <tr><td colspan="4" class="doc" id="hasObjectExpression2"><pre>Matches a member expression where the object expression is matched by a
6682 given matcher. Implicit object expressions are included; that is, it matches
6683 use of implicit `this`.
6685 Given
6686 struct X {
6687 int m;
6688 int f(X x) { x.m; return m; }
6690 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
6691 matches `x.m`, but not `m`; however,
6692 memberExpr(hasObjectExpression(hasType(pointsTo(
6693 cxxRecordDecl(hasName("X"))))))
6694 matches `m` (aka. `this-&gt;m`), but not `x.m`.
6695 </pre></td></tr>
6698 <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>
6699 <tr><td colspan="4" class="doc" id="hasBody3"><pre></pre></td></tr>
6702 <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>
6703 <tr><td colspan="4" class="doc" id="hasInitStatement2"><pre>Matches selection statements with initializer.
6705 Given:
6706 void foo() {
6707 if (int i = foobar(); i &gt; 0) {}
6708 switch (int i = foobar(); i) {}
6709 for (auto&amp; a = get_range(); auto&amp; x : a) {}
6711 void bar() {
6712 if (foobar() &gt; 0) {}
6713 switch (foobar()) {}
6714 for (auto&amp; x : get_range()) {}
6716 ifStmt(hasInitStatement(anything()))
6717 matches the if statement in foo but not in bar.
6718 switchStmt(hasInitStatement(anything()))
6719 matches the switch statement in foo but not in bar.
6720 cxxForRangeStmt(hasInitStatement(anything()))
6721 matches the range for statement in foo but not in bar.
6722 </pre></td></tr>
6725 <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>
6726 <tr><td colspan="4" class="doc" id="hasLoopVariable0"><pre>Matches the initialization statement of a for loop.
6728 Example:
6729 forStmt(hasLoopVariable(anything()))
6730 matches 'int x' in
6731 for (int x : a) { }
6732 </pre></td></tr>
6735 <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>
6736 <tr><td colspan="4" class="doc" id="hasRangeInit0"><pre>Matches the range initialization statement of a for loop.
6738 Example:
6739 forStmt(hasRangeInit(anything()))
6740 matches 'a' in
6741 for (int x : a) { }
6742 </pre></td></tr>
6745 <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>
6746 <tr><td colspan="4" class="doc" id="hasTypeLoc3"><pre>Matches if the type location of a node matches the inner matcher.
6748 Examples:
6749 int x;
6750 declaratorDecl(hasTypeLoc(loc(asString("int"))))
6751 matches int x
6753 auto x = int(3);
6754 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
6755 matches int(3)
6757 struct Foo { Foo(int, int); };
6758 auto x = Foo(1, 2);
6759 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
6760 matches Foo(1, 2)
6762 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;,
6763 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;,
6764 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;,
6765 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
6766 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
6767 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;,
6768 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;,
6769 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
6770 </pre></td></tr>
6773 <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>
6774 <tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre>Matches on the implicit object argument of a member call expression. Unlike
6775 `on`, matches the argument directly without stripping away anything.
6777 Given
6778 class Y { public: void m(); };
6779 Y g();
6780 class X : public Y { void g(); };
6781 void z(Y y, X x) { y.m(); x.m(); x.g(); (g()).m(); }
6782 cxxMemberCallExpr(onImplicitObjectArgument(hasType(
6783 cxxRecordDecl(hasName("Y")))))
6784 matches `y.m()`, `x.m()` and (g()).m(), but not `x.g()`.
6785 cxxMemberCallExpr(on(callExpr()))
6786 does not match `(g()).m()`, because the parens are not ignored.
6788 FIXME: Overload to allow directly matching types?
6789 </pre></td></tr>
6792 <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>
6793 <tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression, after
6794 stripping off any parentheses or implicit casts.
6796 Given
6797 class Y { public: void m(); };
6798 Y g();
6799 class X : public Y {};
6800 void z(Y y, X x) { y.m(); (g()).m(); x.m(); }
6801 cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y")))))
6802 matches `y.m()` and `(g()).m()`.
6803 cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("X")))))
6804 matches `x.m()`.
6805 cxxMemberCallExpr(on(callExpr()))
6806 matches `(g()).m()`.
6808 FIXME: Overload to allow directly matching types?
6809 </pre></td></tr>
6812 <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>
6813 <tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
6814 </pre></td></tr>
6817 <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>
6818 <tr><td colspan="4" class="doc" id="thisPointerType0"><pre>Matches if the type of the expression's implicit object argument either
6819 matches the InnerMatcher, or is a pointer to a type that matches the
6820 InnerMatcher.
6822 Given
6823 class Y { public: void m(); };
6824 class X : public Y { void g(); };
6825 void z() { Y y; y.m(); Y *p; p-&gt;m(); X x; x.m(); x.g(); }
6826 cxxMemberCallExpr(thisPointerType(hasDeclaration(
6827 cxxRecordDecl(hasName("Y")))))
6828 matches `y.m()`, `p-&gt;m()` and `x.m()`.
6829 cxxMemberCallExpr(thisPointerType(hasDeclaration(
6830 cxxRecordDecl(hasName("X")))))
6831 matches `x.g()`.
6832 </pre></td></tr>
6835 <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>
6836 <tr><td colspan="4" class="doc" id="forEachOverridden0"><pre>Matches each method overridden by the given method. This matcher may
6837 produce multiple matches.
6839 Given
6840 class A { virtual void f(); };
6841 class B : public A { void f(); };
6842 class C : public B { void f(); };
6843 cxxMethodDecl(ofClass(hasName("C")),
6844 forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
6845 matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
6846 that B::f is not overridden by C::f).
6848 The check can produce multiple matches in case of multiple inheritance, e.g.
6849 class A1 { virtual void f(); };
6850 class A2 { virtual void f(); };
6851 class C : public A1, public A2 { void f(); };
6852 cxxMethodDecl(ofClass(hasName("C")),
6853 forEachOverridden(cxxMethodDecl().bind("b"))).bind("d")
6854 matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
6855 once with "b" binding "A2::f" and "d" binding "C::f".
6856 </pre></td></tr>
6859 <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>
6860 <tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
6861 belongs to.
6863 FIXME: Generalize this for other kinds of declarations.
6864 FIXME: What other kind of declarations would we need to generalize
6865 this to?
6867 Example matches A() in the last line
6868 (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
6869 ofClass(hasName("A"))))))
6870 class A {
6871 public:
6872 A();
6874 A a = A();
6875 </pre></td></tr>
6878 <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>
6879 <tr><td colspan="4" class="doc" id="hasAnyPlacementArg0"><pre>Matches any placement new expression arguments.
6881 Given:
6882 MyClass *p1 = new (Storage) MyClass();
6883 cxxNewExpr(hasAnyPlacementArg(anything()))
6884 matches the expression 'new (Storage, 16) MyClass()'.
6885 </pre></td></tr>
6888 <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>
6889 <tr><td colspan="4" class="doc" id="hasArraySize0"><pre>Matches array new expressions with a given array size.
6891 Given:
6892 MyClass *p1 = new MyClass[10];
6893 cxxNewExpr(hasArraySize(integerLiteral(equals(10))))
6894 matches the expression 'new MyClass[10]'.
6895 </pre></td></tr>
6898 <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>
6899 <tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
6900 matches the given matcher.
6902 The associated declaration is:
6903 - for type nodes, the declaration of the underlying type
6904 - for CallExpr, the declaration of the callee
6905 - for MemberExpr, the declaration of the referenced member
6906 - for CXXConstructExpr, the declaration of the constructor
6907 - for CXXNewExpr, the declaration of the operator new
6908 - for ObjCIvarExpr, the declaration of the ivar
6910 For type nodes, hasDeclaration will generally match the declaration of the
6911 sugared type. Given
6912 class X {};
6913 typedef X Y;
6914 Y y;
6915 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
6916 typedefDecl. A common use case is to match the underlying, desugared type.
6917 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
6918 varDecl(hasType(hasUnqualifiedDesugaredType(
6919 recordType(hasDeclaration(decl())))))
6920 In this matcher, the decl will match the CXXRecordDecl of class X.
6922 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;,
6923 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;,
6924 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;,
6925 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;,
6926 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;,
6927 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;,
6928 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
6929 </pre></td></tr>
6932 <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>
6933 <tr><td colspan="4" class="doc" id="hasPlacementArg0"><pre>Matches placement new expression arguments.
6935 Given:
6936 MyClass *p1 = new (Storage, 16) MyClass();
6937 cxxNewExpr(hasPlacementArg(1, integerLiteral(equals(16))))
6938 matches the expression 'new (Storage, 16) MyClass()'.
6939 </pre></td></tr>
6942 <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>
6943 <tr><td colspan="4" class="doc" id="hasTypeLoc4"><pre>Matches if the type location of a node matches the inner matcher.
6945 Examples:
6946 int x;
6947 declaratorDecl(hasTypeLoc(loc(asString("int"))))
6948 matches int x
6950 auto x = int(3);
6951 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
6952 matches int(3)
6954 struct Foo { Foo(int, int); };
6955 auto x = Foo(1, 2);
6956 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
6957 matches Foo(1, 2)
6959 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;,
6960 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;,
6961 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;,
6962 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
6963 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
6964 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;,
6965 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;,
6966 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
6967 </pre></td></tr>
6970 <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>
6971 <tr><td colspan="4" class="doc" id="hasEitherOperand1"><pre>Matches if either the left hand side or the right hand side of a
6972 binary operator matches.
6973 </pre></td></tr>
6976 <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>
6977 <tr><td colspan="4" class="doc" id="hasLHS1"><pre>Matches the left hand side of binary operator expressions.
6979 Example matches a (matcher = binaryOperator(hasLHS()))
6980 a || b
6981 </pre></td></tr>
6984 <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>
6985 <tr><td colspan="4" class="doc" id="hasOperands1"><pre>Matches if both matchers match with opposite sides of the binary operator.
6987 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
6988 integerLiteral(equals(2)))
6989 1 + 2 // Match
6990 2 + 1 // Match
6991 1 + 1 // No match
6992 2 + 2 // No match
6993 </pre></td></tr>
6996 <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>
6997 <tr><td colspan="4" class="doc" id="hasRHS1"><pre>Matches the right hand side of binary operator expressions.
6999 Example matches b (matcher = binaryOperator(hasRHS()))
7000 a || b
7001 </pre></td></tr>
7004 <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>
7005 <tr><td colspan="4" class="doc" id="hasUnaryOperand1"><pre>Matches if the operand of a unary operator matches.
7007 Example matches true (matcher = hasUnaryOperand(
7008 cxxBoolLiteral(equals(true))))
7009 !true
7010 </pre></td></tr>
7013 <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>
7014 <tr><td colspan="4" class="doc" id="hasAnyBase0"><pre>Matches C++ classes that have a direct or indirect base matching BaseSpecMatcher.
7016 Example:
7017 matcher hasAnyBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
7018 class Foo;
7019 class Bar : Foo {};
7020 class Baz : Bar {};
7021 class SpecialBase;
7022 class Proxy : SpecialBase {}; // matches Proxy
7023 class IndirectlyDerived : Proxy {}; //matches IndirectlyDerived
7025 FIXME: Refactor this and isDerivedFrom to reuse implementation.
7026 </pre></td></tr>
7029 <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>
7030 <tr><td colspan="4" class="doc" id="hasDirectBase0"><pre>Matches C++ classes that have a direct base matching BaseSpecMatcher.
7032 Example:
7033 matcher hasDirectBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
7034 class Foo;
7035 class Bar : Foo {};
7036 class Baz : Bar {};
7037 class SpecialBase;
7038 class Proxy : SpecialBase {}; // matches Proxy
7039 class IndirectlyDerived : Proxy {}; // doesn't match
7040 </pre></td></tr>
7043 <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>
7044 <tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
7046 Given:
7047 class A { void func(); };
7048 class B { void member(); };
7050 cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
7051 A but not B.
7052 </pre></td></tr>
7055 <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>
7056 <tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from a class
7057 matching Base, or Objective-C classes that directly or indirectly
7058 subclass a class matching Base.
7060 Note that a class is not considered to be derived from itself.
7062 Example matches Y, Z, C (Base == hasName("X"))
7063 class X;
7064 class Y : public X {}; // directly derived
7065 class Z : public Y {}; // indirectly derived
7066 typedef X A;
7067 typedef A B;
7068 class C : public B {}; // derived from a typedef of X
7070 In the following example, Bar matches isDerivedFrom(hasName("X")):
7071 class Foo;
7072 typedef Foo X;
7073 class Bar : public Foo {}; // derived from a type that X is a typedef of
7075 In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
7076 @interface NSObject @end
7077 @interface Bar : NSObject @end
7079 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;
7080 </pre></td></tr>
7083 <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>
7084 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom0"><pre>Matches C++ or Objective-C classes that are directly derived from a class
7085 matching Base.
7087 Note that a class is not considered to be derived from itself.
7089 Example matches Y, C (Base == hasName("X"))
7090 class X;
7091 class Y : public X {}; // directly derived
7092 class Z : public Y {}; // indirectly derived
7093 typedef X A;
7094 typedef A B;
7095 class C : public B {}; // derived from a typedef of X
7097 In the following example, Bar matches isDerivedFrom(hasName("X")):
7098 class Foo;
7099 typedef Foo X;
7100 class Bar : public Foo {}; // derived from a type that X is a typedef of
7101 </pre></td></tr>
7104 <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>
7105 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
7106 match Base.
7107 </pre></td></tr>
7110 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasEitherOperand2')"><a name="hasEitherOperand2Anchor">hasEitherOperand</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
7111 <tr><td colspan="4" class="doc" id="hasEitherOperand2"><pre>Matches if either the left hand side or the right hand side of a
7112 binary operator matches.
7113 </pre></td></tr>
7116 <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>
7117 <tr><td colspan="4" class="doc" id="hasLHS2"><pre>Matches the left hand side of binary operator expressions.
7119 Example matches a (matcher = binaryOperator(hasLHS()))
7120 a || b
7121 </pre></td></tr>
7124 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXRewrittenBinaryOperator.html">CXXRewrittenBinaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperands2')"><a name="hasOperands2Anchor">hasOperands</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; Matcher1, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; Matcher2</td></tr>
7125 <tr><td colspan="4" class="doc" id="hasOperands2"><pre>Matches if both matchers match with opposite sides of the binary operator.
7127 Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
7128 integerLiteral(equals(2)))
7129 1 + 2 // Match
7130 2 + 1 // Match
7131 1 + 1 // No match
7132 2 + 2 // No match
7133 </pre></td></tr>
7136 <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>
7137 <tr><td colspan="4" class="doc" id="hasRHS2"><pre>Matches the right hand side of binary operator expressions.
7139 Example matches b (matcher = binaryOperator(hasRHS()))
7140 a || b
7141 </pre></td></tr>
7144 <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>
7145 <tr><td colspan="4" class="doc" id="hasTypeLoc5"><pre>Matches if the type location of a node matches the inner matcher.
7147 Examples:
7148 int x;
7149 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7150 matches int x
7152 auto x = int(3);
7153 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7154 matches int(3)
7156 struct Foo { Foo(int, int); };
7157 auto x = Foo(1, 2);
7158 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7159 matches Foo(1, 2)
7161 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;,
7162 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;,
7163 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;,
7164 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7165 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7166 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;,
7167 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;,
7168 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7169 </pre></td></tr>
7172 <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>
7173 <tr><td colspan="4" class="doc" id="hasAnyArgument2"><pre>Matches any argument of a call expression or a constructor call
7174 expression, or an ObjC-message-send expression.
7176 Given
7177 void x(int, int, int) { int y; x(1, y, 42); }
7178 callExpr(hasAnyArgument(declRefExpr()))
7179 matches x(1, y, 42)
7180 with hasAnyArgument(...)
7181 matching y
7183 For ObjectiveC, given
7184 @interface I - (void) f:(int) y; @end
7185 void foo(I *i) { [i f:12]; }
7186 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
7187 matches [i f:12]
7188 </pre></td></tr>
7191 <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>
7192 <tr><td colspan="4" class="doc" id="hasArgument2"><pre>Matches the n'th argument of a call expression or a constructor
7193 call expression.
7195 Example matches y in x(y)
7196 (matcher = callExpr(hasArgument(0, declRefExpr())))
7197 void x(int) { int y; x(y); }
7198 </pre></td></tr>
7201 <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>
7202 <tr><td colspan="4" class="doc" id="hasTypeLoc6"><pre>Matches if the type location of a node matches the inner matcher.
7204 Examples:
7205 int x;
7206 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7207 matches int x
7209 auto x = int(3);
7210 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7211 matches int(3)
7213 struct Foo { Foo(int, int); };
7214 auto x = Foo(1, 2);
7215 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7216 matches Foo(1, 2)
7218 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;,
7219 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;,
7220 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;,
7221 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7222 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7223 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;,
7224 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;,
7225 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7226 </pre></td></tr>
7229 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('callee1')"><a name="callee1Anchor">callee</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
7230 <tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
7231 given matcher.
7233 Example matches y.x() (matcher = callExpr(callee(
7234 cxxMethodDecl(hasName("x")))))
7235 class Y { public: void x(); };
7236 void z() { Y y; y.x(); }
7237 </pre></td></tr>
7240 <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>
7241 <tr><td colspan="4" class="doc" id="callee0"><pre>Matches if the call expression's callee expression matches.
7243 Given
7244 class Y { void x() { this-&gt;x(); x(); Y y; y.x(); } };
7245 void f() { f(); }
7246 callExpr(callee(expr()))
7247 matches this-&gt;x(), x(), y.x(), f()
7248 with callee(...)
7249 matching this-&gt;x, x, y.x, f respectively
7251 Note: Callee cannot take the more general internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;
7252 because this introduces ambiguous overloads with calls to Callee taking a
7253 internal::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;, as the matcher hierarchy is purely
7254 implemented in terms of implicit casts.
7255 </pre></td></tr>
7258 <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>
7259 <tr><td colspan="4" class="doc" id="forEachArgumentWithParam0"><pre>Matches all arguments and their respective ParmVarDecl.
7261 Given
7262 void f(int i);
7263 int y;
7264 f(y);
7265 callExpr(
7266 forEachArgumentWithParam(
7267 declRefExpr(to(varDecl(hasName("y")))),
7268 parmVarDecl(hasType(isInteger()))
7270 matches f(y);
7271 with declRefExpr(...)
7272 matching int y
7273 and parmVarDecl(...)
7274 matching int i
7275 </pre></td></tr>
7278 <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>
7279 <tr><td colspan="4" class="doc" id="forEachArgumentWithParamType0"><pre>Matches all arguments and their respective types for a CallExpr or
7280 CXXConstructExpr. It is very similar to forEachArgumentWithParam but
7281 it works on calls through function pointers as well.
7283 The difference is, that function pointers do not provide access to a
7284 ParmVarDecl, but only the QualType for each argument.
7286 Given
7287 void f(int i);
7288 int y;
7289 f(y);
7290 void (*f_ptr)(int) = f;
7291 f_ptr(y);
7292 callExpr(
7293 forEachArgumentWithParamType(
7294 declRefExpr(to(varDecl(hasName("y")))),
7295 qualType(isInteger()).bind("type)
7297 matches f(y) and f_ptr(y)
7298 with declRefExpr(...)
7299 matching int y
7300 and qualType(...)
7301 matching int
7302 </pre></td></tr>
7305 <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>
7306 <tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
7307 expression, or an ObjC-message-send expression.
7309 Given
7310 void x(int, int, int) { int y; x(1, y, 42); }
7311 callExpr(hasAnyArgument(declRefExpr()))
7312 matches x(1, y, 42)
7313 with hasAnyArgument(...)
7314 matching y
7316 For ObjectiveC, given
7317 @interface I - (void) f:(int) y; @end
7318 void foo(I *i) { [i f:12]; }
7319 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
7320 matches [i f:12]
7321 </pre></td></tr>
7324 <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>
7325 <tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
7326 call expression.
7328 Example matches y in x(y)
7329 (matcher = callExpr(hasArgument(0, declRefExpr())))
7330 void x(int) { int y; x(y); }
7331 </pre></td></tr>
7334 <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>
7335 <tr><td colspan="4" class="doc" id="hasDeclaration14"><pre>Matches a node if the declaration associated with that node
7336 matches the given matcher.
7338 The associated declaration is:
7339 - for type nodes, the declaration of the underlying type
7340 - for CallExpr, the declaration of the callee
7341 - for MemberExpr, the declaration of the referenced member
7342 - for CXXConstructExpr, the declaration of the constructor
7343 - for CXXNewExpr, the declaration of the operator new
7344 - for ObjCIvarExpr, the declaration of the ivar
7346 For type nodes, hasDeclaration will generally match the declaration of the
7347 sugared type. Given
7348 class X {};
7349 typedef X Y;
7350 Y y;
7351 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7352 typedefDecl. A common use case is to match the underlying, desugared type.
7353 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7354 varDecl(hasType(hasUnqualifiedDesugaredType(
7355 recordType(hasDeclaration(decl())))))
7356 In this matcher, the decl will match the CXXRecordDecl of class X.
7358 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;,
7359 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;,
7360 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;,
7361 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;,
7362 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;,
7363 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;,
7364 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7365 </pre></td></tr>
7368 <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>
7369 <tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
7370 extension, matches the constant given in the statement.
7372 Given
7373 switch (1) { case 1: case 1+1: case 3 ... 4: ; }
7374 caseStmt(hasCaseConstant(integerLiteral()))
7375 matches "case 1:"
7376 </pre></td></tr>
7379 <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>
7380 <tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression
7381 or opaque value's source expression matches the given matcher.
7383 Example 1: matches "a string"
7384 (matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
7385 class URL { URL(string); };
7386 URL url = "a string";
7388 Example 2: matches 'b' (matcher =
7389 opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
7390 int a = b ?: 1;
7391 </pre></td></tr>
7394 <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>
7395 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
7396 functionDecl that have at least one TemplateArgument matching the given
7397 InnerMatcher.
7399 Given
7400 template&lt;typename T&gt; class A {};
7401 template&lt;&gt; class A&lt;double&gt; {};
7402 A&lt;int&gt; a;
7404 template&lt;typename T&gt; f() {};
7405 void func() { f&lt;int&gt;(); };
7407 classTemplateSpecializationDecl(hasAnyTemplateArgument(
7408 refersToType(asString("int"))))
7409 matches the specialization A&lt;int&gt;
7411 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
7412 matches the specialization f&lt;int&gt;
7413 </pre></td></tr>
7416 <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>
7417 <tr><td colspan="4" class="doc" id="hasSpecializedTemplate0"><pre>Matches the specialized template of a specialization declaration.
7419 Given
7420 template&lt;typename T&gt; class A {}; #1
7421 template&lt;&gt; class A&lt;int&gt; {}; #2
7422 classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl()))
7423 matches '#2' with classTemplateDecl() matching the class template
7424 declaration of 'A' at #1.
7425 </pre></td></tr>
7428 <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>
7429 <tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations, templateSpecializationType and
7430 functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
7432 Given
7433 template&lt;typename T, typename U&gt; class A {};
7434 A&lt;bool, int&gt; b;
7435 A&lt;int, bool&gt; c;
7437 template&lt;typename T&gt; void f() {}
7438 void func() { f&lt;int&gt;(); };
7439 classTemplateSpecializationDecl(hasTemplateArgument(
7440 1, refersToType(asString("int"))))
7441 matches the specialization A&lt;bool, int&gt;
7443 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
7444 matches the specialization f&lt;int&gt;
7445 </pre></td></tr>
7448 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</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>
7449 <tr><td colspan="4" class="doc" id="hasTypeLoc7"><pre>Matches if the type location of a node matches the inner matcher.
7451 Examples:
7452 int x;
7453 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7454 matches int x
7456 auto x = int(3);
7457 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7458 matches int(3)
7460 struct Foo { Foo(int, int); };
7461 auto x = Foo(1, 2);
7462 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7463 matches Foo(1, 2)
7465 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;,
7466 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;,
7467 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;,
7468 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7469 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7470 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;,
7471 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;,
7472 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7473 </pre></td></tr>
7476 <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>
7477 <tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
7478 type.
7480 Given
7481 struct A {};
7482 A a[7];
7483 int b[7];
7484 arrayType(hasElementType(builtinType()))
7485 matches "int b[7]"
7487 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;
7488 </pre></td></tr>
7491 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</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>
7492 <tr><td colspan="4" class="doc" id="hasTypeLoc8"><pre>Matches if the type location of a node matches the inner matcher.
7494 Examples:
7495 int x;
7496 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7497 matches int x
7499 auto x = int(3);
7500 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7501 matches int(3)
7503 struct Foo { Foo(int, int); };
7504 auto x = Foo(1, 2);
7505 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7506 matches Foo(1, 2)
7508 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;,
7509 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;,
7510 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;,
7511 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7512 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7513 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;,
7514 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;,
7515 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7516 </pre></td></tr>
7519 <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>
7520 <tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
7521 a given matcher. Also matches StmtExprs that have CompoundStmt as children.
7523 Given
7524 { {}; 1+2; }
7525 hasAnySubstatement(compoundStmt())
7526 matches '{ {}; 1+2; }'
7527 with compoundStmt()
7528 matching '{}'
7529 </pre></td></tr>
7532 <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>
7533 <tr><td colspan="4" class="doc" id="hasDecayedType0"><pre>Matches the decayed type, whoes decayed type matches InnerMatcher
7534 </pre></td></tr>
7537 <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>
7538 <tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
7539 matches the given matcher.
7541 The associated declaration is:
7542 - for type nodes, the declaration of the underlying type
7543 - for CallExpr, the declaration of the callee
7544 - for MemberExpr, the declaration of the referenced member
7545 - for CXXConstructExpr, the declaration of the constructor
7546 - for CXXNewExpr, the declaration of the operator new
7547 - for ObjCIvarExpr, the declaration of the ivar
7549 For type nodes, hasDeclaration will generally match the declaration of the
7550 sugared type. Given
7551 class X {};
7552 typedef X Y;
7553 Y y;
7554 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7555 typedefDecl. A common use case is to match the underlying, desugared type.
7556 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7557 varDecl(hasType(hasUnqualifiedDesugaredType(
7558 recordType(hasDeclaration(decl())))))
7559 In this matcher, the decl will match the CXXRecordDecl of class X.
7561 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;,
7562 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;,
7563 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;,
7564 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;,
7565 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;,
7566 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;,
7567 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7568 </pre></td></tr>
7571 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</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>
7572 <tr><td colspan="4" class="doc" id="hasTemplateArgumentLoc0"><pre>Matches template specialization `TypeLoc`s where the n'th
7573 `TemplateArgumentLoc` matches the given `InnerMatcher`.
7575 Given
7576 template&lt;typename T, typename U&gt; class A {};
7577 A&lt;double, int&gt; b;
7578 A&lt;int, double&gt; c;
7579 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0,
7580 hasTypeLoc(loc(asString("double")))))))
7581 matches `A&lt;double, int&gt; b`, but not `A&lt;int, double&gt; c`.
7582 </pre></td></tr>
7585 <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>
7586 <tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches if a node refers to a declaration through a specific
7587 using shadow declaration.
7589 Examples:
7590 namespace a { int f(); }
7591 using a::f;
7592 int x = f();
7593 declRefExpr(throughUsingDecl(anything()))
7594 matches f
7596 namespace a { class X{}; }
7597 using a::X;
7598 X x;
7599 typeLoc(loc(usingType(throughUsingDecl(anything()))))
7600 matches X
7602 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;
7603 </pre></td></tr>
7606 <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>
7607 <tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
7608 specified matcher.
7610 Example matches x in if(x)
7611 (matcher = declRefExpr(to(varDecl(hasName("x")))))
7612 bool x;
7613 if (x) {}
7614 </pre></td></tr>
7617 <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>
7618 <tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
7620 Note that this does not work for global declarations because the AST
7621 breaks up multiple-declaration DeclStmt's into multiple single-declaration
7622 DeclStmt's.
7623 Example: Given non-global declarations
7624 int a, b = 0;
7625 int c;
7626 int d = 2, e;
7627 declStmt(containsDeclaration(
7628 0, varDecl(hasInitializer(anything()))))
7629 matches only 'int d = 2, e;', and
7630 declStmt(containsDeclaration(1, varDecl()))
7631 matches 'int a, b = 0' as well as 'int d = 2, e;'
7632 but 'int c;' is not matched.
7633 </pre></td></tr>
7636 <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>
7637 <tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
7639 Given
7640 int a, b;
7641 int c;
7642 declStmt(hasSingleDecl(anything()))
7643 matches 'int c;' but not 'int a, b;'.
7644 </pre></td></tr>
7647 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</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>
7648 <tr><td colspan="4" class="doc" id="hasTypeLoc9"><pre>Matches if the type location of a node matches the inner matcher.
7650 Examples:
7651 int x;
7652 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7653 matches int x
7655 auto x = int(3);
7656 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7657 matches int(3)
7659 struct Foo { Foo(int, int); };
7660 auto x = Foo(1, 2);
7661 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7662 matches Foo(1, 2)
7664 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;,
7665 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;,
7666 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;,
7667 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7668 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7669 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;,
7670 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;,
7671 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7672 </pre></td></tr>
7675 <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>
7676 <tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
7677 Decl, matches InnerMatcher.
7679 Given
7680 namespace N {
7681 namespace M {
7682 class D {};
7686 cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
7687 declaration of class D.
7688 </pre></td></tr>
7691 <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>
7692 <tr><td colspan="4" class="doc" id="hasUnderlyingType0"><pre>Matches DecltypeType or UsingType nodes to find the underlying type.
7694 Given
7695 decltype(1) a = 1;
7696 decltype(2.0) b = 2.0;
7697 decltypeType(hasUnderlyingType(isInteger()))
7698 matches the type of "a"
7700 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;
7701 </pre></td></tr>
7704 <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>
7705 <tr><td colspan="4" class="doc" id="hasAnyBinding0"><pre>Matches any binding of a DecompositionDecl.
7707 For example, in:
7708 void foo()
7710 int arr[3];
7711 auto &amp;[f, s, t] = arr;
7713 f = 42;
7715 The matcher:
7716 decompositionDecl(hasAnyBinding(bindingDecl(hasName("f").bind("fBinding"))))
7717 matches the decomposition decl with 'f' bound to "fBinding".
7718 </pre></td></tr>
7721 <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>
7722 <tr><td colspan="4" class="doc" id="hasBinding0"><pre>Matches the Nth binding of a DecompositionDecl.
7724 For example, in:
7725 void foo()
7727 int arr[3];
7728 auto &amp;[f, s, t] = arr;
7730 f = 42;
7732 The matcher:
7733 decompositionDecl(hasBinding(0,
7734 bindingDecl(hasName("f").bind("fBinding"))))
7735 matches the decomposition decl with 'f' bound to "fBinding".
7736 </pre></td></tr>
7739 <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>
7740 <tr><td colspan="4" class="doc" id="hasBody0"><pre></pre></td></tr>
7743 <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>
7744 <tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
7745 switch statement or conditional operator.
7747 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
7748 if (true) {}
7749 </pre></td></tr>
7752 <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>
7753 <tr><td colspan="4" class="doc" id="hasNamedTypeLoc0"><pre>Matches elaborated `TypeLoc`s that have a named `TypeLoc` matching
7754 `InnerMatcher`.
7756 Given
7757 template &lt;typename T&gt;
7758 class C {};
7759 class C&lt;int&gt; c;
7761 class D {};
7762 class D d;
7763 elaboratedTypeLoc(hasNamedTypeLoc(templateSpecializationTypeLoc()));
7764 matches the `TypeLoc` of the variable declaration of `c`, but not `d`.
7765 </pre></td></tr>
7768 <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>
7769 <tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
7770 matches InnerMatcher if the qualifier exists.
7772 Given
7773 namespace N {
7774 namespace M {
7775 class D {};
7778 N::M::D d;
7780 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
7781 matches the type of the variable declaration of d.
7782 </pre></td></tr>
7785 <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>
7786 <tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
7788 Given
7789 namespace N {
7790 namespace M {
7791 class D {};
7794 N::M::D d;
7796 elaboratedType(namesType(recordType(
7797 hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
7798 declaration of d.
7799 </pre></td></tr>
7802 <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>
7803 <tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
7804 matches the given matcher.
7806 The associated declaration is:
7807 - for type nodes, the declaration of the underlying type
7808 - for CallExpr, the declaration of the callee
7809 - for MemberExpr, the declaration of the referenced member
7810 - for CXXConstructExpr, the declaration of the constructor
7811 - for CXXNewExpr, the declaration of the operator new
7812 - for ObjCIvarExpr, the declaration of the ivar
7814 For type nodes, hasDeclaration will generally match the declaration of the
7815 sugared type. Given
7816 class X {};
7817 typedef X Y;
7818 Y y;
7819 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
7820 typedefDecl. A common use case is to match the underlying, desugared type.
7821 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
7822 varDecl(hasType(hasUnqualifiedDesugaredType(
7823 recordType(hasDeclaration(decl())))))
7824 In this matcher, the decl will match the CXXRecordDecl of class X.
7826 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;,
7827 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;,
7828 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;,
7829 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;,
7830 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;,
7831 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;,
7832 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
7833 </pre></td></tr>
7836 <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>
7837 <tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
7839 (Note: Clang's AST refers to other conversions as "casts" too, and calls
7840 actual casts "explicit" casts.)
7841 </pre></td></tr>
7844 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</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>
7845 <tr><td colspan="4" class="doc" id="hasTypeLoc10"><pre>Matches if the type location of a node matches the inner matcher.
7847 Examples:
7848 int x;
7849 declaratorDecl(hasTypeLoc(loc(asString("int"))))
7850 matches int x
7852 auto x = int(3);
7853 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
7854 matches int(3)
7856 struct Foo { Foo(int, int); };
7857 auto x = Foo(1, 2);
7858 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
7859 matches Foo(1, 2)
7861 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;,
7862 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;,
7863 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;,
7864 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
7865 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
7866 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;,
7867 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;,
7868 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
7869 </pre></td></tr>
7872 <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>
7873 <tr><td colspan="4" class="doc" id="hasType5"><pre>Overloaded to match the declaration of the expression's or value
7874 declaration's type.
7876 In case of a value declaration (for example a variable declaration),
7877 this resolves one layer of indirection. For example, in the value
7878 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
7879 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
7880 declaration of x.
7882 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
7883 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
7884 and friend class X (matcher = friendDecl(hasType("X"))
7885 and public virtual X (matcher = cxxBaseSpecifier(hasType(
7886 cxxRecordDecl(hasName("X"))))
7887 class X {};
7888 void y(X &amp;x) { x; X z; }
7889 class Y { friend class X; };
7890 class Z : public virtual X {};
7892 Example matches class Derived
7893 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
7894 class Base {};
7895 class Derived : Base {};
7897 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;,
7898 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
7899 </pre></td></tr>
7902 <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>
7903 <tr><td colspan="4" class="doc" id="hasType0"><pre>Matches if the expression's or declaration's type matches a type
7904 matcher.
7906 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
7907 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
7908 and U (matcher = typedefDecl(hasType(asString("int")))
7909 and friend class X (matcher = friendDecl(hasType("X"))
7910 and public virtual X (matcher = cxxBaseSpecifier(hasType(
7911 asString("class X")))
7912 class X {};
7913 void y(X &amp;x) { x; X z; }
7914 typedef int U;
7915 class Y { friend class X; };
7916 class Z : public virtual X {};
7917 </pre></td></tr>
7920 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('ignoringElidableConstructorCall0')"><a name="ignoringElidableConstructorCall0Anchor">ignoringElidableConstructorCall</a></td><td>ast_matchers::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
7921 <tr><td colspan="4" class="doc" id="ignoringElidableConstructorCall0"><pre>Matches expressions that match InnerMatcher that are possibly wrapped in an
7922 elidable constructor and other corresponding bookkeeping nodes.
7924 In C++17, elidable copy constructors are no longer being generated in the
7925 AST as it is not permitted by the standard. They are, however, part of the
7926 AST in C++14 and earlier. So, a matcher must abstract over these differences
7927 to work in all language modes. This matcher skips elidable constructor-call
7928 AST nodes, `ExprWithCleanups` nodes wrapping elidable constructor-calls and
7929 various implicit nodes inside the constructor calls, all of which will not
7930 appear in the C++17 AST.
7932 Given
7934 struct H {};
7935 H G();
7936 void f() {
7937 H D = G();
7940 ``varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())))``
7941 matches ``H D = G()`` in C++11 through C++17 (and beyond).
7942 </pre></td></tr>
7945 <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>
7946 <tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
7947 are stripped off.
7949 Parentheses and explicit casts are not discarded.
7950 Given
7951 int arr[5];
7952 int a = 0;
7953 char b = 0;
7954 const int c = a;
7955 int *d = arr;
7956 long e = (long) 0l;
7957 The matchers
7958 varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
7959 varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
7960 would match the declarations for a, b, c, and d, but not e.
7961 While
7962 varDecl(hasInitializer(integerLiteral()))
7963 varDecl(hasInitializer(declRefExpr()))
7964 only match the declarations for a.
7965 </pre></td></tr>
7968 <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>
7969 <tr><td colspan="4" class="doc" id="ignoringImplicit0"><pre>Matches expressions that match InnerMatcher after any implicit AST
7970 nodes are stripped off.
7972 Parentheses and explicit casts are not discarded.
7973 Given
7974 class C {};
7975 C a = C();
7976 C b;
7977 C c = b;
7978 The matchers
7979 varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr())))
7980 would match the declarations for a, b, and c.
7981 While
7982 varDecl(hasInitializer(cxxConstructExpr()))
7983 only match the declarations for b and c.
7984 </pre></td></tr>
7987 <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>
7988 <tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
7989 casts are stripped off.
7991 Implicit and non-C Style casts are also discarded.
7992 Given
7993 int a = 0;
7994 char b = (0);
7995 void* c = reinterpret_cast&lt;char*&gt;(0);
7996 char d = char(0);
7997 The matcher
7998 varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
7999 would match the declarations for a, b, c, and d.
8000 while
8001 varDecl(hasInitializer(integerLiteral()))
8002 only match the declaration for a.
8003 </pre></td></tr>
8006 <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>
8007 <tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
8008 parentheses are stripped off.
8010 Explicit casts are not discarded.
8011 Given
8012 int arr[5];
8013 int a = 0;
8014 char b = (0);
8015 const int c = a;
8016 int *d = (arr);
8017 long e = ((long) 0l);
8018 The matchers
8019 varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
8020 varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
8021 would match the declarations for a, b, c, and d, but not e.
8022 while
8023 varDecl(hasInitializer(integerLiteral()))
8024 varDecl(hasInitializer(declRefExpr()))
8025 would only match the declaration for a.
8026 </pre></td></tr>
8029 <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>
8030 <tr><td colspan="4" class="doc" id="ignoringParens1"><pre>Overload ignoringParens for Expr.
8032 Given
8033 const char* str = ("my-string");
8034 The matcher
8035 implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral())))
8036 would match the implicit cast resulting from the assignment.
8037 </pre></td></tr>
8040 <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>
8041 <tr><td colspan="4" class="doc" id="hasInClassInitializer0"><pre>Matches non-static data members that have an in-class initializer.
8043 Given
8044 class C {
8045 int a = 2;
8046 int b = 3;
8047 int c;
8049 fieldDecl(hasInClassInitializer(integerLiteral(equals(2))))
8050 matches 'int a;' but not 'int b;'.
8051 fieldDecl(hasInClassInitializer(anything()))
8052 matches 'int a;' and 'int b;' but not 'int c;'.
8053 </pre></td></tr>
8056 <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>
8057 <tr><td colspan="4" class="doc" id="hasBody1"><pre></pre></td></tr>
8060 <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>
8061 <tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
8062 switch statement or conditional operator.
8064 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
8065 if (true) {}
8066 </pre></td></tr>
8069 <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>
8070 <tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
8072 Example:
8073 forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
8074 matches '++x' in
8075 for (x; x &lt; N; ++x) { }
8076 </pre></td></tr>
8079 <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>
8080 <tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
8082 Example:
8083 forStmt(hasLoopInit(declStmt()))
8084 matches 'int x = 0' in
8085 for (int x = 0; x &lt; N; ++x) { }
8086 </pre></td></tr>
8089 <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>
8090 <tr><td colspan="4" class="doc" id="hasType6"><pre>Overloaded to match the declaration of the expression's or value
8091 declaration's type.
8093 In case of a value declaration (for example a variable declaration),
8094 this resolves one layer of indirection. For example, in the value
8095 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
8096 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
8097 declaration of x.
8099 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
8100 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
8101 and friend class X (matcher = friendDecl(hasType("X"))
8102 and public virtual X (matcher = cxxBaseSpecifier(hasType(
8103 cxxRecordDecl(hasName("X"))))
8104 class X {};
8105 void y(X &amp;x) { x; X z; }
8106 class Y { friend class X; };
8107 class Z : public virtual X {};
8109 Example matches class Derived
8110 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
8111 class Base {};
8112 class Derived : Base {};
8114 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;,
8115 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
8116 </pre></td></tr>
8119 <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>
8120 <tr><td colspan="4" class="doc" id="hasType1"><pre>Matches if the expression's or declaration's type matches a type
8121 matcher.
8123 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
8124 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
8125 and U (matcher = typedefDecl(hasType(asString("int")))
8126 and friend class X (matcher = friendDecl(hasType("X"))
8127 and public virtual X (matcher = cxxBaseSpecifier(hasType(
8128 asString("class X")))
8129 class X {};
8130 void y(X &amp;x) { x; X z; }
8131 typedef int U;
8132 class Y { friend class X; };
8133 class Z : public virtual X {};
8134 </pre></td></tr>
8137 <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>
8138 <tr><td colspan="4" class="doc" id="hasAnyBody0"><pre>Matches a function declaration that has a given body present in the AST.
8139 Note that this matcher matches all the declarations of a function whose
8140 body is present in the AST.
8142 Given
8143 void f();
8144 void f() {}
8145 void g();
8146 functionDecl(hasAnyBody(compoundStmt()))
8147 matches both 'void f();'
8148 and 'void f() {}'
8149 with compoundStmt()
8150 matching '{}'
8151 but does not match 'void g();'
8152 </pre></td></tr>
8155 <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>
8156 <tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function or an ObjC method declaration or a
8157 block.
8159 Does not match the 'this' parameter of a method.
8161 Given
8162 class X { void f(int x, int y, int z) {} };
8163 cxxMethodDecl(hasAnyParameter(hasName("y")))
8164 matches f(int x, int y, int z) {}
8165 with hasAnyParameter(...)
8166 matching int y
8168 For ObjectiveC, given
8169 @interface I - (void) f:(int) y; @end
8171 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
8172 matches the declaration of method f with hasParameter
8173 matching y.
8175 For blocks, given
8176 b = ^(int y) { printf("%d", y) };
8178 the matcher blockDecl(hasAnyParameter(hasName("y")))
8179 matches the declaration of the block b with hasParameter
8180 matching y.
8181 </pre></td></tr>
8184 <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>
8185 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
8186 functionDecl that have at least one TemplateArgument matching the given
8187 InnerMatcher.
8189 Given
8190 template&lt;typename T&gt; class A {};
8191 template&lt;&gt; class A&lt;double&gt; {};
8192 A&lt;int&gt; a;
8194 template&lt;typename T&gt; f() {};
8195 void func() { f&lt;int&gt;(); };
8197 classTemplateSpecializationDecl(hasAnyTemplateArgument(
8198 refersToType(asString("int"))))
8199 matches the specialization A&lt;int&gt;
8201 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
8202 matches the specialization f&lt;int&gt;
8203 </pre></td></tr>
8206 <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>
8207 <tr><td colspan="4" class="doc" id="hasBody4"><pre></pre></td></tr>
8210 <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>
8211 <tr><td colspan="4" class="doc" id="hasExplicitSpecifier0"><pre>Matches the expression in an explicit specifier if present in the given
8212 declaration.
8214 Given
8215 template&lt;bool b&gt;
8216 struct S {
8217 S(int); // #1
8218 explicit S(double); // #2
8219 operator int(); // #3
8220 explicit operator bool(); // #4
8221 explicit(false) S(bool) // # 7
8222 explicit(true) S(char) // # 8
8223 explicit(b) S(S) // # 9
8225 S(int) -&gt; S&lt;true&gt; // #5
8226 explicit S(double) -&gt; S&lt;false&gt; // #6
8227 cxxConstructorDecl(hasExplicitSpecifier(constantExpr())) will match #7, #8 and #9, but not #1 or #2.
8228 cxxConversionDecl(hasExplicitSpecifier(constantExpr())) will not match #3 or #4.
8229 cxxDeductionGuideDecl(hasExplicitSpecifier(constantExpr())) will not match #5 or #6.
8230 </pre></td></tr>
8233 <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>
8234 <tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function or an ObjC method
8235 declaration or a block.
8237 Given
8238 class X { void f(int x) {} };
8239 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
8240 matches f(int x) {}
8241 with hasParameter(...)
8242 matching int x
8244 For ObjectiveC, given
8245 @interface I - (void) f:(int) y; @end
8247 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
8248 matches the declaration of method f with hasParameter
8249 matching y.
8250 </pre></td></tr>
8253 <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>
8254 <tr><td colspan="4" class="doc" id="hasReturnTypeLoc0"><pre>Matches a function declared with the specified return `TypeLoc`.
8256 Given
8257 int f() { return 5; }
8258 void g() {}
8259 functionDecl(hasReturnTypeLoc(loc(asString("int"))))
8260 matches the declaration of `f`, but not `g`.
8261 </pre></td></tr>
8264 <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>
8265 <tr><td colspan="4" class="doc" id="hasTemplateArgument2"><pre>Matches classTemplateSpecializations, templateSpecializationType and
8266 functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
8268 Given
8269 template&lt;typename T, typename U&gt; class A {};
8270 A&lt;bool, int&gt; b;
8271 A&lt;int, bool&gt; c;
8273 template&lt;typename T&gt; void f() {}
8274 void func() { f&lt;int&gt;(); };
8275 classTemplateSpecializationDecl(hasTemplateArgument(
8276 1, refersToType(asString("int"))))
8277 matches the specialization A&lt;bool, int&gt;
8279 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
8280 matches the specialization f&lt;int&gt;
8281 </pre></td></tr>
8284 <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>
8285 <tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
8287 Given:
8288 class X { int f() { return 1; } };
8289 cxxMethodDecl(returns(asString("int")))
8290 matches int f() { return 1; }
8291 </pre></td></tr>
8294 <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>
8295 <tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
8296 switch statement or conditional operator.
8298 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
8299 if (true) {}
8300 </pre></td></tr>
8303 <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>
8304 <tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
8306 Given
8307 if (A* a = GetAPointer()) {}
8308 hasConditionVariableStatement(...)
8309 matches 'A* a = GetAPointer()'.
8310 </pre></td></tr>
8313 <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>
8314 <tr><td colspan="4" class="doc" id="hasElse0"><pre>Matches the else-statement of an if statement.
8316 Examples matches the if statement
8317 (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
8318 if (false) false; else true;
8319 </pre></td></tr>
8322 <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>
8323 <tr><td colspan="4" class="doc" id="hasInitStatement0"><pre>Matches selection statements with initializer.
8325 Given:
8326 void foo() {
8327 if (int i = foobar(); i &gt; 0) {}
8328 switch (int i = foobar(); i) {}
8329 for (auto&amp; a = get_range(); auto&amp; x : a) {}
8331 void bar() {
8332 if (foobar() &gt; 0) {}
8333 switch (foobar()) {}
8334 for (auto&amp; x : get_range()) {}
8336 ifStmt(hasInitStatement(anything()))
8337 matches the if statement in foo but not in bar.
8338 switchStmt(hasInitStatement(anything()))
8339 matches the switch statement in foo but not in bar.
8340 cxxForRangeStmt(hasInitStatement(anything()))
8341 matches the range for statement in foo but not in bar.
8342 </pre></td></tr>
8345 <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>
8346 <tr><td colspan="4" class="doc" id="hasThen0"><pre>Matches the then-statement of an if statement.
8348 Examples matches the if statement
8349 (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
8350 if (false) true; else false;
8351 </pre></td></tr>
8354 <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>
8355 <tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
8356 matcher.
8358 FIXME: Unit test this matcher
8359 </pre></td></tr>
8362 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1InitListExpr.html">InitListExpr</a>&gt;</td><td class="name" onclick="toggle('hasInit0')"><a name="hasInit0Anchor">hasInit</a></td><td>unsigned N, ast_matchers::Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
8363 <tr><td colspan="4" class="doc" id="hasInit0"><pre>Matches the n'th item of an initializer list expression.
8365 Example matches y.
8366 (matcher = initListExpr(hasInit(0, expr())))
8367 int x{y}.
8368 </pre></td></tr>
8371 <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>
8372 <tr><td colspan="4" class="doc" id="hasSyntacticForm0"><pre>Matches the syntactic form of init list expressions
8373 (if expression have it).
8374 </pre></td></tr>
8377 <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>
8378 <tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
8379 matches the given matcher.
8381 The associated declaration is:
8382 - for type nodes, the declaration of the underlying type
8383 - for CallExpr, the declaration of the callee
8384 - for MemberExpr, the declaration of the referenced member
8385 - for CXXConstructExpr, the declaration of the constructor
8386 - for CXXNewExpr, the declaration of the operator new
8387 - for ObjCIvarExpr, the declaration of the ivar
8389 For type nodes, hasDeclaration will generally match the declaration of the
8390 sugared type. Given
8391 class X {};
8392 typedef X Y;
8393 Y y;
8394 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8395 typedefDecl. A common use case is to match the underlying, desugared type.
8396 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8397 varDecl(hasType(hasUnqualifiedDesugaredType(
8398 recordType(hasDeclaration(decl())))))
8399 In this matcher, the decl will match the CXXRecordDecl of class X.
8401 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;,
8402 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;,
8403 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;,
8404 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;,
8405 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;,
8406 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;,
8407 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8408 </pre></td></tr>
8411 <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>
8412 <tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
8413 matches the given matcher.
8415 The associated declaration is:
8416 - for type nodes, the declaration of the underlying type
8417 - for CallExpr, the declaration of the callee
8418 - for MemberExpr, the declaration of the referenced member
8419 - for CXXConstructExpr, the declaration of the constructor
8420 - for CXXNewExpr, the declaration of the operator new
8421 - for ObjCIvarExpr, the declaration of the ivar
8423 For type nodes, hasDeclaration will generally match the declaration of the
8424 sugared type. Given
8425 class X {};
8426 typedef X Y;
8427 Y y;
8428 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8429 typedefDecl. A common use case is to match the underlying, desugared type.
8430 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8431 varDecl(hasType(hasUnqualifiedDesugaredType(
8432 recordType(hasDeclaration(decl())))))
8433 In this matcher, the decl will match the CXXRecordDecl of class X.
8435 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;,
8436 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;,
8437 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;,
8438 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;,
8439 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;,
8440 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;,
8441 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8442 </pre></td></tr>
8445 <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_1VarDecl.html">VarDecl</a>&gt; InnerMatcher</td></tr>
8446 <tr><td colspan="4" class="doc" id="capturesVar0"><pre>Matches a `LambdaCapture` that refers to the specified `VarDecl`. The
8447 `VarDecl` can be a separate variable that is captured by value or
8448 reference, or a synthesized variable if the capture has an initializer.
8450 Given
8451 void foo() {
8452 int x;
8453 auto f = [x](){};
8454 auto g = [x = 1](){};
8456 In the matcher
8457 lambdaExpr(hasAnyCapture(lambdaCapture(capturesVar(hasName("x")))),
8458 capturesVar(hasName("x")) matches `x` and `x = 1`.
8459 </pre></td></tr>
8462 <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>
8463 <tr><td colspan="4" class="doc" id="forEachLambdaCapture0"><pre>Matches each lambda capture in a lambda expression.
8465 Given
8466 int main() {
8467 int x, y;
8468 float z;
8469 auto f = [=]() { return x + y + z; };
8471 lambdaExpr(forEachLambdaCapture(
8472 lambdaCapture(capturesVar(varDecl(hasType(isInteger()))))))
8473 will trigger two matches, binding for 'x' and 'y' respectively.
8474 </pre></td></tr>
8477 <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>
8478 <tr><td colspan="4" class="doc" id="hasAnyCapture0"><pre>Matches any capture in a lambda expression.
8480 Given
8481 void foo() {
8482 int t = 5;
8483 auto f = [=](){ return t; };
8485 lambdaExpr(hasAnyCapture(lambdaCapture())) and
8486 lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t")))))
8487 both match `[=](){ return t; }`.
8488 </pre></td></tr>
8491 <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>
8492 <tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
8493 matches the given matcher.
8495 The associated declaration is:
8496 - for type nodes, the declaration of the underlying type
8497 - for CallExpr, the declaration of the callee
8498 - for MemberExpr, the declaration of the referenced member
8499 - for CXXConstructExpr, the declaration of the constructor
8500 - for CXXNewExpr, the declaration of the operator new
8501 - for ObjCIvarExpr, the declaration of the ivar
8503 For type nodes, hasDeclaration will generally match the declaration of the
8504 sugared type. Given
8505 class X {};
8506 typedef X Y;
8507 Y y;
8508 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8509 typedefDecl. A common use case is to match the underlying, desugared type.
8510 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8511 varDecl(hasType(hasUnqualifiedDesugaredType(
8512 recordType(hasDeclaration(decl())))))
8513 In this matcher, the decl will match the CXXRecordDecl of class X.
8515 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;,
8516 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;,
8517 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;,
8518 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;,
8519 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;,
8520 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;,
8521 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8522 </pre></td></tr>
8525 <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>
8526 <tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is matched by a
8527 given matcher. Implicit object expressions are included; that is, it matches
8528 use of implicit `this`.
8530 Given
8531 struct X {
8532 int m;
8533 int f(X x) { x.m; return m; }
8535 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
8536 matches `x.m`, but not `m`; however,
8537 memberExpr(hasObjectExpression(hasType(pointsTo(
8538 cxxRecordDecl(hasName("X"))))))
8539 matches `m` (aka. `this-&gt;m`), but not `x.m`.
8540 </pre></td></tr>
8543 <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>
8544 <tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
8545 given matcher.
8547 Given
8548 struct { int first, second; } first, second;
8549 int i(second.first);
8550 int j(first.second);
8551 memberExpr(member(hasName("first")))
8552 matches second.first
8553 but not first.second (because the member name there is "second").
8554 </pre></td></tr>
8557 <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>
8558 <tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
8559 pointee matches a given matcher.
8561 Given
8562 int *a;
8563 int const *b;
8564 float const *f;
8565 pointerType(pointee(isConstQualified(), isInteger()))
8566 matches "int const *b"
8568 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;,
8569 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;
8570 </pre></td></tr>
8573 <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>
8574 <tr><td colspan="4" class="doc" id="hasUnderlyingDecl0"><pre>Matches a NamedDecl whose underlying declaration matches the given
8575 matcher.
8577 Given
8578 namespace N { template&lt;class T&gt; void f(T t); }
8579 template &lt;class T&gt; void g() { using N::f; f(T()); }
8580 unresolvedLookupExpr(hasAnyDeclaration(
8581 namedDecl(hasUnderlyingDecl(hasName("::N::f")))))
8582 matches the use of f in g() .
8583 </pre></td></tr>
8586 <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>
8587 <tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
8589 Given
8590 struct A { struct B { struct C {}; }; };
8591 A::B::C c;
8592 nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
8593 matches "A::"
8594 </pre></td></tr>
8597 <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>
8598 <tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
8599 NestedNameSpecifier-matcher matches.
8600 </pre></td></tr>
8603 <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>
8604 <tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
8605 given TypeLoc.
8607 Given
8608 struct A { struct B { struct C {}; }; };
8609 A::B::C c;
8610 nestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
8611 hasDeclaration(cxxRecordDecl(hasName("A")))))))
8612 matches "A::"
8613 </pre></td></tr>
8616 <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>
8617 <tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
8619 Given
8620 struct A { struct B { struct C {}; }; };
8621 A::B::C c;
8622 nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
8623 matches "A::"
8624 </pre></td></tr>
8627 <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>
8628 <tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
8629 given namespace matcher.
8631 Given
8632 namespace ns { struct A {}; }
8633 ns::A a;
8634 nestedNameSpecifier(specifiesNamespace(hasName("ns")))
8635 matches "ns::"
8636 </pre></td></tr>
8639 <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>
8640 <tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
8641 given QualType matcher without qualifiers.
8643 Given
8644 struct A { struct B { struct C {}; }; };
8645 A::B::C c;
8646 nestedNameSpecifier(specifiesType(
8647 hasDeclaration(cxxRecordDecl(hasName("A")))
8649 matches "A::"
8650 </pre></td></tr>
8653 <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>
8654 <tr><td colspan="4" class="doc" id="hasAnyClause0"><pre>Matches any clause in an OpenMP directive.
8656 Given
8658 #pragma omp parallel
8659 #pragma omp parallel default(none)
8661 ``ompExecutableDirective(hasAnyClause(anything()))`` matches
8662 ``omp parallel default(none)``.
8663 </pre></td></tr>
8666 <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>
8667 <tr><td colspan="4" class="doc" id="hasStructuredBlock0"><pre>Matches the structured-block of the OpenMP executable directive
8669 Prerequisite: the executable directive must not be standalone directive.
8670 If it is, it will never match.
8672 Given
8674 #pragma omp parallel
8676 #pragma omp parallel
8679 ``ompExecutableDirective(hasStructuredBlock(nullStmt()))`` will match ``;``
8680 </pre></td></tr>
8683 <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>
8684 <tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Matches C++ classes that are directly or indirectly derived from a class
8685 matching Base, or Objective-C classes that directly or indirectly
8686 subclass a class matching Base.
8688 Note that a class is not considered to be derived from itself.
8690 Example matches Y, Z, C (Base == hasName("X"))
8691 class X;
8692 class Y : public X {}; // directly derived
8693 class Z : public Y {}; // indirectly derived
8694 typedef X A;
8695 typedef A B;
8696 class C : public B {}; // derived from a typedef of X
8698 In the following example, Bar matches isDerivedFrom(hasName("X")):
8699 class Foo;
8700 typedef Foo X;
8701 class Bar : public Foo {}; // derived from a type that X is a typedef of
8703 In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
8704 @interface NSObject @end
8705 @interface Bar : NSObject @end
8707 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;
8708 </pre></td></tr>
8711 <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>
8712 <tr><td colspan="4" class="doc" id="isDirectlyDerivedFrom1"><pre>Matches C++ or Objective-C classes that are directly derived from a class
8713 matching Base.
8715 Note that a class is not considered to be derived from itself.
8717 Example matches Y, C (Base == hasName("X"))
8718 class X;
8719 class Y : public X {}; // directly derived
8720 class Z : public Y {}; // indirectly derived
8721 typedef X A;
8722 typedef A B;
8723 class C : public B {}; // derived from a typedef of X
8725 In the following example, Bar matches isDerivedFrom(hasName("X")):
8726 class Foo;
8727 typedef Foo X;
8728 class Bar : public Foo {}; // derived from a type that X is a typedef of
8729 </pre></td></tr>
8732 <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>
8733 <tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Similar to isDerivedFrom(), but also matches classes that directly
8734 match Base.
8735 </pre></td></tr>
8738 <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>
8739 <tr><td colspan="4" class="doc" id="hasAnyArgument3"><pre>Matches any argument of a call expression or a constructor call
8740 expression, or an ObjC-message-send expression.
8742 Given
8743 void x(int, int, int) { int y; x(1, y, 42); }
8744 callExpr(hasAnyArgument(declRefExpr()))
8745 matches x(1, y, 42)
8746 with hasAnyArgument(...)
8747 matching y
8749 For ObjectiveC, given
8750 @interface I - (void) f:(int) y; @end
8751 void foo(I *i) { [i f:12]; }
8752 objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
8753 matches [i f:12]
8754 </pre></td></tr>
8757 <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>
8758 <tr><td colspan="4" class="doc" id="hasArgument3"><pre>Matches the n'th argument of a call expression or a constructor
8759 call expression.
8761 Example matches y in x(y)
8762 (matcher = callExpr(hasArgument(0, declRefExpr())))
8763 void x(int) { int y; x(y); }
8764 </pre></td></tr>
8767 <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>
8768 <tr><td colspan="4" class="doc" id="hasReceiver0"><pre>Matches if the Objective-C message is sent to an instance,
8769 and the inner matcher matches on that instance.
8771 For example the method call in
8772 NSString *x = @"hello";
8773 [x containsString:@"h"];
8774 is matched by
8775 objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
8776 </pre></td></tr>
8779 <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>
8780 <tr><td colspan="4" class="doc" id="hasReceiverType0"><pre>Matches on the receiver of an ObjectiveC Message expression.
8782 Example
8783 matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *")));
8784 matches the [webView ...] message invocation.
8785 NSString *webViewJavaScript = ...
8786 UIWebView *webView = ...
8787 [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
8788 </pre></td></tr>
8791 <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>
8792 <tr><td colspan="4" class="doc" id="hasAnyParameter1"><pre>Matches any parameter of a function or an ObjC method declaration or a
8793 block.
8795 Does not match the 'this' parameter of a method.
8797 Given
8798 class X { void f(int x, int y, int z) {} };
8799 cxxMethodDecl(hasAnyParameter(hasName("y")))
8800 matches f(int x, int y, int z) {}
8801 with hasAnyParameter(...)
8802 matching int y
8804 For ObjectiveC, given
8805 @interface I - (void) f:(int) y; @end
8807 the matcher objcMethodDecl(hasAnyParameter(hasName("y")))
8808 matches the declaration of method f with hasParameter
8809 matching y.
8811 For blocks, given
8812 b = ^(int y) { printf("%d", y) };
8814 the matcher blockDecl(hasAnyParameter(hasName("y")))
8815 matches the declaration of the block b with hasParameter
8816 matching y.
8817 </pre></td></tr>
8820 <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>
8821 <tr><td colspan="4" class="doc" id="hasParameter1"><pre>Matches the n'th parameter of a function or an ObjC method
8822 declaration or a block.
8824 Given
8825 class X { void f(int x) {} };
8826 cxxMethodDecl(hasParameter(0, hasType(varDecl())))
8827 matches f(int x) {}
8828 with hasParameter(...)
8829 matching int x
8831 For ObjectiveC, given
8832 @interface I - (void) f:(int) y; @end
8834 the matcher objcMethodDecl(hasParameter(0, hasName("y")))
8835 matches the declaration of method f with hasParameter
8836 matching y.
8837 </pre></td></tr>
8840 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ObjCPropertyDecl.html">ObjCPropertyDecl</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>
8841 <tr><td colspan="4" class="doc" id="hasTypeLoc11"><pre>Matches if the type location of a node matches the inner matcher.
8843 Examples:
8844 int x;
8845 declaratorDecl(hasTypeLoc(loc(asString("int"))))
8846 matches int x
8848 auto x = int(3);
8849 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
8850 matches int(3)
8852 struct Foo { Foo(int, int); };
8853 auto x = Foo(1, 2);
8854 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
8855 matches Foo(1, 2)
8857 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;,
8858 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;,
8859 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;,
8860 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
8861 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
8862 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;,
8863 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;,
8864 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
8865 </pre></td></tr>
8868 <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>
8869 <tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre>Matches if the cast's source expression
8870 or opaque value's source expression matches the given matcher.
8872 Example 1: matches "a string"
8873 (matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
8874 class URL { URL(string); };
8875 URL url = "a string";
8877 Example 2: matches 'b' (matcher =
8878 opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
8879 int a = b ?: 1;
8880 </pre></td></tr>
8883 <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>
8884 <tr><td colspan="4" class="doc" id="hasAnyDeclaration0"><pre>Matches an OverloadExpr if any of the declarations in the set of
8885 overloads matches the given matcher.
8887 Given
8888 template &lt;typename T&gt; void foo(T);
8889 template &lt;typename T&gt; void bar(T);
8890 template &lt;typename T&gt; void baz(T t) {
8891 foo(t);
8892 bar(t);
8894 unresolvedLookupExpr(hasAnyDeclaration(
8895 functionTemplateDecl(hasName("foo"))))
8896 matches foo in foo(t); but not bar in bar(t);
8897 </pre></td></tr>
8900 <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>
8901 <tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
8903 Given
8904 int (*ptr_to_array)[4];
8905 int (*ptr_to_func)(int);
8907 varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
8908 ptr_to_func but not ptr_to_array.
8910 Usable as: Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
8911 </pre></td></tr>
8914 <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>
8915 <tr><td colspan="4" class="doc" id="hasPointeeLoc0"><pre>Matches pointer `TypeLoc`s that have a pointee `TypeLoc` matching
8916 `PointeeMatcher`.
8918 Given
8919 int* x;
8920 pointerTypeLoc(hasPointeeLoc(loc(asString("int"))))
8921 matches `int*`.
8922 </pre></td></tr>
8925 <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>
8926 <tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
8927 pointee matches a given matcher.
8929 Given
8930 int *a;
8931 int const *b;
8932 float const *f;
8933 pointerType(pointee(isConstQualified(), isInteger()))
8934 matches "int const *b"
8936 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;,
8937 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;
8938 </pre></td></tr>
8941 <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>
8942 <tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
8944 Given:
8945 typedef int &amp;int_ref;
8946 int a;
8947 int_ref b = a;
8949 varDecl(hasType(qualType(referenceType()))))) will not match the
8950 declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
8951 </pre></td></tr>
8954 <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>
8955 <tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
8956 matches the given matcher.
8958 The associated declaration is:
8959 - for type nodes, the declaration of the underlying type
8960 - for CallExpr, the declaration of the callee
8961 - for MemberExpr, the declaration of the referenced member
8962 - for CXXConstructExpr, the declaration of the constructor
8963 - for CXXNewExpr, the declaration of the operator new
8964 - for ObjCIvarExpr, the declaration of the ivar
8966 For type nodes, hasDeclaration will generally match the declaration of the
8967 sugared type. Given
8968 class X {};
8969 typedef X Y;
8970 Y y;
8971 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
8972 typedefDecl. A common use case is to match the underlying, desugared type.
8973 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
8974 varDecl(hasType(hasUnqualifiedDesugaredType(
8975 recordType(hasDeclaration(decl())))))
8976 In this matcher, the decl will match the CXXRecordDecl of class X.
8978 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;,
8979 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;,
8980 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;,
8981 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;,
8982 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;,
8983 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;,
8984 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
8985 </pre></td></tr>
8988 <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>
8989 <tr><td colspan="4" class="doc" id="ignoringParens0"><pre>Matches types that match InnerMatcher after any parens are stripped.
8991 Given
8992 void (*fp)(void);
8993 The matcher
8994 varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
8995 would match the declaration for fp.
8996 </pre></td></tr>
8999 <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>
9000 <tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
9001 </pre></td></tr>
9004 <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>
9005 <tr><td colspan="4" class="doc" id="pointsTo0"><pre>Matches if the matched type is a pointer type and the pointee type
9006 matches the specified matcher.
9008 Example matches y-&gt;x()
9009 (matcher = cxxMemberCallExpr(on(hasType(pointsTo
9010 cxxRecordDecl(hasName("Y")))))))
9011 class Y { public: void x(); };
9012 void z() { Y *y; y-&gt;x(); }
9013 </pre></td></tr>
9016 <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>
9017 <tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
9018 </pre></td></tr>
9021 <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>
9022 <tr><td colspan="4" class="doc" id="references0"><pre>Matches if the matched type is a reference type and the referenced
9023 type matches the specified matcher.
9025 Example matches X &amp;x and const X &amp;y
9026 (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
9027 class X {
9028 void a(X b) {
9029 X &amp;x = b;
9030 const X &amp;y = b;
9033 </pre></td></tr>
9036 <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>
9037 <tr><td colspan="4" class="doc" id="hasUnqualifiedLoc0"><pre>Matches `QualifiedTypeLoc`s that have an unqualified `TypeLoc` matching
9038 `InnerMatcher`.
9040 Given
9041 int* const x;
9042 const int y;
9043 qualifiedTypeLoc(hasUnqualifiedLoc(pointerTypeLoc()))
9044 matches the `TypeLoc` of the variable declaration of `x`, but not `y`.
9045 </pre></td></tr>
9048 <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>
9049 <tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
9050 matches the given matcher.
9052 The associated declaration is:
9053 - for type nodes, the declaration of the underlying type
9054 - for CallExpr, the declaration of the callee
9055 - for MemberExpr, the declaration of the referenced member
9056 - for CXXConstructExpr, the declaration of the constructor
9057 - for CXXNewExpr, the declaration of the operator new
9058 - for ObjCIvarExpr, the declaration of the ivar
9060 For type nodes, hasDeclaration will generally match the declaration of the
9061 sugared type. Given
9062 class X {};
9063 typedef X Y;
9064 Y y;
9065 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9066 typedefDecl. A common use case is to match the underlying, desugared type.
9067 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9068 varDecl(hasType(hasUnqualifiedDesugaredType(
9069 recordType(hasDeclaration(decl())))))
9070 In this matcher, the decl will match the CXXRecordDecl of class X.
9072 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;,
9073 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;,
9074 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;,
9075 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;,
9076 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;,
9077 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;,
9078 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9079 </pre></td></tr>
9082 <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>
9083 <tr><td colspan="4" class="doc" id="hasReferentLoc0"><pre>Matches reference `TypeLoc`s that have a referent `TypeLoc` matching
9084 `ReferentMatcher`.
9086 Given
9087 int x = 3;
9088 int&amp; xx = x;
9089 referenceTypeLoc(hasReferentLoc(loc(asString("int"))))
9090 matches `int&amp;`.
9091 </pre></td></tr>
9094 <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>
9095 <tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
9096 pointee matches a given matcher.
9098 Given
9099 int *a;
9100 int const *b;
9101 float const *f;
9102 pointerType(pointee(isConstQualified(), isInteger()))
9103 matches "int const *b"
9105 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;,
9106 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;
9107 </pre></td></tr>
9110 <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>
9111 <tr><td colspan="4" class="doc" id="hasReturnValue0"><pre>Matches the return value expression of a return statement
9113 Given
9114 return a + b;
9115 hasReturnValue(binaryOperator())
9116 matches 'return a + b'
9117 with binaryOperator()
9118 matching 'a + b'
9119 </pre></td></tr>
9122 <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>
9123 <tr><td colspan="4" class="doc" id="hasAnySubstatement1"><pre>Matches compound statements where at least one substatement matches
9124 a given matcher. Also matches StmtExprs that have CompoundStmt as children.
9126 Given
9127 { {}; 1+2; }
9128 hasAnySubstatement(compoundStmt())
9129 matches '{ {}; 1+2; }'
9130 with compoundStmt()
9131 matching '{}'
9132 </pre></td></tr>
9135 <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>
9136 <tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
9137 alignof.
9138 </pre></td></tr>
9141 <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>
9142 <tr><td colspan="4" class="doc" id="forCallable0"><pre>Matches declaration of the function, method, or block the statement
9143 belongs to.
9145 Given:
9146 F&amp; operator=(const F&amp; o) {
9147 std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
9148 return *this;
9150 returnStmt(forCallable(functionDecl(hasName("operator="))))
9151 matches 'return *this'
9152 but does not match 'return v &gt; 0'
9154 Given:
9155 -(void) foo {
9156 int x = 1;
9157 dispatch_sync(queue, ^{ int y = 2; });
9159 declStmt(forCallable(objcMethodDecl()))
9160 matches 'int x = 1'
9161 but does not match 'int y = 2'.
9162 whereas declStmt(forCallable(blockDecl()))
9163 matches 'int y = 2'
9164 but does not match 'int x = 1'.
9165 </pre></td></tr>
9168 <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>
9169 <tr><td colspan="4" class="doc" id="forFunction0"><pre>Matches declaration of the function the statement belongs to.
9171 Deprecated. Use forCallable() to correctly handle the situation when
9172 the declaration is not a function (but a block or an Objective-C method).
9173 forFunction() not only fails to take non-functions into account but also
9174 may match the wrong declaration in their presence.
9176 Given:
9177 F&amp; operator=(const F&amp; o) {
9178 std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v &gt; 0; });
9179 return *this;
9181 returnStmt(forFunction(hasName("operator=")))
9182 matches 'return *this'
9183 but does not match 'return v &gt; 0'
9184 </pre></td></tr>
9187 <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>
9188 <tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
9189 sizeof.
9190 </pre></td></tr>
9193 <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>
9194 <tr><td colspan="4" class="doc" id="hasReplacementType0"><pre>Matches template type parameter substitutions that have a replacement
9195 type that matches the provided matcher.
9197 Given
9198 template &lt;typename T&gt;
9199 double F(T t);
9200 int i;
9201 double j = F(i);
9203 substTemplateTypeParmType(hasReplacementType(type())) matches int
9204 </pre></td></tr>
9207 <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>
9208 <tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
9209 statement. This matcher may produce multiple matches.
9211 Given
9212 switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
9213 switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
9214 matches four times, with "c" binding each of "case 1:", "case 2:",
9215 "case 3:" and "case 4:", and "s" respectively binding "switch (1)",
9216 "switch (1)", "switch (2)" and "switch (2)".
9217 </pre></td></tr>
9220 <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>
9221 <tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
9222 switch statement or conditional operator.
9224 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
9225 if (true) {}
9226 </pre></td></tr>
9229 <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>
9230 <tr><td colspan="4" class="doc" id="hasInitStatement1"><pre>Matches selection statements with initializer.
9232 Given:
9233 void foo() {
9234 if (int i = foobar(); i &gt; 0) {}
9235 switch (int i = foobar(); i) {}
9236 for (auto&amp; a = get_range(); auto&amp; x : a) {}
9238 void bar() {
9239 if (foobar() &gt; 0) {}
9240 switch (foobar()) {}
9241 for (auto&amp; x : get_range()) {}
9243 ifStmt(hasInitStatement(anything()))
9244 matches the if statement in foo but not in bar.
9245 switchStmt(hasInitStatement(anything()))
9246 matches the switch statement in foo but not in bar.
9247 cxxForRangeStmt(hasInitStatement(anything()))
9248 matches the range for statement in foo but not in bar.
9249 </pre></td></tr>
9252 <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>
9253 <tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
9254 matches the given matcher.
9256 The associated declaration is:
9257 - for type nodes, the declaration of the underlying type
9258 - for CallExpr, the declaration of the callee
9259 - for MemberExpr, the declaration of the referenced member
9260 - for CXXConstructExpr, the declaration of the constructor
9261 - for CXXNewExpr, the declaration of the operator new
9262 - for ObjCIvarExpr, the declaration of the ivar
9264 For type nodes, hasDeclaration will generally match the declaration of the
9265 sugared type. Given
9266 class X {};
9267 typedef X Y;
9268 Y y;
9269 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9270 typedefDecl. A common use case is to match the underlying, desugared type.
9271 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9272 varDecl(hasType(hasUnqualifiedDesugaredType(
9273 recordType(hasDeclaration(decl())))))
9274 In this matcher, the decl will match the CXXRecordDecl of class X.
9276 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;,
9277 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;,
9278 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;,
9279 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;,
9280 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;,
9281 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;,
9282 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9283 </pre></td></tr>
9286 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html">TemplateArgumentLoc</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>
9287 <tr><td colspan="4" class="doc" id="hasTypeLoc12"><pre>Matches if the type location of a node matches the inner matcher.
9289 Examples:
9290 int x;
9291 declaratorDecl(hasTypeLoc(loc(asString("int"))))
9292 matches int x
9294 auto x = int(3);
9295 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
9296 matches int(3)
9298 struct Foo { Foo(int, int); };
9299 auto x = Foo(1, 2);
9300 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
9301 matches Foo(1, 2)
9303 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;,
9304 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;,
9305 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;,
9306 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
9307 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
9308 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;,
9309 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;,
9310 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
9311 </pre></td></tr>
9314 <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>
9315 <tr><td colspan="4" class="doc" id="isExpr0"><pre>Matches a sugar TemplateArgument that refers to a certain expression.
9317 Given
9318 struct B { int next; };
9319 template&lt;int(B::*next_ptr)&gt; struct A {};
9320 A&lt;&amp;B::next&gt; a;
9321 templateSpecializationType(hasAnyTemplateArgument(
9322 isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
9323 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
9324 B::next
9325 </pre></td></tr>
9328 <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>
9329 <tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a canonical TemplateArgument that refers to a certain
9330 declaration.
9332 Given
9333 struct B { int next; };
9334 template&lt;int(B::*next_ptr)&gt; struct A {};
9335 A&lt;&amp;B::next&gt; a;
9336 classTemplateSpecializationDecl(hasAnyTemplateArgument(
9337 refersToDeclaration(fieldDecl(hasName("next")))))
9338 matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
9339 B::next
9340 </pre></td></tr>
9343 <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>
9344 <tr><td colspan="4" class="doc" id="refersToIntegralType0"><pre>Matches a TemplateArgument that refers to an integral type.
9346 Given
9347 template&lt;int T&gt; struct C {};
9348 C&lt;42&gt; c;
9349 classTemplateSpecializationDecl(
9350 hasAnyTemplateArgument(refersToIntegralType(asString("int"))))
9351 matches the implicit instantiation of C in C&lt;42&gt;.
9352 </pre></td></tr>
9355 <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>
9356 <tr><td colspan="4" class="doc" id="refersToTemplate0"><pre>Matches a TemplateArgument that refers to a certain template.
9358 Given
9359 template&lt;template &lt;typename&gt; class S&gt; class X {};
9360 template&lt;typename T&gt; class Y {};
9361 X&lt;Y&gt; xi;
9362 classTemplateSpecializationDecl(hasAnyTemplateArgument(
9363 refersToTemplate(templateName())))
9364 matches the specialization X&lt;Y&gt;
9365 </pre></td></tr>
9368 <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>
9369 <tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
9371 Given
9372 struct X {};
9373 template&lt;typename T&gt; struct A {};
9374 A&lt;X&gt; a;
9375 classTemplateSpecializationDecl(hasAnyTemplateArgument(
9376 refersToType(class(hasName("X")))))
9377 matches the specialization A&lt;X&gt;
9378 </pre></td></tr>
9381 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationTypeLoc.html">TemplateSpecializationTypeLoc</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>
9382 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgumentLoc0"><pre>Matches template specialization `TypeLoc`s that have at least one
9383 `TemplateArgumentLoc` matching the given `InnerMatcher`.
9385 Given
9386 template&lt;typename T&gt; class A {};
9387 A&lt;int&gt; a;
9388 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc(
9389 hasTypeLoc(loc(asString("int")))))))
9390 matches `A&lt;int&gt; a`.
9391 </pre></td></tr>
9394 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationTypeLoc.html">TemplateSpecializationTypeLoc</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>
9395 <tr><td colspan="4" class="doc" id="hasTemplateArgumentLoc1"><pre>Matches template specialization `TypeLoc`s where the n'th
9396 `TemplateArgumentLoc` matches the given `InnerMatcher`.
9398 Given
9399 template&lt;typename T, typename U&gt; class A {};
9400 A&lt;double, int&gt; b;
9401 A&lt;int, double&gt; c;
9402 varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0,
9403 hasTypeLoc(loc(asString("double")))))))
9404 matches `A&lt;double, int&gt; b`, but not `A&lt;int, double&gt; c`.
9405 </pre></td></tr>
9408 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('hasAnyTemplateArgument1')"><a name="hasAnyTemplateArgument1Anchor">hasAnyTemplateArgument</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
9409 <tr><td colspan="4" class="doc" id="hasAnyTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
9410 functionDecl that have at least one TemplateArgument matching the given
9411 InnerMatcher.
9413 Given
9414 template&lt;typename T&gt; class A {};
9415 template&lt;&gt; class A&lt;double&gt; {};
9416 A&lt;int&gt; a;
9418 template&lt;typename T&gt; f() {};
9419 void func() { f&lt;int&gt;(); };
9421 classTemplateSpecializationDecl(hasAnyTemplateArgument(
9422 refersToType(asString("int"))))
9423 matches the specialization A&lt;int&gt;
9425 functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
9426 matches the specialization f&lt;int&gt;
9427 </pre></td></tr>
9430 <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>
9431 <tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
9432 matches the given matcher.
9434 The associated declaration is:
9435 - for type nodes, the declaration of the underlying type
9436 - for CallExpr, the declaration of the callee
9437 - for MemberExpr, the declaration of the referenced member
9438 - for CXXConstructExpr, the declaration of the constructor
9439 - for CXXNewExpr, the declaration of the operator new
9440 - for ObjCIvarExpr, the declaration of the ivar
9442 For type nodes, hasDeclaration will generally match the declaration of the
9443 sugared type. Given
9444 class X {};
9445 typedef X Y;
9446 Y y;
9447 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9448 typedefDecl. A common use case is to match the underlying, desugared type.
9449 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9450 varDecl(hasType(hasUnqualifiedDesugaredType(
9451 recordType(hasDeclaration(decl())))))
9452 In this matcher, the decl will match the CXXRecordDecl of class X.
9454 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;,
9455 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;,
9456 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;,
9457 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;,
9458 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;,
9459 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;,
9460 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9461 </pre></td></tr>
9464 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;</td><td class="name" onclick="toggle('hasTemplateArgument1')"><a name="hasTemplateArgument1Anchor">hasTemplateArgument</a></td><td>unsigned N, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
9465 <tr><td colspan="4" class="doc" id="hasTemplateArgument1"><pre>Matches classTemplateSpecializations, templateSpecializationType and
9466 functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
9468 Given
9469 template&lt;typename T, typename U&gt; class A {};
9470 A&lt;bool, int&gt; b;
9471 A&lt;int, bool&gt; c;
9473 template&lt;typename T&gt; void f() {}
9474 void func() { f&lt;int&gt;(); };
9475 classTemplateSpecializationDecl(hasTemplateArgument(
9476 1, refersToType(asString("int"))))
9477 matches the specialization A&lt;bool, int&gt;
9479 functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
9480 matches the specialization f&lt;int&gt;
9481 </pre></td></tr>
9484 <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>
9485 <tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
9486 matches the given matcher.
9488 The associated declaration is:
9489 - for type nodes, the declaration of the underlying type
9490 - for CallExpr, the declaration of the callee
9491 - for MemberExpr, the declaration of the referenced member
9492 - for CXXConstructExpr, the declaration of the constructor
9493 - for CXXNewExpr, the declaration of the operator new
9494 - for ObjCIvarExpr, the declaration of the ivar
9496 For type nodes, hasDeclaration will generally match the declaration of the
9497 sugared type. Given
9498 class X {};
9499 typedef X Y;
9500 Y y;
9501 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9502 typedefDecl. A common use case is to match the underlying, desugared type.
9503 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9504 varDecl(hasType(hasUnqualifiedDesugaredType(
9505 recordType(hasDeclaration(decl())))))
9506 In this matcher, the decl will match the CXXRecordDecl of class X.
9508 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;,
9509 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;,
9510 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;,
9511 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;,
9512 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;,
9513 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;,
9514 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9515 </pre></td></tr>
9518 <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>
9519 <tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
9520 QualType-matcher matches.
9521 </pre></td></tr>
9524 <tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc13')"><a name="hasTypeLoc13Anchor">hasTypeLoc</a></td><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
9525 <tr><td colspan="4" class="doc" id="hasTypeLoc13"><pre>Matches if the type location of a node matches the inner matcher.
9527 Examples:
9528 int x;
9529 declaratorDecl(hasTypeLoc(loc(asString("int"))))
9530 matches int x
9532 auto x = int(3);
9533 cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
9534 matches int(3)
9536 struct Foo { Foo(int, int); };
9537 auto x = Foo(1, 2);
9538 cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
9539 matches Foo(1, 2)
9541 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;,
9542 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;,
9543 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;,
9544 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;,
9545 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;, Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;,
9546 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;,
9547 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;,
9548 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html">TypedefNameDecl</a>&gt;
9549 </pre></td></tr>
9552 <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>
9553 <tr><td colspan="4" class="doc" id="hasType2"><pre>Matches if the expression's or declaration's type matches a type
9554 matcher.
9556 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
9557 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
9558 and U (matcher = typedefDecl(hasType(asString("int")))
9559 and friend class X (matcher = friendDecl(hasType("X"))
9560 and public virtual X (matcher = cxxBaseSpecifier(hasType(
9561 asString("class X")))
9562 class X {};
9563 void y(X &amp;x) { x; X z; }
9564 typedef int U;
9565 class Y { friend class X; };
9566 class Z : public virtual X {};
9567 </pre></td></tr>
9570 <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>
9571 <tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
9572 matches the given matcher.
9574 The associated declaration is:
9575 - for type nodes, the declaration of the underlying type
9576 - for CallExpr, the declaration of the callee
9577 - for MemberExpr, the declaration of the referenced member
9578 - for CXXConstructExpr, the declaration of the constructor
9579 - for CXXNewExpr, the declaration of the operator new
9580 - for ObjCIvarExpr, the declaration of the ivar
9582 For type nodes, hasDeclaration will generally match the declaration of the
9583 sugared type. Given
9584 class X {};
9585 typedef X Y;
9586 Y y;
9587 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9588 typedefDecl. A common use case is to match the underlying, desugared type.
9589 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9590 varDecl(hasType(hasUnqualifiedDesugaredType(
9591 recordType(hasDeclaration(decl())))))
9592 In this matcher, the decl will match the CXXRecordDecl of class X.
9594 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;,
9595 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;,
9596 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;,
9597 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;,
9598 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;,
9599 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;,
9600 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9601 </pre></td></tr>
9604 <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>
9605 <tr><td colspan="4" class="doc" id="hasUnqualifiedDesugaredType0"><pre>Matches if the matched type matches the unqualified desugared
9606 type of the matched node.
9608 For example, in:
9609 class A {};
9610 using B = A;
9611 The matcher type(hasUnqualifiedDesugaredType(recordType())) matches
9612 both B and A.
9613 </pre></td></tr>
9616 <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>
9617 <tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
9619 Given
9620 int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
9621 unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
9622 matches sizeof(a) and alignof(c)
9623 </pre></td></tr>
9626 <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>
9627 <tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
9629 Example matches true (matcher = hasUnaryOperand(
9630 cxxBoolLiteral(equals(true))))
9631 !true
9632 </pre></td></tr>
9635 <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>
9636 <tr><td colspan="4" class="doc" id="hasObjectExpression1"><pre>Matches a member expression where the object expression is matched by a
9637 given matcher. Implicit object expressions are included; that is, it matches
9638 use of implicit `this`.
9640 Given
9641 struct X {
9642 int m;
9643 int f(X x) { x.m; return m; }
9645 memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
9646 matches `x.m`, but not `m`; however,
9647 memberExpr(hasObjectExpression(hasType(pointsTo(
9648 cxxRecordDecl(hasName("X"))))))
9649 matches `m` (aka. `this-&gt;m`), but not `x.m`.
9650 </pre></td></tr>
9653 <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>
9654 <tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
9655 matches the given matcher.
9657 The associated declaration is:
9658 - for type nodes, the declaration of the underlying type
9659 - for CallExpr, the declaration of the callee
9660 - for MemberExpr, the declaration of the referenced member
9661 - for CXXConstructExpr, the declaration of the constructor
9662 - for CXXNewExpr, the declaration of the operator new
9663 - for ObjCIvarExpr, the declaration of the ivar
9665 For type nodes, hasDeclaration will generally match the declaration of the
9666 sugared type. Given
9667 class X {};
9668 typedef X Y;
9669 Y y;
9670 in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
9671 typedefDecl. A common use case is to match the underlying, desugared type.
9672 This can be achieved by using the hasUnqualifiedDesugaredType matcher:
9673 varDecl(hasType(hasUnqualifiedDesugaredType(
9674 recordType(hasDeclaration(decl())))))
9675 In this matcher, the decl will match the CXXRecordDecl of class X.
9677 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;,
9678 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;,
9679 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;,
9680 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;,
9681 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;,
9682 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;,
9683 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
9684 </pre></td></tr>
9687 <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>
9688 <tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
9689 matched by the given matcher.
9691 Given
9692 namespace X { int a; void b(); }
9693 using X::a;
9694 using X::b;
9695 usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
9696 matches using X::b but not using X::a </pre></td></tr>
9699 <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>
9700 <tr><td colspan="4" class="doc" id="hasUnderlyingType1"><pre>Matches DecltypeType or UsingType nodes to find the underlying type.
9702 Given
9703 decltype(1) a = 1;
9704 decltype(2.0) b = 2.0;
9705 decltypeType(hasUnderlyingType(isInteger()))
9706 matches the type of "a"
9708 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;
9709 </pre></td></tr>
9712 <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>
9713 <tr><td colspan="4" class="doc" id="throughUsingDecl1"><pre>Matches if a node refers to a declaration through a specific
9714 using shadow declaration.
9716 Examples:
9717 namespace a { int f(); }
9718 using a::f;
9719 int x = f();
9720 declRefExpr(throughUsingDecl(anything()))
9721 matches f
9723 namespace a { class X{}; }
9724 using a::X;
9725 X x;
9726 typeLoc(loc(usingType(throughUsingDecl(anything()))))
9727 matches X
9729 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;
9730 </pre></td></tr>
9733 <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>
9734 <tr><td colspan="4" class="doc" id="hasType7"><pre>Overloaded to match the declaration of the expression's or value
9735 declaration's type.
9737 In case of a value declaration (for example a variable declaration),
9738 this resolves one layer of indirection. For example, in the value
9739 declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
9740 X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
9741 declaration of x.
9743 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
9744 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
9745 and friend class X (matcher = friendDecl(hasType("X"))
9746 and public virtual X (matcher = cxxBaseSpecifier(hasType(
9747 cxxRecordDecl(hasName("X"))))
9748 class X {};
9749 void y(X &amp;x) { x; X z; }
9750 class Y { friend class X; };
9751 class Z : public virtual X {};
9753 Example matches class Derived
9754 (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
9755 class Base {};
9756 class Derived : Base {};
9758 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;,
9759 Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html">CXXBaseSpecifier</a>&gt;
9760 </pre></td></tr>
9763 <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>
9764 <tr><td colspan="4" class="doc" id="hasType3"><pre>Matches if the expression's or declaration's type matches a type
9765 matcher.
9767 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
9768 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
9769 and U (matcher = typedefDecl(hasType(asString("int")))
9770 and friend class X (matcher = friendDecl(hasType("X"))
9771 and public virtual X (matcher = cxxBaseSpecifier(hasType(
9772 asString("class X")))
9773 class X {};
9774 void y(X &amp;x) { x; X z; }
9775 typedef int U;
9776 class Y { friend class X; };
9777 class Z : public virtual X {};
9778 </pre></td></tr>
9781 <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>
9782 <tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
9783 that matches the given matcher.
9785 Example matches x (matcher = varDecl(hasInitializer(callExpr())))
9786 bool y() { return true; }
9787 bool x = y();
9788 </pre></td></tr>
9791 <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>
9792 <tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
9793 expression.
9795 Given
9796 void f(int b) {
9797 int a[b];
9799 variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
9800 varDecl(hasName("b")))))))
9801 matches "int a[b]"
9802 </pre></td></tr>
9805 <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>
9806 <tr><td colspan="4" class="doc" id="hasBody2"><pre></pre></td></tr>
9809 <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>
9810 <tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
9811 switch statement or conditional operator.
9813 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
9814 if (true) {}
9815 </pre></td></tr>
9817 <!--END_TRAVERSAL_MATCHERS -->
9818 </table>
9820 </div>
9821 </body>
9822 </html>