xref: /minix3/external/bsd/llvm/dist/clang/docs/LibASTMatchersReference.html (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2*f4a2713aSLionel Sambuc          "http://www.w3.org/TR/html4/strict.dtd">
3*f4a2713aSLionel Sambuc<html>
4*f4a2713aSLionel Sambuc<head>
5*f4a2713aSLionel Sambuc<title>AST Matcher Reference</title>
6*f4a2713aSLionel Sambuc<link type="text/css" rel="stylesheet" href="../menu.css" />
7*f4a2713aSLionel Sambuc<link type="text/css" rel="stylesheet" href="../content.css" />
8*f4a2713aSLionel Sambuc<style type="text/css">
9*f4a2713aSLionel Sambuctd {
10*f4a2713aSLionel Sambuc  padding: .33em;
11*f4a2713aSLionel Sambuc}
12*f4a2713aSLionel Sambuctd.doc {
13*f4a2713aSLionel Sambuc  display: none;
14*f4a2713aSLionel Sambuc  border-bottom: 1px solid black;
15*f4a2713aSLionel Sambuc}
16*f4a2713aSLionel Sambuctd.name:hover {
17*f4a2713aSLionel Sambuc  color: blue;
18*f4a2713aSLionel Sambuc  cursor: pointer;
19*f4a2713aSLionel Sambuc}
20*f4a2713aSLionel Sambuc</style>
21*f4a2713aSLionel Sambuc<script type="text/javascript">
22*f4a2713aSLionel Sambucfunction toggle(id) {
23*f4a2713aSLionel Sambuc  if (!id) return;
24*f4a2713aSLionel Sambuc  row = document.getElementById(id);
25*f4a2713aSLionel Sambuc  if (row.style.display != 'table-cell')
26*f4a2713aSLionel Sambuc    row.style.display = 'table-cell';
27*f4a2713aSLionel Sambuc  else
28*f4a2713aSLionel Sambuc    row.style.display = 'none';
29*f4a2713aSLionel Sambuc}
30*f4a2713aSLionel Sambuc</script>
31*f4a2713aSLionel Sambuc</head>
32*f4a2713aSLionel Sambuc<body onLoad="toggle(location.hash.substring(1, location.hash.length - 6))">
33*f4a2713aSLionel Sambuc
34*f4a2713aSLionel Sambuc<!--#include virtual="../menu.html.incl"-->
35*f4a2713aSLionel Sambuc
36*f4a2713aSLionel Sambuc<div id="content">
37*f4a2713aSLionel Sambuc
38*f4a2713aSLionel Sambuc<h1>AST Matcher Reference</h1>
39*f4a2713aSLionel Sambuc
40*f4a2713aSLionel Sambuc<p>This document shows all currently implemented matchers. The matchers are grouped
41*f4a2713aSLionel Sambucby category and node type they match. You can click on matcher names to show the
42*f4a2713aSLionel Sambucmatcher's source documentation.</p>
43*f4a2713aSLionel Sambuc
44*f4a2713aSLionel Sambuc<p>There are three different basic categories of matchers:
45*f4a2713aSLionel Sambuc<ul>
46*f4a2713aSLionel Sambuc<li><a href="#decl-matchers">Node Matchers:</a> Matchers that match a specific type of AST node.</li>
47*f4a2713aSLionel Sambuc<li><a href="#narrowing-matchers">Narrowing Matchers:</a> Matchers that match attributes on AST nodes.</li>
48*f4a2713aSLionel Sambuc<li><a href="#traversal-matchers">Traversal Matchers:</a> Matchers that allow traversal between AST nodes.</li>
49*f4a2713aSLionel Sambuc</ul>
50*f4a2713aSLionel Sambuc</p>
51*f4a2713aSLionel Sambuc
52*f4a2713aSLionel Sambuc<p>Within each category the matchers are ordered by node type they match on.
53*f4a2713aSLionel SambucNote that if a matcher can match multiple node types, it will it will appear
54*f4a2713aSLionel Sambucmultiple times. This means that by searching for Matcher&lt;Stmt&gt; you can
55*f4a2713aSLionel Sambucfind all matchers that can be used to match on Stmt nodes.</p>
56*f4a2713aSLionel Sambuc
57*f4a2713aSLionel Sambuc<p>The exception to that rule are matchers that can match on any node. Those
58*f4a2713aSLionel Sambucare marked with a * and are listed in the beginning of each category.</p>
59*f4a2713aSLionel Sambuc
60*f4a2713aSLionel Sambuc<p>Note that the categorization of matchers is a great help when you combine
61*f4a2713aSLionel Sambucthem into matcher expressions. You will usually want to form matcher expressions
62*f4a2713aSLionel Sambucthat read like english sentences by alternating between node matchers and
63*f4a2713aSLionel Sambucnarrowing or traversal matchers, like this:
64*f4a2713aSLionel Sambuc<pre>
65*f4a2713aSLionel SambucrecordDecl(hasDescendant(
66*f4a2713aSLionel Sambuc    ifStmt(hasTrueExpression(
67*f4a2713aSLionel Sambuc        expr(hasDescendant(
68*f4a2713aSLionel Sambuc            ifStmt()))))))
69*f4a2713aSLionel Sambuc</pre>
70*f4a2713aSLionel Sambuc</p>
71*f4a2713aSLionel Sambuc
72*f4a2713aSLionel Sambuc<!-- ======================================================================= -->
73*f4a2713aSLionel Sambuc<h2 id="decl-matchers">Node Matchers</h2>
74*f4a2713aSLionel Sambuc<!-- ======================================================================= -->
75*f4a2713aSLionel Sambuc
76*f4a2713aSLionel Sambuc<p>Node matchers are at the core of matcher expressions - they specify the type
77*f4a2713aSLionel Sambucof node that is expected. Every match expression starts with a node matcher,
78*f4a2713aSLionel Sambucwhich can then be further refined with a narrowing or traversal matcher. All
79*f4a2713aSLionel Sambuctraversal matchers take node matchers as their arguments.</p>
80*f4a2713aSLionel Sambuc
81*f4a2713aSLionel Sambuc<p>For convenience, all node matchers take an arbitrary number of arguments
82*f4a2713aSLionel Sambucand implicitly act as allOf matchers.</p>
83*f4a2713aSLionel Sambuc
84*f4a2713aSLionel Sambuc<p>Node matchers are the only matchers that support the bind("id") call to
85*f4a2713aSLionel Sambucbind the matched node to the given string, to be later retrieved from the
86*f4a2713aSLionel Sambucmatch callback.</p>
87*f4a2713aSLionel Sambuc
88*f4a2713aSLionel Sambuc<p>It is important to remember that the arguments to node matchers are
89*f4a2713aSLionel Sambucpredicates on the same node, just with additional information about the type.
90*f4a2713aSLionel SambucThis is often useful to make matcher expression more readable by inlining bind
91*f4a2713aSLionel Sambuccalls into redundant node matchers inside another node matcher:
92*f4a2713aSLionel Sambuc<pre>
93*f4a2713aSLionel Sambuc// This binds the CXXRecordDecl to "id", as the decl() matcher will stay on
94*f4a2713aSLionel Sambuc// the same node.
95*f4a2713aSLionel SambucrecordDecl(decl().bind("id"), hasName("::MyClass"))
96*f4a2713aSLionel Sambuc</pre>
97*f4a2713aSLionel Sambuc</p>
98*f4a2713aSLionel Sambuc
99*f4a2713aSLionel Sambuc<table>
100*f4a2713aSLionel Sambuc<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
101*f4a2713aSLionel Sambuc<!-- START_DECL_MATCHERS -->
102*f4a2713aSLionel Sambuc
103*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;</td><td class="name" onclick="toggle('ctorInitializer0')"><a name="ctorInitializer0Anchor">ctorInitializer</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt;...</td></tr>
104*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="ctorInitializer0"><pre>Matches constructor initializers.
105*f4a2713aSLionel Sambuc
106*f4a2713aSLionel SambucExamples matches i(42).
107*f4a2713aSLionel Sambuc  class C {
108*f4a2713aSLionel Sambuc    C() : i(42) {}
109*f4a2713aSLionel Sambuc    int i;
110*f4a2713aSLionel Sambuc  };
111*f4a2713aSLionel Sambuc</pre></td></tr>
112*f4a2713aSLionel Sambuc
113*f4a2713aSLionel Sambuc
114*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1AccessSpecDecl.html">AccessSpecDecl</a>&gt;...</td></tr>
115*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="accessSpecDecl0"><pre>Matches C++ access specifier declarations.
116*f4a2713aSLionel Sambuc
117*f4a2713aSLionel SambucGiven
118*f4a2713aSLionel Sambuc  class C {
119*f4a2713aSLionel Sambuc  public:
120*f4a2713aSLionel Sambuc    int a;
121*f4a2713aSLionel Sambuc  };
122*f4a2713aSLionel SambucaccessSpecDecl()
123*f4a2713aSLionel Sambuc  matches 'public:'
124*f4a2713aSLionel Sambuc</pre></td></tr>
125*f4a2713aSLionel Sambuc
126*f4a2713aSLionel Sambuc
127*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateDecl.html">ClassTemplateDecl</a>&gt;...</td></tr>
128*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="classTemplateDecl0"><pre>Matches C++ class template declarations.
129*f4a2713aSLionel Sambuc
130*f4a2713aSLionel SambucExample matches Z
131*f4a2713aSLionel Sambuc  template&lt;class T&gt; class Z {};
132*f4a2713aSLionel Sambuc</pre></td></tr>
133*f4a2713aSLionel Sambuc
134*f4a2713aSLionel Sambuc
135*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>&gt;...</td></tr>
136*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="classTemplateSpecializationDecl0"><pre>Matches C++ class template specializations.
137*f4a2713aSLionel Sambuc
138*f4a2713aSLionel SambucGiven
139*f4a2713aSLionel Sambuc  template&lt;typename T&gt; class A {};
140*f4a2713aSLionel Sambuc  template&lt;&gt; class A&lt;double&gt; {};
141*f4a2713aSLionel Sambuc  A&lt;int&gt; a;
142*f4a2713aSLionel SambucclassTemplateSpecializationDecl()
143*f4a2713aSLionel Sambuc  matches the specializations A&lt;int&gt; and A&lt;double&gt;
144*f4a2713aSLionel Sambuc</pre></td></tr>
145*f4a2713aSLionel Sambuc
146*f4a2713aSLionel Sambuc
147*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('constructorDecl0')"><a name="constructorDecl0Anchor">constructorDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;...</td></tr>
148*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="constructorDecl0"><pre>Matches C++ constructor declarations.
149*f4a2713aSLionel Sambuc
150*f4a2713aSLionel SambucExample matches Foo::Foo() and Foo::Foo(int)
151*f4a2713aSLionel Sambuc  class Foo {
152*f4a2713aSLionel Sambuc   public:
153*f4a2713aSLionel Sambuc    Foo();
154*f4a2713aSLionel Sambuc    Foo(int);
155*f4a2713aSLionel Sambuc    int DoSomething();
156*f4a2713aSLionel Sambuc  };
157*f4a2713aSLionel Sambuc</pre></td></tr>
158*f4a2713aSLionel Sambuc
159*f4a2713aSLionel Sambuc
160*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;...</td></tr>
161*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="decl0"><pre>Matches declarations.
162*f4a2713aSLionel Sambuc
163*f4a2713aSLionel SambucExamples matches X, C, and the friend declaration inside C;
164*f4a2713aSLionel Sambuc  void X();
165*f4a2713aSLionel Sambuc  class C {
166*f4a2713aSLionel Sambuc    friend X;
167*f4a2713aSLionel Sambuc  };
168*f4a2713aSLionel Sambuc</pre></td></tr>
169*f4a2713aSLionel Sambuc
170*f4a2713aSLionel Sambuc
171*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;...</td></tr>
172*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="declaratorDecl0"><pre>Matches declarator declarations (field, variable, function
173*f4a2713aSLionel Sambucand non-type template parameter declarations).
174*f4a2713aSLionel Sambuc
175*f4a2713aSLionel SambucGiven
176*f4a2713aSLionel Sambuc  class X { int y; };
177*f4a2713aSLionel SambucdeclaratorDecl()
178*f4a2713aSLionel Sambuc  matches int y.
179*f4a2713aSLionel Sambuc</pre></td></tr>
180*f4a2713aSLionel Sambuc
181*f4a2713aSLionel Sambuc
182*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('destructorDecl0')"><a name="destructorDecl0Anchor">destructorDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDestructorDecl.html">CXXDestructorDecl</a>&gt;...</td></tr>
183*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="destructorDecl0"><pre>Matches explicit C++ destructor declarations.
184*f4a2713aSLionel Sambuc
185*f4a2713aSLionel SambucExample matches Foo::~Foo()
186*f4a2713aSLionel Sambuc  class Foo {
187*f4a2713aSLionel Sambuc   public:
188*f4a2713aSLionel Sambuc    virtual ~Foo();
189*f4a2713aSLionel Sambuc  };
190*f4a2713aSLionel Sambuc</pre></td></tr>
191*f4a2713aSLionel Sambuc
192*f4a2713aSLionel Sambuc
193*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1EnumConstantDecl.html">EnumConstantDecl</a>&gt;...</td></tr>
194*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="enumConstantDecl0"><pre>Matches enum constants.
195*f4a2713aSLionel Sambuc
196*f4a2713aSLionel SambucExample matches A, B, C
197*f4a2713aSLionel Sambuc  enum X {
198*f4a2713aSLionel Sambuc    A, B, C
199*f4a2713aSLionel Sambuc  };
200*f4a2713aSLionel Sambuc</pre></td></tr>
201*f4a2713aSLionel Sambuc
202*f4a2713aSLionel Sambuc
203*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1EnumDecl.html">EnumDecl</a>&gt;...</td></tr>
204*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="enumDecl0"><pre>Matches enum declarations.
205*f4a2713aSLionel Sambuc
206*f4a2713aSLionel SambucExample matches X
207*f4a2713aSLionel Sambuc  enum X {
208*f4a2713aSLionel Sambuc    A, B, C
209*f4a2713aSLionel Sambuc  };
210*f4a2713aSLionel Sambuc</pre></td></tr>
211*f4a2713aSLionel Sambuc
212*f4a2713aSLionel Sambuc
213*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt;...</td></tr>
214*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="fieldDecl0"><pre>Matches field declarations.
215*f4a2713aSLionel Sambuc
216*f4a2713aSLionel SambucGiven
217*f4a2713aSLionel Sambuc  class X { int m; };
218*f4a2713aSLionel SambucfieldDecl()
219*f4a2713aSLionel Sambuc  matches 'm'.
220*f4a2713aSLionel Sambuc</pre></td></tr>
221*f4a2713aSLionel Sambuc
222*f4a2713aSLionel Sambuc
223*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1FriendDecl.html">FriendDecl</a>&gt;...</td></tr>
224*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="friendDecl0"><pre>Matches friend declarations.
225*f4a2713aSLionel Sambuc
226*f4a2713aSLionel SambucGiven
227*f4a2713aSLionel Sambuc  class X { friend void foo(); };
228*f4a2713aSLionel SambucfriendDecl()
229*f4a2713aSLionel Sambuc  matches 'friend void foo()'.
230*f4a2713aSLionel Sambuc</pre></td></tr>
231*f4a2713aSLionel Sambuc
232*f4a2713aSLionel Sambuc
233*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;...</td></tr>
234*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="functionDecl0"><pre>Matches function declarations.
235*f4a2713aSLionel Sambuc
236*f4a2713aSLionel SambucExample matches f
237*f4a2713aSLionel Sambuc  void f();
238*f4a2713aSLionel Sambuc</pre></td></tr>
239*f4a2713aSLionel Sambuc
240*f4a2713aSLionel Sambuc
241*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1FunctionTemplateDecl.html">FunctionTemplateDecl</a>&gt;...</td></tr>
242*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="functionTemplateDecl0"><pre>Matches C++ function template declarations.
243*f4a2713aSLionel Sambuc
244*f4a2713aSLionel SambucExample matches f
245*f4a2713aSLionel Sambuc  template&lt;class T&gt; void f(T t) {}
246*f4a2713aSLionel Sambuc</pre></td></tr>
247*f4a2713aSLionel Sambuc
248*f4a2713aSLionel Sambuc
249*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('methodDecl0')"><a name="methodDecl0Anchor">methodDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;...</td></tr>
250*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="methodDecl0"><pre>Matches method declarations.
251*f4a2713aSLionel Sambuc
252*f4a2713aSLionel SambucExample matches y
253*f4a2713aSLionel Sambuc  class X { void y() };
254*f4a2713aSLionel Sambuc</pre></td></tr>
255*f4a2713aSLionel Sambuc
256*f4a2713aSLionel Sambuc
257*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;...</td></tr>
258*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="namedDecl0"><pre>Matches a declaration of anything that could have a name.
259*f4a2713aSLionel Sambuc
260*f4a2713aSLionel SambucExample matches X, S, the anonymous union type, i, and U;
261*f4a2713aSLionel Sambuc  typedef int X;
262*f4a2713aSLionel Sambuc  struct S {
263*f4a2713aSLionel Sambuc    union {
264*f4a2713aSLionel Sambuc      int i;
265*f4a2713aSLionel Sambuc    } U;
266*f4a2713aSLionel Sambuc  };
267*f4a2713aSLionel Sambuc</pre></td></tr>
268*f4a2713aSLionel Sambuc
269*f4a2713aSLionel Sambuc
270*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>&gt;...</td></tr>
271*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="namespaceDecl0"><pre>Matches a declaration of a namespace.
272*f4a2713aSLionel Sambuc
273*f4a2713aSLionel SambucGiven
274*f4a2713aSLionel Sambuc  namespace {}
275*f4a2713aSLionel Sambuc  namespace test {}
276*f4a2713aSLionel SambucnamespaceDecl()
277*f4a2713aSLionel Sambuc  matches "namespace {}" and "namespace test {}"
278*f4a2713aSLionel Sambuc</pre></td></tr>
279*f4a2713aSLionel Sambuc
280*f4a2713aSLionel Sambuc
281*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt;...</td></tr>
282*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="parmVarDecl0"><pre>Matches parameter variable declarations.
283*f4a2713aSLionel Sambuc
284*f4a2713aSLionel SambucGiven
285*f4a2713aSLionel Sambuc  void f(int x);
286*f4a2713aSLionel SambucparmVarDecl()
287*f4a2713aSLionel Sambuc  matches int x.
288*f4a2713aSLionel Sambuc</pre></td></tr>
289*f4a2713aSLionel Sambuc
290*f4a2713aSLionel Sambuc
291*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;...</td></tr>
292*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="recordDecl0"><pre>Matches C++ class declarations.
293*f4a2713aSLionel Sambuc
294*f4a2713aSLionel SambucExample matches X, Z
295*f4a2713aSLionel Sambuc  class X;
296*f4a2713aSLionel Sambuc  template&lt;class T&gt; class Z {};
297*f4a2713aSLionel Sambuc</pre></td></tr>
298*f4a2713aSLionel Sambuc
299*f4a2713aSLionel Sambuc
300*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingValueDecl.html">UnresolvedUsingValueDecl</a>&gt;...</td></tr>
301*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="unresolvedUsingValueDecl0"><pre>Matches unresolved using value declarations.
302*f4a2713aSLionel Sambuc
303*f4a2713aSLionel SambucGiven
304*f4a2713aSLionel Sambuc  template&lt;typename X&gt;
305*f4a2713aSLionel Sambuc  class C : private X {
306*f4a2713aSLionel Sambuc    using X::x;
307*f4a2713aSLionel Sambuc  };
308*f4a2713aSLionel SambucunresolvedUsingValueDecl()
309*f4a2713aSLionel Sambuc  matches using X::x </pre></td></tr>
310*f4a2713aSLionel Sambuc
311*f4a2713aSLionel Sambuc
312*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1UsingDecl.html">UsingDecl</a>&gt;...</td></tr>
313*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="usingDecl0"><pre>Matches using declarations.
314*f4a2713aSLionel Sambuc
315*f4a2713aSLionel SambucGiven
316*f4a2713aSLionel Sambuc  namespace X { int x; }
317*f4a2713aSLionel Sambuc  using X::x;
318*f4a2713aSLionel SambucusingDecl()
319*f4a2713aSLionel Sambuc  matches using X::x </pre></td></tr>
320*f4a2713aSLionel Sambuc
321*f4a2713aSLionel Sambuc
322*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;...</td></tr>
323*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="varDecl0"><pre>Matches variable declarations.
324*f4a2713aSLionel Sambuc
325*f4a2713aSLionel SambucNote: this does not match declarations of member variables, which are
326*f4a2713aSLionel Sambuc"field" declarations in Clang parlance.
327*f4a2713aSLionel Sambuc
328*f4a2713aSLionel SambucExample matches a
329*f4a2713aSLionel Sambuc  int a;
330*f4a2713aSLionel Sambuc</pre></td></tr>
331*f4a2713aSLionel Sambuc
332*f4a2713aSLionel Sambuc
333*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt;...</td></tr>
334*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="nestedNameSpecifierLoc0"><pre>Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
335*f4a2713aSLionel Sambuc</pre></td></tr>
336*f4a2713aSLionel Sambuc
337*f4a2713aSLionel Sambuc
338*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt;...</td></tr>
339*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="nestedNameSpecifier0"><pre>Matches nested name specifiers.
340*f4a2713aSLionel Sambuc
341*f4a2713aSLionel SambucGiven
342*f4a2713aSLionel Sambuc  namespace ns {
343*f4a2713aSLionel Sambuc    struct A { static void f(); };
344*f4a2713aSLionel Sambuc    void A::f() {}
345*f4a2713aSLionel Sambuc    void g() { A::f(); }
346*f4a2713aSLionel Sambuc  }
347*f4a2713aSLionel Sambuc  ns::A a;
348*f4a2713aSLionel SambucnestedNameSpecifier()
349*f4a2713aSLionel Sambuc  matches "ns::" and both "A::"
350*f4a2713aSLionel Sambuc</pre></td></tr>
351*f4a2713aSLionel Sambuc
352*f4a2713aSLionel Sambuc
353*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;...</td></tr>
354*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="qualType0"><pre>Matches QualTypes in the clang AST.
355*f4a2713aSLionel Sambuc</pre></td></tr>
356*f4a2713aSLionel Sambuc
357*f4a2713aSLionel Sambuc
358*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ArraySubscriptExpr.html">ArraySubscriptExpr</a>&gt;...</td></tr>
359*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="arraySubscriptExpr0"><pre>Matches array subscript expressions.
360*f4a2713aSLionel Sambuc
361*f4a2713aSLionel SambucGiven
362*f4a2713aSLionel Sambuc  int i = a[1];
363*f4a2713aSLionel SambucarraySubscriptExpr()
364*f4a2713aSLionel Sambuc  matches "a[1]"
365*f4a2713aSLionel Sambuc</pre></td></tr>
366*f4a2713aSLionel Sambuc
367*f4a2713aSLionel Sambuc
368*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1AsmStmt.html">AsmStmt</a>&gt;...</td></tr>
369*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="asmStmt0"><pre>Matches asm statements.
370*f4a2713aSLionel Sambuc
371*f4a2713aSLionel Sambuc int i = 100;
372*f4a2713aSLionel Sambuc  __asm("mov al, 2");
373*f4a2713aSLionel SambucasmStmt()
374*f4a2713aSLionel Sambuc  matches '__asm("mov al, 2")'
375*f4a2713aSLionel Sambuc</pre></td></tr>
376*f4a2713aSLionel Sambuc
377*f4a2713aSLionel Sambuc
378*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>&gt;...</td></tr>
379*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="binaryOperator0"><pre>Matches binary operator expressions.
380*f4a2713aSLionel Sambuc
381*f4a2713aSLionel SambucExample matches a || b
382*f4a2713aSLionel Sambuc  !(a || b)
383*f4a2713aSLionel Sambuc</pre></td></tr>
384*f4a2713aSLionel Sambuc
385*f4a2713aSLionel Sambuc
386*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('bindTemporaryExpr0')"><a name="bindTemporaryExpr0Anchor">bindTemporaryExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBindTemporaryExpr.html">CXXBindTemporaryExpr</a>&gt;...</td></tr>
387*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="bindTemporaryExpr0"><pre>Matches nodes where temporaries are created.
388*f4a2713aSLionel Sambuc
389*f4a2713aSLionel SambucExample matches FunctionTakesString(GetStringByValue())
390*f4a2713aSLionel Sambuc    (matcher = bindTemporaryExpr())
391*f4a2713aSLionel Sambuc  FunctionTakesString(GetStringByValue());
392*f4a2713aSLionel Sambuc  FunctionTakesStringByPointer(GetStringPointer());
393*f4a2713aSLionel Sambuc</pre></td></tr>
394*f4a2713aSLionel Sambuc
395*f4a2713aSLionel Sambuc
396*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('boolLiteral0')"><a name="boolLiteral0Anchor">boolLiteral</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>&gt;...</td></tr>
397*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="boolLiteral0"><pre>Matches bool literals.
398*f4a2713aSLionel Sambuc
399*f4a2713aSLionel SambucExample matches true
400*f4a2713aSLionel Sambuc  true
401*f4a2713aSLionel Sambuc</pre></td></tr>
402*f4a2713aSLionel Sambuc
403*f4a2713aSLionel Sambuc
404*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1BreakStmt.html">BreakStmt</a>&gt;...</td></tr>
405*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="breakStmt0"><pre>Matches break statements.
406*f4a2713aSLionel Sambuc
407*f4a2713aSLionel SambucGiven
408*f4a2713aSLionel Sambuc  while (true) { break; }
409*f4a2713aSLionel SambucbreakStmt()
410*f4a2713aSLionel Sambuc  matches 'break'
411*f4a2713aSLionel Sambuc</pre></td></tr>
412*f4a2713aSLionel Sambuc
413*f4a2713aSLionel Sambuc
414*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CStyleCastExpr.html">CStyleCastExpr</a>&gt;...</td></tr>
415*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="cStyleCastExpr0"><pre>Matches a C-style cast expression.
416*f4a2713aSLionel Sambuc
417*f4a2713aSLionel SambucExample: Matches (int*) 2.2f in
418*f4a2713aSLionel Sambuc  int i = (int) 2.2f;
419*f4a2713aSLionel Sambuc</pre></td></tr>
420*f4a2713aSLionel Sambuc
421*f4a2713aSLionel Sambuc
422*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;...</td></tr>
423*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="callExpr0"><pre>Matches call expressions.
424*f4a2713aSLionel Sambuc
425*f4a2713aSLionel SambucExample matches x.y() and y()
426*f4a2713aSLionel Sambuc  X x;
427*f4a2713aSLionel Sambuc  x.y();
428*f4a2713aSLionel Sambuc  y();
429*f4a2713aSLionel Sambuc</pre></td></tr>
430*f4a2713aSLionel Sambuc
431*f4a2713aSLionel Sambuc
432*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CaseStmt.html">CaseStmt</a>&gt;...</td></tr>
433*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="caseStmt0"><pre>Matches case statements inside switch statements.
434*f4a2713aSLionel Sambuc
435*f4a2713aSLionel SambucGiven
436*f4a2713aSLionel Sambuc  switch(a) { case 42: break; default: break; }
437*f4a2713aSLionel SambuccaseStmt()
438*f4a2713aSLionel Sambuc  matches 'case 42: break;'.
439*f4a2713aSLionel Sambuc</pre></td></tr>
440*f4a2713aSLionel Sambuc
441*f4a2713aSLionel Sambuc
442*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html">CastExpr</a>&gt;...</td></tr>
443*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="castExpr0"><pre>Matches any cast nodes of Clang's AST.
444*f4a2713aSLionel Sambuc
445*f4a2713aSLionel SambucExample: castExpr() matches each of the following:
446*f4a2713aSLionel Sambuc  (int) 3;
447*f4a2713aSLionel Sambuc  const_cast&lt;Expr *&gt;(SubExpr);
448*f4a2713aSLionel Sambuc  char c = 0;
449*f4a2713aSLionel Sambucbut does not match
450*f4a2713aSLionel Sambuc  int i = (0);
451*f4a2713aSLionel Sambuc  int k = 0;
452*f4a2713aSLionel Sambuc</pre></td></tr>
453*f4a2713aSLionel Sambuc
454*f4a2713aSLionel Sambuc
455*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('catchStmt0')"><a name="catchStmt0Anchor">catchStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCatchStmt.html">CXXCatchStmt</a>&gt;...</td></tr>
456*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="catchStmt0"><pre>Matches catch statements.
457*f4a2713aSLionel Sambuc
458*f4a2713aSLionel Sambuc  try {} catch(int i) {}
459*f4a2713aSLionel SambuccatchStmt()
460*f4a2713aSLionel Sambuc  matches 'catch(int i)'
461*f4a2713aSLionel Sambuc</pre></td></tr>
462*f4a2713aSLionel Sambuc
463*f4a2713aSLionel Sambuc
464*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;...</td></tr>
465*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="characterLiteral0"><pre>Matches character literals (also matches wchar_t).
466*f4a2713aSLionel Sambuc
467*f4a2713aSLionel SambucNot matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral),
468*f4a2713aSLionel Sambucthough.
469*f4a2713aSLionel Sambuc
470*f4a2713aSLionel SambucExample matches 'a', L'a'
471*f4a2713aSLionel Sambuc  char ch = 'a'; wchar_t chw = L'a';
472*f4a2713aSLionel Sambuc</pre></td></tr>
473*f4a2713aSLionel Sambuc
474*f4a2713aSLionel Sambuc
475*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CompoundLiteralExpr.html">CompoundLiteralExpr</a>&gt;...</td></tr>
476*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="compoundLiteralExpr0"><pre>Matches compound (i.e. non-scalar) literals
477*f4a2713aSLionel Sambuc
478*f4a2713aSLionel SambucExample match: {1}, (1, 2)
479*f4a2713aSLionel Sambuc  int array[4] = {1}; vector int myvec = (vector int)(1, 2);
480*f4a2713aSLionel Sambuc</pre></td></tr>
481*f4a2713aSLionel Sambuc
482*f4a2713aSLionel Sambuc
483*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CompoundStmt.html">CompoundStmt</a>&gt;...</td></tr>
484*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="compoundStmt0"><pre>Matches compound statements.
485*f4a2713aSLionel Sambuc
486*f4a2713aSLionel SambucExample matches '{}' and '{{}}'in 'for (;;) {{}}'
487*f4a2713aSLionel Sambuc  for (;;) {{}}
488*f4a2713aSLionel Sambuc</pre></td></tr>
489*f4a2713aSLionel Sambuc
490*f4a2713aSLionel Sambuc
491*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>&gt;...</td></tr>
492*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="conditionalOperator0"><pre>Matches conditional operator expressions.
493*f4a2713aSLionel Sambuc
494*f4a2713aSLionel SambucExample matches a ? b : c
495*f4a2713aSLionel Sambuc  (a ? b : c) + 42
496*f4a2713aSLionel Sambuc</pre></td></tr>
497*f4a2713aSLionel Sambuc
498*f4a2713aSLionel Sambuc
499*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('constCastExpr0')"><a name="constCastExpr0Anchor">constCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstCastExpr.html">CXXConstCastExpr</a>&gt;...</td></tr>
500*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="constCastExpr0"><pre>Matches a const_cast expression.
501*f4a2713aSLionel Sambuc
502*f4a2713aSLionel SambucExample: Matches const_cast&lt;int*&gt;(&amp;r) in
503*f4a2713aSLionel Sambuc  int n = 42;
504*f4a2713aSLionel Sambuc  const int &amp;r(n);
505*f4a2713aSLionel Sambuc  int* p = const_cast&lt;int*&gt;(&amp;r);
506*f4a2713aSLionel Sambuc</pre></td></tr>
507*f4a2713aSLionel Sambuc
508*f4a2713aSLionel Sambuc
509*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('constructExpr0')"><a name="constructExpr0Anchor">constructExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;...</td></tr>
510*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="constructExpr0"><pre>Matches constructor call expressions (including implicit ones).
511*f4a2713aSLionel Sambuc
512*f4a2713aSLionel SambucExample matches string(ptr, n) and ptr within arguments of f
513*f4a2713aSLionel Sambuc    (matcher = constructExpr())
514*f4a2713aSLionel Sambuc  void f(const string &amp;a, const string &amp;b);
515*f4a2713aSLionel Sambuc  char *ptr;
516*f4a2713aSLionel Sambuc  int n;
517*f4a2713aSLionel Sambuc  f(string(ptr, n), ptr);
518*f4a2713aSLionel Sambuc</pre></td></tr>
519*f4a2713aSLionel Sambuc
520*f4a2713aSLionel Sambuc
521*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ContinueStmt.html">ContinueStmt</a>&gt;...</td></tr>
522*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="continueStmt0"><pre>Matches continue statements.
523*f4a2713aSLionel Sambuc
524*f4a2713aSLionel SambucGiven
525*f4a2713aSLionel Sambuc  while (true) { continue; }
526*f4a2713aSLionel SambuccontinueStmt()
527*f4a2713aSLionel Sambuc  matches 'continue'
528*f4a2713aSLionel Sambuc</pre></td></tr>
529*f4a2713aSLionel Sambuc
530*f4a2713aSLionel Sambuc
531*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;...</td></tr>
532*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="declRefExpr0"><pre>Matches expressions that refer to declarations.
533*f4a2713aSLionel Sambuc
534*f4a2713aSLionel SambucExample matches x in if (x)
535*f4a2713aSLionel Sambuc  bool x;
536*f4a2713aSLionel Sambuc  if (x) {}
537*f4a2713aSLionel Sambuc</pre></td></tr>
538*f4a2713aSLionel Sambuc
539*f4a2713aSLionel Sambuc
540*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>&gt;...</td></tr>
541*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="declStmt0"><pre>Matches declaration statements.
542*f4a2713aSLionel Sambuc
543*f4a2713aSLionel SambucGiven
544*f4a2713aSLionel Sambuc  int a;
545*f4a2713aSLionel SambucdeclStmt()
546*f4a2713aSLionel Sambuc  matches 'int a'.
547*f4a2713aSLionel Sambuc</pre></td></tr>
548*f4a2713aSLionel Sambuc
549*f4a2713aSLionel Sambuc
550*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('defaultArgExpr0')"><a name="defaultArgExpr0Anchor">defaultArgExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDefaultArgExpr.html">CXXDefaultArgExpr</a>&gt;...</td></tr>
551*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="defaultArgExpr0"><pre>Matches the value of a default argument at the call site.
552*f4a2713aSLionel Sambuc
553*f4a2713aSLionel SambucExample matches the CXXDefaultArgExpr placeholder inserted for the
554*f4a2713aSLionel Sambuc    default value of the second parameter in the call expression f(42)
555*f4a2713aSLionel Sambuc    (matcher = defaultArgExpr())
556*f4a2713aSLionel Sambuc  void f(int x, int y = 0);
557*f4a2713aSLionel Sambuc  f(42);
558*f4a2713aSLionel Sambuc</pre></td></tr>
559*f4a2713aSLionel Sambuc
560*f4a2713aSLionel Sambuc
561*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1DefaultStmt.html">DefaultStmt</a>&gt;...</td></tr>
562*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="defaultStmt0"><pre>Matches default statements inside switch statements.
563*f4a2713aSLionel Sambuc
564*f4a2713aSLionel SambucGiven
565*f4a2713aSLionel Sambuc  switch(a) { case 42: break; default: break; }
566*f4a2713aSLionel SambucdefaultStmt()
567*f4a2713aSLionel Sambuc  matches 'default: break;'.
568*f4a2713aSLionel Sambuc</pre></td></tr>
569*f4a2713aSLionel Sambuc
570*f4a2713aSLionel Sambuc
571*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('deleteExpr0')"><a name="deleteExpr0Anchor">deleteExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDeleteExpr.html">CXXDeleteExpr</a>&gt;...</td></tr>
572*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="deleteExpr0"><pre>Matches delete expressions.
573*f4a2713aSLionel Sambuc
574*f4a2713aSLionel SambucGiven
575*f4a2713aSLionel Sambuc  delete X;
576*f4a2713aSLionel SambucdeleteExpr()
577*f4a2713aSLionel Sambuc  matches 'delete X'.
578*f4a2713aSLionel Sambuc</pre></td></tr>
579*f4a2713aSLionel Sambuc
580*f4a2713aSLionel Sambuc
581*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1DoStmt.html">DoStmt</a>&gt;...</td></tr>
582*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="doStmt0"><pre>Matches do statements.
583*f4a2713aSLionel Sambuc
584*f4a2713aSLionel SambucGiven
585*f4a2713aSLionel Sambuc  do {} while (true);
586*f4a2713aSLionel SambucdoStmt()
587*f4a2713aSLionel Sambuc  matches 'do {} while(true)'
588*f4a2713aSLionel Sambuc</pre></td></tr>
589*f4a2713aSLionel Sambuc
590*f4a2713aSLionel Sambuc
591*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('dynamicCastExpr0')"><a name="dynamicCastExpr0Anchor">dynamicCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXDynamicCastExpr.html">CXXDynamicCastExpr</a>&gt;...</td></tr>
592*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="dynamicCastExpr0"><pre>Matches a dynamic_cast expression.
593*f4a2713aSLionel Sambuc
594*f4a2713aSLionel SambucExample:
595*f4a2713aSLionel Sambuc  dynamicCastExpr()
596*f4a2713aSLionel Sambucmatches
597*f4a2713aSLionel Sambuc  dynamic_cast&lt;D*&gt;(&amp;b);
598*f4a2713aSLionel Sambucin
599*f4a2713aSLionel Sambuc  struct B { virtual ~B() {} }; struct D : B {};
600*f4a2713aSLionel Sambuc  B b;
601*f4a2713aSLionel Sambuc  D* p = dynamic_cast&lt;D*&gt;(&amp;b);
602*f4a2713aSLionel Sambuc</pre></td></tr>
603*f4a2713aSLionel Sambuc
604*f4a2713aSLionel Sambuc
605*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ExplicitCastExpr.html">ExplicitCastExpr</a>&gt;...</td></tr>
606*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="explicitCastExpr0"><pre>Matches explicit cast expressions.
607*f4a2713aSLionel Sambuc
608*f4a2713aSLionel SambucMatches any cast expression written in user code, whether it be a
609*f4a2713aSLionel SambucC-style cast, a functional-style cast, or a keyword cast.
610*f4a2713aSLionel Sambuc
611*f4a2713aSLionel SambucDoes not match implicit conversions.
612*f4a2713aSLionel Sambuc
613*f4a2713aSLionel SambucNote: the name "explicitCast" is chosen to match Clang's terminology, as
614*f4a2713aSLionel SambucClang uses the term "cast" to apply to implicit conversions as well as to
615*f4a2713aSLionel Sambucactual cast expressions.
616*f4a2713aSLionel Sambuc
617*f4a2713aSLionel SambuchasDestinationType.
618*f4a2713aSLionel Sambuc
619*f4a2713aSLionel SambucExample: matches all five of the casts in
620*f4a2713aSLionel Sambuc  int((int)(reinterpret_cast&lt;int&gt;(static_cast&lt;int&gt;(const_cast&lt;int&gt;(42)))))
621*f4a2713aSLionel Sambucbut does not match the implicit conversion in
622*f4a2713aSLionel Sambuc  long ell = 42;
623*f4a2713aSLionel Sambuc</pre></td></tr>
624*f4a2713aSLionel Sambuc
625*f4a2713aSLionel Sambuc
626*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;...</td></tr>
627*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="expr0"><pre>Matches expressions.
628*f4a2713aSLionel Sambuc
629*f4a2713aSLionel SambucExample matches x()
630*f4a2713aSLionel Sambuc  void f() { x(); }
631*f4a2713aSLionel Sambuc</pre></td></tr>
632*f4a2713aSLionel Sambuc
633*f4a2713aSLionel Sambuc
634*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;...</td></tr>
635*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="floatLiteral0"><pre>Matches float literals of all sizes encodings, e.g.
636*f4a2713aSLionel Sambuc1.0, 1.0f, 1.0L and 1e10.
637*f4a2713aSLionel Sambuc
638*f4a2713aSLionel SambucDoes not match implicit conversions such as
639*f4a2713aSLionel Sambuc  float a = 10;
640*f4a2713aSLionel Sambuc</pre></td></tr>
641*f4a2713aSLionel Sambuc
642*f4a2713aSLionel Sambuc
643*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('forRangeStmt0')"><a name="forRangeStmt0Anchor">forRangeStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXForRangeStmt.html">CXXForRangeStmt</a>&gt;...</td></tr>
644*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="forRangeStmt0"><pre>Matches range-based for statements.
645*f4a2713aSLionel Sambuc
646*f4a2713aSLionel SambucforRangeStmt() matches 'for (auto a : i)'
647*f4a2713aSLionel Sambuc  int i[] =  {1, 2, 3}; for (auto a : i);
648*f4a2713aSLionel Sambuc  for(int j = 0; j &lt; 5; ++j);
649*f4a2713aSLionel Sambuc</pre></td></tr>
650*f4a2713aSLionel Sambuc
651*f4a2713aSLionel Sambuc
652*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ForStmt.html">ForStmt</a>&gt;...</td></tr>
653*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="forStmt0"><pre>Matches for statements.
654*f4a2713aSLionel Sambuc
655*f4a2713aSLionel SambucExample matches 'for (;;) {}'
656*f4a2713aSLionel Sambuc  for (;;) {}
657*f4a2713aSLionel Sambuc  int i[] =  {1, 2, 3}; for (auto a : i);
658*f4a2713aSLionel Sambuc</pre></td></tr>
659*f4a2713aSLionel Sambuc
660*f4a2713aSLionel Sambuc
661*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('functionalCastExpr0')"><a name="functionalCastExpr0Anchor">functionalCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXFunctionalCastExpr.html">CXXFunctionalCastExpr</a>&gt;...</td></tr>
662*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="functionalCastExpr0"><pre>Matches functional cast expressions
663*f4a2713aSLionel Sambuc
664*f4a2713aSLionel SambucExample: Matches Foo(bar);
665*f4a2713aSLionel Sambuc  Foo f = bar;
666*f4a2713aSLionel Sambuc  Foo g = (Foo) bar;
667*f4a2713aSLionel Sambuc  Foo h = Foo(bar);
668*f4a2713aSLionel Sambuc</pre></td></tr>
669*f4a2713aSLionel Sambuc
670*f4a2713aSLionel Sambuc
671*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1GotoStmt.html">GotoStmt</a>&gt;...</td></tr>
672*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="gotoStmt0"><pre>Matches goto statements.
673*f4a2713aSLionel Sambuc
674*f4a2713aSLionel SambucGiven
675*f4a2713aSLionel Sambuc  goto FOO;
676*f4a2713aSLionel Sambuc  FOO: bar();
677*f4a2713aSLionel SambucgotoStmt()
678*f4a2713aSLionel Sambuc  matches 'goto FOO'
679*f4a2713aSLionel Sambuc</pre></td></tr>
680*f4a2713aSLionel Sambuc
681*f4a2713aSLionel Sambuc
682*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1IfStmt.html">IfStmt</a>&gt;...</td></tr>
683*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="ifStmt0"><pre>Matches if statements.
684*f4a2713aSLionel Sambuc
685*f4a2713aSLionel SambucExample matches 'if (x) {}'
686*f4a2713aSLionel Sambuc  if (x) {}
687*f4a2713aSLionel Sambuc</pre></td></tr>
688*f4a2713aSLionel Sambuc
689*f4a2713aSLionel Sambuc
690*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ImplicitCastExpr.html">ImplicitCastExpr</a>&gt;...</td></tr>
691*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="implicitCastExpr0"><pre>Matches the implicit cast nodes of Clang's AST.
692*f4a2713aSLionel Sambuc
693*f4a2713aSLionel SambucThis matches many different places, including function call return value
694*f4a2713aSLionel Sambuceliding, as well as any type conversions.
695*f4a2713aSLionel Sambuc</pre></td></tr>
696*f4a2713aSLionel Sambuc
697*f4a2713aSLionel Sambuc
698*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1InitListExpr.html">InitListExpr</a>&gt;...</td></tr>
699*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="initListExpr0"><pre>Matches init list expressions.
700*f4a2713aSLionel Sambuc
701*f4a2713aSLionel SambucGiven
702*f4a2713aSLionel Sambuc  int a[] = { 1, 2 };
703*f4a2713aSLionel Sambuc  struct B { int x, y; };
704*f4a2713aSLionel Sambuc  B b = { 5, 6 };
705*f4a2713aSLionel SambucinitList()
706*f4a2713aSLionel Sambuc  matches "{ 1, 2 }" and "{ 5, 6 }"
707*f4a2713aSLionel Sambuc</pre></td></tr>
708*f4a2713aSLionel Sambuc
709*f4a2713aSLionel Sambuc
710*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;...</td></tr>
711*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="integerLiteral0"><pre>Matches integer literals of all sizes encodings, e.g.
712*f4a2713aSLionel Sambuc1, 1L, 0x1 and 1U.
713*f4a2713aSLionel Sambuc
714*f4a2713aSLionel SambucDoes not match character-encoded integers such as L'a'.
715*f4a2713aSLionel Sambuc</pre></td></tr>
716*f4a2713aSLionel Sambuc
717*f4a2713aSLionel Sambuc
718*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;...</td></tr>
719*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="labelStmt0"><pre>Matches label statements.
720*f4a2713aSLionel Sambuc
721*f4a2713aSLionel SambucGiven
722*f4a2713aSLionel Sambuc  goto FOO;
723*f4a2713aSLionel Sambuc  FOO: bar();
724*f4a2713aSLionel SambuclabelStmt()
725*f4a2713aSLionel Sambuc  matches 'FOO:'
726*f4a2713aSLionel Sambuc</pre></td></tr>
727*f4a2713aSLionel Sambuc
728*f4a2713aSLionel Sambuc
729*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1LambdaExpr.html">LambdaExpr</a>&gt;...</td></tr>
730*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="lambdaExpr0"><pre>Matches lambda expressions.
731*f4a2713aSLionel Sambuc
732*f4a2713aSLionel SambucExample matches [&amp;](){return 5;}
733*f4a2713aSLionel Sambuc  [&amp;](){return 5;}
734*f4a2713aSLionel Sambuc</pre></td></tr>
735*f4a2713aSLionel Sambuc
736*f4a2713aSLionel Sambuc
737*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1MaterializeTemporaryExpr.html">MaterializeTemporaryExpr</a>&gt;...</td></tr>
738*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="materializeTemporaryExpr0"><pre>Matches nodes where temporaries are materialized.
739*f4a2713aSLionel Sambuc
740*f4a2713aSLionel SambucExample: Given
741*f4a2713aSLionel Sambuc  struct T {void func()};
742*f4a2713aSLionel Sambuc  T f();
743*f4a2713aSLionel Sambuc  void g(T);
744*f4a2713aSLionel SambucmaterializeTemporaryExpr() matches 'f()' in these statements
745*f4a2713aSLionel Sambuc  T u(f());
746*f4a2713aSLionel Sambuc  g(f());
747*f4a2713aSLionel Sambucbut does not match
748*f4a2713aSLionel Sambuc  f();
749*f4a2713aSLionel Sambuc  f().func();
750*f4a2713aSLionel Sambuc</pre></td></tr>
751*f4a2713aSLionel Sambuc
752*f4a2713aSLionel Sambuc
753*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('memberCallExpr0')"><a name="memberCallExpr0Anchor">memberCallExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMemberCallExpr.html">CXXMemberCallExpr</a>&gt;...</td></tr>
754*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="memberCallExpr0"><pre>Matches member call expressions.
755*f4a2713aSLionel Sambuc
756*f4a2713aSLionel SambucExample matches x.y()
757*f4a2713aSLionel Sambuc  X x;
758*f4a2713aSLionel Sambuc  x.y();
759*f4a2713aSLionel Sambuc</pre></td></tr>
760*f4a2713aSLionel Sambuc
761*f4a2713aSLionel Sambuc
762*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;...</td></tr>
763*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="memberExpr0"><pre>Matches member expressions.
764*f4a2713aSLionel Sambuc
765*f4a2713aSLionel SambucGiven
766*f4a2713aSLionel Sambuc  class Y {
767*f4a2713aSLionel Sambuc    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
768*f4a2713aSLionel Sambuc    int a; static int b;
769*f4a2713aSLionel Sambuc  };
770*f4a2713aSLionel SambucmemberExpr()
771*f4a2713aSLionel Sambuc  matches this-&gt;x, x, y.x, a, this-&gt;b
772*f4a2713aSLionel Sambuc</pre></td></tr>
773*f4a2713aSLionel Sambuc
774*f4a2713aSLionel Sambuc
775*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('newExpr0')"><a name="newExpr0Anchor">newExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>&gt;...</td></tr>
776*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="newExpr0"><pre>Matches new expressions.
777*f4a2713aSLionel Sambuc
778*f4a2713aSLionel SambucGiven
779*f4a2713aSLionel Sambuc  new X;
780*f4a2713aSLionel SambucnewExpr()
781*f4a2713aSLionel Sambuc  matches 'new X'.
782*f4a2713aSLionel Sambuc</pre></td></tr>
783*f4a2713aSLionel Sambuc
784*f4a2713aSLionel Sambuc
785*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('nullPtrLiteralExpr0')"><a name="nullPtrLiteralExpr0Anchor">nullPtrLiteralExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNullPtrLiteralExpr.html">CXXNullPtrLiteralExpr</a>&gt;...</td></tr>
786*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="nullPtrLiteralExpr0"><pre>Matches nullptr literal.
787*f4a2713aSLionel Sambuc</pre></td></tr>
788*f4a2713aSLionel Sambuc
789*f4a2713aSLionel Sambuc
790*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NullStmt.html">NullStmt</a>&gt;...</td></tr>
791*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="nullStmt0"><pre>Matches null statements.
792*f4a2713aSLionel Sambuc
793*f4a2713aSLionel Sambuc  foo();;
794*f4a2713aSLionel SambucnullStmt()
795*f4a2713aSLionel Sambuc  matches the second ';'
796*f4a2713aSLionel Sambuc</pre></td></tr>
797*f4a2713aSLionel Sambuc
798*f4a2713aSLionel Sambuc
799*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('operatorCallExpr0')"><a name="operatorCallExpr0Anchor">operatorCallExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;...</td></tr>
800*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="operatorCallExpr0"><pre>Matches overloaded operator calls.
801*f4a2713aSLionel Sambuc
802*f4a2713aSLionel SambucNote that if an operator isn't overloaded, it won't match. Instead, use
803*f4a2713aSLionel SambucbinaryOperator matcher.
804*f4a2713aSLionel SambucCurrently it does not match operators such as new delete.
805*f4a2713aSLionel SambucFIXME: figure out why these do not match?
806*f4a2713aSLionel Sambuc
807*f4a2713aSLionel SambucExample matches both operator&lt;&lt;((o &lt;&lt; b), c) and operator&lt;&lt;(o, b)
808*f4a2713aSLionel Sambuc    (matcher = operatorCallExpr())
809*f4a2713aSLionel Sambuc  ostream &amp;operator&lt;&lt; (ostream &amp;out, int i) { };
810*f4a2713aSLionel Sambuc  ostream &amp;o; int b = 1, c = 1;
811*f4a2713aSLionel Sambuc  o &lt;&lt; b &lt;&lt; c;
812*f4a2713aSLionel Sambuc</pre></td></tr>
813*f4a2713aSLionel Sambuc
814*f4a2713aSLionel Sambuc
815*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('reinterpretCastExpr0')"><a name="reinterpretCastExpr0Anchor">reinterpretCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXReinterpretCastExpr.html">CXXReinterpretCastExpr</a>&gt;...</td></tr>
816*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="reinterpretCastExpr0"><pre>Matches a reinterpret_cast expression.
817*f4a2713aSLionel Sambuc
818*f4a2713aSLionel SambucEither the source expression or the destination type can be matched
819*f4a2713aSLionel Sambucusing has(), but hasDestinationType() is more specific and can be
820*f4a2713aSLionel Sambucmore readable.
821*f4a2713aSLionel Sambuc
822*f4a2713aSLionel SambucExample matches reinterpret_cast&lt;char*&gt;(&amp;p) in
823*f4a2713aSLionel Sambuc  void* p = reinterpret_cast&lt;char*&gt;(&amp;p);
824*f4a2713aSLionel Sambuc</pre></td></tr>
825*f4a2713aSLionel Sambuc
826*f4a2713aSLionel Sambuc
827*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ReturnStmt.html">ReturnStmt</a>&gt;...</td></tr>
828*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="returnStmt0"><pre>Matches return statements.
829*f4a2713aSLionel Sambuc
830*f4a2713aSLionel SambucGiven
831*f4a2713aSLionel Sambuc  return 1;
832*f4a2713aSLionel SambucreturnStmt()
833*f4a2713aSLionel Sambuc  matches 'return 1'
834*f4a2713aSLionel Sambuc</pre></td></tr>
835*f4a2713aSLionel Sambuc
836*f4a2713aSLionel Sambuc
837*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('staticCastExpr0')"><a name="staticCastExpr0Anchor">staticCastExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXStaticCastExpr.html">CXXStaticCastExpr</a>&gt;...</td></tr>
838*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="staticCastExpr0"><pre>Matches a C++ static_cast expression.
839*f4a2713aSLionel Sambuc
840*f4a2713aSLionel SambuchasDestinationType
841*f4a2713aSLionel SambucreinterpretCast
842*f4a2713aSLionel Sambuc
843*f4a2713aSLionel SambucExample:
844*f4a2713aSLionel Sambuc  staticCastExpr()
845*f4a2713aSLionel Sambucmatches
846*f4a2713aSLionel Sambuc  static_cast&lt;long&gt;(8)
847*f4a2713aSLionel Sambucin
848*f4a2713aSLionel Sambuc  long eight(static_cast&lt;long&gt;(8));
849*f4a2713aSLionel Sambuc</pre></td></tr>
850*f4a2713aSLionel Sambuc
851*f4a2713aSLionel Sambuc
852*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;...</td></tr>
853*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="stmt0"><pre>Matches statements.
854*f4a2713aSLionel Sambuc
855*f4a2713aSLionel SambucGiven
856*f4a2713aSLionel Sambuc  { ++a; }
857*f4a2713aSLionel Sambucstmt()
858*f4a2713aSLionel Sambuc  matches both the compound statement '{ ++a; }' and '++a'.
859*f4a2713aSLionel Sambuc</pre></td></tr>
860*f4a2713aSLionel Sambuc
861*f4a2713aSLionel Sambuc
862*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1StringLiteral.html">StringLiteral</a>&gt;...</td></tr>
863*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="stringLiteral0"><pre>Matches string literals (also matches wide string literals).
864*f4a2713aSLionel Sambuc
865*f4a2713aSLionel SambucExample matches "abcd", L"abcd"
866*f4a2713aSLionel Sambuc  char *s = "abcd"; wchar_t *ws = L"abcd"
867*f4a2713aSLionel Sambuc</pre></td></tr>
868*f4a2713aSLionel Sambuc
869*f4a2713aSLionel Sambuc
870*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1SwitchCase.html">SwitchCase</a>&gt;...</td></tr>
871*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="switchCase0"><pre>Matches case and default statements inside switch statements.
872*f4a2713aSLionel Sambuc
873*f4a2713aSLionel SambucGiven
874*f4a2713aSLionel Sambuc  switch(a) { case 42: break; default: break; }
875*f4a2713aSLionel SambucswitchCase()
876*f4a2713aSLionel Sambuc  matches 'case 42: break;' and 'default: break;'.
877*f4a2713aSLionel Sambuc</pre></td></tr>
878*f4a2713aSLionel Sambuc
879*f4a2713aSLionel Sambuc
880*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1SwitchStmt.html">SwitchStmt</a>&gt;...</td></tr>
881*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="switchStmt0"><pre>Matches switch statements.
882*f4a2713aSLionel Sambuc
883*f4a2713aSLionel SambucGiven
884*f4a2713aSLionel Sambuc  switch(a) { case 42: break; default: break; }
885*f4a2713aSLionel SambucswitchStmt()
886*f4a2713aSLionel Sambuc  matches 'switch(a)'.
887*f4a2713aSLionel Sambuc</pre></td></tr>
888*f4a2713aSLionel Sambuc
889*f4a2713aSLionel Sambuc
890*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('temporaryObjectExpr0')"><a name="temporaryObjectExpr0Anchor">temporaryObjectExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXTemporaryObjectExpr.html">CXXTemporaryObjectExpr</a>&gt;...</td></tr>
891*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="temporaryObjectExpr0"><pre>Matches functional cast expressions having N != 1 arguments
892*f4a2713aSLionel Sambuc
893*f4a2713aSLionel SambucExample: Matches Foo(bar, bar)
894*f4a2713aSLionel Sambuc  Foo h = Foo(bar, bar);
895*f4a2713aSLionel Sambuc</pre></td></tr>
896*f4a2713aSLionel Sambuc
897*f4a2713aSLionel Sambuc
898*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('thisExpr0')"><a name="thisExpr0Anchor">thisExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXThisExpr.html">CXXThisExpr</a>&gt;...</td></tr>
899*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="thisExpr0"><pre>Matches implicit and explicit this expressions.
900*f4a2713aSLionel Sambuc
901*f4a2713aSLionel SambucExample matches the implicit this expression in "return i".
902*f4a2713aSLionel Sambuc    (matcher = thisExpr())
903*f4a2713aSLionel Sambucstruct foo {
904*f4a2713aSLionel Sambuc  int i;
905*f4a2713aSLionel Sambuc  int f() { return i; }
906*f4a2713aSLionel Sambuc};
907*f4a2713aSLionel Sambuc</pre></td></tr>
908*f4a2713aSLionel Sambuc
909*f4a2713aSLionel Sambuc
910*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('throwExpr0')"><a name="throwExpr0Anchor">throwExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXThrowExpr.html">CXXThrowExpr</a>&gt;...</td></tr>
911*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="throwExpr0"><pre>Matches throw expressions.
912*f4a2713aSLionel Sambuc
913*f4a2713aSLionel Sambuc  try { throw 5; } catch(int i) {}
914*f4a2713aSLionel SambucthrowExpr()
915*f4a2713aSLionel Sambuc  matches 'throw 5'
916*f4a2713aSLionel Sambuc</pre></td></tr>
917*f4a2713aSLionel Sambuc
918*f4a2713aSLionel Sambuc
919*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('tryStmt0')"><a name="tryStmt0Anchor">tryStmt</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXTryStmt.html">CXXTryStmt</a>&gt;...</td></tr>
920*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="tryStmt0"><pre>Matches try statements.
921*f4a2713aSLionel Sambuc
922*f4a2713aSLionel Sambuc  try {} catch(int i) {}
923*f4a2713aSLionel SambuctryStmt()
924*f4a2713aSLionel Sambuc  matches 'try {}'
925*f4a2713aSLionel Sambuc</pre></td></tr>
926*f4a2713aSLionel Sambuc
927*f4a2713aSLionel Sambuc
928*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;...</td></tr>
929*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="unaryExprOrTypeTraitExpr0"><pre>Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
930*f4a2713aSLionel Sambuc
931*f4a2713aSLionel SambucGiven
932*f4a2713aSLionel Sambuc  Foo x = bar;
933*f4a2713aSLionel Sambuc  int y = sizeof(x) + alignof(x);
934*f4a2713aSLionel SambucunaryExprOrTypeTraitExpr()
935*f4a2713aSLionel Sambuc  matches sizeof(x) and alignof(x)
936*f4a2713aSLionel Sambuc</pre></td></tr>
937*f4a2713aSLionel Sambuc
938*f4a2713aSLionel Sambuc
939*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;...</td></tr>
940*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="unaryOperator0"><pre>Matches unary operator expressions.
941*f4a2713aSLionel Sambuc
942*f4a2713aSLionel SambucExample matches !a
943*f4a2713aSLionel Sambuc  !a || b
944*f4a2713aSLionel Sambuc</pre></td></tr>
945*f4a2713aSLionel Sambuc
946*f4a2713aSLionel Sambuc
947*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('unresolvedConstructExpr0')"><a name="unresolvedConstructExpr0Anchor">unresolvedConstructExpr</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXUnresolvedConstructExpr.html">CXXUnresolvedConstructExpr</a>&gt;...</td></tr>
948*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="unresolvedConstructExpr0"><pre>Matches unresolved constructor call expressions.
949*f4a2713aSLionel Sambuc
950*f4a2713aSLionel SambucExample matches T(t) in return statement of f
951*f4a2713aSLionel Sambuc    (matcher = unresolvedConstructExpr())
952*f4a2713aSLionel Sambuc  template &lt;typename T&gt;
953*f4a2713aSLionel Sambuc  void f(const T&amp; t) { return T(t); }
954*f4a2713aSLionel Sambuc</pre></td></tr>
955*f4a2713aSLionel Sambuc
956*f4a2713aSLionel Sambuc
957*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1UserDefinedLiteral.html">UserDefinedLiteral</a>&gt;...</td></tr>
958*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="userDefinedLiteral0"><pre>Matches user defined literal operator call.
959*f4a2713aSLionel Sambuc
960*f4a2713aSLionel SambucExample match: "foo"_suffix
961*f4a2713aSLionel Sambuc</pre></td></tr>
962*f4a2713aSLionel Sambuc
963*f4a2713aSLionel Sambuc
964*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1WhileStmt.html">WhileStmt</a>&gt;...</td></tr>
965*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="whileStmt0"><pre>Matches while statements.
966*f4a2713aSLionel Sambuc
967*f4a2713aSLionel SambucGiven
968*f4a2713aSLionel Sambuc  while (true) {}
969*f4a2713aSLionel SambucwhileStmt()
970*f4a2713aSLionel Sambuc  matches 'while (true) {}'.
971*f4a2713aSLionel Sambuc</pre></td></tr>
972*f4a2713aSLionel Sambuc
973*f4a2713aSLionel Sambuc
974*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;...</td></tr>
975*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="typeLoc0"><pre>Matches TypeLocs in the clang AST.
976*f4a2713aSLionel Sambuc</pre></td></tr>
977*f4a2713aSLionel Sambuc
978*f4a2713aSLionel Sambuc
979*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;...</td></tr>
980*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="arrayType0"><pre>Matches all kinds of arrays.
981*f4a2713aSLionel Sambuc
982*f4a2713aSLionel SambucGiven
983*f4a2713aSLionel Sambuc  int a[] = { 2, 3 };
984*f4a2713aSLionel Sambuc  int b[4];
985*f4a2713aSLionel Sambuc  void f() { int c[a[0]]; }
986*f4a2713aSLionel SambucarrayType()
987*f4a2713aSLionel Sambuc  matches "int a[]", "int b[4]" and "int c[a[0]]";
988*f4a2713aSLionel Sambuc</pre></td></tr>
989*f4a2713aSLionel Sambuc
990*f4a2713aSLionel Sambuc
991*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;...</td></tr>
992*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="atomicType0"><pre>Matches atomic types.
993*f4a2713aSLionel Sambuc
994*f4a2713aSLionel SambucGiven
995*f4a2713aSLionel Sambuc  _Atomic(int) i;
996*f4a2713aSLionel SambucatomicType()
997*f4a2713aSLionel Sambuc  matches "_Atomic(int) i"
998*f4a2713aSLionel Sambuc</pre></td></tr>
999*f4a2713aSLionel Sambuc
1000*f4a2713aSLionel Sambuc
1001*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;...</td></tr>
1002*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="autoType0"><pre>Matches types nodes representing C++11 auto types.
1003*f4a2713aSLionel Sambuc
1004*f4a2713aSLionel SambucGiven:
1005*f4a2713aSLionel Sambuc  auto n = 4;
1006*f4a2713aSLionel Sambuc  int v[] = { 2, 3 }
1007*f4a2713aSLionel Sambuc  for (auto i : v) { }
1008*f4a2713aSLionel SambucautoType()
1009*f4a2713aSLionel Sambuc  matches "auto n" and "auto i"
1010*f4a2713aSLionel Sambuc</pre></td></tr>
1011*f4a2713aSLionel Sambuc
1012*f4a2713aSLionel Sambuc
1013*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;...</td></tr>
1014*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="blockPointerType0"><pre>Matches block pointer types, i.e. types syntactically represented as
1015*f4a2713aSLionel Sambuc"void (^)(int)".
1016*f4a2713aSLionel Sambuc
1017*f4a2713aSLionel SambucThe pointee is always required to be a FunctionType.
1018*f4a2713aSLionel Sambuc</pre></td></tr>
1019*f4a2713aSLionel Sambuc
1020*f4a2713aSLionel Sambuc
1021*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1BuiltinType.html">BuiltinType</a>&gt;...</td></tr>
1022*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="builtinType0"><pre>Matches builtin Types.
1023*f4a2713aSLionel Sambuc
1024*f4a2713aSLionel SambucGiven
1025*f4a2713aSLionel Sambuc  struct A {};
1026*f4a2713aSLionel Sambuc  A a;
1027*f4a2713aSLionel Sambuc  int b;
1028*f4a2713aSLionel Sambuc  float c;
1029*f4a2713aSLionel Sambuc  bool d;
1030*f4a2713aSLionel SambucbuiltinType()
1031*f4a2713aSLionel Sambuc  matches "int b", "float c" and "bool d"
1032*f4a2713aSLionel Sambuc</pre></td></tr>
1033*f4a2713aSLionel Sambuc
1034*f4a2713aSLionel Sambuc
1035*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;...</td></tr>
1036*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="complexType0"><pre>Matches C99 complex types.
1037*f4a2713aSLionel Sambuc
1038*f4a2713aSLionel SambucGiven
1039*f4a2713aSLionel Sambuc  _Complex float f;
1040*f4a2713aSLionel SambuccomplexType()
1041*f4a2713aSLionel Sambuc  matches "_Complex float f"
1042*f4a2713aSLionel Sambuc</pre></td></tr>
1043*f4a2713aSLionel Sambuc
1044*f4a2713aSLionel Sambuc
1045*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ConstantArrayType.html">ConstantArrayType</a>&gt;...</td></tr>
1046*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="constantArrayType0"><pre>Matches C arrays with a specified constant size.
1047*f4a2713aSLionel Sambuc
1048*f4a2713aSLionel SambucGiven
1049*f4a2713aSLionel Sambuc  void() {
1050*f4a2713aSLionel Sambuc    int a[2];
1051*f4a2713aSLionel Sambuc    int b[] = { 2, 3 };
1052*f4a2713aSLionel Sambuc    int c[b[0]];
1053*f4a2713aSLionel Sambuc  }
1054*f4a2713aSLionel SambucconstantArrayType()
1055*f4a2713aSLionel Sambuc  matches "int a[2]"
1056*f4a2713aSLionel Sambuc</pre></td></tr>
1057*f4a2713aSLionel Sambuc
1058*f4a2713aSLionel Sambuc
1059*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1DependentSizedArrayType.html">DependentSizedArrayType</a>&gt;...</td></tr>
1060*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="dependentSizedArrayType0"><pre>Matches C++ arrays whose size is a value-dependent expression.
1061*f4a2713aSLionel Sambuc
1062*f4a2713aSLionel SambucGiven
1063*f4a2713aSLionel Sambuc  template&lt;typename T, int Size&gt;
1064*f4a2713aSLionel Sambuc  class array {
1065*f4a2713aSLionel Sambuc    T data[Size];
1066*f4a2713aSLionel Sambuc  };
1067*f4a2713aSLionel SambucdependentSizedArrayType
1068*f4a2713aSLionel Sambuc  matches "T data[Size]"
1069*f4a2713aSLionel Sambuc</pre></td></tr>
1070*f4a2713aSLionel Sambuc
1071*f4a2713aSLionel Sambuc
1072*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ElaboratedType.html">ElaboratedType</a>&gt;...</td></tr>
1073*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="elaboratedType0"><pre>Matches types specified with an elaborated type keyword or with a
1074*f4a2713aSLionel Sambucqualified name.
1075*f4a2713aSLionel Sambuc
1076*f4a2713aSLionel SambucGiven
1077*f4a2713aSLionel Sambuc  namespace N {
1078*f4a2713aSLionel Sambuc    namespace M {
1079*f4a2713aSLionel Sambuc      class D {};
1080*f4a2713aSLionel Sambuc    }
1081*f4a2713aSLionel Sambuc  }
1082*f4a2713aSLionel Sambuc  class C {};
1083*f4a2713aSLionel Sambuc
1084*f4a2713aSLionel Sambuc  class C c;
1085*f4a2713aSLionel Sambuc  N::M::D d;
1086*f4a2713aSLionel Sambuc
1087*f4a2713aSLionel SambucelaboratedType() matches the type of the variable declarations of both
1088*f4a2713aSLionel Sambucc and d.
1089*f4a2713aSLionel Sambuc</pre></td></tr>
1090*f4a2713aSLionel Sambuc
1091*f4a2713aSLionel Sambuc
1092*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1FunctionType.html">FunctionType</a>&gt;...</td></tr>
1093*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="functionType0"><pre>Matches FunctionType nodes.
1094*f4a2713aSLionel Sambuc
1095*f4a2713aSLionel SambucGiven
1096*f4a2713aSLionel Sambuc  int (*f)(int);
1097*f4a2713aSLionel Sambuc  void g();
1098*f4a2713aSLionel SambucfunctionType()
1099*f4a2713aSLionel Sambuc  matches "int (*f)(int)" and the type of "g".
1100*f4a2713aSLionel Sambuc</pre></td></tr>
1101*f4a2713aSLionel Sambuc
1102*f4a2713aSLionel Sambuc
1103*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1IncompleteArrayType.html">IncompleteArrayType</a>&gt;...</td></tr>
1104*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="incompleteArrayType0"><pre>Matches C arrays with unspecified size.
1105*f4a2713aSLionel Sambuc
1106*f4a2713aSLionel SambucGiven
1107*f4a2713aSLionel Sambuc  int a[] = { 2, 3 };
1108*f4a2713aSLionel Sambuc  int b[42];
1109*f4a2713aSLionel Sambuc  void f(int c[]) { int d[a[0]]; };
1110*f4a2713aSLionel SambucincompleteArrayType()
1111*f4a2713aSLionel Sambuc  matches "int a[]" and "int c[]"
1112*f4a2713aSLionel Sambuc</pre></td></tr>
1113*f4a2713aSLionel Sambuc
1114*f4a2713aSLionel Sambuc
1115*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1LValueReferenceType.html">LValueReferenceType</a>&gt;...</td></tr>
1116*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="lValueReferenceType0"><pre>Matches lvalue reference types.
1117*f4a2713aSLionel Sambuc
1118*f4a2713aSLionel SambucGiven:
1119*f4a2713aSLionel Sambuc  int *a;
1120*f4a2713aSLionel Sambuc  int &amp;b = *a;
1121*f4a2713aSLionel Sambuc  int &amp;&amp;c = 1;
1122*f4a2713aSLionel Sambuc  auto &amp;d = b;
1123*f4a2713aSLionel Sambuc  auto &amp;&amp;e = c;
1124*f4a2713aSLionel Sambuc  auto &amp;&amp;f = 2;
1125*f4a2713aSLionel Sambuc  int g = 5;
1126*f4a2713aSLionel Sambuc
1127*f4a2713aSLionel SambuclValueReferenceType() matches the types of b, d, and e. e is
1128*f4a2713aSLionel Sambucmatched since the type is deduced as int&amp; by reference collapsing rules.
1129*f4a2713aSLionel Sambuc</pre></td></tr>
1130*f4a2713aSLionel Sambuc
1131*f4a2713aSLionel Sambuc
1132*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;...</td></tr>
1133*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="memberPointerType0"><pre>Matches member pointer types.
1134*f4a2713aSLionel SambucGiven
1135*f4a2713aSLionel Sambuc  struct A { int i; }
1136*f4a2713aSLionel Sambuc  A::* ptr = A::i;
1137*f4a2713aSLionel SambucmemberPointerType()
1138*f4a2713aSLionel Sambuc  matches "A::* ptr"
1139*f4a2713aSLionel Sambuc</pre></td></tr>
1140*f4a2713aSLionel Sambuc
1141*f4a2713aSLionel Sambuc
1142*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;...</td></tr>
1143*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="parenType0"><pre>Matches ParenType nodes.
1144*f4a2713aSLionel Sambuc
1145*f4a2713aSLionel SambucGiven
1146*f4a2713aSLionel Sambuc  int (*ptr_to_array)[4];
1147*f4a2713aSLionel Sambuc  int *array_of_ptrs[4];
1148*f4a2713aSLionel Sambuc
1149*f4a2713aSLionel SambucvarDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
1150*f4a2713aSLionel Sambucarray_of_ptrs.
1151*f4a2713aSLionel Sambuc</pre></td></tr>
1152*f4a2713aSLionel Sambuc
1153*f4a2713aSLionel Sambuc
1154*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;...</td></tr>
1155*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointerType0"><pre>Matches pointer types.
1156*f4a2713aSLionel Sambuc
1157*f4a2713aSLionel SambucGiven
1158*f4a2713aSLionel Sambuc  int *a;
1159*f4a2713aSLionel Sambuc  int &amp;b = *a;
1160*f4a2713aSLionel Sambuc  int c = 5;
1161*f4a2713aSLionel SambucpointerType()
1162*f4a2713aSLionel Sambuc  matches "int *a"
1163*f4a2713aSLionel Sambuc</pre></td></tr>
1164*f4a2713aSLionel Sambuc
1165*f4a2713aSLionel Sambuc
1166*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1RValueReferenceType.html">RValueReferenceType</a>&gt;...</td></tr>
1167*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="rValueReferenceType0"><pre>Matches rvalue reference types.
1168*f4a2713aSLionel Sambuc
1169*f4a2713aSLionel SambucGiven:
1170*f4a2713aSLionel Sambuc  int *a;
1171*f4a2713aSLionel Sambuc  int &amp;b = *a;
1172*f4a2713aSLionel Sambuc  int &amp;&amp;c = 1;
1173*f4a2713aSLionel Sambuc  auto &amp;d = b;
1174*f4a2713aSLionel Sambuc  auto &amp;&amp;e = c;
1175*f4a2713aSLionel Sambuc  auto &amp;&amp;f = 2;
1176*f4a2713aSLionel Sambuc  int g = 5;
1177*f4a2713aSLionel Sambuc
1178*f4a2713aSLionel SambucrValueReferenceType() matches the types of c and f. e is not
1179*f4a2713aSLionel Sambucmatched as it is deduced to int&amp; by reference collapsing rules.
1180*f4a2713aSLionel Sambuc</pre></td></tr>
1181*f4a2713aSLionel Sambuc
1182*f4a2713aSLionel Sambuc
1183*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;...</td></tr>
1184*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="recordType0"><pre>Matches record types (e.g. structs, classes).
1185*f4a2713aSLionel Sambuc
1186*f4a2713aSLionel SambucGiven
1187*f4a2713aSLionel Sambuc  class C {};
1188*f4a2713aSLionel Sambuc  struct S {};
1189*f4a2713aSLionel Sambuc
1190*f4a2713aSLionel Sambuc  C c;
1191*f4a2713aSLionel Sambuc  S s;
1192*f4a2713aSLionel Sambuc
1193*f4a2713aSLionel SambucrecordType() matches the type of the variable declarations of both c
1194*f4a2713aSLionel Sambucand s.
1195*f4a2713aSLionel Sambuc</pre></td></tr>
1196*f4a2713aSLionel Sambuc
1197*f4a2713aSLionel Sambuc
1198*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;...</td></tr>
1199*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="referenceType0"><pre>Matches both lvalue and rvalue reference types.
1200*f4a2713aSLionel Sambuc
1201*f4a2713aSLionel SambucGiven
1202*f4a2713aSLionel Sambuc  int *a;
1203*f4a2713aSLionel Sambuc  int &amp;b = *a;
1204*f4a2713aSLionel Sambuc  int &amp;&amp;c = 1;
1205*f4a2713aSLionel Sambuc  auto &amp;d = b;
1206*f4a2713aSLionel Sambuc  auto &amp;&amp;e = c;
1207*f4a2713aSLionel Sambuc  auto &amp;&amp;f = 2;
1208*f4a2713aSLionel Sambuc  int g = 5;
1209*f4a2713aSLionel Sambuc
1210*f4a2713aSLionel SambucreferenceType() matches the types of b, c, d, e, and f.
1211*f4a2713aSLionel Sambuc</pre></td></tr>
1212*f4a2713aSLionel Sambuc
1213*f4a2713aSLionel Sambuc
1214*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;...</td></tr>
1215*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="templateSpecializationType0"><pre>Matches template specialization types.
1216*f4a2713aSLionel Sambuc
1217*f4a2713aSLionel SambucGiven
1218*f4a2713aSLionel Sambuc  template &lt;typename T&gt;
1219*f4a2713aSLionel Sambuc  class C { };
1220*f4a2713aSLionel Sambuc
1221*f4a2713aSLionel Sambuc  template class C&lt;int&gt;;  A
1222*f4a2713aSLionel Sambuc  C&lt;char&gt; var;            B
1223*f4a2713aSLionel Sambuc
1224*f4a2713aSLionel SambuctemplateSpecializationType() matches the type of the explicit
1225*f4a2713aSLionel Sambucinstantiation in A and the type of the variable declaration in B.
1226*f4a2713aSLionel Sambuc</pre></td></tr>
1227*f4a2713aSLionel Sambuc
1228*f4a2713aSLionel Sambuc
1229*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;...</td></tr>
1230*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="type0"><pre>Matches Types in the clang AST.
1231*f4a2713aSLionel Sambuc</pre></td></tr>
1232*f4a2713aSLionel Sambuc
1233*f4a2713aSLionel Sambuc
1234*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;...</td></tr>
1235*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="typedefType0"><pre>Matches typedef types.
1236*f4a2713aSLionel Sambuc
1237*f4a2713aSLionel SambucGiven
1238*f4a2713aSLionel Sambuc  typedef int X;
1239*f4a2713aSLionel SambuctypedefType()
1240*f4a2713aSLionel Sambuc  matches "typedef int X"
1241*f4a2713aSLionel Sambuc</pre></td></tr>
1242*f4a2713aSLionel Sambuc
1243*f4a2713aSLionel Sambuc
1244*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1UnaryTransformType.html">UnaryTransformType</a>&gt;...</td></tr>
1245*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="unaryTransformType0"><pre>Matches types nodes representing unary type transformations.
1246*f4a2713aSLionel Sambuc
1247*f4a2713aSLionel SambucGiven:
1248*f4a2713aSLionel Sambuc  typedef __underlying_type(T) type;
1249*f4a2713aSLionel SambucunaryTransformType()
1250*f4a2713aSLionel Sambuc  matches "__underlying_type(T)"
1251*f4a2713aSLionel Sambuc</pre></td></tr>
1252*f4a2713aSLionel Sambuc
1253*f4a2713aSLionel Sambuc
1254*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1VariableArrayType.html">VariableArrayType</a>&gt;...</td></tr>
1255*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="variableArrayType0"><pre>Matches C arrays with a specified size that is not an
1256*f4a2713aSLionel Sambucinteger-constant-expression.
1257*f4a2713aSLionel Sambuc
1258*f4a2713aSLionel SambucGiven
1259*f4a2713aSLionel Sambuc  void f() {
1260*f4a2713aSLionel Sambuc    int a[] = { 2, 3 }
1261*f4a2713aSLionel Sambuc    int b[42];
1262*f4a2713aSLionel Sambuc    int c[a[0]];
1263*f4a2713aSLionel SambucvariableArrayType()
1264*f4a2713aSLionel Sambuc  matches "int c[a[0]]"
1265*f4a2713aSLionel Sambuc</pre></td></tr>
1266*f4a2713aSLionel Sambuc
1267*f4a2713aSLionel Sambuc<!--END_DECL_MATCHERS -->
1268*f4a2713aSLionel Sambuc</table>
1269*f4a2713aSLionel Sambuc
1270*f4a2713aSLionel Sambuc<!-- ======================================================================= -->
1271*f4a2713aSLionel Sambuc<h2 id="narrowing-matchers">Narrowing Matchers</h2>
1272*f4a2713aSLionel Sambuc<!-- ======================================================================= -->
1273*f4a2713aSLionel Sambuc
1274*f4a2713aSLionel Sambuc<p>Narrowing matchers match certain attributes on the current node, thus
1275*f4a2713aSLionel Sambucnarrowing down the set of nodes of the current type to match on.</p>
1276*f4a2713aSLionel Sambuc
1277*f4a2713aSLionel Sambuc<p>There are special logical narrowing matchers (allOf, anyOf, anything and unless)
1278*f4a2713aSLionel Sambucwhich allow users to create more powerful match expressions.</p>
1279*f4a2713aSLionel Sambuc
1280*f4a2713aSLionel Sambuc<table>
1281*f4a2713aSLionel Sambuc<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
1282*f4a2713aSLionel Sambuc<!-- START_NARROWING_MATCHERS -->
1283*f4a2713aSLionel Sambuc
1284*f4a2713aSLionel Sambuc<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>
1285*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="allOf0"><pre>Matches if all given matchers match.
1286*f4a2713aSLionel Sambuc
1287*f4a2713aSLionel SambucUsable as: Any Matcher
1288*f4a2713aSLionel Sambuc</pre></td></tr>
1289*f4a2713aSLionel Sambuc
1290*f4a2713aSLionel Sambuc
1291*f4a2713aSLionel Sambuc<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>
1292*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="anyOf0"><pre>Matches if any of the given matchers matches.
1293*f4a2713aSLionel Sambuc
1294*f4a2713aSLionel SambucUsable as: Any Matcher
1295*f4a2713aSLionel Sambuc</pre></td></tr>
1296*f4a2713aSLionel Sambuc
1297*f4a2713aSLionel Sambuc
1298*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('anything0')"><a name="anything0Anchor">anything</a></td><td></td></tr>
1299*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="anything0"><pre>Matches any node.
1300*f4a2713aSLionel Sambuc
1301*f4a2713aSLionel SambucUseful when another matcher requires a child matcher, but there's no
1302*f4a2713aSLionel Sambucadditional constraint. This will often be used with an explicit conversion
1303*f4a2713aSLionel Sambucto an internal::Matcher&lt;&gt; type such as TypeMatcher.
1304*f4a2713aSLionel Sambuc
1305*f4a2713aSLionel SambucExample: DeclarationMatcher(anything()) matches all declarations, e.g.,
1306*f4a2713aSLionel Sambuc"int* p" and "void f()" in
1307*f4a2713aSLionel Sambuc  int* p;
1308*f4a2713aSLionel Sambuc  void f();
1309*f4a2713aSLionel Sambuc
1310*f4a2713aSLionel SambucUsable as: Any Matcher
1311*f4a2713aSLionel Sambuc</pre></td></tr>
1312*f4a2713aSLionel Sambuc
1313*f4a2713aSLionel Sambuc
1314*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('unless0')"><a name="unless0Anchor">unless</a></td><td>Matcher&lt;*&gt;  InnerMatcher</td></tr>
1315*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="unless0"><pre>Matches if the provided matcher does not match.
1316*f4a2713aSLionel Sambuc
1317*f4a2713aSLionel SambucExample matches Y (matcher = recordDecl(unless(hasName("X"))))
1318*f4a2713aSLionel Sambuc  class X {};
1319*f4a2713aSLionel Sambuc  class Y {};
1320*f4a2713aSLionel Sambuc
1321*f4a2713aSLionel SambucUsable as: Any Matcher
1322*f4a2713aSLionel Sambuc</pre></td></tr>
1323*f4a2713aSLionel Sambuc
1324*f4a2713aSLionel Sambuc
1325*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1326*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasOperatorName0"><pre>Matches the operator Name of operator expressions (binary or
1327*f4a2713aSLionel Sambucunary).
1328*f4a2713aSLionel Sambuc
1329*f4a2713aSLionel SambucExample matches a || b (matcher = binaryOperator(hasOperatorName("||")))
1330*f4a2713aSLionel Sambuc  !(a || b)
1331*f4a2713aSLionel Sambuc</pre></td></tr>
1332*f4a2713aSLionel Sambuc
1333*f4a2713aSLionel Sambuc
1334*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;CXXBoolLiteral&gt;</td><td class="name" onclick="toggle('equals2')"><a name="equals2Anchor">equals</a></td><td>ValueT  Value</td></tr>
1335*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value.
1336*f4a2713aSLionel Sambuc
1337*f4a2713aSLionel SambucExample matches true (matcher = boolLiteral(equals(true)))
1338*f4a2713aSLionel Sambuc  true
1339*f4a2713aSLionel Sambuc
1340*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
1341*f4a2713aSLionel Sambuc           Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
1342*f4a2713aSLionel Sambuc</pre></td></tr>
1343*f4a2713aSLionel Sambuc
1344*f4a2713aSLionel Sambuc
1345*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1346*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has
1347*f4a2713aSLionel Sambuca specific number of arguments (including absent default arguments).
1348*f4a2713aSLionel Sambuc
1349*f4a2713aSLionel SambucExample matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
1350*f4a2713aSLionel Sambuc  void f(int x, int y);
1351*f4a2713aSLionel Sambuc  f(0, 0);
1352*f4a2713aSLionel Sambuc</pre></td></tr>
1353*f4a2713aSLionel Sambuc
1354*f4a2713aSLionel Sambuc
1355*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructorDecl.html">CXXConstructorDecl</a>&gt;</td><td class="name" onclick="toggle('isImplicit0')"><a name="isImplicit0Anchor">isImplicit</a></td><td></td></tr>
1356*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isImplicit0"><pre>Matches a constructor declaration that has been implicitly added
1357*f4a2713aSLionel Sambucby the compiler (eg. implicit defaultcopy constructors).
1358*f4a2713aSLionel Sambuc</pre></td></tr>
1359*f4a2713aSLionel Sambuc
1360*f4a2713aSLionel Sambuc
1361*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1362*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isWritten0"><pre>Matches a constructor initializer if it is explicitly written in
1363*f4a2713aSLionel Sambuccode (as opposed to implicitly added by the compiler).
1364*f4a2713aSLionel Sambuc
1365*f4a2713aSLionel SambucGiven
1366*f4a2713aSLionel Sambuc  struct Foo {
1367*f4a2713aSLionel Sambuc    Foo() { }
1368*f4a2713aSLionel Sambuc    Foo(int) : foo_("A") { }
1369*f4a2713aSLionel Sambuc    string foo_;
1370*f4a2713aSLionel Sambuc  };
1371*f4a2713aSLionel SambucconstructorDecl(hasAnyConstructorInitializer(isWritten()))
1372*f4a2713aSLionel Sambuc  will match Foo(int), but not Foo()
1373*f4a2713aSLionel Sambuc</pre></td></tr>
1374*f4a2713aSLionel Sambuc
1375*f4a2713aSLionel Sambuc
1376*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;</td><td class="name" onclick="toggle('hasOverloadedOperatorName0')"><a name="hasOverloadedOperatorName0Anchor">hasOverloadedOperatorName</a></td><td>StringRef Name</td></tr>
1377*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName0"><pre>Matches overloaded operator names.
1378*f4a2713aSLionel Sambuc
1379*f4a2713aSLionel SambucMatches overloaded operator names specified in strings without the
1380*f4a2713aSLionel Sambuc"operator" prefix: e.g. "&lt;&lt;".
1381*f4a2713aSLionel Sambuc
1382*f4a2713aSLionel SambucGiven:
1383*f4a2713aSLionel Sambuc  class A { int operator*(); };
1384*f4a2713aSLionel Sambuc  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
1385*f4a2713aSLionel Sambuc  A a;
1386*f4a2713aSLionel Sambuc  a &lt;&lt; a;   &lt;-- This matches
1387*f4a2713aSLionel Sambuc
1388*f4a2713aSLionel SambucoperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the specified
1389*f4a2713aSLionel Sambucline and recordDecl(hasMethod(hasOverloadedOperatorName("*"))) matches
1390*f4a2713aSLionel Sambucthe declaration of A.
1391*f4a2713aSLionel Sambuc
1392*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;
1393*f4a2713aSLionel Sambuc</pre></td></tr>
1394*f4a2713aSLionel Sambuc
1395*f4a2713aSLionel Sambuc
1396*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1397*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isConst0"><pre>Matches if the given method declaration is const.
1398*f4a2713aSLionel Sambuc
1399*f4a2713aSLionel SambucGiven
1400*f4a2713aSLionel Sambucstruct A {
1401*f4a2713aSLionel Sambuc  void foo() const;
1402*f4a2713aSLionel Sambuc  void bar();
1403*f4a2713aSLionel Sambuc};
1404*f4a2713aSLionel Sambuc
1405*f4a2713aSLionel SambucmethodDecl(isConst()) matches A::foo() but not A::bar()
1406*f4a2713aSLionel Sambuc</pre></td></tr>
1407*f4a2713aSLionel Sambuc
1408*f4a2713aSLionel Sambuc
1409*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1410*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isOverride0"><pre>Matches if the given method declaration overrides another method.
1411*f4a2713aSLionel Sambuc
1412*f4a2713aSLionel SambucGiven
1413*f4a2713aSLionel Sambuc  class A {
1414*f4a2713aSLionel Sambuc   public:
1415*f4a2713aSLionel Sambuc    virtual void x();
1416*f4a2713aSLionel Sambuc  };
1417*f4a2713aSLionel Sambuc  class B : public A {
1418*f4a2713aSLionel Sambuc   public:
1419*f4a2713aSLionel Sambuc    virtual void x();
1420*f4a2713aSLionel Sambuc  };
1421*f4a2713aSLionel Sambuc  matches B::x
1422*f4a2713aSLionel Sambuc</pre></td></tr>
1423*f4a2713aSLionel Sambuc
1424*f4a2713aSLionel Sambuc
1425*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1426*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isVirtual0"><pre>Matches if the given method declaration is virtual.
1427*f4a2713aSLionel Sambuc
1428*f4a2713aSLionel SambucGiven
1429*f4a2713aSLionel Sambuc  class A {
1430*f4a2713aSLionel Sambuc   public:
1431*f4a2713aSLionel Sambuc    virtual void x();
1432*f4a2713aSLionel Sambuc  };
1433*f4a2713aSLionel Sambuc  matches A::x
1434*f4a2713aSLionel Sambuc</pre></td></tr>
1435*f4a2713aSLionel Sambuc
1436*f4a2713aSLionel Sambuc
1437*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1438*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasOverloadedOperatorName1"><pre>Matches overloaded operator names.
1439*f4a2713aSLionel Sambuc
1440*f4a2713aSLionel SambucMatches overloaded operator names specified in strings without the
1441*f4a2713aSLionel Sambuc"operator" prefix: e.g. "&lt;&lt;".
1442*f4a2713aSLionel Sambuc
1443*f4a2713aSLionel SambucGiven:
1444*f4a2713aSLionel Sambuc  class A { int operator*(); };
1445*f4a2713aSLionel Sambuc  const A &amp;operator&lt;&lt;(const A &amp;a, const A &amp;b);
1446*f4a2713aSLionel Sambuc  A a;
1447*f4a2713aSLionel Sambuc  a &lt;&lt; a;   &lt;-- This matches
1448*f4a2713aSLionel Sambuc
1449*f4a2713aSLionel SambucoperatorCallExpr(hasOverloadedOperatorName("&lt;&lt;"))) matches the specified
1450*f4a2713aSLionel Sambucline and recordDecl(hasMethod(hasOverloadedOperatorName("*"))) matches
1451*f4a2713aSLionel Sambucthe declaration of A.
1452*f4a2713aSLionel Sambuc
1453*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXOperatorCallExpr.html">CXXOperatorCallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt;
1454*f4a2713aSLionel Sambuc</pre></td></tr>
1455*f4a2713aSLionel Sambuc
1456*f4a2713aSLionel Sambuc
1457*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isDerivedFrom1')"><a name="isDerivedFrom1Anchor">isDerivedFrom</a></td><td>StringRef BaseName</td></tr>
1458*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isDerivedFrom1"><pre>Overloaded method as shortcut for isDerivedFrom(hasName(...)).
1459*f4a2713aSLionel Sambuc</pre></td></tr>
1460*f4a2713aSLionel Sambuc
1461*f4a2713aSLionel Sambuc
1462*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1463*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization2"><pre>Matches explicit template specializations of function, class, or
1464*f4a2713aSLionel Sambucstatic member variable template instantiations.
1465*f4a2713aSLionel Sambuc
1466*f4a2713aSLionel SambucGiven
1467*f4a2713aSLionel Sambuc  template&lt;typename T&gt; void A(T t) { }
1468*f4a2713aSLionel Sambuc  template&lt;&gt; void A(int N) { }
1469*f4a2713aSLionel SambucfunctionDecl(isExplicitTemplateSpecialization())
1470*f4a2713aSLionel Sambuc  matches the specialization A&lt;int&gt;().
1471*f4a2713aSLionel Sambuc
1472*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1473*f4a2713aSLionel Sambuc</pre></td></tr>
1474*f4a2713aSLionel Sambuc
1475*f4a2713aSLionel Sambuc
1476*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;</td><td class="name" onclick="toggle('isSameOrDerivedFrom1')"><a name="isSameOrDerivedFrom1Anchor">isSameOrDerivedFrom</a></td><td>StringRef BaseName</td></tr>
1477*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom1"><pre>Overloaded method as shortcut for
1478*f4a2713aSLionel SambucisSameOrDerivedFrom(hasName(...)).
1479*f4a2713aSLionel Sambuc</pre></td></tr>
1480*f4a2713aSLionel Sambuc
1481*f4a2713aSLionel Sambuc
1482*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1483*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isTemplateInstantiation2"><pre>Matches template instantiations of function, class, or static
1484*f4a2713aSLionel Sambucmember variable template instantiations.
1485*f4a2713aSLionel Sambuc
1486*f4a2713aSLionel SambucGiven
1487*f4a2713aSLionel Sambuc  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
1488*f4a2713aSLionel Sambucor
1489*f4a2713aSLionel Sambuc  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
1490*f4a2713aSLionel SambucrecordDecl(hasName("::X"), isTemplateInstantiation())
1491*f4a2713aSLionel Sambuc  matches the template instantiation of X&lt;A&gt;.
1492*f4a2713aSLionel Sambuc
1493*f4a2713aSLionel SambucBut given
1494*f4a2713aSLionel Sambuc  template &lt;typename T&gt;  class X {}; class A {};
1495*f4a2713aSLionel Sambuc  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
1496*f4a2713aSLionel SambucrecordDecl(hasName("::X"), isTemplateInstantiation())
1497*f4a2713aSLionel Sambuc  does not match, as X&lt;A&gt; is an explicit template specialization.
1498*f4a2713aSLionel Sambuc
1499*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1500*f4a2713aSLionel Sambuc</pre></td></tr>
1501*f4a2713aSLionel Sambuc
1502*f4a2713aSLionel Sambuc
1503*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1504*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="argumentCountIs0"><pre>Checks that a call expression or a constructor call expression has
1505*f4a2713aSLionel Sambuca specific number of arguments (including absent default arguments).
1506*f4a2713aSLionel Sambuc
1507*f4a2713aSLionel SambucExample matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
1508*f4a2713aSLionel Sambuc  void f(int x, int y);
1509*f4a2713aSLionel Sambuc  f(0, 0);
1510*f4a2713aSLionel Sambuc</pre></td></tr>
1511*f4a2713aSLionel Sambuc
1512*f4a2713aSLionel Sambuc
1513*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>ValueT  Value</td></tr>
1514*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value.
1515*f4a2713aSLionel Sambuc
1516*f4a2713aSLionel SambucExample matches true (matcher = boolLiteral(equals(true)))
1517*f4a2713aSLionel Sambuc  true
1518*f4a2713aSLionel Sambuc
1519*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
1520*f4a2713aSLionel Sambuc           Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
1521*f4a2713aSLionel Sambuc</pre></td></tr>
1522*f4a2713aSLionel Sambuc
1523*f4a2713aSLionel Sambuc
1524*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1525*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="statementCountIs0"><pre>Checks that a compound statement contains a specific number of
1526*f4a2713aSLionel Sambucchild statements.
1527*f4a2713aSLionel Sambuc
1528*f4a2713aSLionel SambucExample: Given
1529*f4a2713aSLionel Sambuc  { for (;;) {} }
1530*f4a2713aSLionel SambuccompoundStmt(statementCountIs(0)))
1531*f4a2713aSLionel Sambuc  matches '{}'
1532*f4a2713aSLionel Sambuc  but does not match the outer compound statement.
1533*f4a2713aSLionel Sambuc</pre></td></tr>
1534*f4a2713aSLionel Sambuc
1535*f4a2713aSLionel Sambuc
1536*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1537*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasSize0"><pre>Matches ConstantArrayType nodes that have the specified size.
1538*f4a2713aSLionel Sambuc
1539*f4a2713aSLionel SambucGiven
1540*f4a2713aSLionel Sambuc  int a[42];
1541*f4a2713aSLionel Sambuc  int b[2 * 21];
1542*f4a2713aSLionel Sambuc  int c[41], d[43];
1543*f4a2713aSLionel SambucconstantArrayType(hasSize(42))
1544*f4a2713aSLionel Sambuc  matches "int a[42]" and "int b[2 * 21]"
1545*f4a2713aSLionel Sambuc</pre></td></tr>
1546*f4a2713aSLionel Sambuc
1547*f4a2713aSLionel Sambuc
1548*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1549*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="declCountIs0"><pre>Matches declaration statements that contain a specific number of
1550*f4a2713aSLionel Sambucdeclarations.
1551*f4a2713aSLionel Sambuc
1552*f4a2713aSLionel SambucExample: Given
1553*f4a2713aSLionel Sambuc  int a, b;
1554*f4a2713aSLionel Sambuc  int c;
1555*f4a2713aSLionel Sambuc  int d = 2, e;
1556*f4a2713aSLionel SambucdeclCountIs(2)
1557*f4a2713aSLionel Sambuc  matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
1558*f4a2713aSLionel Sambuc</pre></td></tr>
1559*f4a2713aSLionel Sambuc
1560*f4a2713aSLionel Sambuc
1561*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1562*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
1563*f4a2713aSLionel Sambuc
1564*f4a2713aSLionel SambucMatches a node if it equals the node previously bound to ID.
1565*f4a2713aSLionel Sambuc
1566*f4a2713aSLionel SambucGiven
1567*f4a2713aSLionel Sambuc  class X { int a; int b; };
1568*f4a2713aSLionel SambucrecordDecl(
1569*f4a2713aSLionel Sambuc    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
1570*f4a2713aSLionel Sambuc    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
1571*f4a2713aSLionel Sambuc  matches the class X, as a and b have the same type.
1572*f4a2713aSLionel Sambuc
1573*f4a2713aSLionel SambucNote that when multiple matches are involved via forEach* matchers,
1574*f4a2713aSLionel SambucequalsBoundNodes acts as a filter.
1575*f4a2713aSLionel SambucFor example:
1576*f4a2713aSLionel SambuccompoundStmt(
1577*f4a2713aSLionel Sambuc    forEachDescendant(varDecl().bind("d")),
1578*f4a2713aSLionel Sambuc    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
1579*f4a2713aSLionel Sambucwill trigger a match for each combination of variable declaration
1580*f4a2713aSLionel Sambucand reference to that variable declaration within a compound statement.
1581*f4a2713aSLionel Sambuc</pre></td></tr>
1582*f4a2713aSLionel Sambuc
1583*f4a2713aSLionel Sambuc
1584*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>Decl* Other</td></tr>
1585*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equalsNode0"><pre>Matches if a node equals another node.
1586*f4a2713aSLionel Sambuc
1587*f4a2713aSLionel SambucDecl has pointer identity in the AST.
1588*f4a2713aSLionel Sambuc</pre></td></tr>
1589*f4a2713aSLionel Sambuc
1590*f4a2713aSLionel Sambuc
1591*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1592*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isPrivate0"><pre>Matches private C++ declarations.
1593*f4a2713aSLionel Sambuc
1594*f4a2713aSLionel SambucGiven
1595*f4a2713aSLionel Sambuc  class C {
1596*f4a2713aSLionel Sambuc  public:    int a;
1597*f4a2713aSLionel Sambuc  protected: int b;
1598*f4a2713aSLionel Sambuc  private:   int c;
1599*f4a2713aSLionel Sambuc  };
1600*f4a2713aSLionel SambucfieldDecl(isPrivate())
1601*f4a2713aSLionel Sambuc  matches 'int c;'
1602*f4a2713aSLionel Sambuc</pre></td></tr>
1603*f4a2713aSLionel Sambuc
1604*f4a2713aSLionel Sambuc
1605*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1606*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isProtected0"><pre>Matches protected C++ declarations.
1607*f4a2713aSLionel Sambuc
1608*f4a2713aSLionel SambucGiven
1609*f4a2713aSLionel Sambuc  class C {
1610*f4a2713aSLionel Sambuc  public:    int a;
1611*f4a2713aSLionel Sambuc  protected: int b;
1612*f4a2713aSLionel Sambuc  private:   int c;
1613*f4a2713aSLionel Sambuc  };
1614*f4a2713aSLionel SambucfieldDecl(isProtected())
1615*f4a2713aSLionel Sambuc  matches 'int b;'
1616*f4a2713aSLionel Sambuc</pre></td></tr>
1617*f4a2713aSLionel Sambuc
1618*f4a2713aSLionel Sambuc
1619*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1620*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isPublic0"><pre>Matches public C++ declarations.
1621*f4a2713aSLionel Sambuc
1622*f4a2713aSLionel SambucGiven
1623*f4a2713aSLionel Sambuc  class C {
1624*f4a2713aSLionel Sambuc  public:    int a;
1625*f4a2713aSLionel Sambuc  protected: int b;
1626*f4a2713aSLionel Sambuc  private:   int c;
1627*f4a2713aSLionel Sambuc  };
1628*f4a2713aSLionel SambucfieldDecl(isPublic())
1629*f4a2713aSLionel Sambuc  matches 'int a;'
1630*f4a2713aSLionel Sambuc</pre></td></tr>
1631*f4a2713aSLionel Sambuc
1632*f4a2713aSLionel Sambuc
1633*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>ValueT  Value</td></tr>
1634*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value.
1635*f4a2713aSLionel Sambuc
1636*f4a2713aSLionel SambucExample matches true (matcher = boolLiteral(equals(true)))
1637*f4a2713aSLionel Sambuc  true
1638*f4a2713aSLionel Sambuc
1639*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
1640*f4a2713aSLionel Sambuc           Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
1641*f4a2713aSLionel Sambuc</pre></td></tr>
1642*f4a2713aSLionel Sambuc
1643*f4a2713aSLionel Sambuc
1644*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;</td><td class="name" onclick="toggle('isDefinition2')"><a name="isDefinition2Anchor">isDefinition</a></td><td></td></tr>
1645*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isDefinition2"><pre>Matches if a declaration has a body attached.
1646*f4a2713aSLionel Sambuc
1647*f4a2713aSLionel SambucExample matches A, va, fa
1648*f4a2713aSLionel Sambuc  class A {};
1649*f4a2713aSLionel Sambuc  class B;  Doesn't match, as it has no body.
1650*f4a2713aSLionel Sambuc  int va;
1651*f4a2713aSLionel Sambuc  extern int vb;  Doesn't match, as it doesn't define the variable.
1652*f4a2713aSLionel Sambuc  void fa() {}
1653*f4a2713aSLionel Sambuc  void fb();  Doesn't match, as it has no body.
1654*f4a2713aSLionel Sambuc
1655*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
1656*f4a2713aSLionel Sambuc</pre></td></tr>
1657*f4a2713aSLionel Sambuc
1658*f4a2713aSLionel Sambuc
1659*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1660*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization0"><pre>Matches explicit template specializations of function, class, or
1661*f4a2713aSLionel Sambucstatic member variable template instantiations.
1662*f4a2713aSLionel Sambuc
1663*f4a2713aSLionel SambucGiven
1664*f4a2713aSLionel Sambuc  template&lt;typename T&gt; void A(T t) { }
1665*f4a2713aSLionel Sambuc  template&lt;&gt; void A(int N) { }
1666*f4a2713aSLionel SambucfunctionDecl(isExplicitTemplateSpecialization())
1667*f4a2713aSLionel Sambuc  matches the specialization A&lt;int&gt;().
1668*f4a2713aSLionel Sambuc
1669*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1670*f4a2713aSLionel Sambuc</pre></td></tr>
1671*f4a2713aSLionel Sambuc
1672*f4a2713aSLionel Sambuc
1673*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1674*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function declarations.
1675*f4a2713aSLionel Sambuc
1676*f4a2713aSLionel SambucGiven:
1677*f4a2713aSLionel Sambuc  extern "C" void f() {}
1678*f4a2713aSLionel Sambuc  extern "C" { void g() {} }
1679*f4a2713aSLionel Sambuc  void h() {}
1680*f4a2713aSLionel SambucfunctionDecl(isExternC())
1681*f4a2713aSLionel Sambuc  matches the declaration of f and g, but not the declaration h
1682*f4a2713aSLionel Sambuc</pre></td></tr>
1683*f4a2713aSLionel Sambuc
1684*f4a2713aSLionel Sambuc
1685*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1686*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isTemplateInstantiation0"><pre>Matches template instantiations of function, class, or static
1687*f4a2713aSLionel Sambucmember variable template instantiations.
1688*f4a2713aSLionel Sambuc
1689*f4a2713aSLionel SambucGiven
1690*f4a2713aSLionel Sambuc  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
1691*f4a2713aSLionel Sambucor
1692*f4a2713aSLionel Sambuc  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
1693*f4a2713aSLionel SambucrecordDecl(hasName("::X"), isTemplateInstantiation())
1694*f4a2713aSLionel Sambuc  matches the template instantiation of X&lt;A&gt;.
1695*f4a2713aSLionel Sambuc
1696*f4a2713aSLionel SambucBut given
1697*f4a2713aSLionel Sambuc  template &lt;typename T&gt;  class X {}; class A {};
1698*f4a2713aSLionel Sambuc  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
1699*f4a2713aSLionel SambucrecordDecl(hasName("::X"), isTemplateInstantiation())
1700*f4a2713aSLionel Sambuc  does not match, as X&lt;A&gt; is an explicit template specialization.
1701*f4a2713aSLionel Sambuc
1702*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1703*f4a2713aSLionel Sambuc</pre></td></tr>
1704*f4a2713aSLionel Sambuc
1705*f4a2713aSLionel Sambuc
1706*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1707*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="parameterCountIs0"><pre>Matches FunctionDecls that have a specific parameter count.
1708*f4a2713aSLionel Sambuc
1709*f4a2713aSLionel SambucGiven
1710*f4a2713aSLionel Sambuc  void f(int i) {}
1711*f4a2713aSLionel Sambuc  void g(int i, int j) {}
1712*f4a2713aSLionel SambucfunctionDecl(parameterCountIs(2))
1713*f4a2713aSLionel Sambuc  matches g(int i, int j) {}
1714*f4a2713aSLionel Sambuc</pre></td></tr>
1715*f4a2713aSLionel Sambuc
1716*f4a2713aSLionel Sambuc
1717*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>ValueT  Value</td></tr>
1718*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value.
1719*f4a2713aSLionel Sambuc
1720*f4a2713aSLionel SambucExample matches true (matcher = boolLiteral(equals(true)))
1721*f4a2713aSLionel Sambuc  true
1722*f4a2713aSLionel Sambuc
1723*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>&gt;, Matcher&lt;CXXBoolLiteral&gt;,
1724*f4a2713aSLionel Sambuc           Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
1725*f4a2713aSLionel Sambuc</pre></td></tr>
1726*f4a2713aSLionel Sambuc
1727*f4a2713aSLionel Sambuc
1728*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1729*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isArrow0"><pre>Matches member expressions that are called with '-&gt;' as opposed
1730*f4a2713aSLionel Sambucto '.'.
1731*f4a2713aSLionel Sambuc
1732*f4a2713aSLionel SambucMember calls on the implicit this pointer match as called with '-&gt;'.
1733*f4a2713aSLionel Sambuc
1734*f4a2713aSLionel SambucGiven
1735*f4a2713aSLionel Sambuc  class Y {
1736*f4a2713aSLionel Sambuc    void x() { this-&gt;x(); x(); Y y; y.x(); a; this-&gt;b; Y::b; }
1737*f4a2713aSLionel Sambuc    int a;
1738*f4a2713aSLionel Sambuc    static int b;
1739*f4a2713aSLionel Sambuc  };
1740*f4a2713aSLionel SambucmemberExpr(isArrow())
1741*f4a2713aSLionel Sambuc  matches this-&gt;x, x, y.x, a, this-&gt;b
1742*f4a2713aSLionel Sambuc</pre></td></tr>
1743*f4a2713aSLionel Sambuc
1744*f4a2713aSLionel Sambuc
1745*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>std::string Name</td></tr>
1746*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name.
1747*f4a2713aSLionel Sambuc
1748*f4a2713aSLionel SambucSupports specifying enclosing namespaces or classes by prefixing the name
1749*f4a2713aSLionel Sambucwith '&lt;enclosing&gt;::'.
1750*f4a2713aSLionel SambucDoes not match typedefs of an underlying type with the given name.
1751*f4a2713aSLionel Sambuc
1752*f4a2713aSLionel SambucExample matches X (Name == "X")
1753*f4a2713aSLionel Sambuc  class X;
1754*f4a2713aSLionel Sambuc
1755*f4a2713aSLionel SambucExample matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
1756*f4a2713aSLionel Sambuc  namespace a { namespace b { class X; } }
1757*f4a2713aSLionel Sambuc</pre></td></tr>
1758*f4a2713aSLionel Sambuc
1759*f4a2713aSLionel Sambuc
1760*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt;</td><td class="name" onclick="toggle('matchesName0')"><a name="matchesName0Anchor">matchesName</a></td><td>std::string RegExp</td></tr>
1761*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="matchesName0"><pre>Matches NamedDecl nodes whose fully qualified names contain
1762*f4a2713aSLionel Sambuca substring matched by the given RegExp.
1763*f4a2713aSLionel Sambuc
1764*f4a2713aSLionel SambucSupports specifying enclosing namespaces or classes by
1765*f4a2713aSLionel Sambucprefixing the name with '&lt;enclosing&gt;::'.  Does not match typedefs
1766*f4a2713aSLionel Sambucof an underlying type with the given name.
1767*f4a2713aSLionel Sambuc
1768*f4a2713aSLionel SambucExample matches X (regexp == "::X")
1769*f4a2713aSLionel Sambuc  class X;
1770*f4a2713aSLionel Sambuc
1771*f4a2713aSLionel SambucExample matches X (regexp is one of "::X", "^foo::.*X", among others)
1772*f4a2713aSLionel Sambuc  namespace foo { namespace bar { class X; } }
1773*f4a2713aSLionel Sambuc</pre></td></tr>
1774*f4a2713aSLionel Sambuc
1775*f4a2713aSLionel Sambuc
1776*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1777*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="asString0"><pre>Matches if the matched type is represented by the given string.
1778*f4a2713aSLionel Sambuc
1779*f4a2713aSLionel SambucGiven
1780*f4a2713aSLionel Sambuc  class Y { public: void x(); };
1781*f4a2713aSLionel Sambuc  void z() { Y* y; y-&gt;x(); }
1782*f4a2713aSLionel SambuccallExpr(on(hasType(asString("class Y *"))))
1783*f4a2713aSLionel Sambuc  matches y-&gt;x()
1784*f4a2713aSLionel Sambuc</pre></td></tr>
1785*f4a2713aSLionel Sambuc
1786*f4a2713aSLionel Sambuc
1787*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1788*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equalsBoundNode3"><pre>Matches if a node equals a previously bound node.
1789*f4a2713aSLionel Sambuc
1790*f4a2713aSLionel SambucMatches a node if it equals the node previously bound to ID.
1791*f4a2713aSLionel Sambuc
1792*f4a2713aSLionel SambucGiven
1793*f4a2713aSLionel Sambuc  class X { int a; int b; };
1794*f4a2713aSLionel SambucrecordDecl(
1795*f4a2713aSLionel Sambuc    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
1796*f4a2713aSLionel Sambuc    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
1797*f4a2713aSLionel Sambuc  matches the class X, as a and b have the same type.
1798*f4a2713aSLionel Sambuc
1799*f4a2713aSLionel SambucNote that when multiple matches are involved via forEach* matchers,
1800*f4a2713aSLionel SambucequalsBoundNodes acts as a filter.
1801*f4a2713aSLionel SambucFor example:
1802*f4a2713aSLionel SambuccompoundStmt(
1803*f4a2713aSLionel Sambuc    forEachDescendant(varDecl().bind("d")),
1804*f4a2713aSLionel Sambuc    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
1805*f4a2713aSLionel Sambucwill trigger a match for each combination of variable declaration
1806*f4a2713aSLionel Sambucand reference to that variable declaration within a compound statement.
1807*f4a2713aSLionel Sambuc</pre></td></tr>
1808*f4a2713aSLionel Sambuc
1809*f4a2713aSLionel Sambuc
1810*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1811*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasLocalQualifiers0"><pre>Matches QualType nodes that have local CV-qualifiers attached to
1812*f4a2713aSLionel Sambucthe node, not hidden within a typedef.
1813*f4a2713aSLionel Sambuc
1814*f4a2713aSLionel SambucGiven
1815*f4a2713aSLionel Sambuc  typedef const int const_int;
1816*f4a2713aSLionel Sambuc  const_int i;
1817*f4a2713aSLionel Sambuc  int *const j;
1818*f4a2713aSLionel Sambuc  int *volatile k;
1819*f4a2713aSLionel Sambuc  int m;
1820*f4a2713aSLionel SambucvarDecl(hasType(hasLocalQualifiers())) matches only j and k.
1821*f4a2713aSLionel Sambuci is const-qualified but the qualifier is not local.
1822*f4a2713aSLionel Sambuc</pre></td></tr>
1823*f4a2713aSLionel Sambuc
1824*f4a2713aSLionel Sambuc
1825*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1826*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isConstQualified0"><pre>Matches QualType nodes that are const-qualified, i.e., that
1827*f4a2713aSLionel Sambucinclude "top-level" const.
1828*f4a2713aSLionel Sambuc
1829*f4a2713aSLionel SambucGiven
1830*f4a2713aSLionel Sambuc  void a(int);
1831*f4a2713aSLionel Sambuc  void b(int const);
1832*f4a2713aSLionel Sambuc  void c(const int);
1833*f4a2713aSLionel Sambuc  void d(const int*);
1834*f4a2713aSLionel Sambuc  void e(int const) {};
1835*f4a2713aSLionel SambucfunctionDecl(hasAnyParameter(hasType(isConstQualified())))
1836*f4a2713aSLionel Sambuc  matches "void b(int const)", "void c(const int)" and
1837*f4a2713aSLionel Sambuc  "void e(int const) {}". It does not match d as there
1838*f4a2713aSLionel Sambuc  is no top-level const on the parameter type "const int *".
1839*f4a2713aSLionel Sambuc</pre></td></tr>
1840*f4a2713aSLionel Sambuc
1841*f4a2713aSLionel Sambuc
1842*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1843*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isInteger0"><pre>Matches QualType nodes that are of integer type.
1844*f4a2713aSLionel Sambuc
1845*f4a2713aSLionel SambucGiven
1846*f4a2713aSLionel Sambuc  void a(int);
1847*f4a2713aSLionel Sambuc  void b(long);
1848*f4a2713aSLionel Sambuc  void c(double);
1849*f4a2713aSLionel SambucfunctionDecl(hasAnyParameter(hasType(isInteger())))
1850*f4a2713aSLionel Sambucmatches "a(int)", "b(long)", but not "c(double)".
1851*f4a2713aSLionel Sambuc</pre></td></tr>
1852*f4a2713aSLionel Sambuc
1853*f4a2713aSLionel Sambuc
1854*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1855*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equalsBoundNode0"><pre>Matches if a node equals a previously bound node.
1856*f4a2713aSLionel Sambuc
1857*f4a2713aSLionel SambucMatches a node if it equals the node previously bound to ID.
1858*f4a2713aSLionel Sambuc
1859*f4a2713aSLionel SambucGiven
1860*f4a2713aSLionel Sambuc  class X { int a; int b; };
1861*f4a2713aSLionel SambucrecordDecl(
1862*f4a2713aSLionel Sambuc    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
1863*f4a2713aSLionel Sambuc    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
1864*f4a2713aSLionel Sambuc  matches the class X, as a and b have the same type.
1865*f4a2713aSLionel Sambuc
1866*f4a2713aSLionel SambucNote that when multiple matches are involved via forEach* matchers,
1867*f4a2713aSLionel SambucequalsBoundNodes acts as a filter.
1868*f4a2713aSLionel SambucFor example:
1869*f4a2713aSLionel SambuccompoundStmt(
1870*f4a2713aSLionel Sambuc    forEachDescendant(varDecl().bind("d")),
1871*f4a2713aSLionel Sambuc    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
1872*f4a2713aSLionel Sambucwill trigger a match for each combination of variable declaration
1873*f4a2713aSLionel Sambucand reference to that variable declaration within a compound statement.
1874*f4a2713aSLionel Sambuc</pre></td></tr>
1875*f4a2713aSLionel Sambuc
1876*f4a2713aSLionel Sambuc
1877*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>Stmt* Other</td></tr>
1878*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equalsNode1"><pre>Matches if a node equals another node.
1879*f4a2713aSLionel Sambuc
1880*f4a2713aSLionel SambucStmt has pointer identity in the AST.
1881*f4a2713aSLionel Sambuc
1882*f4a2713aSLionel Sambuc</pre></td></tr>
1883*f4a2713aSLionel Sambuc
1884*f4a2713aSLionel Sambuc
1885*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1886*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isDefinition0"><pre>Matches if a declaration has a body attached.
1887*f4a2713aSLionel Sambuc
1888*f4a2713aSLionel SambucExample matches A, va, fa
1889*f4a2713aSLionel Sambuc  class A {};
1890*f4a2713aSLionel Sambuc  class B;  Doesn't match, as it has no body.
1891*f4a2713aSLionel Sambuc  int va;
1892*f4a2713aSLionel Sambuc  extern int vb;  Doesn't match, as it doesn't define the variable.
1893*f4a2713aSLionel Sambuc  void fa() {}
1894*f4a2713aSLionel Sambuc  void fb();  Doesn't match, as it has no body.
1895*f4a2713aSLionel Sambuc
1896*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
1897*f4a2713aSLionel Sambuc</pre></td></tr>
1898*f4a2713aSLionel Sambuc
1899*f4a2713aSLionel Sambuc
1900*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1901*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="equalsBoundNode2"><pre>Matches if a node equals a previously bound node.
1902*f4a2713aSLionel Sambuc
1903*f4a2713aSLionel SambucMatches a node if it equals the node previously bound to ID.
1904*f4a2713aSLionel Sambuc
1905*f4a2713aSLionel SambucGiven
1906*f4a2713aSLionel Sambuc  class X { int a; int b; };
1907*f4a2713aSLionel SambucrecordDecl(
1908*f4a2713aSLionel Sambuc    has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
1909*f4a2713aSLionel Sambuc    has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
1910*f4a2713aSLionel Sambuc  matches the class X, as a and b have the same type.
1911*f4a2713aSLionel Sambuc
1912*f4a2713aSLionel SambucNote that when multiple matches are involved via forEach* matchers,
1913*f4a2713aSLionel SambucequalsBoundNodes acts as a filter.
1914*f4a2713aSLionel SambucFor example:
1915*f4a2713aSLionel SambuccompoundStmt(
1916*f4a2713aSLionel Sambuc    forEachDescendant(varDecl().bind("d")),
1917*f4a2713aSLionel Sambuc    forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
1918*f4a2713aSLionel Sambucwill trigger a match for each combination of variable declaration
1919*f4a2713aSLionel Sambucand reference to that variable declaration within a compound statement.
1920*f4a2713aSLionel Sambuc</pre></td></tr>
1921*f4a2713aSLionel Sambuc
1922*f4a2713aSLionel Sambuc
1923*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1924*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="ofKind0"><pre>Matches unary expressions of a certain kind.
1925*f4a2713aSLionel Sambuc
1926*f4a2713aSLionel SambucGiven
1927*f4a2713aSLionel Sambuc  int x;
1928*f4a2713aSLionel Sambuc  int s = sizeof(x) + alignof(x)
1929*f4a2713aSLionel SambucunaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf))
1930*f4a2713aSLionel Sambuc  matches sizeof(x)
1931*f4a2713aSLionel Sambuc</pre></td></tr>
1932*f4a2713aSLionel Sambuc
1933*f4a2713aSLionel Sambuc
1934*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryOperator.html">UnaryOperator</a>&gt;</td><td class="name" onclick="toggle('hasOperatorName1')"><a name="hasOperatorName1Anchor">hasOperatorName</a></td><td>std::string Name</td></tr>
1935*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasOperatorName1"><pre>Matches the operator Name of operator expressions (binary or
1936*f4a2713aSLionel Sambucunary).
1937*f4a2713aSLionel Sambuc
1938*f4a2713aSLionel SambucExample matches a || b (matcher = binaryOperator(hasOperatorName("||")))
1939*f4a2713aSLionel Sambuc  !(a || b)
1940*f4a2713aSLionel Sambuc</pre></td></tr>
1941*f4a2713aSLionel Sambuc
1942*f4a2713aSLionel Sambuc
1943*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1944*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isDefinition1"><pre>Matches if a declaration has a body attached.
1945*f4a2713aSLionel Sambuc
1946*f4a2713aSLionel SambucExample matches A, va, fa
1947*f4a2713aSLionel Sambuc  class A {};
1948*f4a2713aSLionel Sambuc  class B;  Doesn't match, as it has no body.
1949*f4a2713aSLionel Sambuc  int va;
1950*f4a2713aSLionel Sambuc  extern int vb;  Doesn't match, as it doesn't define the variable.
1951*f4a2713aSLionel Sambuc  void fa() {}
1952*f4a2713aSLionel Sambuc  void fb();  Doesn't match, as it has no body.
1953*f4a2713aSLionel Sambuc
1954*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagDecl.html">TagDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;
1955*f4a2713aSLionel Sambuc</pre></td></tr>
1956*f4a2713aSLionel Sambuc
1957*f4a2713aSLionel Sambuc
1958*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1959*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isExplicitTemplateSpecialization1"><pre>Matches explicit template specializations of function, class, or
1960*f4a2713aSLionel Sambucstatic member variable template instantiations.
1961*f4a2713aSLionel Sambuc
1962*f4a2713aSLionel SambucGiven
1963*f4a2713aSLionel Sambuc  template&lt;typename T&gt; void A(T t) { }
1964*f4a2713aSLionel Sambuc  template&lt;&gt; void A(int N) { }
1965*f4a2713aSLionel SambucfunctionDecl(isExplicitTemplateSpecialization())
1966*f4a2713aSLionel Sambuc  matches the specialization A&lt;int&gt;().
1967*f4a2713aSLionel Sambuc
1968*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1969*f4a2713aSLionel Sambuc</pre></td></tr>
1970*f4a2713aSLionel Sambuc
1971*f4a2713aSLionel Sambuc
1972*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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>
1973*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isTemplateInstantiation1"><pre>Matches template instantiations of function, class, or static
1974*f4a2713aSLionel Sambucmember variable template instantiations.
1975*f4a2713aSLionel Sambuc
1976*f4a2713aSLionel SambucGiven
1977*f4a2713aSLionel Sambuc  template &lt;typename T&gt; class X {}; class A {}; X&lt;A&gt; x;
1978*f4a2713aSLionel Sambucor
1979*f4a2713aSLionel Sambuc  template &lt;typename T&gt; class X {}; class A {}; template class X&lt;A&gt;;
1980*f4a2713aSLionel SambucrecordDecl(hasName("::X"), isTemplateInstantiation())
1981*f4a2713aSLionel Sambuc  matches the template instantiation of X&lt;A&gt;.
1982*f4a2713aSLionel Sambuc
1983*f4a2713aSLionel SambucBut given
1984*f4a2713aSLionel Sambuc  template &lt;typename T&gt;  class X {}; class A {};
1985*f4a2713aSLionel Sambuc  template &lt;&gt; class X&lt;A&gt; {}; X&lt;A&gt; x;
1986*f4a2713aSLionel SambucrecordDecl(hasName("::X"), isTemplateInstantiation())
1987*f4a2713aSLionel Sambuc  does not match, as X&lt;A&gt; is an explicit template specialization.
1988*f4a2713aSLionel Sambuc
1989*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt;
1990*f4a2713aSLionel Sambuc</pre></td></tr>
1991*f4a2713aSLionel Sambuc
1992*f4a2713aSLionel Sambuc<!--END_NARROWING_MATCHERS -->
1993*f4a2713aSLionel Sambuc</table>
1994*f4a2713aSLionel Sambuc
1995*f4a2713aSLionel Sambuc<!-- ======================================================================= -->
1996*f4a2713aSLionel Sambuc<h2 id="traversal-matchers">AST Traversal Matchers</h2>
1997*f4a2713aSLionel Sambuc<!-- ======================================================================= -->
1998*f4a2713aSLionel Sambuc
1999*f4a2713aSLionel Sambuc<p>Traversal matchers specify the relationship to other nodes that are
2000*f4a2713aSLionel Sambucreachable from the current node.</p>
2001*f4a2713aSLionel Sambuc
2002*f4a2713aSLionel Sambuc<p>Note that there are special traversal matchers (has, hasDescendant, forEach and
2003*f4a2713aSLionel SambucforEachDescendant) which work on all nodes and allow users to write more generic
2004*f4a2713aSLionel Sambucmatch expressions.</p>
2005*f4a2713aSLionel Sambuc
2006*f4a2713aSLionel Sambuc<table>
2007*f4a2713aSLionel Sambuc<tr style="text-align:left"><th>Return type</th><th>Name</th><th>Parameters</th></tr>
2008*f4a2713aSLionel Sambuc<!-- START_TRAVERSAL_MATCHERS -->
2009*f4a2713aSLionel Sambuc
2010*f4a2713aSLionel Sambuc<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>
2011*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="eachOf0"><pre>Matches if any of the given matchers matches.
2012*f4a2713aSLionel Sambuc
2013*f4a2713aSLionel SambucUnlike anyOf, eachOf will generate a match result for each
2014*f4a2713aSLionel Sambucmatching submatcher.
2015*f4a2713aSLionel Sambuc
2016*f4a2713aSLionel SambucFor example, in:
2017*f4a2713aSLionel Sambuc  class A { int a; int b; };
2018*f4a2713aSLionel SambucThe matcher:
2019*f4a2713aSLionel Sambuc  recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
2020*f4a2713aSLionel Sambuc                    has(fieldDecl(hasName("b")).bind("v"))))
2021*f4a2713aSLionel Sambucwill generate two results binding "v", the first of which binds
2022*f4a2713aSLionel Sambucthe field declaration of a, the second the field declaration of
2023*f4a2713aSLionel Sambucb.
2024*f4a2713aSLionel Sambuc
2025*f4a2713aSLionel SambucUsable as: Any Matcher
2026*f4a2713aSLionel Sambuc</pre></td></tr>
2027*f4a2713aSLionel Sambuc
2028*f4a2713aSLionel Sambuc
2029*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEach0')"><a name="forEach0Anchor">forEach</a></td><td>Matcher&lt;*&gt;</td></tr>
2030*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="forEach0"><pre>Matches AST nodes that have child AST nodes that match the
2031*f4a2713aSLionel Sambucprovided matcher.
2032*f4a2713aSLionel Sambuc
2033*f4a2713aSLionel SambucExample matches X, Y (matcher = recordDecl(forEach(recordDecl(hasName("X")))
2034*f4a2713aSLionel Sambuc  class X {};  Matches X, because X::X is a class of name X inside X.
2035*f4a2713aSLionel Sambuc  class Y { class X {}; };
2036*f4a2713aSLionel Sambuc  class Z { class Y { class X {}; }; };  Does not match Z.
2037*f4a2713aSLionel Sambuc
2038*f4a2713aSLionel SambucChildT must be an AST base type.
2039*f4a2713aSLionel Sambuc
2040*f4a2713aSLionel SambucAs opposed to 'has', 'forEach' will cause a match for each result that
2041*f4a2713aSLionel Sambucmatches instead of only on the first one.
2042*f4a2713aSLionel Sambuc
2043*f4a2713aSLionel SambucUsable as: Any Matcher
2044*f4a2713aSLionel Sambuc</pre></td></tr>
2045*f4a2713aSLionel Sambuc
2046*f4a2713aSLionel Sambuc
2047*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('forEachDescendant0')"><a name="forEachDescendant0Anchor">forEachDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
2048*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="forEachDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
2049*f4a2713aSLionel Sambucprovided matcher.
2050*f4a2713aSLionel Sambuc
2051*f4a2713aSLionel SambucExample matches X, A, B, C
2052*f4a2713aSLionel Sambuc    (matcher = recordDecl(forEachDescendant(recordDecl(hasName("X")))))
2053*f4a2713aSLionel Sambuc  class X {};  Matches X, because X::X is a class of name X inside X.
2054*f4a2713aSLionel Sambuc  class A { class X {}; };
2055*f4a2713aSLionel Sambuc  class B { class C { class X {}; }; };
2056*f4a2713aSLionel Sambuc
2057*f4a2713aSLionel SambucDescendantT must be an AST base type.
2058*f4a2713aSLionel Sambuc
2059*f4a2713aSLionel SambucAs opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
2060*f4a2713aSLionel Sambuceach result that matches instead of only on the first one.
2061*f4a2713aSLionel Sambuc
2062*f4a2713aSLionel SambucNote: Recursively combined ForEachDescendant can cause many matches:
2063*f4a2713aSLionel Sambuc  recordDecl(forEachDescendant(recordDecl(forEachDescendant(recordDecl()))))
2064*f4a2713aSLionel Sambucwill match 10 times (plus injected class name matches) on:
2065*f4a2713aSLionel Sambuc  class A { class B { class C { class D { class E {}; }; }; }; };
2066*f4a2713aSLionel Sambuc
2067*f4a2713aSLionel SambucUsable as: Any Matcher
2068*f4a2713aSLionel Sambuc</pre></td></tr>
2069*f4a2713aSLionel Sambuc
2070*f4a2713aSLionel Sambuc
2071*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('has0')"><a name="has0Anchor">has</a></td><td>Matcher&lt;*&gt;</td></tr>
2072*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="has0"><pre>Matches AST nodes that have child AST nodes that match the
2073*f4a2713aSLionel Sambucprovided matcher.
2074*f4a2713aSLionel Sambuc
2075*f4a2713aSLionel SambucExample matches X, Y (matcher = recordDecl(has(recordDecl(hasName("X")))
2076*f4a2713aSLionel Sambuc  class X {};  Matches X, because X::X is a class of name X inside X.
2077*f4a2713aSLionel Sambuc  class Y { class X {}; };
2078*f4a2713aSLionel Sambuc  class Z { class Y { class X {}; }; };  Does not match Z.
2079*f4a2713aSLionel Sambuc
2080*f4a2713aSLionel SambucChildT must be an AST base type.
2081*f4a2713aSLionel Sambuc
2082*f4a2713aSLionel SambucUsable as: Any Matcher
2083*f4a2713aSLionel Sambuc</pre></td></tr>
2084*f4a2713aSLionel Sambuc
2085*f4a2713aSLionel Sambuc
2086*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasAncestor0')"><a name="hasAncestor0Anchor">hasAncestor</a></td><td>Matcher&lt;*&gt;</td></tr>
2087*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasAncestor0"><pre>Matches AST nodes that have an ancestor that matches the provided
2088*f4a2713aSLionel Sambucmatcher.
2089*f4a2713aSLionel Sambuc
2090*f4a2713aSLionel SambucGiven
2091*f4a2713aSLionel Sambucvoid f() { if (true) { int x = 42; } }
2092*f4a2713aSLionel Sambucvoid g() { for (;;) { int x = 43; } }
2093*f4a2713aSLionel Sambucexpr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43.
2094*f4a2713aSLionel Sambuc
2095*f4a2713aSLionel SambucUsable as: Any Matcher
2096*f4a2713aSLionel Sambuc</pre></td></tr>
2097*f4a2713aSLionel Sambuc
2098*f4a2713aSLionel Sambuc
2099*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasDescendant0')"><a name="hasDescendant0Anchor">hasDescendant</a></td><td>Matcher&lt;*&gt;</td></tr>
2100*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDescendant0"><pre>Matches AST nodes that have descendant AST nodes that match the
2101*f4a2713aSLionel Sambucprovided matcher.
2102*f4a2713aSLionel Sambuc
2103*f4a2713aSLionel SambucExample matches X, Y, Z
2104*f4a2713aSLionel Sambuc    (matcher = recordDecl(hasDescendant(recordDecl(hasName("X")))))
2105*f4a2713aSLionel Sambuc  class X {};  Matches X, because X::X is a class of name X inside X.
2106*f4a2713aSLionel Sambuc  class Y { class X {}; };
2107*f4a2713aSLionel Sambuc  class Z { class Y { class X {}; }; };
2108*f4a2713aSLionel Sambuc
2109*f4a2713aSLionel SambucDescendantT must be an AST base type.
2110*f4a2713aSLionel Sambuc
2111*f4a2713aSLionel SambucUsable as: Any Matcher
2112*f4a2713aSLionel Sambuc</pre></td></tr>
2113*f4a2713aSLionel Sambuc
2114*f4a2713aSLionel Sambuc
2115*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;*&gt;</td><td class="name" onclick="toggle('hasParent0')"><a name="hasParent0Anchor">hasParent</a></td><td>Matcher&lt;*&gt;</td></tr>
2116*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasParent0"><pre>Matches AST nodes that have a parent that matches the provided
2117*f4a2713aSLionel Sambucmatcher.
2118*f4a2713aSLionel Sambuc
2119*f4a2713aSLionel SambucGiven
2120*f4a2713aSLionel Sambucvoid f() { for (;;) { int x = 42; if (true) { int x = 43; } } }
2121*f4a2713aSLionel SambuccompoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
2122*f4a2713aSLionel Sambuc
2123*f4a2713aSLionel SambucUsable as: Any Matcher
2124*f4a2713aSLionel Sambuc</pre></td></tr>
2125*f4a2713aSLionel Sambuc
2126*f4a2713aSLionel Sambuc
2127*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2128*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasBase0"><pre>Matches the base expression of an array subscript expression.
2129*f4a2713aSLionel Sambuc
2130*f4a2713aSLionel SambucGiven
2131*f4a2713aSLionel Sambuc  int i[5];
2132*f4a2713aSLionel Sambuc  void f() { i[1] = 42; }
2133*f4a2713aSLionel SambucarraySubscriptExpression(hasBase(implicitCastExpr(
2134*f4a2713aSLionel Sambuc    hasSourceExpression(declRefExpr()))))
2135*f4a2713aSLionel Sambuc  matches i[1] with the declRefExpr() matching i
2136*f4a2713aSLionel Sambuc</pre></td></tr>
2137*f4a2713aSLionel Sambuc
2138*f4a2713aSLionel Sambuc
2139*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2140*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasIndex0"><pre>Matches the index expression of an array subscript expression.
2141*f4a2713aSLionel Sambuc
2142*f4a2713aSLionel SambucGiven
2143*f4a2713aSLionel Sambuc  int i[5];
2144*f4a2713aSLionel Sambuc  void f() { i[1] = 42; }
2145*f4a2713aSLionel SambucarraySubscriptExpression(hasIndex(integerLiteral()))
2146*f4a2713aSLionel Sambuc  matches i[1] with the integerLiteral() matching 1
2147*f4a2713aSLionel Sambuc</pre></td></tr>
2148*f4a2713aSLionel Sambuc
2149*f4a2713aSLionel Sambuc
2150*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayTypeLoc.html">ArrayTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasElementTypeLoc0')"><a name="hasElementTypeLoc0Anchor">hasElementTypeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
2151*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasElementTypeLoc0"><pre>Matches arrays and C99 complex types that have a specific element
2152*f4a2713aSLionel Sambuctype.
2153*f4a2713aSLionel Sambuc
2154*f4a2713aSLionel SambucGiven
2155*f4a2713aSLionel Sambuc  struct A {};
2156*f4a2713aSLionel Sambuc  A a[7];
2157*f4a2713aSLionel Sambuc  int b[7];
2158*f4a2713aSLionel SambucarrayType(hasElementType(builtinType()))
2159*f4a2713aSLionel Sambuc  matches "int b[7]"
2160*f4a2713aSLionel Sambuc
2161*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
2162*f4a2713aSLionel Sambuc</pre></td></tr>
2163*f4a2713aSLionel Sambuc
2164*f4a2713aSLionel Sambuc
2165*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2166*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasElementType0"><pre>Matches arrays and C99 complex types that have a specific element
2167*f4a2713aSLionel Sambuctype.
2168*f4a2713aSLionel Sambuc
2169*f4a2713aSLionel SambucGiven
2170*f4a2713aSLionel Sambuc  struct A {};
2171*f4a2713aSLionel Sambuc  A a[7];
2172*f4a2713aSLionel Sambuc  int b[7];
2173*f4a2713aSLionel SambucarrayType(hasElementType(builtinType()))
2174*f4a2713aSLionel Sambuc  matches "int b[7]"
2175*f4a2713aSLionel Sambuc
2176*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
2177*f4a2713aSLionel Sambuc</pre></td></tr>
2178*f4a2713aSLionel Sambuc
2179*f4a2713aSLionel Sambuc
2180*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicTypeLoc.html">AtomicTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasValueTypeLoc0')"><a name="hasValueTypeLoc0Anchor">hasValueTypeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
2181*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasValueTypeLoc0"><pre>Matches atomic types with a specific value type.
2182*f4a2713aSLionel Sambuc
2183*f4a2713aSLionel SambucGiven
2184*f4a2713aSLionel Sambuc  _Atomic(int) i;
2185*f4a2713aSLionel Sambuc  _Atomic(float) f;
2186*f4a2713aSLionel SambucatomicType(hasValueType(isInteger()))
2187*f4a2713aSLionel Sambuc matches "_Atomic(int) i"
2188*f4a2713aSLionel Sambuc
2189*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
2190*f4a2713aSLionel Sambuc</pre></td></tr>
2191*f4a2713aSLionel Sambuc
2192*f4a2713aSLionel Sambuc
2193*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2194*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasValueType0"><pre>Matches atomic types with a specific value type.
2195*f4a2713aSLionel Sambuc
2196*f4a2713aSLionel SambucGiven
2197*f4a2713aSLionel Sambuc  _Atomic(int) i;
2198*f4a2713aSLionel Sambuc  _Atomic(float) f;
2199*f4a2713aSLionel SambucatomicType(hasValueType(isInteger()))
2200*f4a2713aSLionel Sambuc matches "_Atomic(int) i"
2201*f4a2713aSLionel Sambuc
2202*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AtomicType.html">AtomicType</a>&gt;
2203*f4a2713aSLionel Sambuc</pre></td></tr>
2204*f4a2713aSLionel Sambuc
2205*f4a2713aSLionel Sambuc
2206*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2207*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeducedType0"><pre>Matches AutoType nodes where the deduced type is a specific type.
2208*f4a2713aSLionel Sambuc
2209*f4a2713aSLionel SambucNote: There is no TypeLoc for the deduced type and thus no
2210*f4a2713aSLionel SambucgetDeducedLoc() matcher.
2211*f4a2713aSLionel Sambuc
2212*f4a2713aSLionel SambucGiven
2213*f4a2713aSLionel Sambuc  auto a = 1;
2214*f4a2713aSLionel Sambuc  auto b = 2.0;
2215*f4a2713aSLionel SambucautoType(hasDeducedType(isInteger()))
2216*f4a2713aSLionel Sambuc  matches "auto a"
2217*f4a2713aSLionel Sambuc
2218*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1AutoType.html">AutoType</a>&gt;
2219*f4a2713aSLionel Sambuc</pre></td></tr>
2220*f4a2713aSLionel Sambuc
2221*f4a2713aSLionel Sambuc
2222*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;  InnerMatcher</td></tr>
2223*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a
2224*f4a2713aSLionel Sambucbinary operator matches.
2225*f4a2713aSLionel Sambuc</pre></td></tr>
2226*f4a2713aSLionel Sambuc
2227*f4a2713aSLionel Sambuc
2228*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2229*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasLHS0"><pre>Matches the left hand side of binary operator expressions.
2230*f4a2713aSLionel Sambuc
2231*f4a2713aSLionel SambucExample matches a (matcher = binaryOperator(hasLHS()))
2232*f4a2713aSLionel Sambuc  a || b
2233*f4a2713aSLionel Sambuc</pre></td></tr>
2234*f4a2713aSLionel Sambuc
2235*f4a2713aSLionel Sambuc
2236*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2237*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasRHS0"><pre>Matches the right hand side of binary operator expressions.
2238*f4a2713aSLionel Sambuc
2239*f4a2713aSLionel SambucExample matches b (matcher = binaryOperator(hasRHS()))
2240*f4a2713aSLionel Sambuc  a || b
2241*f4a2713aSLionel Sambuc</pre></td></tr>
2242*f4a2713aSLionel Sambuc
2243*f4a2713aSLionel Sambuc
2244*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerTypeLoc.html">BlockPointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc0')"><a name="pointeeLoc0Anchor">pointeeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
2245*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointeeLoc0"><pre>Narrows PointerType (and similar) matchers to those where the
2246*f4a2713aSLionel Sambucpointee matches a given matcher.
2247*f4a2713aSLionel Sambuc
2248*f4a2713aSLionel SambucGiven
2249*f4a2713aSLionel Sambuc  int *a;
2250*f4a2713aSLionel Sambuc  int const *b;
2251*f4a2713aSLionel Sambuc  float const *f;
2252*f4a2713aSLionel SambucpointerType(pointee(isConstQualified(), isInteger()))
2253*f4a2713aSLionel Sambuc  matches "int const *b"
2254*f4a2713aSLionel Sambuc
2255*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
2256*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
2257*f4a2713aSLionel Sambuc</pre></td></tr>
2258*f4a2713aSLionel Sambuc
2259*f4a2713aSLionel Sambuc
2260*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2261*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointee0"><pre>Narrows PointerType (and similar) matchers to those where the
2262*f4a2713aSLionel Sambucpointee matches a given matcher.
2263*f4a2713aSLionel Sambuc
2264*f4a2713aSLionel SambucGiven
2265*f4a2713aSLionel Sambuc  int *a;
2266*f4a2713aSLionel Sambuc  int const *b;
2267*f4a2713aSLionel Sambuc  float const *f;
2268*f4a2713aSLionel SambucpointerType(pointee(isConstQualified(), isInteger()))
2269*f4a2713aSLionel Sambuc  matches "int const *b"
2270*f4a2713aSLionel Sambuc
2271*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
2272*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
2273*f4a2713aSLionel Sambuc</pre></td></tr>
2274*f4a2713aSLionel Sambuc
2275*f4a2713aSLionel Sambuc
2276*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2277*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasAnyArgument1"><pre>Matches any argument of a call expression or a constructor call
2278*f4a2713aSLionel Sambucexpression.
2279*f4a2713aSLionel Sambuc
2280*f4a2713aSLionel SambucGiven
2281*f4a2713aSLionel Sambuc  void x(int, int, int) { int y; x(1, y, 42); }
2282*f4a2713aSLionel SambuccallExpr(hasAnyArgument(declRefExpr()))
2283*f4a2713aSLionel Sambuc  matches x(1, y, 42)
2284*f4a2713aSLionel Sambucwith hasAnyArgument(...)
2285*f4a2713aSLionel Sambuc  matching y
2286*f4a2713aSLionel Sambuc
2287*f4a2713aSLionel SambucFIXME: Currently this will ignore parentheses and implicit casts on
2288*f4a2713aSLionel Sambucthe argument before applying the inner matcher. We'll want to remove
2289*f4a2713aSLionel Sambucthis to allow for greater control by the user once ignoreImplicit()
2290*f4a2713aSLionel Sambuchas been implemented.
2291*f4a2713aSLionel Sambuc</pre></td></tr>
2292*f4a2713aSLionel Sambuc
2293*f4a2713aSLionel Sambuc
2294*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2295*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasArgument1"><pre>Matches the n'th argument of a call expression or a constructor
2296*f4a2713aSLionel Sambuccall expression.
2297*f4a2713aSLionel Sambuc
2298*f4a2713aSLionel SambucExample matches y in x(y)
2299*f4a2713aSLionel Sambuc    (matcher = callExpr(hasArgument(0, declRefExpr())))
2300*f4a2713aSLionel Sambuc  void x(int) { int y; x(y); }
2301*f4a2713aSLionel Sambuc</pre></td></tr>
2302*f4a2713aSLionel Sambuc
2303*f4a2713aSLionel Sambuc
2304*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration12')"><a name="hasDeclaration12Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
2305*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node
2306*f4a2713aSLionel Sambucmatches the given matcher.
2307*f4a2713aSLionel Sambuc
2308*f4a2713aSLionel SambucThe associated declaration is:
2309*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
2310*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
2311*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
2312*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
2313*f4a2713aSLionel Sambuc
2314*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
2315*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
2316*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
2317*f4a2713aSLionel SambucgetDecl().
2318*f4a2713aSLionel Sambuc
2319*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
2320*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
2321*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
2322*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
2323*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
2324*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
2325*f4a2713aSLionel Sambuc</pre></td></tr>
2326*f4a2713aSLionel Sambuc
2327*f4a2713aSLionel Sambuc
2328*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt; InnerMatcher</td></tr>
2329*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="forEachConstructorInitializer0"><pre>Matches each constructor initializer in a constructor definition.
2330*f4a2713aSLionel Sambuc
2331*f4a2713aSLionel SambucGiven
2332*f4a2713aSLionel Sambuc  class A { A() : i(42), j(42) {} int i; int j; };
2333*f4a2713aSLionel SambucconstructorDecl(forEachConstructorInitializer(forField(decl().bind("x"))))
2334*f4a2713aSLionel Sambuc  will trigger two matches, binding for 'i' and 'j' respectively.
2335*f4a2713aSLionel Sambuc</pre></td></tr>
2336*f4a2713aSLionel Sambuc
2337*f4a2713aSLionel Sambuc
2338*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CXXCtorInitializer.html">CXXCtorInitializer</a>&gt; InnerMatcher</td></tr>
2339*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasAnyConstructorInitializer0"><pre>Matches a constructor initializer.
2340*f4a2713aSLionel Sambuc
2341*f4a2713aSLionel SambucGiven
2342*f4a2713aSLionel Sambuc  struct Foo {
2343*f4a2713aSLionel Sambuc    Foo() : foo_(1) { }
2344*f4a2713aSLionel Sambuc    int foo_;
2345*f4a2713aSLionel Sambuc  };
2346*f4a2713aSLionel SambucrecordDecl(has(constructorDecl(hasAnyConstructorInitializer(anything()))))
2347*f4a2713aSLionel Sambuc  record matches Foo, hasAnyConstructorInitializer matches foo_(1)
2348*f4a2713aSLionel Sambuc</pre></td></tr>
2349*f4a2713aSLionel Sambuc
2350*f4a2713aSLionel Sambuc
2351*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1FieldDecl.html">FieldDecl</a>&gt; InnerMatcher</td></tr>
2352*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="forField0"><pre>Matches the field declaration of a constructor initializer.
2353*f4a2713aSLionel Sambuc
2354*f4a2713aSLionel SambucGiven
2355*f4a2713aSLionel Sambuc  struct Foo {
2356*f4a2713aSLionel Sambuc    Foo() : foo_(1) { }
2357*f4a2713aSLionel Sambuc    int foo_;
2358*f4a2713aSLionel Sambuc  };
2359*f4a2713aSLionel SambucrecordDecl(has(constructorDecl(hasAnyConstructorInitializer(
2360*f4a2713aSLionel Sambuc    forField(hasName("foo_"))))))
2361*f4a2713aSLionel Sambuc  matches Foo
2362*f4a2713aSLionel Sambucwith forField matching foo_
2363*f4a2713aSLionel Sambuc</pre></td></tr>
2364*f4a2713aSLionel Sambuc
2365*f4a2713aSLionel Sambuc
2366*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2367*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="withInitializer0"><pre>Matches the initializer expression of a constructor initializer.
2368*f4a2713aSLionel Sambuc
2369*f4a2713aSLionel SambucGiven
2370*f4a2713aSLionel Sambuc  struct Foo {
2371*f4a2713aSLionel Sambuc    Foo() : foo_(1) { }
2372*f4a2713aSLionel Sambuc    int foo_;
2373*f4a2713aSLionel Sambuc  };
2374*f4a2713aSLionel SambucrecordDecl(has(constructorDecl(hasAnyConstructorInitializer(
2375*f4a2713aSLionel Sambuc    withInitializer(integerLiteral(equals(1)))))))
2376*f4a2713aSLionel Sambuc  matches Foo
2377*f4a2713aSLionel Sambucwith withInitializer matching (1)
2378*f4a2713aSLionel Sambuc</pre></td></tr>
2379*f4a2713aSLionel Sambuc
2380*f4a2713aSLionel Sambuc
2381*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2382*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="on0"><pre>Matches on the implicit object argument of a member call expression.
2383*f4a2713aSLionel Sambuc
2384*f4a2713aSLionel SambucExample matches y.x() (matcher = callExpr(on(hasType(recordDecl(hasName("Y"))))))
2385*f4a2713aSLionel Sambuc  class Y { public: void x(); };
2386*f4a2713aSLionel Sambuc  void z() { Y y; y.x(); }",
2387*f4a2713aSLionel Sambuc
2388*f4a2713aSLionel SambucFIXME: Overload to allow directly matching types?
2389*f4a2713aSLionel Sambuc</pre></td></tr>
2390*f4a2713aSLionel Sambuc
2391*f4a2713aSLionel Sambuc
2392*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2393*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="onImplicitObjectArgument0"><pre></pre></td></tr>
2394*f4a2713aSLionel Sambuc
2395*f4a2713aSLionel Sambuc
2396*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2397*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="thisPointerType1"><pre>Overloaded to match the type's declaration.
2398*f4a2713aSLionel Sambuc</pre></td></tr>
2399*f4a2713aSLionel Sambuc
2400*f4a2713aSLionel Sambuc
2401*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>&gt; InnerMatcher</td></tr>
2402*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="ofClass0"><pre>Matches the class declaration that the given method declaration
2403*f4a2713aSLionel Sambucbelongs to.
2404*f4a2713aSLionel Sambuc
2405*f4a2713aSLionel SambucFIXME: Generalize this for other kinds of declarations.
2406*f4a2713aSLionel SambucFIXME: What other kind of declarations would we need to generalize
2407*f4a2713aSLionel Sambucthis to?
2408*f4a2713aSLionel Sambuc
2409*f4a2713aSLionel SambucExample matches A() in the last line
2410*f4a2713aSLionel Sambuc    (matcher = constructExpr(hasDeclaration(methodDecl(
2411*f4a2713aSLionel Sambuc        ofClass(hasName("A"))))))
2412*f4a2713aSLionel Sambuc  class A {
2413*f4a2713aSLionel Sambuc   public:
2414*f4a2713aSLionel Sambuc    A();
2415*f4a2713aSLionel Sambuc  };
2416*f4a2713aSLionel Sambuc  A a = A();
2417*f4a2713aSLionel Sambuc</pre></td></tr>
2418*f4a2713aSLionel Sambuc
2419*f4a2713aSLionel Sambuc
2420*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html">CXXMethodDecl</a>&gt; InnerMatcher</td></tr>
2421*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasMethod0"><pre>Matches the first method of a class or struct that satisfies InnerMatcher.
2422*f4a2713aSLionel Sambuc
2423*f4a2713aSLionel SambucGiven:
2424*f4a2713aSLionel Sambuc  class A { void func(); };
2425*f4a2713aSLionel Sambuc  class B { void member(); };
2426*f4a2713aSLionel Sambuc
2427*f4a2713aSLionel SambucrecordDecl(hasMethod(hasName("func"))) matches the declaration of A
2428*f4a2713aSLionel Sambucbut not B.
2429*f4a2713aSLionel Sambuc</pre></td></tr>
2430*f4a2713aSLionel Sambuc
2431*f4a2713aSLionel Sambuc
2432*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
2433*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isDerivedFrom0"><pre>Matches C++ classes that are directly or indirectly derived from
2434*f4a2713aSLionel Sambuca class matching Base.
2435*f4a2713aSLionel Sambuc
2436*f4a2713aSLionel SambucNote that a class is not considered to be derived from itself.
2437*f4a2713aSLionel Sambuc
2438*f4a2713aSLionel SambucExample matches Y, Z, C (Base == hasName("X"))
2439*f4a2713aSLionel Sambuc  class X;
2440*f4a2713aSLionel Sambuc  class Y : public X {};  directly derived
2441*f4a2713aSLionel Sambuc  class Z : public Y {};  indirectly derived
2442*f4a2713aSLionel Sambuc  typedef X A;
2443*f4a2713aSLionel Sambuc  typedef A B;
2444*f4a2713aSLionel Sambuc  class C : public B {};  derived from a typedef of X
2445*f4a2713aSLionel Sambuc
2446*f4a2713aSLionel SambucIn the following example, Bar matches isDerivedFrom(hasName("X")):
2447*f4a2713aSLionel Sambuc  class Foo;
2448*f4a2713aSLionel Sambuc  typedef Foo X;
2449*f4a2713aSLionel Sambuc  class Bar : public Foo {};  derived from a type that X is a typedef of
2450*f4a2713aSLionel Sambuc</pre></td></tr>
2451*f4a2713aSLionel Sambuc
2452*f4a2713aSLionel Sambuc
2453*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; Base</td></tr>
2454*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="isSameOrDerivedFrom0"><pre>Similar to isDerivedFrom(), but also matches classes that directly
2455*f4a2713aSLionel Sambucmatch Base.
2456*f4a2713aSLionel Sambuc</pre></td></tr>
2457*f4a2713aSLionel Sambuc
2458*f4a2713aSLionel Sambuc
2459*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2460*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="callee1"><pre>Matches if the call expression's callee's declaration matches the
2461*f4a2713aSLionel Sambucgiven matcher.
2462*f4a2713aSLionel Sambuc
2463*f4a2713aSLionel SambucExample matches y.x() (matcher = callExpr(callee(methodDecl(hasName("x")))))
2464*f4a2713aSLionel Sambuc  class Y { public: void x(); };
2465*f4a2713aSLionel Sambuc  void z() { Y y; y.x();
2466*f4a2713aSLionel Sambuc</pre></td></tr>
2467*f4a2713aSLionel Sambuc
2468*f4a2713aSLionel Sambuc
2469*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2470*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasAnyArgument0"><pre>Matches any argument of a call expression or a constructor call
2471*f4a2713aSLionel Sambucexpression.
2472*f4a2713aSLionel Sambuc
2473*f4a2713aSLionel SambucGiven
2474*f4a2713aSLionel Sambuc  void x(int, int, int) { int y; x(1, y, 42); }
2475*f4a2713aSLionel SambuccallExpr(hasAnyArgument(declRefExpr()))
2476*f4a2713aSLionel Sambuc  matches x(1, y, 42)
2477*f4a2713aSLionel Sambucwith hasAnyArgument(...)
2478*f4a2713aSLionel Sambuc  matching y
2479*f4a2713aSLionel Sambuc
2480*f4a2713aSLionel SambucFIXME: Currently this will ignore parentheses and implicit casts on
2481*f4a2713aSLionel Sambucthe argument before applying the inner matcher. We'll want to remove
2482*f4a2713aSLionel Sambucthis to allow for greater control by the user once ignoreImplicit()
2483*f4a2713aSLionel Sambuchas been implemented.
2484*f4a2713aSLionel Sambuc</pre></td></tr>
2485*f4a2713aSLionel Sambuc
2486*f4a2713aSLionel Sambuc
2487*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2488*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasArgument0"><pre>Matches the n'th argument of a call expression or a constructor
2489*f4a2713aSLionel Sambuccall expression.
2490*f4a2713aSLionel Sambuc
2491*f4a2713aSLionel SambucExample matches y in x(y)
2492*f4a2713aSLionel Sambuc    (matcher = callExpr(hasArgument(0, declRefExpr())))
2493*f4a2713aSLionel Sambuc  void x(int) { int y; x(y); }
2494*f4a2713aSLionel Sambuc</pre></td></tr>
2495*f4a2713aSLionel Sambuc
2496*f4a2713aSLionel Sambuc
2497*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;</td><td class="name" onclick="toggle('hasDeclaration13')"><a name="hasDeclaration13Anchor">hasDeclaration</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
2498*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node
2499*f4a2713aSLionel Sambucmatches the given matcher.
2500*f4a2713aSLionel Sambuc
2501*f4a2713aSLionel SambucThe associated declaration is:
2502*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
2503*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
2504*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
2505*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
2506*f4a2713aSLionel Sambuc
2507*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
2508*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
2509*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
2510*f4a2713aSLionel SambucgetDecl().
2511*f4a2713aSLionel Sambuc
2512*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
2513*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
2514*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
2515*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
2516*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
2517*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
2518*f4a2713aSLionel Sambuc</pre></td></tr>
2519*f4a2713aSLionel Sambuc
2520*f4a2713aSLionel Sambuc
2521*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2522*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasCaseConstant0"><pre>If the given case statement does not use the GNU case range
2523*f4a2713aSLionel Sambucextension, matches the constant given in the statement.
2524*f4a2713aSLionel Sambuc
2525*f4a2713aSLionel SambucGiven
2526*f4a2713aSLionel Sambuc  switch (1) { case 1: case 1+1: case 3 ... 4: ; }
2527*f4a2713aSLionel SambuccaseStmt(hasCaseConstant(integerLiteral()))
2528*f4a2713aSLionel Sambuc  matches "case 1:"
2529*f4a2713aSLionel Sambuc</pre></td></tr>
2530*f4a2713aSLionel Sambuc
2531*f4a2713aSLionel Sambuc
2532*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2533*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression matches the given matcher.
2534*f4a2713aSLionel Sambuc
2535*f4a2713aSLionel SambucExample: matches "a string" (matcher =
2536*f4a2713aSLionel Sambuc                                 hasSourceExpression(constructExpr()))
2537*f4a2713aSLionel Sambucclass URL { URL(string); };
2538*f4a2713aSLionel SambucURL url = "a string";
2539*f4a2713aSLionel Sambuc</pre></td></tr>
2540*f4a2713aSLionel Sambuc
2541*f4a2713aSLionel Sambuc
2542*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
2543*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasAnyTemplateArgument0"><pre>Matches classTemplateSpecializations that have at least one
2544*f4a2713aSLionel SambucTemplateArgument matching the given InnerMatcher.
2545*f4a2713aSLionel Sambuc
2546*f4a2713aSLionel SambucGiven
2547*f4a2713aSLionel Sambuc  template&lt;typename T&gt; class A {};
2548*f4a2713aSLionel Sambuc  template&lt;&gt; class A&lt;double&gt; {};
2549*f4a2713aSLionel Sambuc  A&lt;int&gt; a;
2550*f4a2713aSLionel SambucclassTemplateSpecializationDecl(hasAnyTemplateArgument(
2551*f4a2713aSLionel Sambuc    refersToType(asString("int"))))
2552*f4a2713aSLionel Sambuc  matches the specialization A&lt;int&gt;
2553*f4a2713aSLionel Sambuc</pre></td></tr>
2554*f4a2713aSLionel Sambuc
2555*f4a2713aSLionel Sambuc
2556*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>&gt; InnerMatcher</td></tr>
2557*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasTemplateArgument0"><pre>Matches classTemplateSpecializations where the n'th TemplateArgument
2558*f4a2713aSLionel Sambucmatches the given InnerMatcher.
2559*f4a2713aSLionel Sambuc
2560*f4a2713aSLionel SambucGiven
2561*f4a2713aSLionel Sambuc  template&lt;typename T, typename U&gt; class A {};
2562*f4a2713aSLionel Sambuc  A&lt;bool, int&gt; b;
2563*f4a2713aSLionel Sambuc  A&lt;int, bool&gt; c;
2564*f4a2713aSLionel SambucclassTemplateSpecializationDecl(hasTemplateArgument(
2565*f4a2713aSLionel Sambuc    1, refersToType(asString("int"))))
2566*f4a2713aSLionel Sambuc  matches the specialization A&lt;bool, int&gt;
2567*f4a2713aSLionel Sambuc</pre></td></tr>
2568*f4a2713aSLionel Sambuc
2569*f4a2713aSLionel Sambuc
2570*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexTypeLoc.html">ComplexTypeLoc</a>&gt;</td><td class="name" onclick="toggle('hasElementTypeLoc1')"><a name="hasElementTypeLoc1Anchor">hasElementTypeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
2571*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasElementTypeLoc1"><pre>Matches arrays and C99 complex types that have a specific element
2572*f4a2713aSLionel Sambuctype.
2573*f4a2713aSLionel Sambuc
2574*f4a2713aSLionel SambucGiven
2575*f4a2713aSLionel Sambuc  struct A {};
2576*f4a2713aSLionel Sambuc  A a[7];
2577*f4a2713aSLionel Sambuc  int b[7];
2578*f4a2713aSLionel SambucarrayType(hasElementType(builtinType()))
2579*f4a2713aSLionel Sambuc  matches "int b[7]"
2580*f4a2713aSLionel Sambuc
2581*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
2582*f4a2713aSLionel Sambuc</pre></td></tr>
2583*f4a2713aSLionel Sambuc
2584*f4a2713aSLionel Sambuc
2585*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
2586*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasElementType1"><pre>Matches arrays and C99 complex types that have a specific element
2587*f4a2713aSLionel Sambuctype.
2588*f4a2713aSLionel Sambuc
2589*f4a2713aSLionel SambucGiven
2590*f4a2713aSLionel Sambuc  struct A {};
2591*f4a2713aSLionel Sambuc  A a[7];
2592*f4a2713aSLionel Sambuc  int b[7];
2593*f4a2713aSLionel SambucarrayType(hasElementType(builtinType()))
2594*f4a2713aSLionel Sambuc  matches "int b[7]"
2595*f4a2713aSLionel Sambuc
2596*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ArrayType.html">ArrayType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ComplexType.html">ComplexType</a>&gt;
2597*f4a2713aSLionel Sambuc</pre></td></tr>
2598*f4a2713aSLionel Sambuc
2599*f4a2713aSLionel Sambuc
2600*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
2601*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasAnySubstatement0"><pre>Matches compound statements where at least one substatement matches
2602*f4a2713aSLionel Sambuca given matcher.
2603*f4a2713aSLionel Sambuc
2604*f4a2713aSLionel SambucGiven
2605*f4a2713aSLionel Sambuc  { {}; 1+2; }
2606*f4a2713aSLionel SambuchasAnySubstatement(compoundStmt())
2607*f4a2713aSLionel Sambuc  matches '{ {}; 1+2; }'
2608*f4a2713aSLionel Sambucwith compoundStmt()
2609*f4a2713aSLionel Sambuc  matching '{}'
2610*f4a2713aSLionel Sambuc</pre></td></tr>
2611*f4a2713aSLionel Sambuc
2612*f4a2713aSLionel Sambuc
2613*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>&gt;</td><td class="name" onclick="toggle('hasCondition4')"><a name="hasCondition4Anchor">hasCondition</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2614*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasCondition4"><pre>Matches the condition expression of an if statement, for loop,
2615*f4a2713aSLionel Sambucor conditional operator.
2616*f4a2713aSLionel Sambuc
2617*f4a2713aSLionel SambucExample matches true (matcher = hasCondition(boolLiteral(equals(true))))
2618*f4a2713aSLionel Sambuc  if (true) {}
2619*f4a2713aSLionel Sambuc</pre></td></tr>
2620*f4a2713aSLionel Sambuc
2621*f4a2713aSLionel Sambuc
2622*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>&gt;</td><td class="name" onclick="toggle('hasFalseExpression0')"><a name="hasFalseExpression0Anchor">hasFalseExpression</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2623*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasFalseExpression0"><pre>Matches the false branch expression of a conditional operator.
2624*f4a2713aSLionel Sambuc
2625*f4a2713aSLionel SambucExample matches b
2626*f4a2713aSLionel Sambuc  condition ? a : b
2627*f4a2713aSLionel Sambuc</pre></td></tr>
2628*f4a2713aSLionel Sambuc
2629*f4a2713aSLionel Sambuc
2630*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ConditionalOperator.html">ConditionalOperator</a>&gt;</td><td class="name" onclick="toggle('hasTrueExpression0')"><a name="hasTrueExpression0Anchor">hasTrueExpression</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2631*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasTrueExpression0"><pre>Matches the true branch expression of a conditional operator.
2632*f4a2713aSLionel Sambuc
2633*f4a2713aSLionel SambucExample matches a
2634*f4a2713aSLionel Sambuc  condition ? a : b
2635*f4a2713aSLionel Sambuc</pre></td></tr>
2636*f4a2713aSLionel Sambuc
2637*f4a2713aSLionel Sambuc
2638*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
2639*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node
2640*f4a2713aSLionel Sambucmatches the given matcher.
2641*f4a2713aSLionel Sambuc
2642*f4a2713aSLionel SambucThe associated declaration is:
2643*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
2644*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
2645*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
2646*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
2647*f4a2713aSLionel Sambuc
2648*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
2649*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
2650*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
2651*f4a2713aSLionel SambucgetDecl().
2652*f4a2713aSLionel Sambuc
2653*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
2654*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
2655*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
2656*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
2657*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
2658*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
2659*f4a2713aSLionel Sambuc</pre></td></tr>
2660*f4a2713aSLionel Sambuc
2661*f4a2713aSLionel Sambuc
2662*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>&gt; InnerMatcher</td></tr>
2663*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="throughUsingDecl0"><pre>Matches a DeclRefExpr that refers to a declaration through a
2664*f4a2713aSLionel Sambucspecific using shadow declaration.
2665*f4a2713aSLionel Sambuc
2666*f4a2713aSLionel SambucFIXME: This currently only works for functions. Fix.
2667*f4a2713aSLionel Sambuc
2668*f4a2713aSLionel SambucGiven
2669*f4a2713aSLionel Sambuc  namespace a { void f() {} }
2670*f4a2713aSLionel Sambuc  using a::f;
2671*f4a2713aSLionel Sambuc  void g() {
2672*f4a2713aSLionel Sambuc    f();     Matches this ..
2673*f4a2713aSLionel Sambuc    a::f();  .. but not this.
2674*f4a2713aSLionel Sambuc  }
2675*f4a2713aSLionel SambucdeclRefExpr(throughUsingDeclaration(anything()))
2676*f4a2713aSLionel Sambuc  matches f()
2677*f4a2713aSLionel Sambuc</pre></td></tr>
2678*f4a2713aSLionel Sambuc
2679*f4a2713aSLionel Sambuc
2680*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2681*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="to0"><pre>Matches a DeclRefExpr that refers to a declaration that matches the
2682*f4a2713aSLionel Sambucspecified matcher.
2683*f4a2713aSLionel Sambuc
2684*f4a2713aSLionel SambucExample matches x in if(x)
2685*f4a2713aSLionel Sambuc    (matcher = declRefExpr(to(varDecl(hasName("x")))))
2686*f4a2713aSLionel Sambuc  bool x;
2687*f4a2713aSLionel Sambuc  if (x) {}
2688*f4a2713aSLionel Sambuc</pre></td></tr>
2689*f4a2713aSLionel Sambuc
2690*f4a2713aSLionel Sambuc
2691*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2692*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="containsDeclaration0"><pre>Matches the n'th declaration of a declaration statement.
2693*f4a2713aSLionel Sambuc
2694*f4a2713aSLionel SambucNote that this does not work for global declarations because the AST
2695*f4a2713aSLionel Sambucbreaks up multiple-declaration DeclStmt's into multiple single-declaration
2696*f4a2713aSLionel SambucDeclStmt's.
2697*f4a2713aSLionel SambucExample: Given non-global declarations
2698*f4a2713aSLionel Sambuc  int a, b = 0;
2699*f4a2713aSLionel Sambuc  int c;
2700*f4a2713aSLionel Sambuc  int d = 2, e;
2701*f4a2713aSLionel SambucdeclStmt(containsDeclaration(
2702*f4a2713aSLionel Sambuc      0, varDecl(hasInitializer(anything()))))
2703*f4a2713aSLionel Sambuc  matches only 'int d = 2, e;', and
2704*f4a2713aSLionel SambucdeclStmt(containsDeclaration(1, varDecl()))
2705*f4a2713aSLionel Sambuc  matches 'int a, b = 0' as well as 'int d = 2, e;'
2706*f4a2713aSLionel Sambuc  but 'int c;' is not matched.
2707*f4a2713aSLionel Sambuc</pre></td></tr>
2708*f4a2713aSLionel Sambuc
2709*f4a2713aSLionel Sambuc
2710*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2711*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasSingleDecl0"><pre>Matches the Decl of a DeclStmt which has a single declaration.
2712*f4a2713aSLionel Sambuc
2713*f4a2713aSLionel SambucGiven
2714*f4a2713aSLionel Sambuc  int a, b;
2715*f4a2713aSLionel Sambuc  int c;
2716*f4a2713aSLionel SambucdeclStmt(hasSingleDecl(anything()))
2717*f4a2713aSLionel Sambuc  matches 'int c;' but not 'int a, b;'.
2718*f4a2713aSLionel Sambuc</pre></td></tr>
2719*f4a2713aSLionel Sambuc
2720*f4a2713aSLionel Sambuc
2721*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclaratorDecl.html">DeclaratorDecl</a>&gt;</td><td class="name" onclick="toggle('hasTypeLoc0')"><a name="hasTypeLoc0Anchor">hasTypeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; Inner</td></tr>
2722*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasTypeLoc0"><pre>Matches if the type location of the declarator decl's type matches
2723*f4a2713aSLionel Sambucthe inner matcher.
2724*f4a2713aSLionel Sambuc
2725*f4a2713aSLionel SambucGiven
2726*f4a2713aSLionel Sambuc  int x;
2727*f4a2713aSLionel SambucdeclaratorDecl(hasTypeLoc(loc(asString("int"))))
2728*f4a2713aSLionel Sambuc  matches int x
2729*f4a2713aSLionel Sambuc</pre></td></tr>
2730*f4a2713aSLionel Sambuc
2731*f4a2713aSLionel Sambuc
2732*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2733*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclContext0"><pre>Matches declarations whose declaration context, interpreted as a
2734*f4a2713aSLionel SambucDecl, matches InnerMatcher.
2735*f4a2713aSLionel Sambuc
2736*f4a2713aSLionel SambucGiven
2737*f4a2713aSLionel Sambuc  namespace N {
2738*f4a2713aSLionel Sambuc    namespace M {
2739*f4a2713aSLionel Sambuc      class D {};
2740*f4a2713aSLionel Sambuc    }
2741*f4a2713aSLionel Sambuc  }
2742*f4a2713aSLionel Sambuc
2743*f4a2713aSLionel SambucrecordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
2744*f4a2713aSLionel Sambucdeclaration of class D.
2745*f4a2713aSLionel Sambuc</pre></td></tr>
2746*f4a2713aSLionel Sambuc
2747*f4a2713aSLionel Sambuc
2748*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
2749*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasBody0"><pre>Matches a 'for', 'while', or 'do while' statement that has
2750*f4a2713aSLionel Sambuca given body.
2751*f4a2713aSLionel Sambuc
2752*f4a2713aSLionel SambucGiven
2753*f4a2713aSLionel Sambuc  for (;;) {}
2754*f4a2713aSLionel SambuchasBody(compoundStmt())
2755*f4a2713aSLionel Sambuc  matches 'for (;;) {}'
2756*f4a2713aSLionel Sambucwith compoundStmt()
2757*f4a2713aSLionel Sambuc  matching '{}'
2758*f4a2713aSLionel Sambuc</pre></td></tr>
2759*f4a2713aSLionel Sambuc
2760*f4a2713aSLionel Sambuc
2761*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2762*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasCondition3"><pre>Matches the condition expression of an if statement, for loop,
2763*f4a2713aSLionel Sambucor conditional operator.
2764*f4a2713aSLionel Sambuc
2765*f4a2713aSLionel SambucExample matches true (matcher = hasCondition(boolLiteral(equals(true))))
2766*f4a2713aSLionel Sambuc  if (true) {}
2767*f4a2713aSLionel Sambuc</pre></td></tr>
2768*f4a2713aSLionel Sambuc
2769*f4a2713aSLionel Sambuc
2770*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt; InnerMatcher</td></tr>
2771*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasQualifier0"><pre>Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
2772*f4a2713aSLionel Sambucmatches InnerMatcher if the qualifier exists.
2773*f4a2713aSLionel Sambuc
2774*f4a2713aSLionel SambucGiven
2775*f4a2713aSLionel Sambuc  namespace N {
2776*f4a2713aSLionel Sambuc    namespace M {
2777*f4a2713aSLionel Sambuc      class D {};
2778*f4a2713aSLionel Sambuc    }
2779*f4a2713aSLionel Sambuc  }
2780*f4a2713aSLionel Sambuc  N::M::D d;
2781*f4a2713aSLionel Sambuc
2782*f4a2713aSLionel SambucelaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
2783*f4a2713aSLionel Sambucmatches the type of the variable declaration of d.
2784*f4a2713aSLionel Sambuc</pre></td></tr>
2785*f4a2713aSLionel Sambuc
2786*f4a2713aSLionel Sambuc
2787*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
2788*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="namesType0"><pre>Matches ElaboratedTypes whose named type matches InnerMatcher.
2789*f4a2713aSLionel Sambuc
2790*f4a2713aSLionel SambucGiven
2791*f4a2713aSLionel Sambuc  namespace N {
2792*f4a2713aSLionel Sambuc    namespace M {
2793*f4a2713aSLionel Sambuc      class D {};
2794*f4a2713aSLionel Sambuc    }
2795*f4a2713aSLionel Sambuc  }
2796*f4a2713aSLionel Sambuc  N::M::D d;
2797*f4a2713aSLionel Sambuc
2798*f4a2713aSLionel SambucelaboratedType(namesType(recordType(
2799*f4a2713aSLionel SambuchasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
2800*f4a2713aSLionel Sambucdeclaration of d.
2801*f4a2713aSLionel Sambuc</pre></td></tr>
2802*f4a2713aSLionel Sambuc
2803*f4a2713aSLionel Sambuc
2804*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
2805*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node
2806*f4a2713aSLionel Sambucmatches the given matcher.
2807*f4a2713aSLionel Sambuc
2808*f4a2713aSLionel SambucThe associated declaration is:
2809*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
2810*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
2811*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
2812*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
2813*f4a2713aSLionel Sambuc
2814*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
2815*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
2816*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
2817*f4a2713aSLionel SambucgetDecl().
2818*f4a2713aSLionel Sambuc
2819*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
2820*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
2821*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
2822*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
2823*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
2824*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
2825*f4a2713aSLionel Sambuc</pre></td></tr>
2826*f4a2713aSLionel Sambuc
2827*f4a2713aSLionel Sambuc
2828*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
2829*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDestinationType0"><pre>Matches casts whose destination type matches a given matcher.
2830*f4a2713aSLionel Sambuc
2831*f4a2713aSLionel Sambuc(Note: Clang's AST refers to other conversions as "casts" too, and calls
2832*f4a2713aSLionel Sambucactual casts "explicit" casts.)
2833*f4a2713aSLionel Sambuc</pre></td></tr>
2834*f4a2713aSLionel Sambuc
2835*f4a2713aSLionel Sambuc
2836*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;</td><td class="name" onclick="toggle('hasType2')"><a name="hasType2Anchor">hasType</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
2837*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasType2"><pre>Overloaded to match the declaration of the expression's or value
2838*f4a2713aSLionel Sambucdeclaration's type.
2839*f4a2713aSLionel Sambuc
2840*f4a2713aSLionel SambucIn case of a value declaration (for example a variable declaration),
2841*f4a2713aSLionel Sambucthis resolves one layer of indirection. For example, in the value
2842*f4a2713aSLionel Sambucdeclaration "X x;", recordDecl(hasName("X")) matches the declaration of X,
2843*f4a2713aSLionel Sambucwhile varDecl(hasType(recordDecl(hasName("X")))) matches the declaration
2844*f4a2713aSLionel Sambucof x."
2845*f4a2713aSLionel Sambuc
2846*f4a2713aSLionel SambucExample matches x (matcher = expr(hasType(recordDecl(hasName("X")))))
2847*f4a2713aSLionel Sambuc            and z (matcher = varDecl(hasType(recordDecl(hasName("X")))))
2848*f4a2713aSLionel Sambuc class X {};
2849*f4a2713aSLionel Sambuc void y(X &amp;x) { x; X z; }
2850*f4a2713aSLionel Sambuc
2851*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;
2852*f4a2713aSLionel Sambuc</pre></td></tr>
2853*f4a2713aSLionel Sambuc
2854*f4a2713aSLionel Sambuc
2855*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2856*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="ignoringImpCasts0"><pre>Matches expressions that match InnerMatcher after any implicit casts
2857*f4a2713aSLionel Sambucare stripped off.
2858*f4a2713aSLionel Sambuc
2859*f4a2713aSLionel SambucParentheses and explicit casts are not discarded.
2860*f4a2713aSLionel SambucGiven
2861*f4a2713aSLionel Sambuc  int arr[5];
2862*f4a2713aSLionel Sambuc  int a = 0;
2863*f4a2713aSLionel Sambuc  char b = 0;
2864*f4a2713aSLionel Sambuc  const int c = a;
2865*f4a2713aSLionel Sambuc  int *d = arr;
2866*f4a2713aSLionel Sambuc  long e = (long) 0l;
2867*f4a2713aSLionel SambucThe matchers
2868*f4a2713aSLionel Sambuc   varDecl(hasInitializer(ignoringImpCasts(integerLiteral())))
2869*f4a2713aSLionel Sambuc   varDecl(hasInitializer(ignoringImpCasts(declRefExpr())))
2870*f4a2713aSLionel Sambucwould match the declarations for a, b, c, and d, but not e.
2871*f4a2713aSLionel SambucWhile
2872*f4a2713aSLionel Sambuc   varDecl(hasInitializer(integerLiteral()))
2873*f4a2713aSLionel Sambuc   varDecl(hasInitializer(declRefExpr()))
2874*f4a2713aSLionel Sambuconly match the declarations for b, c, and d.
2875*f4a2713aSLionel Sambuc</pre></td></tr>
2876*f4a2713aSLionel Sambuc
2877*f4a2713aSLionel Sambuc
2878*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2879*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="ignoringParenCasts0"><pre>Matches expressions that match InnerMatcher after parentheses and
2880*f4a2713aSLionel Sambuccasts are stripped off.
2881*f4a2713aSLionel Sambuc
2882*f4a2713aSLionel SambucImplicit and non-C Style casts are also discarded.
2883*f4a2713aSLionel SambucGiven
2884*f4a2713aSLionel Sambuc  int a = 0;
2885*f4a2713aSLionel Sambuc  char b = (0);
2886*f4a2713aSLionel Sambuc  void* c = reinterpret_cast&lt;char*&gt;(0);
2887*f4a2713aSLionel Sambuc  char d = char(0);
2888*f4a2713aSLionel SambucThe matcher
2889*f4a2713aSLionel Sambuc   varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))
2890*f4a2713aSLionel Sambucwould match the declarations for a, b, c, and d.
2891*f4a2713aSLionel Sambucwhile
2892*f4a2713aSLionel Sambuc   varDecl(hasInitializer(integerLiteral()))
2893*f4a2713aSLionel Sambuconly match the declaration for a.
2894*f4a2713aSLionel Sambuc</pre></td></tr>
2895*f4a2713aSLionel Sambuc
2896*f4a2713aSLionel Sambuc
2897*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2898*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="ignoringParenImpCasts0"><pre>Matches expressions that match InnerMatcher after implicit casts and
2899*f4a2713aSLionel Sambucparentheses are stripped off.
2900*f4a2713aSLionel Sambuc
2901*f4a2713aSLionel SambucExplicit casts are not discarded.
2902*f4a2713aSLionel SambucGiven
2903*f4a2713aSLionel Sambuc  int arr[5];
2904*f4a2713aSLionel Sambuc  int a = 0;
2905*f4a2713aSLionel Sambuc  char b = (0);
2906*f4a2713aSLionel Sambuc  const int c = a;
2907*f4a2713aSLionel Sambuc  int *d = (arr);
2908*f4a2713aSLionel Sambuc  long e = ((long) 0l);
2909*f4a2713aSLionel SambucThe matchers
2910*f4a2713aSLionel Sambuc   varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral())))
2911*f4a2713aSLionel Sambuc   varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr())))
2912*f4a2713aSLionel Sambucwould match the declarations for a, b, c, and d, but not e.
2913*f4a2713aSLionel Sambucwhile
2914*f4a2713aSLionel Sambuc   varDecl(hasInitializer(integerLiteral()))
2915*f4a2713aSLionel Sambuc   varDecl(hasInitializer(declRefExpr()))
2916*f4a2713aSLionel Sambucwould only match the declaration for a.
2917*f4a2713aSLionel Sambuc</pre></td></tr>
2918*f4a2713aSLionel Sambuc
2919*f4a2713aSLionel Sambuc
2920*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
2921*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasBody1"><pre>Matches a 'for', 'while', or 'do while' statement that has
2922*f4a2713aSLionel Sambuca given body.
2923*f4a2713aSLionel Sambuc
2924*f4a2713aSLionel SambucGiven
2925*f4a2713aSLionel Sambuc  for (;;) {}
2926*f4a2713aSLionel SambuchasBody(compoundStmt())
2927*f4a2713aSLionel Sambuc  matches 'for (;;) {}'
2928*f4a2713aSLionel Sambucwith compoundStmt()
2929*f4a2713aSLionel Sambuc  matching '{}'
2930*f4a2713aSLionel Sambuc</pre></td></tr>
2931*f4a2713aSLionel Sambuc
2932*f4a2713aSLionel Sambuc
2933*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2934*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasCondition1"><pre>Matches the condition expression of an if statement, for loop,
2935*f4a2713aSLionel Sambucor conditional operator.
2936*f4a2713aSLionel Sambuc
2937*f4a2713aSLionel SambucExample matches true (matcher = hasCondition(boolLiteral(equals(true))))
2938*f4a2713aSLionel Sambuc  if (true) {}
2939*f4a2713aSLionel Sambuc</pre></td></tr>
2940*f4a2713aSLionel Sambuc
2941*f4a2713aSLionel Sambuc
2942*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
2943*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasIncrement0"><pre>Matches the increment statement of a for loop.
2944*f4a2713aSLionel Sambuc
2945*f4a2713aSLionel SambucExample:
2946*f4a2713aSLionel Sambuc    forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
2947*f4a2713aSLionel Sambucmatches '++x' in
2948*f4a2713aSLionel Sambuc    for (x; x &lt; N; ++x) { }
2949*f4a2713aSLionel Sambuc</pre></td></tr>
2950*f4a2713aSLionel Sambuc
2951*f4a2713aSLionel Sambuc
2952*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
2953*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasLoopInit0"><pre>Matches the initialization statement of a for loop.
2954*f4a2713aSLionel Sambuc
2955*f4a2713aSLionel SambucExample:
2956*f4a2713aSLionel Sambuc    forStmt(hasLoopInit(declStmt()))
2957*f4a2713aSLionel Sambucmatches 'int x = 0' in
2958*f4a2713aSLionel Sambuc    for (int x = 0; x &lt; N; ++x) { }
2959*f4a2713aSLionel Sambuc</pre></td></tr>
2960*f4a2713aSLionel Sambuc
2961*f4a2713aSLionel Sambuc
2962*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
2963*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasAnyParameter0"><pre>Matches any parameter of a function declaration.
2964*f4a2713aSLionel Sambuc
2965*f4a2713aSLionel SambucDoes not match the 'this' parameter of a method.
2966*f4a2713aSLionel Sambuc
2967*f4a2713aSLionel SambucGiven
2968*f4a2713aSLionel Sambuc  class X { void f(int x, int y, int z) {} };
2969*f4a2713aSLionel SambucmethodDecl(hasAnyParameter(hasName("y")))
2970*f4a2713aSLionel Sambuc  matches f(int x, int y, int z) {}
2971*f4a2713aSLionel Sambucwith hasAnyParameter(...)
2972*f4a2713aSLionel Sambuc  matching int y
2973*f4a2713aSLionel Sambuc</pre></td></tr>
2974*f4a2713aSLionel Sambuc
2975*f4a2713aSLionel Sambuc
2976*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html">ParmVarDecl</a>&gt; InnerMatcher</td></tr>
2977*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasParameter0"><pre>Matches the n'th parameter of a function declaration.
2978*f4a2713aSLionel Sambuc
2979*f4a2713aSLionel SambucGiven
2980*f4a2713aSLionel Sambuc  class X { void f(int x) {} };
2981*f4a2713aSLionel SambucmethodDecl(hasParameter(0, hasType(varDecl())))
2982*f4a2713aSLionel Sambuc  matches f(int x) {}
2983*f4a2713aSLionel Sambucwith hasParameter(...)
2984*f4a2713aSLionel Sambuc  matching int x
2985*f4a2713aSLionel Sambuc</pre></td></tr>
2986*f4a2713aSLionel Sambuc
2987*f4a2713aSLionel Sambuc
2988*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
2989*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="returns0"><pre>Matches the return type of a function declaration.
2990*f4a2713aSLionel Sambuc
2991*f4a2713aSLionel SambucGiven:
2992*f4a2713aSLionel Sambuc  class X { int f() { return 1; } };
2993*f4a2713aSLionel SambucmethodDecl(returns(asString("int")))
2994*f4a2713aSLionel Sambuc  matches int f() { return 1; }
2995*f4a2713aSLionel Sambuc</pre></td></tr>
2996*f4a2713aSLionel Sambuc
2997*f4a2713aSLionel Sambuc
2998*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
2999*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasCondition0"><pre>Matches the condition expression of an if statement, for loop,
3000*f4a2713aSLionel Sambucor conditional operator.
3001*f4a2713aSLionel Sambuc
3002*f4a2713aSLionel SambucExample matches true (matcher = hasCondition(boolLiteral(equals(true))))
3003*f4a2713aSLionel Sambuc  if (true) {}
3004*f4a2713aSLionel Sambuc</pre></td></tr>
3005*f4a2713aSLionel Sambuc
3006*f4a2713aSLionel Sambuc
3007*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1DeclStmt.html">DeclStmt</a>&gt; InnerMatcher</td></tr>
3008*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasConditionVariableStatement0"><pre>Matches the condition variable statement in an if statement.
3009*f4a2713aSLionel Sambuc
3010*f4a2713aSLionel SambucGiven
3011*f4a2713aSLionel Sambuc  if (A* a = GetAPointer()) {}
3012*f4a2713aSLionel SambuchasConditionVariableStatement(...)
3013*f4a2713aSLionel Sambuc  matches 'A* a = GetAPointer()'.
3014*f4a2713aSLionel Sambuc</pre></td></tr>
3015*f4a2713aSLionel Sambuc
3016*f4a2713aSLionel Sambuc
3017*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3018*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasImplicitDestinationType0"><pre>Matches implicit casts whose destination type matches a given
3019*f4a2713aSLionel Sambucmatcher.
3020*f4a2713aSLionel Sambuc
3021*f4a2713aSLionel SambucFIXME: Unit test this matcher
3022*f4a2713aSLionel Sambuc</pre></td></tr>
3023*f4a2713aSLionel Sambuc
3024*f4a2713aSLionel Sambuc
3025*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3026*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node
3027*f4a2713aSLionel Sambucmatches the given matcher.
3028*f4a2713aSLionel Sambuc
3029*f4a2713aSLionel SambucThe associated declaration is:
3030*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3031*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3032*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3033*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3034*f4a2713aSLionel Sambuc
3035*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3036*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3037*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3038*f4a2713aSLionel SambucgetDecl().
3039*f4a2713aSLionel Sambuc
3040*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3041*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3042*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3043*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3044*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3045*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3046*f4a2713aSLionel Sambuc</pre></td></tr>
3047*f4a2713aSLionel Sambuc
3048*f4a2713aSLionel Sambuc
3049*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3050*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node
3051*f4a2713aSLionel Sambucmatches the given matcher.
3052*f4a2713aSLionel Sambuc
3053*f4a2713aSLionel SambucThe associated declaration is:
3054*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3055*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3056*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3057*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3058*f4a2713aSLionel Sambuc
3059*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3060*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3061*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3062*f4a2713aSLionel SambucgetDecl().
3063*f4a2713aSLionel Sambuc
3064*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3065*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3066*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3067*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3068*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3069*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3070*f4a2713aSLionel Sambuc</pre></td></tr>
3071*f4a2713aSLionel Sambuc
3072*f4a2713aSLionel Sambuc
3073*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3074*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node
3075*f4a2713aSLionel Sambucmatches the given matcher.
3076*f4a2713aSLionel Sambuc
3077*f4a2713aSLionel SambucThe associated declaration is:
3078*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3079*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3080*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3081*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3082*f4a2713aSLionel Sambuc
3083*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3084*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3085*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3086*f4a2713aSLionel SambucgetDecl().
3087*f4a2713aSLionel Sambuc
3088*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3089*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3090*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3091*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3092*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3093*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3094*f4a2713aSLionel Sambuc</pre></td></tr>
3095*f4a2713aSLionel Sambuc
3096*f4a2713aSLionel Sambuc
3097*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3098*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasObjectExpression0"><pre>Matches a member expression where the object expression is
3099*f4a2713aSLionel Sambucmatched by a given matcher.
3100*f4a2713aSLionel Sambuc
3101*f4a2713aSLionel SambucGiven
3102*f4a2713aSLionel Sambuc  struct X { int m; };
3103*f4a2713aSLionel Sambuc  void f(X x) { x.m; m; }
3104*f4a2713aSLionel SambucmemberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))))
3105*f4a2713aSLionel Sambuc  matches "x.m" and "m"
3106*f4a2713aSLionel Sambucwith hasObjectExpression(...)
3107*f4a2713aSLionel Sambuc  matching "x" and the implicit object expression of "m" which has type X*.
3108*f4a2713aSLionel Sambuc</pre></td></tr>
3109*f4a2713aSLionel Sambuc
3110*f4a2713aSLionel Sambuc
3111*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt; InnerMatcher</td></tr>
3112*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="member0"><pre>Matches a member expression where the member is matched by a
3113*f4a2713aSLionel Sambucgiven matcher.
3114*f4a2713aSLionel Sambuc
3115*f4a2713aSLionel SambucGiven
3116*f4a2713aSLionel Sambuc  struct { int first, second; } first, second;
3117*f4a2713aSLionel Sambuc  int i(second.first);
3118*f4a2713aSLionel Sambuc  int j(first.second);
3119*f4a2713aSLionel SambucmemberExpr(member(hasName("first")))
3120*f4a2713aSLionel Sambuc  matches second.first
3121*f4a2713aSLionel Sambuc  but not first.second (because the member name there is "second").
3122*f4a2713aSLionel Sambuc</pre></td></tr>
3123*f4a2713aSLionel Sambuc
3124*f4a2713aSLionel Sambuc
3125*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerTypeLoc.html">MemberPointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc1')"><a name="pointeeLoc1Anchor">pointeeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
3126*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointeeLoc1"><pre>Narrows PointerType (and similar) matchers to those where the
3127*f4a2713aSLionel Sambucpointee matches a given matcher.
3128*f4a2713aSLionel Sambuc
3129*f4a2713aSLionel SambucGiven
3130*f4a2713aSLionel Sambuc  int *a;
3131*f4a2713aSLionel Sambuc  int const *b;
3132*f4a2713aSLionel Sambuc  float const *f;
3133*f4a2713aSLionel SambucpointerType(pointee(isConstQualified(), isInteger()))
3134*f4a2713aSLionel Sambuc  matches "int const *b"
3135*f4a2713aSLionel Sambuc
3136*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3137*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3138*f4a2713aSLionel Sambuc</pre></td></tr>
3139*f4a2713aSLionel Sambuc
3140*f4a2713aSLionel Sambuc
3141*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
3142*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointee1"><pre>Narrows PointerType (and similar) matchers to those where the
3143*f4a2713aSLionel Sambucpointee matches a given matcher.
3144*f4a2713aSLionel Sambuc
3145*f4a2713aSLionel SambucGiven
3146*f4a2713aSLionel Sambuc  int *a;
3147*f4a2713aSLionel Sambuc  int const *b;
3148*f4a2713aSLionel Sambuc  float const *f;
3149*f4a2713aSLionel SambucpointerType(pointee(isConstQualified(), isInteger()))
3150*f4a2713aSLionel Sambuc  matches "int const *b"
3151*f4a2713aSLionel Sambuc
3152*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3153*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3154*f4a2713aSLionel Sambuc</pre></td></tr>
3155*f4a2713aSLionel Sambuc
3156*f4a2713aSLionel Sambuc
3157*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifierLoc.html">NestedNameSpecifierLoc</a>&gt; InnerMatcher</td></tr>
3158*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasPrefix1"><pre>Matches on the prefix of a NestedNameSpecifierLoc.
3159*f4a2713aSLionel Sambuc
3160*f4a2713aSLionel SambucGiven
3161*f4a2713aSLionel Sambuc  struct A { struct B { struct C {}; }; };
3162*f4a2713aSLionel Sambuc  A::B::C c;
3163*f4a2713aSLionel SambucnestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A")))))
3164*f4a2713aSLionel Sambuc  matches "A::"
3165*f4a2713aSLionel Sambuc</pre></td></tr>
3166*f4a2713aSLionel Sambuc
3167*f4a2713aSLionel Sambuc
3168*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt;  InnerMatcher</td></tr>
3169*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="loc1"><pre>Matches NestedNameSpecifierLocs for which the given inner
3170*f4a2713aSLionel SambucNestedNameSpecifier-matcher matches.
3171*f4a2713aSLionel Sambuc</pre></td></tr>
3172*f4a2713aSLionel Sambuc
3173*f4a2713aSLionel Sambuc
3174*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt; InnerMatcher</td></tr>
3175*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="specifiesTypeLoc0"><pre>Matches nested name specifier locs that specify a type matching the
3176*f4a2713aSLionel Sambucgiven TypeLoc.
3177*f4a2713aSLionel Sambuc
3178*f4a2713aSLionel SambucGiven
3179*f4a2713aSLionel Sambuc  struct A { struct B { struct C {}; }; };
3180*f4a2713aSLionel Sambuc  A::B::C c;
3181*f4a2713aSLionel SambucnestedNameSpecifierLoc(specifiesTypeLoc(loc(type(
3182*f4a2713aSLionel Sambuc  hasDeclaration(recordDecl(hasName("A")))))))
3183*f4a2713aSLionel Sambuc  matches "A::"
3184*f4a2713aSLionel Sambuc</pre></td></tr>
3185*f4a2713aSLionel Sambuc
3186*f4a2713aSLionel Sambuc
3187*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NestedNameSpecifier.html">NestedNameSpecifier</a>&gt; InnerMatcher</td></tr>
3188*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasPrefix0"><pre>Matches on the prefix of a NestedNameSpecifier.
3189*f4a2713aSLionel Sambuc
3190*f4a2713aSLionel SambucGiven
3191*f4a2713aSLionel Sambuc  struct A { struct B { struct C {}; }; };
3192*f4a2713aSLionel Sambuc  A::B::C c;
3193*f4a2713aSLionel SambucnestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and
3194*f4a2713aSLionel Sambuc  matches "A::"
3195*f4a2713aSLionel Sambuc</pre></td></tr>
3196*f4a2713aSLionel Sambuc
3197*f4a2713aSLionel Sambuc
3198*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NamespaceDecl.html">NamespaceDecl</a>&gt; InnerMatcher</td></tr>
3199*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="specifiesNamespace0"><pre>Matches nested name specifiers that specify a namespace matching the
3200*f4a2713aSLionel Sambucgiven namespace matcher.
3201*f4a2713aSLionel Sambuc
3202*f4a2713aSLionel SambucGiven
3203*f4a2713aSLionel Sambuc  namespace ns { struct A {}; }
3204*f4a2713aSLionel Sambuc  ns::A a;
3205*f4a2713aSLionel SambucnestedNameSpecifier(specifiesNamespace(hasName("ns")))
3206*f4a2713aSLionel Sambuc  matches "ns::"
3207*f4a2713aSLionel Sambuc</pre></td></tr>
3208*f4a2713aSLionel Sambuc
3209*f4a2713aSLionel Sambuc
3210*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3211*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="specifiesType0"><pre>Matches nested name specifiers that specify a type matching the
3212*f4a2713aSLionel Sambucgiven QualType matcher without qualifiers.
3213*f4a2713aSLionel Sambuc
3214*f4a2713aSLionel SambucGiven
3215*f4a2713aSLionel Sambuc  struct A { struct B { struct C {}; }; };
3216*f4a2713aSLionel Sambuc  A::B::C c;
3217*f4a2713aSLionel SambucnestedNameSpecifier(specifiesType(hasDeclaration(recordDecl(hasName("A")))))
3218*f4a2713aSLionel Sambuc  matches "A::"
3219*f4a2713aSLionel Sambuc</pre></td></tr>
3220*f4a2713aSLionel Sambuc
3221*f4a2713aSLionel Sambuc
3222*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
3223*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="innerType0"><pre>Matches ParenType nodes where the inner type is a specific type.
3224*f4a2713aSLionel Sambuc
3225*f4a2713aSLionel SambucGiven
3226*f4a2713aSLionel Sambuc  int (*ptr_to_array)[4];
3227*f4a2713aSLionel Sambuc  int (*ptr_to_func)(int);
3228*f4a2713aSLionel Sambuc
3229*f4a2713aSLionel SambucvarDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
3230*f4a2713aSLionel Sambucptr_to_func but not ptr_to_array.
3231*f4a2713aSLionel Sambuc
3232*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ParenType.html">ParenType</a>&gt;
3233*f4a2713aSLionel Sambuc</pre></td></tr>
3234*f4a2713aSLionel Sambuc
3235*f4a2713aSLionel Sambuc
3236*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerTypeLoc.html">PointerTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc2')"><a name="pointeeLoc2Anchor">pointeeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
3237*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointeeLoc2"><pre>Narrows PointerType (and similar) matchers to those where the
3238*f4a2713aSLionel Sambucpointee matches a given matcher.
3239*f4a2713aSLionel Sambuc
3240*f4a2713aSLionel SambucGiven
3241*f4a2713aSLionel Sambuc  int *a;
3242*f4a2713aSLionel Sambuc  int const *b;
3243*f4a2713aSLionel Sambuc  float const *f;
3244*f4a2713aSLionel SambucpointerType(pointee(isConstQualified(), isInteger()))
3245*f4a2713aSLionel Sambuc  matches "int const *b"
3246*f4a2713aSLionel Sambuc
3247*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3248*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3249*f4a2713aSLionel Sambuc</pre></td></tr>
3250*f4a2713aSLionel Sambuc
3251*f4a2713aSLionel Sambuc
3252*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
3253*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointee2"><pre>Narrows PointerType (and similar) matchers to those where the
3254*f4a2713aSLionel Sambucpointee matches a given matcher.
3255*f4a2713aSLionel Sambuc
3256*f4a2713aSLionel SambucGiven
3257*f4a2713aSLionel Sambuc  int *a;
3258*f4a2713aSLionel Sambuc  int const *b;
3259*f4a2713aSLionel Sambuc  float const *f;
3260*f4a2713aSLionel SambucpointerType(pointee(isConstQualified(), isInteger()))
3261*f4a2713aSLionel Sambuc  matches "int const *b"
3262*f4a2713aSLionel Sambuc
3263*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3264*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3265*f4a2713aSLionel Sambuc</pre></td></tr>
3266*f4a2713aSLionel Sambuc
3267*f4a2713aSLionel Sambuc
3268*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3269*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasCanonicalType0"><pre>Matches QualTypes whose canonical type matches InnerMatcher.
3270*f4a2713aSLionel Sambuc
3271*f4a2713aSLionel SambucGiven:
3272*f4a2713aSLionel Sambuc  typedef int &amp;int_ref;
3273*f4a2713aSLionel Sambuc  int a;
3274*f4a2713aSLionel Sambuc  int_ref b = a;
3275*f4a2713aSLionel Sambuc
3276*f4a2713aSLionel SambucvarDecl(hasType(qualType(referenceType()))))) will not match the
3277*f4a2713aSLionel Sambucdeclaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
3278*f4a2713aSLionel Sambuc</pre></td></tr>
3279*f4a2713aSLionel Sambuc
3280*f4a2713aSLionel Sambuc
3281*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3282*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node
3283*f4a2713aSLionel Sambucmatches the given matcher.
3284*f4a2713aSLionel Sambuc
3285*f4a2713aSLionel SambucThe associated declaration is:
3286*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3287*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3288*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3289*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3290*f4a2713aSLionel Sambuc
3291*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3292*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3293*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3294*f4a2713aSLionel SambucgetDecl().
3295*f4a2713aSLionel Sambuc
3296*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3297*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3298*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3299*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3300*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3301*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3302*f4a2713aSLionel Sambuc</pre></td></tr>
3303*f4a2713aSLionel Sambuc
3304*f4a2713aSLionel Sambuc
3305*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3306*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointsTo1"><pre>Overloaded to match the pointee type's declaration.
3307*f4a2713aSLionel Sambuc</pre></td></tr>
3308*f4a2713aSLionel Sambuc
3309*f4a2713aSLionel Sambuc
3310*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3311*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="references1"><pre>Overloaded to match the referenced type's declaration.
3312*f4a2713aSLionel Sambuc</pre></td></tr>
3313*f4a2713aSLionel Sambuc
3314*f4a2713aSLionel Sambuc
3315*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3316*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node
3317*f4a2713aSLionel Sambucmatches the given matcher.
3318*f4a2713aSLionel Sambuc
3319*f4a2713aSLionel SambucThe associated declaration is:
3320*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3321*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3322*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3323*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3324*f4a2713aSLionel Sambuc
3325*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3326*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3327*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3328*f4a2713aSLionel SambucgetDecl().
3329*f4a2713aSLionel Sambuc
3330*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3331*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3332*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3333*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3334*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3335*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3336*f4a2713aSLionel Sambuc</pre></td></tr>
3337*f4a2713aSLionel Sambuc
3338*f4a2713aSLionel Sambuc
3339*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceTypeLoc.html">ReferenceTypeLoc</a>&gt;</td><td class="name" onclick="toggle('pointeeLoc3')"><a name="pointeeLoc3Anchor">pointeeLoc</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypeLoc.html">TypeLoc</a>&gt;</td></tr>
3340*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointeeLoc3"><pre>Narrows PointerType (and similar) matchers to those where the
3341*f4a2713aSLionel Sambucpointee matches a given matcher.
3342*f4a2713aSLionel Sambuc
3343*f4a2713aSLionel SambucGiven
3344*f4a2713aSLionel Sambuc  int *a;
3345*f4a2713aSLionel Sambuc  int const *b;
3346*f4a2713aSLionel Sambuc  float const *f;
3347*f4a2713aSLionel SambucpointerType(pointee(isConstQualified(), isInteger()))
3348*f4a2713aSLionel Sambuc  matches "int const *b"
3349*f4a2713aSLionel Sambuc
3350*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3351*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3352*f4a2713aSLionel Sambuc</pre></td></tr>
3353*f4a2713aSLionel Sambuc
3354*f4a2713aSLionel Sambuc
3355*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Type.html">Type</a>&gt;</td></tr>
3356*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="pointee3"><pre>Narrows PointerType (and similar) matchers to those where the
3357*f4a2713aSLionel Sambucpointee matches a given matcher.
3358*f4a2713aSLionel Sambuc
3359*f4a2713aSLionel SambucGiven
3360*f4a2713aSLionel Sambuc  int *a;
3361*f4a2713aSLionel Sambuc  int const *b;
3362*f4a2713aSLionel Sambuc  float const *f;
3363*f4a2713aSLionel SambucpointerType(pointee(isConstQualified(), isInteger()))
3364*f4a2713aSLionel Sambuc  matches "int const *b"
3365*f4a2713aSLionel Sambuc
3366*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1BlockPointerType.html">BlockPointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html">MemberPointerType</a>&gt;,
3367*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1PointerType.html">PointerType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ReferenceType.html">ReferenceType</a>&gt;
3368*f4a2713aSLionel Sambuc</pre></td></tr>
3369*f4a2713aSLionel Sambuc
3370*f4a2713aSLionel Sambuc
3371*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;  InnerMatcher</td></tr>
3372*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
3373*f4a2713aSLionel Sambucalignof.
3374*f4a2713aSLionel Sambuc</pre></td></tr>
3375*f4a2713aSLionel Sambuc
3376*f4a2713aSLionel Sambuc
3377*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>&gt;  InnerMatcher</td></tr>
3378*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching
3379*f4a2713aSLionel Sambucsizeof.
3380*f4a2713aSLionel Sambuc</pre></td></tr>
3381*f4a2713aSLionel Sambuc
3382*f4a2713aSLionel Sambuc
3383*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1SwitchCase.html">SwitchCase</a>&gt; InnerMatcher</td></tr>
3384*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="forEachSwitchCase0"><pre>Matches each case or default statement belonging to the given switch
3385*f4a2713aSLionel Sambucstatement. This matcher may produce multiple matches.
3386*f4a2713aSLionel Sambuc
3387*f4a2713aSLionel SambucGiven
3388*f4a2713aSLionel Sambuc  switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
3389*f4a2713aSLionel SambucswitchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
3390*f4a2713aSLionel Sambuc  matches four times, with "c" binding each of "case 1:", "case 2:",
3391*f4a2713aSLionel Sambuc"case 3:" and "case 4:", and "s" respectively binding "switch (1)",
3392*f4a2713aSLionel Sambuc"switch (1)", "switch (2)" and "switch (2)".
3393*f4a2713aSLionel Sambuc</pre></td></tr>
3394*f4a2713aSLionel Sambuc
3395*f4a2713aSLionel Sambuc
3396*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3397*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node
3398*f4a2713aSLionel Sambucmatches the given matcher.
3399*f4a2713aSLionel Sambuc
3400*f4a2713aSLionel SambucThe associated declaration is:
3401*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3402*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3403*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3404*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3405*f4a2713aSLionel Sambuc
3406*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3407*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3408*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3409*f4a2713aSLionel SambucgetDecl().
3410*f4a2713aSLionel Sambuc
3411*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3412*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3413*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3414*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3415*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3416*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3417*f4a2713aSLionel Sambuc</pre></td></tr>
3418*f4a2713aSLionel Sambuc
3419*f4a2713aSLionel Sambuc
3420*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3421*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="refersToDeclaration0"><pre>Matches a TemplateArgument that refers to a certain declaration.
3422*f4a2713aSLionel Sambuc
3423*f4a2713aSLionel SambucGiven
3424*f4a2713aSLionel Sambuc  template&lt;typename T&gt; struct A {};
3425*f4a2713aSLionel Sambuc  struct B { B* next; };
3426*f4a2713aSLionel Sambuc  A&lt;&amp;B::next&gt; a;
3427*f4a2713aSLionel SambucclassTemplateSpecializationDecl(hasAnyTemplateArgument(
3428*f4a2713aSLionel Sambuc    refersToDeclaration(fieldDecl(hasName("next"))))
3429*f4a2713aSLionel Sambuc  matches the specialization A&lt;&amp;B::next&gt; with fieldDecl(...) matching
3430*f4a2713aSLionel Sambuc    B::next
3431*f4a2713aSLionel Sambuc</pre></td></tr>
3432*f4a2713aSLionel Sambuc
3433*f4a2713aSLionel Sambuc
3434*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3435*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="refersToType0"><pre>Matches a TemplateArgument that refers to a certain type.
3436*f4a2713aSLionel Sambuc
3437*f4a2713aSLionel SambucGiven
3438*f4a2713aSLionel Sambuc  struct X {};
3439*f4a2713aSLionel Sambuc  template&lt;typename T&gt; struct A {};
3440*f4a2713aSLionel Sambuc  A&lt;X&gt; a;
3441*f4a2713aSLionel SambucclassTemplateSpecializationDecl(hasAnyTemplateArgument(
3442*f4a2713aSLionel Sambuc    refersToType(class(hasName("X")))))
3443*f4a2713aSLionel Sambuc  matches the specialization A&lt;X&gt;
3444*f4a2713aSLionel Sambuc</pre></td></tr>
3445*f4a2713aSLionel Sambuc
3446*f4a2713aSLionel Sambuc
3447*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3448*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node
3449*f4a2713aSLionel Sambucmatches the given matcher.
3450*f4a2713aSLionel Sambuc
3451*f4a2713aSLionel SambucThe associated declaration is:
3452*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3453*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3454*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3455*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3456*f4a2713aSLionel Sambuc
3457*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3458*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3459*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3460*f4a2713aSLionel SambucgetDecl().
3461*f4a2713aSLionel Sambuc
3462*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3463*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3464*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3465*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3466*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3467*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3468*f4a2713aSLionel Sambuc</pre></td></tr>
3469*f4a2713aSLionel Sambuc
3470*f4a2713aSLionel Sambuc
3471*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3472*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node
3473*f4a2713aSLionel Sambucmatches the given matcher.
3474*f4a2713aSLionel Sambuc
3475*f4a2713aSLionel SambucThe associated declaration is:
3476*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3477*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3478*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3479*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3480*f4a2713aSLionel Sambuc
3481*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3482*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3483*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3484*f4a2713aSLionel SambucgetDecl().
3485*f4a2713aSLionel Sambuc
3486*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3487*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3488*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3489*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3490*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3491*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3492*f4a2713aSLionel Sambuc</pre></td></tr>
3493*f4a2713aSLionel Sambuc
3494*f4a2713aSLionel Sambuc
3495*f4a2713aSLionel Sambuc<tr><td>Matcher&lt;T&gt;</td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>Matcher&lt;T&gt;  Matcher</td></tr>
3496*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches.
3497*f4a2713aSLionel Sambuc
3498*f4a2713aSLionel SambucGenerates results for each match.
3499*f4a2713aSLionel Sambuc
3500*f4a2713aSLionel SambucFor example, in:
3501*f4a2713aSLionel Sambuc  class A { class B {}; class C {}; };
3502*f4a2713aSLionel SambucThe matcher:
3503*f4a2713aSLionel Sambuc  recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("m")))
3504*f4a2713aSLionel Sambucwill generate results for A, B and C.
3505*f4a2713aSLionel Sambuc
3506*f4a2713aSLionel SambucUsable as: Any Matcher
3507*f4a2713aSLionel Sambuc</pre></td></tr>
3508*f4a2713aSLionel Sambuc
3509*f4a2713aSLionel Sambuc
3510*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;  InnerMatcher</td></tr>
3511*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="loc0"><pre>Matches TypeLocs for which the given inner
3512*f4a2713aSLionel SambucQualType-matcher matches.
3513*f4a2713aSLionel Sambuc</pre></td></tr>
3514*f4a2713aSLionel Sambuc
3515*f4a2713aSLionel Sambuc
3516*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3517*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node
3518*f4a2713aSLionel Sambucmatches the given matcher.
3519*f4a2713aSLionel Sambuc
3520*f4a2713aSLionel SambucThe associated declaration is:
3521*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3522*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3523*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3524*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3525*f4a2713aSLionel Sambuc
3526*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3527*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3528*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3529*f4a2713aSLionel SambucgetDecl().
3530*f4a2713aSLionel Sambuc
3531*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3532*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3533*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3534*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3535*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3536*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3537*f4a2713aSLionel Sambuc</pre></td></tr>
3538*f4a2713aSLionel Sambuc
3539*f4a2713aSLionel Sambuc
3540*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt; InnerMatcher</td></tr>
3541*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasArgumentOfType0"><pre>Matches unary expressions that have a specific type of argument.
3542*f4a2713aSLionel Sambuc
3543*f4a2713aSLionel SambucGiven
3544*f4a2713aSLionel Sambuc  int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c);
3545*f4a2713aSLionel SambucunaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))
3546*f4a2713aSLionel Sambuc  matches sizeof(a) and alignof(c)
3547*f4a2713aSLionel Sambuc</pre></td></tr>
3548*f4a2713aSLionel Sambuc
3549*f4a2713aSLionel Sambuc
3550*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3551*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasUnaryOperand0"><pre>Matches if the operand of a unary operator matches.
3552*f4a2713aSLionel Sambuc
3553*f4a2713aSLionel SambucExample matches true (matcher = hasUnaryOperand(boolLiteral(equals(true))))
3554*f4a2713aSLionel Sambuc  !true
3555*f4a2713aSLionel Sambuc</pre></td></tr>
3556*f4a2713aSLionel Sambuc
3557*f4a2713aSLionel Sambuc
3558*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;  InnerMatcher</td></tr>
3559*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node
3560*f4a2713aSLionel Sambucmatches the given matcher.
3561*f4a2713aSLionel Sambuc
3562*f4a2713aSLionel SambucThe associated declaration is:
3563*f4a2713aSLionel Sambuc- for type nodes, the declaration of the underlying type
3564*f4a2713aSLionel Sambuc- for CallExpr, the declaration of the callee
3565*f4a2713aSLionel Sambuc- for MemberExpr, the declaration of the referenced member
3566*f4a2713aSLionel Sambuc- for CXXConstructExpr, the declaration of the constructor
3567*f4a2713aSLionel Sambuc
3568*f4a2713aSLionel SambucAlso usable as Matcher&lt;T&gt; for any T supporting the getDecl() member
3569*f4a2713aSLionel Sambucfunction. e.g. various subtypes of clang::Type and various expressions.
3570*f4a2713aSLionel SambucFIXME: Add all node types for which this is matcher is usable due to
3571*f4a2713aSLionel SambucgetDecl().
3572*f4a2713aSLionel Sambuc
3573*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;,
3574*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>&gt;,
3575*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>&gt;,
3576*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>&gt;,
3577*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>&gt;,
3578*f4a2713aSLionel Sambuc  Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>&gt;
3579*f4a2713aSLionel Sambuc</pre></td></tr>
3580*f4a2713aSLionel Sambuc
3581*f4a2713aSLionel Sambuc
3582*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingDecl.html">UsingDecl</a>&gt;</td><td class="name" onclick="toggle('hasAnyUsingShadowDecl0')"><a name="hasAnyUsingShadowDecl0Anchor">hasAnyUsingShadowDecl</a></td><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1UsingShadowDecl.html">UsingShadowDecl</a>&gt; InnerMatcher</td></tr>
3583*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasAnyUsingShadowDecl0"><pre>Matches any using shadow declaration.
3584*f4a2713aSLionel Sambuc
3585*f4a2713aSLionel SambucGiven
3586*f4a2713aSLionel Sambuc  namespace X { void b(); }
3587*f4a2713aSLionel Sambuc  using X::b;
3588*f4a2713aSLionel SambucusingDecl(hasAnyUsingShadowDecl(hasName("b"))))
3589*f4a2713aSLionel Sambuc  matches using X::b </pre></td></tr>
3590*f4a2713aSLionel Sambuc
3591*f4a2713aSLionel Sambuc
3592*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>&gt; InnerMatcher</td></tr>
3593*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasTargetDecl0"><pre>Matches a using shadow declaration where the target declaration is
3594*f4a2713aSLionel Sambucmatched by the given matcher.
3595*f4a2713aSLionel Sambuc
3596*f4a2713aSLionel SambucGiven
3597*f4a2713aSLionel Sambuc  namespace X { int a; void b(); }
3598*f4a2713aSLionel Sambuc  using X::a;
3599*f4a2713aSLionel Sambuc  using X::b;
3600*f4a2713aSLionel SambucusingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
3601*f4a2713aSLionel Sambuc  matches using X::b but not using X::a </pre></td></tr>
3602*f4a2713aSLionel Sambuc
3603*f4a2713aSLionel Sambuc
3604*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt; InnerMatcher</td></tr>
3605*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasType3"><pre>Overloaded to match the declaration of the expression's or value
3606*f4a2713aSLionel Sambucdeclaration's type.
3607*f4a2713aSLionel Sambuc
3608*f4a2713aSLionel SambucIn case of a value declaration (for example a variable declaration),
3609*f4a2713aSLionel Sambucthis resolves one layer of indirection. For example, in the value
3610*f4a2713aSLionel Sambucdeclaration "X x;", recordDecl(hasName("X")) matches the declaration of X,
3611*f4a2713aSLionel Sambucwhile varDecl(hasType(recordDecl(hasName("X")))) matches the declaration
3612*f4a2713aSLionel Sambucof x."
3613*f4a2713aSLionel Sambuc
3614*f4a2713aSLionel SambucExample matches x (matcher = expr(hasType(recordDecl(hasName("X")))))
3615*f4a2713aSLionel Sambuc            and z (matcher = varDecl(hasType(recordDecl(hasName("X")))))
3616*f4a2713aSLionel Sambuc class X {};
3617*f4a2713aSLionel Sambuc void y(X &amp;x) { x; X z; }
3618*f4a2713aSLionel Sambuc
3619*f4a2713aSLionel SambucUsable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>&gt;
3620*f4a2713aSLionel Sambuc</pre></td></tr>
3621*f4a2713aSLionel Sambuc
3622*f4a2713aSLionel Sambuc
3623*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3624*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasInitializer0"><pre>Matches a variable declaration that has an initializer expression
3625*f4a2713aSLionel Sambucthat matches the given matcher.
3626*f4a2713aSLionel Sambuc
3627*f4a2713aSLionel SambucExample matches x (matcher = varDecl(hasInitializer(callExpr())))
3628*f4a2713aSLionel Sambuc  bool y() { return true; }
3629*f4a2713aSLionel Sambuc  bool x = y();
3630*f4a2713aSLionel Sambuc</pre></td></tr>
3631*f4a2713aSLionel Sambuc
3632*f4a2713aSLionel Sambuc
3633*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3634*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasSizeExpr0"><pre>Matches VariableArrayType nodes that have a specific size
3635*f4a2713aSLionel Sambucexpression.
3636*f4a2713aSLionel Sambuc
3637*f4a2713aSLionel SambucGiven
3638*f4a2713aSLionel Sambuc  void f(int b) {
3639*f4a2713aSLionel Sambuc    int a[b];
3640*f4a2713aSLionel Sambuc  }
3641*f4a2713aSLionel SambucvariableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
3642*f4a2713aSLionel Sambuc  varDecl(hasName("b")))))))
3643*f4a2713aSLionel Sambuc  matches "int a[b]"
3644*f4a2713aSLionel Sambuc</pre></td></tr>
3645*f4a2713aSLionel Sambuc
3646*f4a2713aSLionel Sambuc
3647*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt; InnerMatcher</td></tr>
3648*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasBody2"><pre>Matches a 'for', 'while', or 'do while' statement that has
3649*f4a2713aSLionel Sambuca given body.
3650*f4a2713aSLionel Sambuc
3651*f4a2713aSLionel SambucGiven
3652*f4a2713aSLionel Sambuc  for (;;) {}
3653*f4a2713aSLionel SambuchasBody(compoundStmt())
3654*f4a2713aSLionel Sambuc  matches 'for (;;) {}'
3655*f4a2713aSLionel Sambucwith compoundStmt()
3656*f4a2713aSLionel Sambuc  matching '{}'
3657*f4a2713aSLionel Sambuc</pre></td></tr>
3658*f4a2713aSLionel Sambuc
3659*f4a2713aSLionel Sambuc
3660*f4a2713aSLionel Sambuc<tr><td>Matcher&lt<a href="http://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="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>&gt; InnerMatcher</td></tr>
3661*f4a2713aSLionel Sambuc<tr><td colspan="4" class="doc" id="hasCondition2"><pre>Matches the condition expression of an if statement, for loop,
3662*f4a2713aSLionel Sambucor conditional operator.
3663*f4a2713aSLionel Sambuc
3664*f4a2713aSLionel SambucExample matches true (matcher = hasCondition(boolLiteral(equals(true))))
3665*f4a2713aSLionel Sambuc  if (true) {}
3666*f4a2713aSLionel Sambuc</pre></td></tr>
3667*f4a2713aSLionel Sambuc
3668*f4a2713aSLionel Sambuc<!--END_TRAVERSAL_MATCHERS -->
3669*f4a2713aSLionel Sambuc</table>
3670*f4a2713aSLionel Sambuc
3671*f4a2713aSLionel Sambuc</div>
3672*f4a2713aSLionel Sambuc</body>
3673*f4a2713aSLionel Sambuc</html>
3674*f4a2713aSLionel Sambuc
3675*f4a2713aSLionel Sambuc
3676