/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===- ASTMatchersInternal.cpp - Structural query framework ---------------===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // Implements the base layer of the matcher framework. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #include "clang/ASTMatchers/ASTMatchersInternal.h" |
14 | | #include "clang/AST/ASTContext.h" |
15 | | #include "clang/AST/ASTTypeTraits.h" |
16 | | #include "clang/AST/Decl.h" |
17 | | #include "clang/AST/DeclTemplate.h" |
18 | | #include "clang/AST/ParentMapContext.h" |
19 | | #include "clang/AST/PrettyPrinter.h" |
20 | | #include "clang/ASTMatchers/ASTMatchers.h" |
21 | | #include "clang/Basic/LLVM.h" |
22 | | #include "clang/Lex/Lexer.h" |
23 | | #include "llvm/ADT/ArrayRef.h" |
24 | | #include "llvm/ADT/IntrusiveRefCntPtr.h" |
25 | | #include "llvm/ADT/SmallString.h" |
26 | | #include "llvm/ADT/SmallVector.h" |
27 | | #include "llvm/ADT/StringRef.h" |
28 | | #include "llvm/Support/Casting.h" |
29 | | #include "llvm/Support/ErrorHandling.h" |
30 | | #include "llvm/Support/ManagedStatic.h" |
31 | | #include "llvm/Support/Regex.h" |
32 | | #include "llvm/Support/WithColor.h" |
33 | | #include "llvm/Support/raw_ostream.h" |
34 | | #include <algorithm> |
35 | | #include <cassert> |
36 | | #include <cstddef> |
37 | | #include <optional> |
38 | | #include <string> |
39 | | #include <utility> |
40 | | #include <vector> |
41 | | |
42 | | namespace clang { |
43 | | namespace ast_matchers { |
44 | | |
45 | | AST_MATCHER_P(ObjCMessageExpr, hasAnySelectorMatcher, std::vector<std::string>, |
46 | 59 | Matches) { |
47 | 59 | return llvm::is_contained(Matches, Node.getSelector().getAsString()); |
48 | 59 | } |
49 | | |
50 | | namespace internal { |
51 | | |
52 | | static bool notUnaryOperator(const DynTypedNode &DynNode, |
53 | | ASTMatchFinder *Finder, |
54 | | BoundNodesTreeBuilder *Builder, |
55 | | ArrayRef<DynTypedMatcher> InnerMatchers); |
56 | | |
57 | | static bool allOfVariadicOperator(const DynTypedNode &DynNode, |
58 | | ASTMatchFinder *Finder, |
59 | | BoundNodesTreeBuilder *Builder, |
60 | | ArrayRef<DynTypedMatcher> InnerMatchers); |
61 | | |
62 | | static bool eachOfVariadicOperator(const DynTypedNode &DynNode, |
63 | | ASTMatchFinder *Finder, |
64 | | BoundNodesTreeBuilder *Builder, |
65 | | ArrayRef<DynTypedMatcher> InnerMatchers); |
66 | | |
67 | | static bool anyOfVariadicOperator(const DynTypedNode &DynNode, |
68 | | ASTMatchFinder *Finder, |
69 | | BoundNodesTreeBuilder *Builder, |
70 | | ArrayRef<DynTypedMatcher> InnerMatchers); |
71 | | |
72 | | static bool optionallyVariadicOperator(const DynTypedNode &DynNode, |
73 | | ASTMatchFinder *Finder, |
74 | | BoundNodesTreeBuilder *Builder, |
75 | | ArrayRef<DynTypedMatcher> InnerMatchers); |
76 | | |
77 | | bool matchesAnyBase(const CXXRecordDecl &Node, |
78 | | const Matcher<CXXBaseSpecifier> &BaseSpecMatcher, |
79 | 1.73k | ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder) { |
80 | 1.73k | if (!Node.hasDefinition()) |
81 | 1.02k | return false; |
82 | | |
83 | 706 | CXXBasePaths Paths; |
84 | 706 | Paths.setOrigin(&Node); |
85 | | |
86 | 706 | const auto basePredicate = |
87 | 706 | [Finder, Builder, &BaseSpecMatcher](const CXXBaseSpecifier *BaseSpec, |
88 | 706 | CXXBasePath &IgnoredParam) { |
89 | 406 | BoundNodesTreeBuilder Result(*Builder); |
90 | 406 | if (BaseSpecMatcher.matches(*BaseSpec, Finder, &Result)) { |
91 | 184 | *Builder = std::move(Result); |
92 | 184 | return true; |
93 | 184 | } |
94 | 222 | return false; |
95 | 406 | }; |
96 | | |
97 | 706 | return Node.lookupInBases(basePredicate, Paths, |
98 | 706 | /*LookupInDependent =*/true); |
99 | 1.73k | } |
100 | | |
101 | 43.4k | void BoundNodesTreeBuilder::visitMatches(Visitor *ResultVisitor) { |
102 | 43.4k | if (Bindings.empty()) |
103 | 22.0k | Bindings.push_back(BoundNodesMap()); |
104 | 48.0k | for (BoundNodesMap &Binding : Bindings) { |
105 | 48.0k | ResultVisitor->visitMatch(BoundNodes(Binding)); |
106 | 48.0k | } |
107 | 43.4k | } |
108 | | |
109 | | namespace { |
110 | | |
111 | | using VariadicOperatorFunction = bool (*)( |
112 | | const DynTypedNode &DynNode, ASTMatchFinder *Finder, |
113 | | BoundNodesTreeBuilder *Builder, ArrayRef<DynTypedMatcher> InnerMatchers); |
114 | | |
115 | | template <VariadicOperatorFunction Func> |
116 | | class VariadicMatcher : public DynMatcherInterface { |
117 | | public: |
118 | | VariadicMatcher(std::vector<DynTypedMatcher> InnerMatchers) |
119 | 293k | : InnerMatchers(std::move(InnerMatchers)) {} ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::VariadicMatcher(std::__1::vector<clang::ast_matchers::internal::DynTypedMatcher, std::__1::allocator<clang::ast_matchers::internal::DynTypedMatcher> >) Line | Count | Source | 119 | 132k | : InnerMatchers(std::move(InnerMatchers)) {} |
ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::anyOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::VariadicMatcher(std::__1::vector<clang::ast_matchers::internal::DynTypedMatcher, std::__1::allocator<clang::ast_matchers::internal::DynTypedMatcher> >) Line | Count | Source | 119 | 115k | : InnerMatchers(std::move(InnerMatchers)) {} |
ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::eachOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::VariadicMatcher(std::__1::vector<clang::ast_matchers::internal::DynTypedMatcher, std::__1::allocator<clang::ast_matchers::internal::DynTypedMatcher> >) Line | Count | Source | 119 | 5.26k | : InnerMatchers(std::move(InnerMatchers)) {} |
ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::optionallyVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::VariadicMatcher(std::__1::vector<clang::ast_matchers::internal::DynTypedMatcher, std::__1::allocator<clang::ast_matchers::internal::DynTypedMatcher> >) Line | Count | Source | 119 | 229 | : InnerMatchers(std::move(InnerMatchers)) {} |
ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::notUnaryOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::VariadicMatcher(std::__1::vector<clang::ast_matchers::internal::DynTypedMatcher, std::__1::allocator<clang::ast_matchers::internal::DynTypedMatcher> >) Line | Count | Source | 119 | 40.2k | : InnerMatchers(std::move(InnerMatchers)) {} |
|
120 | | |
121 | | bool dynMatches(const DynTypedNode &DynNode, ASTMatchFinder *Finder, |
122 | 481k | BoundNodesTreeBuilder *Builder) const override { |
123 | 481k | return Func(DynNode, Finder, Builder, InnerMatchers); |
124 | 481k | } ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::allOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const Line | Count | Source | 122 | 232k | BoundNodesTreeBuilder *Builder) const override { | 123 | 232k | return Func(DynNode, Finder, Builder, InnerMatchers); | 124 | 232k | } |
ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::anyOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const Line | Count | Source | 122 | 210k | BoundNodesTreeBuilder *Builder) const override { | 123 | 210k | return Func(DynNode, Finder, Builder, InnerMatchers); | 124 | 210k | } |
ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::eachOfVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const Line | Count | Source | 122 | 10.8k | BoundNodesTreeBuilder *Builder) const override { | 123 | 10.8k | return Func(DynNode, Finder, Builder, InnerMatchers); | 124 | 10.8k | } |
ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::optionallyVariadicOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const Line | Count | Source | 122 | 268 | BoundNodesTreeBuilder *Builder) const override { | 123 | 268 | return Func(DynNode, Finder, Builder, InnerMatchers); | 124 | 268 | } |
ASTMatchersInternal.cpp:clang::ast_matchers::internal::(anonymous namespace)::VariadicMatcher<&(clang::ast_matchers::internal::notUnaryOperator(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*, llvm::ArrayRef<clang::ast_matchers::internal::DynTypedMatcher>))>::dynMatches(clang::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const Line | Count | Source | 122 | 27.0k | BoundNodesTreeBuilder *Builder) const override { | 123 | 27.0k | return Func(DynNode, Finder, Builder, InnerMatchers); | 124 | 27.0k | } |
|
125 | | |
126 | | private: |
127 | | std::vector<DynTypedMatcher> InnerMatchers; |
128 | | }; |
129 | | |
130 | | class IdDynMatcher : public DynMatcherInterface { |
131 | | public: |
132 | | IdDynMatcher(StringRef ID, |
133 | | IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher) |
134 | 70.1k | : ID(ID), InnerMatcher(std::move(InnerMatcher)) {} |
135 | | |
136 | | bool dynMatches(const DynTypedNode &DynNode, ASTMatchFinder *Finder, |
137 | 270k | BoundNodesTreeBuilder *Builder) const override { |
138 | 270k | bool Result = InnerMatcher->dynMatches(DynNode, Finder, Builder); |
139 | 270k | if (Result) Builder->setBinding(ID, DynNode)38.9k ; |
140 | 270k | return Result; |
141 | 270k | } |
142 | | |
143 | 520k | std::optional<clang::TraversalKind> TraversalKind() const override { |
144 | 520k | return InnerMatcher->TraversalKind(); |
145 | 520k | } |
146 | | |
147 | | private: |
148 | | const std::string ID; |
149 | | const IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher; |
150 | | }; |
151 | | |
152 | | /// A matcher that always returns true. |
153 | | class TrueMatcherImpl : public DynMatcherInterface { |
154 | | public: |
155 | 314 | TrueMatcherImpl() = default; |
156 | | |
157 | | bool dynMatches(const DynTypedNode &, ASTMatchFinder *, |
158 | 50.1k | BoundNodesTreeBuilder *) const override { |
159 | 50.1k | return true; |
160 | 50.1k | } |
161 | | }; |
162 | | |
163 | | /// A matcher that specifies a particular \c TraversalKind. |
164 | | /// |
165 | | /// The kind provided to the constructor overrides any kind that may be |
166 | | /// specified by the `InnerMatcher`. |
167 | | class DynTraversalMatcherImpl : public DynMatcherInterface { |
168 | | public: |
169 | | explicit DynTraversalMatcherImpl( |
170 | | clang::TraversalKind TK, |
171 | | IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher) |
172 | 10.0k | : TK(TK), InnerMatcher(std::move(InnerMatcher)) {} |
173 | | |
174 | | bool dynMatches(const DynTypedNode &DynNode, ASTMatchFinder *Finder, |
175 | 41.6k | BoundNodesTreeBuilder *Builder) const override { |
176 | 41.6k | return this->InnerMatcher->dynMatches(DynNode, Finder, Builder); |
177 | 41.6k | } |
178 | | |
179 | 243k | std::optional<clang::TraversalKind> TraversalKind() const override { |
180 | 243k | return TK; |
181 | 243k | } |
182 | | |
183 | | private: |
184 | | clang::TraversalKind TK; |
185 | | IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher; |
186 | | }; |
187 | | |
188 | | } // namespace |
189 | | |
190 | 4.17M | bool ASTMatchFinder::isTraversalIgnoringImplicitNodes() const { |
191 | 4.17M | return getASTContext().getParentMapContext().getTraversalKind() == |
192 | 4.17M | TK_IgnoreUnlessSpelledInSource; |
193 | 4.17M | } |
194 | | |
195 | | DynTypedMatcher |
196 | | DynTypedMatcher::constructVariadic(DynTypedMatcher::VariadicOperator Op, |
197 | | ASTNodeKind SupportedKind, |
198 | 293k | std::vector<DynTypedMatcher> InnerMatchers) { |
199 | 293k | assert(!InnerMatchers.empty() && "Array must not be empty."); |
200 | 293k | assert(llvm::all_of(InnerMatchers, |
201 | 293k | [SupportedKind](const DynTypedMatcher &M) { |
202 | 293k | return M.canConvertTo(SupportedKind); |
203 | 293k | }) && |
204 | 293k | "InnerMatchers must be convertible to SupportedKind!"); |
205 | | |
206 | | // We must relax the restrict kind here. |
207 | | // The different operators might deal differently with a mismatch. |
208 | | // Make it the same as SupportedKind, since that is the broadest type we are |
209 | | // allowed to accept. |
210 | 293k | auto RestrictKind = SupportedKind; |
211 | | |
212 | 293k | switch (Op) { |
213 | 132k | case VO_AllOf: |
214 | | // In the case of allOf() we must pass all the checks, so making |
215 | | // RestrictKind the most restrictive can save us time. This way we reject |
216 | | // invalid types earlier and we can elide the kind checks inside the |
217 | | // matcher. |
218 | 285k | for (auto &IM : InnerMatchers) { |
219 | 285k | RestrictKind = |
220 | 285k | ASTNodeKind::getMostDerivedType(RestrictKind, IM.RestrictKind); |
221 | 285k | } |
222 | 132k | return DynTypedMatcher( |
223 | 132k | SupportedKind, RestrictKind, |
224 | 132k | new VariadicMatcher<allOfVariadicOperator>(std::move(InnerMatchers))); |
225 | | |
226 | 115k | case VO_AnyOf: |
227 | 115k | return DynTypedMatcher( |
228 | 115k | SupportedKind, RestrictKind, |
229 | 115k | new VariadicMatcher<anyOfVariadicOperator>(std::move(InnerMatchers))); |
230 | | |
231 | 5.26k | case VO_EachOf: |
232 | 5.26k | return DynTypedMatcher( |
233 | 5.26k | SupportedKind, RestrictKind, |
234 | 5.26k | new VariadicMatcher<eachOfVariadicOperator>(std::move(InnerMatchers))); |
235 | | |
236 | 229 | case VO_Optionally: |
237 | 229 | return DynTypedMatcher(SupportedKind, RestrictKind, |
238 | 229 | new VariadicMatcher<optionallyVariadicOperator>( |
239 | 229 | std::move(InnerMatchers))); |
240 | | |
241 | 40.2k | case VO_UnaryNot: |
242 | | // FIXME: Implement the Not operator to take a single matcher instead of a |
243 | | // vector. |
244 | 40.2k | return DynTypedMatcher( |
245 | 40.2k | SupportedKind, RestrictKind, |
246 | 40.2k | new VariadicMatcher<notUnaryOperator>(std::move(InnerMatchers))); |
247 | 293k | } |
248 | 0 | llvm_unreachable("Invalid Op value."); |
249 | 0 | } |
250 | | |
251 | | DynTypedMatcher |
252 | | DynTypedMatcher::constructRestrictedWrapper(const DynTypedMatcher &InnerMatcher, |
253 | 1.87k | ASTNodeKind RestrictKind) { |
254 | 1.87k | DynTypedMatcher Copy = InnerMatcher; |
255 | 1.87k | Copy.RestrictKind = RestrictKind; |
256 | 1.87k | return Copy; |
257 | 1.87k | } |
258 | | |
259 | 10.0k | DynTypedMatcher DynTypedMatcher::withTraversalKind(TraversalKind TK) { |
260 | 10.0k | auto Copy = *this; |
261 | 10.0k | Copy.Implementation = |
262 | 10.0k | new DynTraversalMatcherImpl(TK, std::move(Copy.Implementation)); |
263 | 10.0k | return Copy; |
264 | 10.0k | } |
265 | | |
266 | 77.1k | DynTypedMatcher DynTypedMatcher::trueMatcher(ASTNodeKind NodeKind) { |
267 | | // We only ever need one instance of TrueMatcherImpl, so we create a static |
268 | | // instance and reuse it to reduce the overhead of the matcher and increase |
269 | | // the chance of cache hits. |
270 | 77.1k | static const llvm::IntrusiveRefCntPtr<TrueMatcherImpl> Instance = |
271 | 77.1k | new TrueMatcherImpl(); |
272 | 77.1k | return DynTypedMatcher(NodeKind, NodeKind, Instance); |
273 | 77.1k | } |
274 | | |
275 | 352k | bool DynTypedMatcher::canMatchNodesOfKind(ASTNodeKind Kind) const { |
276 | 352k | return RestrictKind.isBaseOf(Kind); |
277 | 352k | } |
278 | | |
279 | 1.33M | DynTypedMatcher DynTypedMatcher::dynCastTo(const ASTNodeKind Kind) const { |
280 | 1.33M | auto Copy = *this; |
281 | 1.33M | Copy.SupportedKind = Kind; |
282 | 1.33M | Copy.RestrictKind = ASTNodeKind::getMostDerivedType(Kind, RestrictKind); |
283 | 1.33M | return Copy; |
284 | 1.33M | } |
285 | | |
286 | | bool DynTypedMatcher::matches(const DynTypedNode &DynNode, |
287 | | ASTMatchFinder *Finder, |
288 | 1.70M | BoundNodesTreeBuilder *Builder) const { |
289 | 1.70M | TraversalKindScope RAII(Finder->getASTContext(), |
290 | 1.70M | Implementation->TraversalKind()); |
291 | | |
292 | 1.70M | if (Finder->isTraversalIgnoringImplicitNodes() && |
293 | 1.70M | Finder->IsMatchingInASTNodeNotSpelledInSource()56.5k ) |
294 | 2.26k | return false; |
295 | | |
296 | 1.70M | if (!Finder->isTraversalIgnoringImplicitNodes() && |
297 | 1.70M | Finder->IsMatchingInASTNodeNotAsIs()1.64M ) |
298 | 174 | return false; |
299 | | |
300 | 1.70M | auto N = |
301 | 1.70M | Finder->getASTContext().getParentMapContext().traverseIgnored(DynNode); |
302 | | |
303 | 1.70M | if (RestrictKind.isBaseOf(N.getNodeKind()) && |
304 | 1.70M | Implementation->dynMatches(N, Finder, Builder)857k ) { |
305 | 235k | return true; |
306 | 235k | } |
307 | | // Delete all bindings when a matcher does not match. |
308 | | // This prevents unexpected exposure of bound nodes in unmatches |
309 | | // branches of the match tree. |
310 | 1.46M | Builder->removeBindings([](const BoundNodesMap &) { return true; }35.5k ); |
311 | 1.46M | return false; |
312 | 1.70M | } |
313 | | |
314 | | bool DynTypedMatcher::matchesNoKindCheck(const DynTypedNode &DynNode, |
315 | | ASTMatchFinder *Finder, |
316 | 306k | BoundNodesTreeBuilder *Builder) const { |
317 | 306k | TraversalKindScope raii(Finder->getASTContext(), |
318 | 306k | Implementation->TraversalKind()); |
319 | | |
320 | 306k | if (Finder->isTraversalIgnoringImplicitNodes() && |
321 | 306k | Finder->IsMatchingInASTNodeNotSpelledInSource()4.42k ) |
322 | 0 | return false; |
323 | | |
324 | 306k | if (!Finder->isTraversalIgnoringImplicitNodes() && |
325 | 306k | Finder->IsMatchingInASTNodeNotAsIs()301k ) |
326 | 0 | return false; |
327 | | |
328 | 306k | auto N = |
329 | 306k | Finder->getASTContext().getParentMapContext().traverseIgnored(DynNode); |
330 | | |
331 | 306k | assert(RestrictKind.isBaseOf(N.getNodeKind())); |
332 | 306k | if (Implementation->dynMatches(N, Finder, Builder)) { |
333 | 108k | return true; |
334 | 108k | } |
335 | | // Delete all bindings when a matcher does not match. |
336 | | // This prevents unexpected exposure of bound nodes in unmatches |
337 | | // branches of the match tree. |
338 | 198k | Builder->removeBindings([](const BoundNodesMap &) { return true; }1.00k ); |
339 | 198k | return false; |
340 | 306k | } |
341 | | |
342 | 70.1k | std::optional<DynTypedMatcher> DynTypedMatcher::tryBind(StringRef ID) const { |
343 | 70.1k | if (!AllowBind) |
344 | 0 | return std::nullopt; |
345 | 70.1k | auto Result = *this; |
346 | 70.1k | Result.Implementation = |
347 | 70.1k | new IdDynMatcher(ID, std::move(Result.Implementation)); |
348 | 70.1k | return std::move(Result); |
349 | 70.1k | } |
350 | | |
351 | 747k | bool DynTypedMatcher::canConvertTo(ASTNodeKind To) const { |
352 | 747k | const auto From = getSupportedKind(); |
353 | 747k | auto QualKind = ASTNodeKind::getFromNodeKind<QualType>(); |
354 | 747k | auto TypeKind = ASTNodeKind::getFromNodeKind<Type>(); |
355 | | /// Mimic the implicit conversions of Matcher<>. |
356 | | /// - From Matcher<Type> to Matcher<QualType> |
357 | 747k | if (From.isSame(TypeKind) && To.isSame(QualKind)2.23k ) return true1.48k ; |
358 | | /// - From Matcher<Base> to Matcher<Derived> |
359 | 746k | return From.isBaseOf(To); |
360 | 747k | } |
361 | | |
362 | 14.4k | void BoundNodesTreeBuilder::addMatch(const BoundNodesTreeBuilder &Other) { |
363 | 14.4k | Bindings.append(Other.Bindings.begin(), Other.Bindings.end()); |
364 | 14.4k | } |
365 | | |
366 | | static bool notUnaryOperator(const DynTypedNode &DynNode, |
367 | | ASTMatchFinder *Finder, |
368 | | BoundNodesTreeBuilder *Builder, |
369 | 27.0k | ArrayRef<DynTypedMatcher> InnerMatchers) { |
370 | 27.0k | if (InnerMatchers.size() != 1) |
371 | 0 | return false; |
372 | | |
373 | | // The 'unless' matcher will always discard the result: |
374 | | // If the inner matcher doesn't match, unless returns true, |
375 | | // but the inner matcher cannot have bound anything. |
376 | | // If the inner matcher matches, the result is false, and |
377 | | // any possible binding will be discarded. |
378 | | // We still need to hand in all the bound nodes up to this |
379 | | // point so the inner matcher can depend on bound nodes, |
380 | | // and we need to actively discard the bound nodes, otherwise |
381 | | // the inner matcher will reset the bound nodes if it doesn't |
382 | | // match, but this would be inversed by 'unless'. |
383 | 27.0k | BoundNodesTreeBuilder Discard(*Builder); |
384 | 27.0k | return !InnerMatchers[0].matches(DynNode, Finder, &Discard); |
385 | 27.0k | } |
386 | | |
387 | | static bool allOfVariadicOperator(const DynTypedNode &DynNode, |
388 | | ASTMatchFinder *Finder, |
389 | | BoundNodesTreeBuilder *Builder, |
390 | 232k | ArrayRef<DynTypedMatcher> InnerMatchers) { |
391 | | // allOf leads to one matcher for each alternative in the first |
392 | | // matcher combined with each alternative in the second matcher. |
393 | | // Thus, we can reuse the same Builder. |
394 | 306k | return llvm::all_of(InnerMatchers, [&](const DynTypedMatcher &InnerMatcher) { |
395 | 306k | return InnerMatcher.matchesNoKindCheck(DynNode, Finder, Builder); |
396 | 306k | }); |
397 | 232k | } |
398 | | |
399 | | static bool eachOfVariadicOperator(const DynTypedNode &DynNode, |
400 | | ASTMatchFinder *Finder, |
401 | | BoundNodesTreeBuilder *Builder, |
402 | 10.8k | ArrayRef<DynTypedMatcher> InnerMatchers) { |
403 | 10.8k | BoundNodesTreeBuilder Result; |
404 | 10.8k | bool Matched = false; |
405 | 84.6k | for (const DynTypedMatcher &InnerMatcher : InnerMatchers) { |
406 | 84.6k | BoundNodesTreeBuilder BuilderInner(*Builder); |
407 | 84.6k | if (InnerMatcher.matches(DynNode, Finder, &BuilderInner)) { |
408 | 3.53k | Matched = true; |
409 | 3.53k | Result.addMatch(BuilderInner); |
410 | 3.53k | } |
411 | 84.6k | } |
412 | 10.8k | *Builder = std::move(Result); |
413 | 10.8k | return Matched; |
414 | 10.8k | } |
415 | | |
416 | | static bool anyOfVariadicOperator(const DynTypedNode &DynNode, |
417 | | ASTMatchFinder *Finder, |
418 | | BoundNodesTreeBuilder *Builder, |
419 | 210k | ArrayRef<DynTypedMatcher> InnerMatchers) { |
420 | 818k | for (const DynTypedMatcher &InnerMatcher : InnerMatchers) { |
421 | 818k | BoundNodesTreeBuilder Result = *Builder; |
422 | 818k | if (InnerMatcher.matches(DynNode, Finder, &Result)) { |
423 | 30.4k | *Builder = std::move(Result); |
424 | 30.4k | return true; |
425 | 30.4k | } |
426 | 818k | } |
427 | 180k | return false; |
428 | 210k | } |
429 | | |
430 | | static bool |
431 | | optionallyVariadicOperator(const DynTypedNode &DynNode, ASTMatchFinder *Finder, |
432 | | BoundNodesTreeBuilder *Builder, |
433 | 268 | ArrayRef<DynTypedMatcher> InnerMatchers) { |
434 | 268 | if (InnerMatchers.size() != 1) |
435 | 0 | return false; |
436 | | |
437 | 268 | BoundNodesTreeBuilder Result(*Builder); |
438 | 268 | if (InnerMatchers[0].matches(DynNode, Finder, &Result)) |
439 | 46 | *Builder = std::move(Result); |
440 | 268 | return true; |
441 | 268 | } |
442 | | |
443 | | inline static |
444 | 8.20k | std::vector<std::string> vectorFromRefs(ArrayRef<const StringRef *> NameRefs) { |
445 | 8.20k | std::vector<std::string> Names; |
446 | 8.20k | Names.reserve(NameRefs.size()); |
447 | 8.20k | for (auto *Name : NameRefs) |
448 | 37.3k | Names.emplace_back(*Name); |
449 | 8.20k | return Names; |
450 | 8.20k | } |
451 | | |
452 | 5.62k | Matcher<NamedDecl> hasAnyNameFunc(ArrayRef<const StringRef *> NameRefs) { |
453 | 5.62k | return internal::Matcher<NamedDecl>( |
454 | 5.62k | new internal::HasNameMatcher(vectorFromRefs(NameRefs))); |
455 | 5.62k | } |
456 | | |
457 | | Matcher<ObjCMessageExpr> hasAnySelectorFunc( |
458 | 306 | ArrayRef<const StringRef *> NameRefs) { |
459 | 306 | return hasAnySelectorMatcher(vectorFromRefs(NameRefs)); |
460 | 306 | } |
461 | | |
462 | 2.26k | HasOpNameMatcher hasAnyOperatorNameFunc(ArrayRef<const StringRef *> NameRefs) { |
463 | 2.26k | return HasOpNameMatcher(vectorFromRefs(NameRefs)); |
464 | 2.26k | } |
465 | | |
466 | | HasOverloadOpNameMatcher |
467 | 10 | hasAnyOverloadedOperatorNameFunc(ArrayRef<const StringRef *> NameRefs) { |
468 | 10 | return HasOverloadOpNameMatcher(vectorFromRefs(NameRefs)); |
469 | 10 | } |
470 | | |
471 | | HasNameMatcher::HasNameMatcher(std::vector<std::string> N) |
472 | | : UseUnqualifiedMatch( |
473 | 36.7k | llvm::all_of(N, [](StringRef Name) 35.5k { return !Name.contains("::"); })), |
474 | 35.5k | Names(std::move(N)) { |
475 | 35.5k | #ifndef NDEBUG |
476 | 35.5k | for (StringRef Name : Names) |
477 | 50.9k | assert(!Name.empty()); |
478 | 35.5k | #endif |
479 | 35.5k | } |
480 | | |
481 | 515k | static bool consumeNameSuffix(StringRef &FullName, StringRef Suffix) { |
482 | 515k | StringRef Name = FullName; |
483 | 515k | if (!Name.endswith(Suffix)) |
484 | 384k | return false; |
485 | 130k | Name = Name.drop_back(Suffix.size()); |
486 | 130k | if (!Name.empty()) { |
487 | 11.0k | if (!Name.endswith("::")) |
488 | 306 | return false; |
489 | 10.7k | Name = Name.drop_back(2); |
490 | 10.7k | } |
491 | 130k | FullName = Name; |
492 | 130k | return true; |
493 | 130k | } |
494 | | |
495 | | static StringRef getNodeName(const NamedDecl &Node, |
496 | 477k | llvm::SmallString<128> &Scratch) { |
497 | | // Simple name. |
498 | 477k | if (Node.getIdentifier()) |
499 | 431k | return Node.getName(); |
500 | | |
501 | 45.3k | if (Node.getDeclName()) { |
502 | | // Name needs to be constructed. |
503 | 31.5k | Scratch.clear(); |
504 | 31.5k | llvm::raw_svector_ostream OS(Scratch); |
505 | 31.5k | Node.printName(OS); |
506 | 31.5k | return OS.str(); |
507 | 31.5k | } |
508 | | |
509 | 13.8k | return "(anonymous)"; |
510 | 45.3k | } |
511 | | |
512 | | static StringRef getNodeName(const RecordDecl &Node, |
513 | 2.19k | llvm::SmallString<128> &Scratch) { |
514 | 2.19k | if (Node.getIdentifier()) { |
515 | 1.95k | return Node.getName(); |
516 | 1.95k | } |
517 | 240 | Scratch.clear(); |
518 | 240 | return ("(anonymous " + Node.getKindName() + ")").toStringRef(Scratch); |
519 | 2.19k | } |
520 | | |
521 | | static StringRef getNodeName(const NamespaceDecl &Node, |
522 | 3.52k | llvm::SmallString<128> &Scratch) { |
523 | 3.52k | return Node.isAnonymousNamespace() ? "(anonymous namespace)"160 : Node.getName()3.36k ; |
524 | 3.52k | } |
525 | | |
526 | | namespace { |
527 | | |
528 | | class PatternSet { |
529 | | public: |
530 | 249k | PatternSet(ArrayRef<std::string> Names) { |
531 | 249k | Patterns.reserve(Names.size()); |
532 | 249k | for (StringRef Name : Names) |
533 | 278k | Patterns.push_back({Name, Name.startswith("::")}); |
534 | 249k | } |
535 | | |
536 | | /// Consumes the name suffix from each pattern in the set and removes the ones |
537 | | /// that didn't match. |
538 | | /// Return true if there are still any patterns left. |
539 | 255k | bool consumeNameSuffix(StringRef NodeName, bool CanSkip) { |
540 | 542k | for (size_t I = 0; I < Patterns.size();) { |
541 | 287k | if (::clang::ast_matchers::internal::consumeNameSuffix(Patterns[I].P, |
542 | 287k | NodeName) || |
543 | 287k | CanSkip215k ) { |
544 | 71.5k | ++I; |
545 | 215k | } else { |
546 | 215k | Patterns.erase(Patterns.begin() + I); |
547 | 215k | } |
548 | 287k | } |
549 | 255k | return !Patterns.empty(); |
550 | 255k | } |
551 | | |
552 | | /// Check if any of the patterns are a match. |
553 | | /// A match will be a pattern that was fully consumed, that also matches the |
554 | | /// 'fully qualified' requirement. |
555 | 68.6k | bool foundMatch(bool AllowFullyQualified) const { |
556 | 71.5k | return llvm::any_of(Patterns, [&](const Pattern &Pattern) { |
557 | 71.5k | return Pattern.P.empty() && |
558 | 71.5k | (63.2k AllowFullyQualified63.2k || !Pattern.IsFullyQualified24.3k ); |
559 | 71.5k | }); |
560 | 68.6k | } |
561 | | |
562 | | private: |
563 | | struct Pattern { |
564 | | StringRef P; |
565 | | bool IsFullyQualified; |
566 | | }; |
567 | | |
568 | | llvm::SmallVector<Pattern, 8> Patterns; |
569 | | }; |
570 | | |
571 | | } // namespace |
572 | | |
573 | 227k | bool HasNameMatcher::matchesNodeUnqualified(const NamedDecl &Node) const { |
574 | 227k | assert(UseUnqualifiedMatch); |
575 | 227k | llvm::SmallString<128> Scratch; |
576 | 227k | StringRef NodeName = getNodeName(Node, Scratch); |
577 | 228k | return llvm::any_of(Names, [&](StringRef Name) { |
578 | 228k | return consumeNameSuffix(Name, NodeName) && Name.empty()58.6k ; |
579 | 228k | }); |
580 | 227k | } |
581 | | |
582 | 249k | bool HasNameMatcher::matchesNodeFullFast(const NamedDecl &Node) const { |
583 | 249k | PatternSet Patterns(Names); |
584 | 249k | llvm::SmallString<128> Scratch; |
585 | | |
586 | | // This function is copied and adapted from NamedDecl::printQualifiedName() |
587 | | // By matching each part individually we optimize in a couple of ways: |
588 | | // - We can exit early on the first failure. |
589 | | // - We can skip inline/anonymous namespaces without another pass. |
590 | | // - We print one name at a time, reducing the chance of overflowing the |
591 | | // inlined space of the SmallString. |
592 | | |
593 | | // First, match the name. |
594 | 249k | if (!Patterns.consumeNameSuffix(getNodeName(Node, Scratch), |
595 | 249k | /*CanSkip=*/false)) |
596 | 185k | return false; |
597 | | |
598 | | // Try to match each declaration context. |
599 | | // We are allowed to skip anonymous and inline namespaces if they don't match. |
600 | 64.1k | const DeclContext *Ctx = Node.getDeclContext(); |
601 | | |
602 | 64.1k | if (Ctx->isFunctionOrMethod()) |
603 | 5.63k | return Patterns.foundMatch(/*AllowFullyQualified=*/false); |
604 | | |
605 | 63.3k | for (; 58.5k Ctx; Ctx = Ctx->getParent()4.77k ) { |
606 | | // Linkage Spec can just be ignored |
607 | | // FIXME: Any other DeclContext kinds that can be safely disregarded |
608 | 63.3k | if (isa<LinkageSpecDecl>(Ctx)) |
609 | 336 | continue; |
610 | 62.9k | if (!isa<NamedDecl>(Ctx)) |
611 | 39.0k | break; |
612 | 23.9k | if (Patterns.foundMatch(/*AllowFullyQualified=*/false)) |
613 | 17.7k | return true; |
614 | | |
615 | 6.15k | if (const auto *ND = dyn_cast<NamespaceDecl>(Ctx)) { |
616 | | // If it matches (or we can skip it), continue. |
617 | 3.52k | if (Patterns.consumeNameSuffix(getNodeName(*ND, Scratch), |
618 | 3.52k | /*CanSkip=*/ND->isAnonymousNamespace() || |
619 | 3.52k | ND->isInline()3.36k )) |
620 | 3.20k | continue; |
621 | 320 | return false; |
622 | 3.52k | } |
623 | 2.63k | if (const auto *RD = dyn_cast<RecordDecl>(Ctx)) { |
624 | 2.51k | if (!isa<ClassTemplateSpecializationDecl>(Ctx)) { |
625 | 2.19k | if (Patterns.consumeNameSuffix(getNodeName(*RD, Scratch), |
626 | 2.19k | /*CanSkip=*/false)) |
627 | 1.23k | continue; |
628 | | |
629 | 958 | return false; |
630 | 2.19k | } |
631 | 2.51k | } |
632 | | |
633 | | // We don't know how to deal with this DeclContext. |
634 | | // Fallback to the slow version of the code. |
635 | 440 | return matchesNodeFullSlow(Node); |
636 | 2.63k | } |
637 | | |
638 | 39.0k | return Patterns.foundMatch(/*AllowFullyQualified=*/true); |
639 | 58.5k | } |
640 | | |
641 | 125k | bool HasNameMatcher::matchesNodeFullSlow(const NamedDecl &Node) const { |
642 | 125k | const bool SkipUnwrittenCases[] = {false, true}; |
643 | 219k | for (bool SkipUnwritten : SkipUnwrittenCases) { |
644 | 219k | llvm::SmallString<128> NodeName = StringRef("::"); |
645 | 219k | llvm::raw_svector_ostream OS(NodeName); |
646 | | |
647 | 219k | PrintingPolicy Policy = Node.getASTContext().getPrintingPolicy(); |
648 | 219k | Policy.SuppressUnwrittenScope = SkipUnwritten; |
649 | 219k | Policy.SuppressInlineNamespace = SkipUnwritten; |
650 | 219k | Node.printQualifiedName(OS, Policy); |
651 | | |
652 | 219k | const StringRef FullName = OS.str(); |
653 | | |
654 | 243k | for (const StringRef Pattern : Names) { |
655 | 243k | if (Pattern.startswith("::")) { |
656 | 6.48k | if (FullName == Pattern) |
657 | 956 | return true; |
658 | 237k | } else if (FullName.endswith(Pattern) && |
659 | 237k | FullName.drop_back(Pattern.size()).endswith("::")31.5k ) { |
660 | 30.4k | return true; |
661 | 30.4k | } |
662 | 243k | } |
663 | 219k | } |
664 | | |
665 | 93.9k | return false; |
666 | 125k | } |
667 | | |
668 | 124k | bool HasNameMatcher::matchesNode(const NamedDecl &Node) const { |
669 | 124k | assert(matchesNodeFullFast(Node) == matchesNodeFullSlow(Node)); |
670 | 124k | if (UseUnqualifiedMatch) { |
671 | 113k | assert(matchesNodeUnqualified(Node) == matchesNodeFullFast(Node)); |
672 | 113k | return matchesNodeUnqualified(Node); |
673 | 113k | } |
674 | 11.2k | return matchesNodeFullFast(Node); |
675 | 124k | } |
676 | | |
677 | | // Checks whether \p Loc points to a token with source text of \p TokenText. |
678 | | static bool isTokenAtLoc(const SourceManager &SM, const LangOptions &LangOpts, |
679 | 1.11k | StringRef Text, SourceLocation Loc) { |
680 | 1.11k | llvm::SmallString<16> Buffer; |
681 | 1.11k | bool Invalid = false; |
682 | | // Since `Loc` may point into an expansion buffer, which has no corresponding |
683 | | // source, we need to look at the spelling location to read the actual source. |
684 | 1.11k | StringRef TokenText = Lexer::getSpelling(SM.getSpellingLoc(Loc), Buffer, SM, |
685 | 1.11k | LangOpts, &Invalid); |
686 | 1.11k | return !Invalid && Text == TokenText; |
687 | 1.11k | } |
688 | | |
689 | | std::optional<SourceLocation> |
690 | | getExpansionLocOfMacro(StringRef MacroName, SourceLocation Loc, |
691 | 1.02k | const ASTContext &Context) { |
692 | 1.02k | auto &SM = Context.getSourceManager(); |
693 | 1.02k | const LangOptions &LangOpts = Context.getLangOpts(); |
694 | 1.49k | while (Loc.isMacroID()) { |
695 | 1.25k | SrcMgr::ExpansionInfo Expansion = |
696 | 1.25k | SM.getSLocEntry(SM.getFileID(Loc)).getExpansion(); |
697 | 1.25k | if (Expansion.isMacroArgExpansion()) |
698 | | // Check macro argument for an expansion of the given macro. For example, |
699 | | // `F(G(3))`, where `MacroName` is `G`. |
700 | 278 | if (std::optional<SourceLocation> ArgLoc = getExpansionLocOfMacro( |
701 | 278 | MacroName, Expansion.getSpellingLoc(), Context)) |
702 | 144 | return ArgLoc; |
703 | 1.11k | Loc = Expansion.getExpansionLocStart(); |
704 | 1.11k | if (isTokenAtLoc(SM, LangOpts, MacroName, Loc)) |
705 | 648 | return Loc; |
706 | 1.11k | } |
707 | 232 | return std::nullopt; |
708 | 1.02k | } |
709 | | |
710 | | std::shared_ptr<llvm::Regex> createAndVerifyRegex(StringRef Regex, |
711 | | llvm::Regex::RegexFlags Flags, |
712 | 381 | StringRef MatcherID) { |
713 | 381 | assert(!Regex.empty() && "Empty regex string"); |
714 | 381 | auto SharedRegex = std::make_shared<llvm::Regex>(Regex, Flags); |
715 | 381 | std::string Error; |
716 | 381 | if (!SharedRegex->isValid(Error)) { |
717 | 1 | llvm::WithColor::error() |
718 | 1 | << "building matcher '" << MatcherID << "': " << Error << "\n"; |
719 | 1 | llvm::WithColor::note() << " input was '" << Regex << "'\n"; |
720 | 1 | } |
721 | 381 | return SharedRegex; |
722 | 381 | } |
723 | | } // end namespace internal |
724 | | |
725 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAutoreleasePoolStmt> |
726 | | autoreleasePoolStmt; |
727 | | const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl> |
728 | | translationUnitDecl; |
729 | | const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl> typedefDecl; |
730 | | const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl> |
731 | | typedefNameDecl; |
732 | | const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl> typeAliasDecl; |
733 | | const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl> |
734 | | typeAliasTemplateDecl; |
735 | | const internal::VariadicAllOfMatcher<Decl> decl; |
736 | | const internal::VariadicDynCastAllOfMatcher<Decl, DecompositionDecl> decompositionDecl; |
737 | | const internal::VariadicDynCastAllOfMatcher<Decl, BindingDecl> bindingDecl; |
738 | | const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl> |
739 | | linkageSpecDecl; |
740 | | const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl; |
741 | | const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl> labelDecl; |
742 | | const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl> namespaceDecl; |
743 | | const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl> |
744 | | namespaceAliasDecl; |
745 | | const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl> recordDecl; |
746 | | const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl> cxxRecordDecl; |
747 | | const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl> |
748 | | classTemplateDecl; |
749 | | const internal::VariadicDynCastAllOfMatcher<Decl, |
750 | | ClassTemplateSpecializationDecl> |
751 | | classTemplateSpecializationDecl; |
752 | | const internal::VariadicDynCastAllOfMatcher< |
753 | | Decl, ClassTemplatePartialSpecializationDecl> |
754 | | classTemplatePartialSpecializationDecl; |
755 | | const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl> |
756 | | declaratorDecl; |
757 | | const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl> parmVarDecl; |
758 | | const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl> |
759 | | accessSpecDecl; |
760 | | const internal::VariadicAllOfMatcher<CXXBaseSpecifier> cxxBaseSpecifier; |
761 | | const internal::VariadicAllOfMatcher<CXXCtorInitializer> cxxCtorInitializer; |
762 | | const internal::VariadicAllOfMatcher<TemplateArgument> templateArgument; |
763 | | const internal::VariadicAllOfMatcher<TemplateArgumentLoc> templateArgumentLoc; |
764 | | const internal::VariadicAllOfMatcher<TemplateName> templateName; |
765 | | const internal::VariadicDynCastAllOfMatcher<Decl, NonTypeTemplateParmDecl> |
766 | | nonTypeTemplateParmDecl; |
767 | | const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl> |
768 | | templateTypeParmDecl; |
769 | | const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTemplateParmDecl> |
770 | | templateTemplateParmDecl; |
771 | | |
772 | | const internal::VariadicAllOfMatcher<LambdaCapture> lambdaCapture; |
773 | | const internal::VariadicAllOfMatcher<QualType> qualType; |
774 | | const internal::VariadicAllOfMatcher<Type> type; |
775 | | const internal::VariadicAllOfMatcher<TypeLoc> typeLoc; |
776 | | |
777 | | const internal::VariadicDynCastAllOfMatcher<TypeLoc, QualifiedTypeLoc> |
778 | | qualifiedTypeLoc; |
779 | | const internal::VariadicDynCastAllOfMatcher<TypeLoc, PointerTypeLoc> |
780 | | pointerTypeLoc; |
781 | | const internal::VariadicDynCastAllOfMatcher<TypeLoc, ReferenceTypeLoc> |
782 | | referenceTypeLoc; |
783 | | const internal::VariadicDynCastAllOfMatcher<TypeLoc, |
784 | | TemplateSpecializationTypeLoc> |
785 | | templateSpecializationTypeLoc; |
786 | | const internal::VariadicDynCastAllOfMatcher<TypeLoc, ElaboratedTypeLoc> |
787 | | elaboratedTypeLoc; |
788 | | |
789 | | const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryExprOrTypeTraitExpr> |
790 | | unaryExprOrTypeTraitExpr; |
791 | | const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl> valueDecl; |
792 | | const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl> |
793 | | cxxConstructorDecl; |
794 | | const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl> |
795 | | cxxDestructorDecl; |
796 | | const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl> enumDecl; |
797 | | const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl> |
798 | | enumConstantDecl; |
799 | | const internal::VariadicDynCastAllOfMatcher<Decl, TagDecl> tagDecl; |
800 | | const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl> cxxMethodDecl; |
801 | | const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl> |
802 | | cxxConversionDecl; |
803 | | const internal::VariadicDynCastAllOfMatcher<Decl, ConceptDecl> conceptDecl; |
804 | | const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl; |
805 | | const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> fieldDecl; |
806 | | const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl> |
807 | | indirectFieldDecl; |
808 | | const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl> functionDecl; |
809 | | const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl> |
810 | | functionTemplateDecl; |
811 | | const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl> friendDecl; |
812 | | const internal::VariadicAllOfMatcher<Stmt> stmt; |
813 | | const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt> declStmt; |
814 | | const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr> memberExpr; |
815 | | const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr> |
816 | | unresolvedMemberExpr; |
817 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDependentScopeMemberExpr> |
818 | | cxxDependentScopeMemberExpr; |
819 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr> callExpr; |
820 | | const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr> lambdaExpr; |
821 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr> |
822 | | cxxMemberCallExpr; |
823 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr> |
824 | | objcMessageExpr; |
825 | | const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl> |
826 | | objcInterfaceDecl; |
827 | | const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl> |
828 | | objcImplementationDecl; |
829 | | const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl> |
830 | | objcProtocolDecl; |
831 | | const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl> |
832 | | objcCategoryDecl; |
833 | | const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl> |
834 | | objcCategoryImplDecl; |
835 | | const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl> |
836 | | objcMethodDecl; |
837 | | const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl> |
838 | | blockDecl; |
839 | | const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl> objcIvarDecl; |
840 | | const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl> |
841 | | objcPropertyDecl; |
842 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt> |
843 | | objcThrowStmt; |
844 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt> objcTryStmt; |
845 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt> |
846 | | objcCatchStmt; |
847 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt> |
848 | | objcFinallyStmt; |
849 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups> |
850 | | exprWithCleanups; |
851 | | const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr> initListExpr; |
852 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStdInitializerListExpr> |
853 | | cxxStdInitializerListExpr; |
854 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr> |
855 | | implicitValueInitExpr; |
856 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr> parenListExpr; |
857 | | const internal::VariadicDynCastAllOfMatcher<Stmt, SubstNonTypeTemplateParmExpr> |
858 | | substNonTypeTemplateParmExpr; |
859 | | const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl> usingDecl; |
860 | | const internal::VariadicDynCastAllOfMatcher<Decl, UsingEnumDecl> usingEnumDecl; |
861 | | const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl> |
862 | | usingDirectiveDecl; |
863 | | const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr> |
864 | | unresolvedLookupExpr; |
865 | | const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingValueDecl> |
866 | | unresolvedUsingValueDecl; |
867 | | const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingTypenameDecl> |
868 | | unresolvedUsingTypenameDecl; |
869 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr> constantExpr; |
870 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr> parenExpr; |
871 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr> |
872 | | cxxConstructExpr; |
873 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXUnresolvedConstructExpr> |
874 | | cxxUnresolvedConstructExpr; |
875 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr> cxxThisExpr; |
876 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr> |
877 | | cxxBindTemporaryExpr; |
878 | | const internal::VariadicDynCastAllOfMatcher<Stmt, MaterializeTemporaryExpr> |
879 | | materializeTemporaryExpr; |
880 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr> cxxNewExpr; |
881 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr> cxxDeleteExpr; |
882 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNoexceptExpr> |
883 | | cxxNoexceptExpr; |
884 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr> |
885 | | arraySubscriptExpr; |
886 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitIndexExpr> |
887 | | arrayInitIndexExpr; |
888 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitLoopExpr> |
889 | | arrayInitLoopExpr; |
890 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr> |
891 | | cxxDefaultArgExpr; |
892 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr> |
893 | | cxxOperatorCallExpr; |
894 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXRewrittenBinaryOperator> |
895 | | cxxRewrittenBinaryOperator; |
896 | | const internal::VariadicDynCastAllOfMatcher<Stmt, Expr> expr; |
897 | | const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr> declRefExpr; |
898 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr> objcIvarRefExpr; |
899 | | const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr> blockExpr; |
900 | | const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt> ifStmt; |
901 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt> forStmt; |
902 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt> |
903 | | cxxForRangeStmt; |
904 | | const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt> whileStmt; |
905 | | const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt> doStmt; |
906 | | const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt> breakStmt; |
907 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt> continueStmt; |
908 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CoreturnStmt> coreturnStmt; |
909 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt> returnStmt; |
910 | | const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt> gotoStmt; |
911 | | const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt> labelStmt; |
912 | | const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr> addrLabelExpr; |
913 | | const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt> switchStmt; |
914 | | const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase> switchCase; |
915 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt> caseStmt; |
916 | | const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt> defaultStmt; |
917 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt> compoundStmt; |
918 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CoroutineBodyStmt> |
919 | | coroutineBodyStmt; |
920 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt> cxxCatchStmt; |
921 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt> cxxTryStmt; |
922 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr> cxxThrowExpr; |
923 | | const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt> nullStmt; |
924 | | const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt> asmStmt; |
925 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr> |
926 | | cxxBoolLiteral; |
927 | | const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral> stringLiteral; |
928 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCStringLiteral> objcStringLiteral; |
929 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral> |
930 | | characterLiteral; |
931 | | const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral> |
932 | | integerLiteral; |
933 | | const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral> floatLiteral; |
934 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral> imaginaryLiteral; |
935 | | const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral> |
936 | | fixedPointLiteral; |
937 | | const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral> |
938 | | userDefinedLiteral; |
939 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr> |
940 | | compoundLiteralExpr; |
941 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr> |
942 | | cxxNullPtrLiteralExpr; |
943 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr> chooseExpr; |
944 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ConvertVectorExpr> |
945 | | convertVectorExpr; |
946 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CoawaitExpr> |
947 | | coawaitExpr; |
948 | | const internal::VariadicDynCastAllOfMatcher<Stmt, DependentCoawaitExpr> |
949 | | dependentCoawaitExpr; |
950 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CoyieldExpr> |
951 | | coyieldExpr; |
952 | | const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr> gnuNullExpr; |
953 | | const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr> |
954 | | genericSelectionExpr; |
955 | | const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr> atomicExpr; |
956 | | const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr> stmtExpr; |
957 | | const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator> |
958 | | binaryOperator; |
959 | | const internal::MapAnyOfMatcher<BinaryOperator, CXXOperatorCallExpr, |
960 | | CXXRewrittenBinaryOperator> |
961 | | binaryOperation; |
962 | | const internal::MapAnyOfMatcher<CallExpr, CXXConstructExpr> invocation; |
963 | | const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator> unaryOperator; |
964 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator> |
965 | | conditionalOperator; |
966 | | const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryConditionalOperator> |
967 | | binaryConditionalOperator; |
968 | | const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr> |
969 | | opaqueValueExpr; |
970 | | const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl> |
971 | | staticAssertDecl; |
972 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr> |
973 | | cxxReinterpretCastExpr; |
974 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr> |
975 | | cxxStaticCastExpr; |
976 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr> |
977 | | cxxDynamicCastExpr; |
978 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr> |
979 | | cxxConstCastExpr; |
980 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr> |
981 | | cStyleCastExpr; |
982 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr> |
983 | | explicitCastExpr; |
984 | | const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr> |
985 | | implicitCastExpr; |
986 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr> castExpr; |
987 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr> |
988 | | cxxFunctionalCastExpr; |
989 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr> |
990 | | cxxTemporaryObjectExpr; |
991 | | const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr> |
992 | | predefinedExpr; |
993 | | const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr> |
994 | | designatedInitExpr; |
995 | | const internal::VariadicOperatorMatcherFunc< |
996 | | 2, std::numeric_limits<unsigned>::max()> |
997 | | eachOf = {internal::DynTypedMatcher::VO_EachOf}; |
998 | | const internal::VariadicOperatorMatcherFunc< |
999 | | 2, std::numeric_limits<unsigned>::max()> |
1000 | | anyOf = {internal::DynTypedMatcher::VO_AnyOf}; |
1001 | | const internal::VariadicOperatorMatcherFunc< |
1002 | | 2, std::numeric_limits<unsigned>::max()> |
1003 | | allOf = {internal::DynTypedMatcher::VO_AllOf}; |
1004 | | const internal::VariadicOperatorMatcherFunc<1, 1> optionally = { |
1005 | | internal::DynTypedMatcher::VO_Optionally}; |
1006 | | const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef, |
1007 | | internal::hasAnyNameFunc> |
1008 | | hasAnyName = {}; |
1009 | | |
1010 | | const internal::VariadicFunction<internal::HasOpNameMatcher, StringRef, |
1011 | | internal::hasAnyOperatorNameFunc> |
1012 | | hasAnyOperatorName = {}; |
1013 | | const internal::VariadicFunction<internal::HasOverloadOpNameMatcher, StringRef, |
1014 | | internal::hasAnyOverloadedOperatorNameFunc> |
1015 | | hasAnyOverloadedOperatorName = {}; |
1016 | | const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>, StringRef, |
1017 | | internal::hasAnySelectorFunc> |
1018 | | hasAnySelector = {}; |
1019 | | const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher> has = {}; |
1020 | | const internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher> |
1021 | | hasDescendant = {}; |
1022 | | const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher> forEach = |
1023 | | {}; |
1024 | | const internal::ArgumentAdaptingMatcherFunc<internal::ForEachDescendantMatcher> |
1025 | | forEachDescendant = {}; |
1026 | | const internal::ArgumentAdaptingMatcherFunc< |
1027 | | internal::HasParentMatcher, |
1028 | | internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>, |
1029 | | internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>> |
1030 | | hasParent = {}; |
1031 | | const internal::ArgumentAdaptingMatcherFunc< |
1032 | | internal::HasAncestorMatcher, |
1033 | | internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>, |
1034 | | internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>> |
1035 | | hasAncestor = {}; |
1036 | | const internal::VariadicOperatorMatcherFunc<1, 1> unless = { |
1037 | | internal::DynTypedMatcher::VO_UnaryNot}; |
1038 | | const internal::VariadicAllOfMatcher<NestedNameSpecifier> nestedNameSpecifier; |
1039 | | const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc> |
1040 | | nestedNameSpecifierLoc; |
1041 | | const internal::VariadicAllOfMatcher<Attr> attr; |
1042 | | const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr> |
1043 | | cudaKernelCallExpr; |
1044 | | const AstTypeMatcher<BuiltinType> builtinType; |
1045 | | const AstTypeMatcher<ArrayType> arrayType; |
1046 | | const AstTypeMatcher<ComplexType> complexType; |
1047 | | const AstTypeMatcher<ConstantArrayType> constantArrayType; |
1048 | | const AstTypeMatcher<DeducedTemplateSpecializationType> |
1049 | | deducedTemplateSpecializationType; |
1050 | | const AstTypeMatcher<DependentSizedArrayType> dependentSizedArrayType; |
1051 | | const AstTypeMatcher<DependentSizedExtVectorType> dependentSizedExtVectorType; |
1052 | | const AstTypeMatcher<IncompleteArrayType> incompleteArrayType; |
1053 | | const AstTypeMatcher<VariableArrayType> variableArrayType; |
1054 | | const AstTypeMatcher<AtomicType> atomicType; |
1055 | | const AstTypeMatcher<AutoType> autoType; |
1056 | | const AstTypeMatcher<DecltypeType> decltypeType; |
1057 | | const AstTypeMatcher<FunctionType> functionType; |
1058 | | const AstTypeMatcher<FunctionProtoType> functionProtoType; |
1059 | | const AstTypeMatcher<ParenType> parenType; |
1060 | | const AstTypeMatcher<BlockPointerType> blockPointerType; |
1061 | | const AstTypeMatcher<MacroQualifiedType> macroQualifiedType; |
1062 | | const AstTypeMatcher<MemberPointerType> memberPointerType; |
1063 | | const AstTypeMatcher<PointerType> pointerType; |
1064 | | const AstTypeMatcher<ObjCObjectPointerType> objcObjectPointerType; |
1065 | | const AstTypeMatcher<ReferenceType> referenceType; |
1066 | | const AstTypeMatcher<LValueReferenceType> lValueReferenceType; |
1067 | | const AstTypeMatcher<RValueReferenceType> rValueReferenceType; |
1068 | | const AstTypeMatcher<TypedefType> typedefType; |
1069 | | const AstTypeMatcher<EnumType> enumType; |
1070 | | const AstTypeMatcher<TemplateSpecializationType> templateSpecializationType; |
1071 | | const AstTypeMatcher<UnaryTransformType> unaryTransformType; |
1072 | | const AstTypeMatcher<RecordType> recordType; |
1073 | | const AstTypeMatcher<TagType> tagType; |
1074 | | const AstTypeMatcher<ElaboratedType> elaboratedType; |
1075 | | const AstTypeMatcher<UsingType> usingType; |
1076 | | const AstTypeMatcher<SubstTemplateTypeParmType> substTemplateTypeParmType; |
1077 | | const AstTypeMatcher<TemplateTypeParmType> templateTypeParmType; |
1078 | | const AstTypeMatcher<InjectedClassNameType> injectedClassNameType; |
1079 | | const AstTypeMatcher<DecayedType> decayedType; |
1080 | | AST_TYPELOC_TRAVERSE_MATCHER_DEF(hasElementType, |
1081 | | AST_POLYMORPHIC_SUPPORTED_TYPES(ArrayType, |
1082 | | ComplexType)); |
1083 | | AST_TYPELOC_TRAVERSE_MATCHER_DEF(hasValueType, |
1084 | | AST_POLYMORPHIC_SUPPORTED_TYPES(AtomicType)); |
1085 | | AST_TYPELOC_TRAVERSE_MATCHER_DEF( |
1086 | | pointee, |
1087 | | AST_POLYMORPHIC_SUPPORTED_TYPES(BlockPointerType, MemberPointerType, |
1088 | | PointerType, ReferenceType)); |
1089 | | |
1090 | | const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective> |
1091 | | ompExecutableDirective; |
1092 | | const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause> |
1093 | | ompDefaultClause; |
1094 | | const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl> |
1095 | | cxxDeductionGuideDecl; |
1096 | | |
1097 | | } // end namespace ast_matchers |
1098 | | } // end namespace clang |