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