clang  6.0.0svn
ASTMatchersInternal.cpp
Go to the documentation of this file.
1 //===- ASTMatchersInternal.cpp - Structural query framework ---------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Implements the base layer of the matcher framework.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "clang/AST/ASTContext.h"
17 #include "clang/AST/Decl.h"
18 #include "clang/AST/DeclTemplate.h"
21 #include "clang/Basic/LLVM.h"
22 #include "llvm/ADT/ArrayRef.h"
23 #include "llvm/ADT/IntrusiveRefCntPtr.h"
24 #include "llvm/ADT/None.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/raw_ostream.h"
32 #include <algorithm>
33 #include <cassert>
34 #include <cstddef>
35 #include <string>
36 #include <utility>
37 #include <vector>
38 
39 namespace clang {
40 namespace ast_matchers {
41 namespace internal {
42 
44  ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder,
45  ArrayRef<DynTypedMatcher> InnerMatchers);
46 
48  ASTMatchFinder *Finder,
49  BoundNodesTreeBuilder *Builder,
50  ArrayRef<DynTypedMatcher> InnerMatchers);
51 
53  ASTMatchFinder *Finder,
54  BoundNodesTreeBuilder *Builder,
55  ArrayRef<DynTypedMatcher> InnerMatchers);
56 
58  ASTMatchFinder *Finder,
59  BoundNodesTreeBuilder *Builder,
60  ArrayRef<DynTypedMatcher> InnerMatchers);
61 
62 void BoundNodesTreeBuilder::visitMatches(Visitor *ResultVisitor) {
63  if (Bindings.empty())
64  Bindings.push_back(BoundNodesMap());
65  for (BoundNodesMap &Binding : Bindings) {
66  ResultVisitor->visitMatch(BoundNodes(Binding));
67  }
68 }
69 
70 namespace {
71 
72 using VariadicOperatorFunction = bool (*)(
73  const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder,
74  BoundNodesTreeBuilder *Builder, ArrayRef<DynTypedMatcher> InnerMatchers);
75 
76 template <VariadicOperatorFunction Func>
77 class VariadicMatcher : public DynMatcherInterface {
78 public:
79  VariadicMatcher(std::vector<DynTypedMatcher> InnerMatchers)
80  : InnerMatchers(std::move(InnerMatchers)) {}
81 
82  bool dynMatches(const ast_type_traits::DynTypedNode &DynNode,
83  ASTMatchFinder *Finder,
84  BoundNodesTreeBuilder *Builder) const override {
85  return Func(DynNode, Finder, Builder, InnerMatchers);
86  }
87 
88 private:
89  std::vector<DynTypedMatcher> InnerMatchers;
90 };
91 
92 class IdDynMatcher : public DynMatcherInterface {
93 public:
94  IdDynMatcher(StringRef ID,
95  IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher)
96  : ID(ID), InnerMatcher(std::move(InnerMatcher)) {}
97 
98  bool dynMatches(const ast_type_traits::DynTypedNode &DynNode,
99  ASTMatchFinder *Finder,
100  BoundNodesTreeBuilder *Builder) const override {
101  bool Result = InnerMatcher->dynMatches(DynNode, Finder, Builder);
102  if (Result) Builder->setBinding(ID, DynNode);
103  return Result;
104  }
105 
106 private:
107  const std::string ID;
108  const IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher;
109 };
110 
111 /// \brief A matcher that always returns true.
112 ///
113 /// We only ever need one instance of this matcher, so we create a global one
114 /// and reuse it to reduce the overhead of the matcher and increase the chance
115 /// of cache hits.
116 class TrueMatcherImpl : public DynMatcherInterface {
117 public:
118  TrueMatcherImpl() {
119  Retain(); // Reference count will never become zero.
120  }
121 
122  bool dynMatches(const ast_type_traits::DynTypedNode &, ASTMatchFinder *,
123  BoundNodesTreeBuilder *) const override {
124  return true;
125  }
126 };
127 
128 } // namespace
129 
130 static llvm::ManagedStatic<TrueMatcherImpl> TrueMatcherInstance;
131 
132 DynTypedMatcher DynTypedMatcher::constructVariadic(
133  DynTypedMatcher::VariadicOperator Op,
134  ast_type_traits::ASTNodeKind SupportedKind,
135  std::vector<DynTypedMatcher> InnerMatchers) {
136  assert(!InnerMatchers.empty() && "Array must not be empty.");
137  assert(std::all_of(InnerMatchers.begin(), InnerMatchers.end(),
138  [SupportedKind](const DynTypedMatcher &M) {
139  return M.canConvertTo(SupportedKind);
140  }) &&
141  "InnerMatchers must be convertible to SupportedKind!");
142 
143  // We must relax the restrict kind here.
144  // The different operators might deal differently with a mismatch.
145  // Make it the same as SupportedKind, since that is the broadest type we are
146  // allowed to accept.
147  auto RestrictKind = SupportedKind;
148 
149  switch (Op) {
150  case VO_AllOf:
151  // In the case of allOf() we must pass all the checks, so making
152  // RestrictKind the most restrictive can save us time. This way we reject
153  // invalid types earlier and we can elide the kind checks inside the
154  // matcher.
155  for (auto &IM : InnerMatchers) {
157  RestrictKind, IM.RestrictKind);
158  }
159  return DynTypedMatcher(
160  SupportedKind, RestrictKind,
161  new VariadicMatcher<AllOfVariadicOperator>(std::move(InnerMatchers)));
162 
163  case VO_AnyOf:
164  return DynTypedMatcher(
165  SupportedKind, RestrictKind,
166  new VariadicMatcher<AnyOfVariadicOperator>(std::move(InnerMatchers)));
167 
168  case VO_EachOf:
169  return DynTypedMatcher(
170  SupportedKind, RestrictKind,
171  new VariadicMatcher<EachOfVariadicOperator>(std::move(InnerMatchers)));
172 
173  case VO_UnaryNot:
174  // FIXME: Implement the Not operator to take a single matcher instead of a
175  // vector.
176  return DynTypedMatcher(
177  SupportedKind, RestrictKind,
178  new VariadicMatcher<NotUnaryOperator>(std::move(InnerMatchers)));
179  }
180  llvm_unreachable("Invalid Op value.");
181 }
182 
183 DynTypedMatcher DynTypedMatcher::trueMatcher(
184  ast_type_traits::ASTNodeKind NodeKind) {
185  return DynTypedMatcher(NodeKind, NodeKind, &*TrueMatcherInstance);
186 }
187 
188 bool DynTypedMatcher::canMatchNodesOfKind(
190  return RestrictKind.isBaseOf(Kind);
191 }
192 
193 DynTypedMatcher DynTypedMatcher::dynCastTo(
194  const ast_type_traits::ASTNodeKind Kind) const {
195  auto Copy = *this;
196  Copy.SupportedKind = Kind;
197  Copy.RestrictKind =
199  return Copy;
200 }
201 
203  ASTMatchFinder *Finder,
204  BoundNodesTreeBuilder *Builder) const {
205  if (RestrictKind.isBaseOf(DynNode.getNodeKind()) &&
206  Implementation->dynMatches(DynNode, Finder, Builder)) {
207  return true;
208  }
209  // Delete all bindings when a matcher does not match.
210  // This prevents unexpected exposure of bound nodes in unmatches
211  // branches of the match tree.
212  Builder->removeBindings([](const BoundNodesMap &) { return true; });
213  return false;
214 }
215 
216 bool DynTypedMatcher::matchesNoKindCheck(
217  const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder,
218  BoundNodesTreeBuilder *Builder) const {
219  assert(RestrictKind.isBaseOf(DynNode.getNodeKind()));
220  if (Implementation->dynMatches(DynNode, Finder, Builder)) {
221  return true;
222  }
223  // Delete all bindings when a matcher does not match.
224  // This prevents unexpected exposure of bound nodes in unmatches
225  // branches of the match tree.
226  Builder->removeBindings([](const BoundNodesMap &) { return true; });
227  return false;
228 }
229 
230 llvm::Optional<DynTypedMatcher> DynTypedMatcher::tryBind(StringRef ID) const {
231  if (!AllowBind) return llvm::None;
232  auto Result = *this;
233  Result.Implementation =
234  new IdDynMatcher(ID, std::move(Result.Implementation));
235  return std::move(Result);
236 }
237 
238 bool DynTypedMatcher::canConvertTo(ast_type_traits::ASTNodeKind To) const {
239  const auto From = getSupportedKind();
240  auto QualKind = ast_type_traits::ASTNodeKind::getFromNodeKind<QualType>();
241  auto TypeKind = ast_type_traits::ASTNodeKind::getFromNodeKind<Type>();
242  /// Mimic the implicit conversions of Matcher<>.
243  /// - From Matcher<Type> to Matcher<QualType>
244  if (From.isSame(TypeKind) && To.isSame(QualKind)) return true;
245  /// - From Matcher<Base> to Matcher<Derived>
246  return From.isBaseOf(To);
247 }
248 
249 void BoundNodesTreeBuilder::addMatch(const BoundNodesTreeBuilder &Other) {
250  Bindings.append(Other.Bindings.begin(), Other.Bindings.end());
251 }
252 
254  ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder,
255  ArrayRef<DynTypedMatcher> InnerMatchers) {
256  if (InnerMatchers.size() != 1)
257  return false;
258 
259  // The 'unless' matcher will always discard the result:
260  // If the inner matcher doesn't match, unless returns true,
261  // but the inner matcher cannot have bound anything.
262  // If the inner matcher matches, the result is false, and
263  // any possible binding will be discarded.
264  // We still need to hand in all the bound nodes up to this
265  // point so the inner matcher can depend on bound nodes,
266  // and we need to actively discard the bound nodes, otherwise
267  // the inner matcher will reset the bound nodes if it doesn't
268  // match, but this would be inversed by 'unless'.
269  BoundNodesTreeBuilder Discard(*Builder);
270  return !InnerMatchers[0].matches(DynNode, Finder, &Discard);
271 }
272 
274  ASTMatchFinder *Finder,
275  BoundNodesTreeBuilder *Builder,
276  ArrayRef<DynTypedMatcher> InnerMatchers) {
277  // allOf leads to one matcher for each alternative in the first
278  // matcher combined with each alternative in the second matcher.
279  // Thus, we can reuse the same Builder.
280  for (const DynTypedMatcher &InnerMatcher : InnerMatchers) {
281  if (!InnerMatcher.matchesNoKindCheck(DynNode, Finder, Builder))
282  return false;
283  }
284  return true;
285 }
286 
288  ASTMatchFinder *Finder,
289  BoundNodesTreeBuilder *Builder,
290  ArrayRef<DynTypedMatcher> InnerMatchers) {
291  BoundNodesTreeBuilder Result;
292  bool Matched = false;
293  for (const DynTypedMatcher &InnerMatcher : InnerMatchers) {
294  BoundNodesTreeBuilder BuilderInner(*Builder);
295  if (InnerMatcher.matches(DynNode, Finder, &BuilderInner)) {
296  Matched = true;
297  Result.addMatch(BuilderInner);
298  }
299  }
300  *Builder = std::move(Result);
301  return Matched;
302 }
303 
305  ASTMatchFinder *Finder,
306  BoundNodesTreeBuilder *Builder,
307  ArrayRef<DynTypedMatcher> InnerMatchers) {
308  for (const DynTypedMatcher &InnerMatcher : InnerMatchers) {
309  BoundNodesTreeBuilder Result = *Builder;
310  if (InnerMatcher.matches(DynNode, Finder, &Result)) {
311  *Builder = std::move(Result);
312  return true;
313  }
314  }
315  return false;
316 }
317 
318 Matcher<NamedDecl> hasAnyNameFunc(ArrayRef<const StringRef *> NameRefs) {
319  std::vector<std::string> Names;
320  for (auto *Name : NameRefs)
321  Names.emplace_back(*Name);
322  return internal::Matcher<NamedDecl>(
323  new internal::HasNameMatcher(std::move(Names)));
324 }
325 
326 HasNameMatcher::HasNameMatcher(std::vector<std::string> N)
327  : UseUnqualifiedMatch(std::all_of(
328  N.begin(), N.end(),
329  [](StringRef Name) { return Name.find("::") == Name.npos; })),
330  Names(std::move(N)) {
331 #ifndef NDEBUG
332  for (StringRef Name : Names)
333  assert(!Name.empty());
334 #endif
335 }
336 
337 static bool consumeNameSuffix(StringRef &FullName, StringRef Suffix) {
338  StringRef Name = FullName;
339  if (!Name.endswith(Suffix))
340  return false;
341  Name = Name.drop_back(Suffix.size());
342  if (!Name.empty()) {
343  if (!Name.endswith("::"))
344  return false;
345  Name = Name.drop_back(2);
346  }
347  FullName = Name;
348  return true;
349 }
350 
351 static StringRef getNodeName(const NamedDecl &Node,
352  llvm::SmallString<128> &Scratch) {
353  // Simple name.
354  if (Node.getIdentifier())
355  return Node.getName();
356 
357  if (Node.getDeclName()) {
358  // Name needs to be constructed.
359  Scratch.clear();
360  llvm::raw_svector_ostream OS(Scratch);
361  Node.printName(OS);
362  return OS.str();
363  }
364 
365  return "(anonymous)";
366 }
367 
368 static StringRef getNodeName(const RecordDecl &Node,
369  llvm::SmallString<128> &Scratch) {
370  if (Node.getIdentifier()) {
371  return Node.getName();
372  }
373  Scratch.clear();
374  return ("(anonymous " + Node.getKindName() + ")").toStringRef(Scratch);
375 }
376 
377 static StringRef getNodeName(const NamespaceDecl &Node,
378  llvm::SmallString<128> &Scratch) {
379  return Node.isAnonymousNamespace() ? "(anonymous namespace)" : Node.getName();
380 }
381 
382 namespace {
383 
384 class PatternSet {
385 public:
386  PatternSet(ArrayRef<std::string> Names) {
387  for (StringRef Name : Names)
388  Patterns.push_back({Name, Name.startswith("::")});
389  }
390 
391  /// Consumes the name suffix from each pattern in the set and removes the ones
392  /// that didn't match.
393  /// Return true if there are still any patterns left.
394  bool consumeNameSuffix(StringRef NodeName, bool CanSkip) {
395  for (size_t I = 0; I < Patterns.size();) {
396  if (internal::consumeNameSuffix(Patterns[I].P, NodeName) ||
397  CanSkip) {
398  ++I;
399  } else {
400  Patterns.erase(Patterns.begin() + I);
401  }
402  }
403  return !Patterns.empty();
404  }
405 
406  /// Check if any of the patterns are a match.
407  /// A match will be a pattern that was fully consumed, that also matches the
408  /// 'fully qualified' requirement.
409  bool foundMatch(bool AllowFullyQualified) const {
410  for (auto& P: Patterns)
411  if (P.P.empty() && (AllowFullyQualified || !P.IsFullyQualified))
412  return true;
413  return false;
414  }
415 
416 private:
417  struct Pattern {
418  StringRef P;
420  };
421 
423 };
424 
425 } // namespace
426 
427 bool HasNameMatcher::matchesNodeUnqualified(const NamedDecl &Node) const {
428  assert(UseUnqualifiedMatch);
429  llvm::SmallString<128> Scratch;
430  StringRef NodeName = getNodeName(Node, Scratch);
431  return std::any_of(Names.begin(), Names.end(), [&](StringRef Name) {
432  return consumeNameSuffix(Name, NodeName) && Name.empty();
433  });
434 }
435 
436 bool HasNameMatcher::matchesNodeFullFast(const NamedDecl &Node) const {
437  PatternSet Patterns(Names);
438  llvm::SmallString<128> Scratch;
439 
440  // This function is copied and adapted from NamedDecl::printQualifiedName()
441  // By matching each part individually we optimize in a couple of ways:
442  // - We can exit early on the first failure.
443  // - We can skip inline/anonymous namespaces without another pass.
444  // - We print one name at a time, reducing the chance of overflowing the
445  // inlined space of the SmallString.
446 
447  // First, match the name.
448  if (!Patterns.consumeNameSuffix(getNodeName(Node, Scratch),
449  /*CanSkip=*/false))
450  return false;
451 
452  // Try to match each declaration context.
453  // We are allowed to skip anonymous and inline namespaces if they don't match.
454  const DeclContext *Ctx = Node.getDeclContext();
455 
456  if (Ctx->isFunctionOrMethod())
457  return Patterns.foundMatch(/*AllowFullyQualified=*/false);
458 
459  for (; Ctx && isa<NamedDecl>(Ctx); Ctx = Ctx->getParent()) {
460  if (Patterns.foundMatch(/*AllowFullyQualified=*/false))
461  return true;
462 
463  if (const auto *ND = dyn_cast<NamespaceDecl>(Ctx)) {
464  // If it matches (or we can skip it), continue.
465  if (Patterns.consumeNameSuffix(getNodeName(*ND, Scratch),
466  /*CanSkip=*/ND->isAnonymousNamespace() ||
467  ND->isInline()))
468  continue;
469  return false;
470  }
471  if (const auto *RD = dyn_cast<RecordDecl>(Ctx)) {
472  if (!isa<ClassTemplateSpecializationDecl>(Ctx)) {
473  if (Patterns.consumeNameSuffix(getNodeName(*RD, Scratch),
474  /*CanSkip=*/false))
475  continue;
476 
477  return false;
478  }
479  }
480 
481  // We don't know how to deal with this DeclContext.
482  // Fallback to the slow version of the code.
483  return matchesNodeFullSlow(Node);
484  }
485 
486  return Patterns.foundMatch(/*AllowFullyQualified=*/true);
487 }
488 
489 bool HasNameMatcher::matchesNodeFullSlow(const NamedDecl &Node) const {
490  const bool SkipUnwrittenCases[] = {false, true};
491  for (bool SkipUnwritten : SkipUnwrittenCases) {
492  llvm::SmallString<128> NodeName = StringRef("::");
493  llvm::raw_svector_ostream OS(NodeName);
494 
495  if (SkipUnwritten) {
496  PrintingPolicy Policy = Node.getASTContext().getPrintingPolicy();
497  Policy.SuppressUnwrittenScope = true;
498  Node.printQualifiedName(OS, Policy);
499  } else {
500  Node.printQualifiedName(OS);
501  }
502 
503  const StringRef FullName = OS.str();
504 
505  for (const StringRef Pattern : Names) {
506  if (Pattern.startswith("::")) {
507  if (FullName == Pattern)
508  return true;
509  } else if (FullName.endswith(Pattern) &&
510  FullName.drop_back(Pattern.size()).endswith("::")) {
511  return true;
512  }
513  }
514  }
515 
516  return false;
517 }
518 
519 bool HasNameMatcher::matchesNode(const NamedDecl &Node) const {
520  assert(matchesNodeFullFast(Node) == matchesNodeFullSlow(Node));
521  if (UseUnqualifiedMatch) {
522  assert(matchesNodeUnqualified(Node) == matchesNodeFullFast(Node));
523  return matchesNodeUnqualified(Node);
524  }
525  return matchesNodeFullFast(Node);
526 }
527 
528 } // end namespace internal
529 
530 const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
532 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl> typedefDecl;
533 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
535 const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl> typeAliasDecl;
536 const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
538 const internal::VariadicAllOfMatcher<Decl> decl;
539 const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
541 const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl;
542 const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl> labelDecl;
543 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl> namespaceDecl;
544 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
546 const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl> recordDecl;
547 const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl> cxxRecordDecl;
548 const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
550 const internal::VariadicDynCastAllOfMatcher<Decl,
553 const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
555 const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl> parmVarDecl;
556 const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
558 const internal::VariadicAllOfMatcher<CXXCtorInitializer> cxxCtorInitializer;
559 const internal::VariadicAllOfMatcher<TemplateArgument> templateArgument;
560 const internal::VariadicAllOfMatcher<TemplateName> templateName;
561 const internal::VariadicDynCastAllOfMatcher<Decl, NonTypeTemplateParmDecl>
563 const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
565 const internal::VariadicAllOfMatcher<QualType> qualType;
566 const internal::VariadicAllOfMatcher<Type> type;
567 const internal::VariadicAllOfMatcher<TypeLoc> typeLoc;
568 const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryExprOrTypeTraitExpr>
570 const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl> valueDecl;
571 const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
573 const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
575 const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl> enumDecl;
576 const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
578 const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl> cxxMethodDecl;
579 const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
581 const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl;
582 const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> fieldDecl;
583 const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl> functionDecl;
584 const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
586 const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl> friendDecl;
587 const internal::VariadicAllOfMatcher<Stmt> stmt;
588 const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt> declStmt;
589 const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr> memberExpr;
590 const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr> callExpr;
591 const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr> lambdaExpr;
592 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
594 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
596 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
598 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
600 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
602 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
604 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
606 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
608 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl> objcIvarDecl;
609 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
611 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
613 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt> objcTryStmt;
614 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
616 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
618 const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
620 const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr> initListExpr;
621 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStdInitializerListExpr>
623 const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
625 const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr> parenListExpr;
626 const internal::VariadicDynCastAllOfMatcher<Stmt, SubstNonTypeTemplateParmExpr>
628 const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl> usingDecl;
629 const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
631 const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
633 const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingValueDecl>
635 const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingTypenameDecl>
637 const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr> parenExpr;
638 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
640 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXUnresolvedConstructExpr>
642 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr> cxxThisExpr;
643 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
645 const internal::VariadicDynCastAllOfMatcher<Stmt, MaterializeTemporaryExpr>
647 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr> cxxNewExpr;
648 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr> cxxDeleteExpr;
649 const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
651 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
653 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
655 const internal::VariadicDynCastAllOfMatcher<Stmt, Expr> expr;
656 const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr> declRefExpr;
657 const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt> ifStmt;
658 const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt> forStmt;
659 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
661 const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt> whileStmt;
662 const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt> doStmt;
663 const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt> breakStmt;
664 const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt> continueStmt;
665 const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt> returnStmt;
666 const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt> gotoStmt;
667 const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt> labelStmt;
668 const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr> addrLabelExpr;
669 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt> switchStmt;
670 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase> switchCase;
671 const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt> caseStmt;
672 const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt> defaultStmt;
673 const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt> compoundStmt;
674 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt> cxxCatchStmt;
675 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt> cxxTryStmt;
676 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr> cxxThrowExpr;
677 const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt> nullStmt;
678 const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt> asmStmt;
679 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
681 const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral> stringLiteral;
682 const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
684 const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
686 const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral> floatLiteral;
687 const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
689 const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
691 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
693 const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr> gnuNullExpr;
694 const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr> atomicExpr;
695 const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr> stmtExpr;
696 const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
698 const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator> unaryOperator;
699 const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
701 const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryConditionalOperator>
703 const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
705 const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
707 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
709 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
711 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
713 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
715 const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
717 const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
719 const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
721 const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr> castExpr;
722 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
724 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
726 const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
728 const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
730 const internal::VariadicOperatorMatcherFunc<
732  eachOf = {internal::DynTypedMatcher::VO_EachOf};
733 const internal::VariadicOperatorMatcherFunc<
735  anyOf = {internal::DynTypedMatcher::VO_AnyOf};
736 const internal::VariadicOperatorMatcherFunc<
738  allOf = {internal::DynTypedMatcher::VO_AllOf};
739 const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
742 const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher> has = {};
743 const internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher>
745 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher> forEach =
746  {};
747 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachDescendantMatcher>
749 const internal::ArgumentAdaptingMatcherFunc<
750  internal::HasParentMatcher,
751  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
752  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
753  hasParent = {};
754 const internal::ArgumentAdaptingMatcherFunc<
755  internal::HasAncestorMatcher,
756  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
757  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
759 const internal::VariadicOperatorMatcherFunc<1, 1> unless = {
760  internal::DynTypedMatcher::VO_UnaryNot};
761 const internal::VariadicAllOfMatcher<NestedNameSpecifier> nestedNameSpecifier;
762 const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
764 const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
796 AST_TYPELOC_TRAVERSE_MATCHER_DEF(hasElementType,
798  ComplexType));
802  pointee,
805 
806 } // end namespace ast_matchers
807 } // end namespace clang
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThisExpr > cxxThisExpr
Matches implicit and explicit this expressions.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Decl, NonTypeTemplateParmDecl > nonTypeTemplateParmDecl
Matches non-type template parameter declarations.
Defines the clang::ASTContext interface.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtThrowStmt > objcThrowStmt
Matches Objective-C @throw statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenExpr > parenExpr
Matches parentheses used in expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > typedefDecl
Matches typedef declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, LinkageSpecDecl > linkageSpecDecl
Matches a declaration of a linkage specification.
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition: Type.h:2285
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachMatcher > forEach
Matches AST nodes that have child AST nodes that match the provided matcher.
const AstTypeMatcher< UnaryTransformType > unaryTransformType
Matches types nodes representing unary type transformations.
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXUnresolvedConstructExpr > cxxUnresolvedConstructExpr
Matches unresolved constructor call expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCInterfaceDecl > objcInterfaceDecl
Matches Objective-C interface declarations.
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > has
Matches AST nodes that have child AST nodes that match the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBindTemporaryExpr > cxxBindTemporaryExpr
Matches nodes where temporaries are created.
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> anyOf
Matches if any of the given matchers matches.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
Defines the C++ template declaration subclasses.
StringRef P
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > hasDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher. ...
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
bool isSame(ASTNodeKind Other) const
Returns true if this and Other represent the same kind.
Definition: ASTTypeTraits.h:65
bool AnyOfVariadicOperator(const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef< DynTypedMatcher > InnerMatchers)
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2560
NamespaceDecl - Represent a C++ namespace.
Definition: Decl.h:506
const AstTypeMatcher< SubstTemplateTypeParmType > substTemplateTypeParmType
Matches types that represent the result of substituting a type for a template type parameter...
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> eachOf
Matches if any of the given matchers matches.
const AstTypeMatcher< AutoType > autoType
Matches types nodes representing C++11 auto types.
const AstTypeMatcher< RValueReferenceType > rValueReferenceType
Matches rvalue reference types.
const internal::VariadicAllOfMatcher< TemplateName > templateName
Matches template name.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtTryStmt > objcTryStmt
Matches Objective-C statements.
const AstTypeMatcher< PointerType > pointerType
Matches pointer types, but does not match Objective-C object pointer types.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> allOf
Matches if all given matchers match.
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryOperator > binaryOperator
Matches binary operator expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStdInitializerListExpr > cxxStdInitializerListExpr
Matches C++ initializer list expressions.
Matcher< NamedDecl > hasAnyNameFunc(ArrayRef< const StringRef *> NameRefs)
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionDecl > functionDecl
Matches function declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, NamedDecl > namedDecl
Matches a declaration of anything that could have a name.
const AstTypeMatcher< BuiltinType > builtinType
Matches builtin Types.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThrowExpr > cxxThrowExpr
Matches throw expressions.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
Definition: Decl.h:265
const internal::VariadicDynCastAllOfMatcher< Decl, EnumDecl > enumDecl
Matches enum declarations.
const AstTypeMatcher< RecordType > recordType
Matches record types (e.g.
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3482
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:291
bool NotUnaryOperator(const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef< DynTypedMatcher > InnerMatchers)
Represents a class template specialization, which refers to a class template with a given set of temp...
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateDecl > classTemplateDecl
Matches C++ class template declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryDecl > objcCategoryDecl
Matches Objective-C category declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > cxxOperatorCallExpr
Matches overloaded operator calls.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasTemplateDecl > typeAliasTemplateDecl
Matches type alias template declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, DesignatedInitExpr > designatedInitExpr
Matches C99 designated initializer expressions [C99 6.7.8].
const AstTypeMatcher< InjectedClassNameType > injectedClassNameType
Matches injected class name types.
Definition: Format.h:1900
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNullPtrLiteralExpr > cxxNullPtrLiteralExpr
Matches nullptr literal.
const AstTypeMatcher< DependentSizedArrayType > dependentSizedArrayType
Matches C++ arrays whose size is a value-dependent expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTryStmt > cxxTryStmt
Matches try statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStaticCastExpr > cxxStaticCastExpr
Matches a C++ static_cast expression.
internal::VariadicDynCastAllOfMatcher< Type, NodeType > AstTypeMatcher
Definition: ASTMatchers.h:4742
const AstTypeMatcher< TypedefType > typedefType
Matches typedef types.
const internal::VariadicDynCastAllOfMatcher< Stmt, GotoStmt > gotoStmt
Matches goto statements.
const AstTypeMatcher< ComplexType > complexType
Matches C99 complex types.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFunctionalCastExpr > cxxFunctionalCastExpr
Matches functional cast expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXReinterpretCastExpr > cxxReinterpretCastExpr
Matches a reinterpret_cast expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, FloatingLiteral > floatLiteral
Matches float literals of all sizes / encodings, e.g.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclStmt > declStmt
Matches declaration statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, OpaqueValueExpr > opaqueValueExpr
Matches opaque value expressions.
const AstTypeMatcher< MemberPointerType > memberPointerType
Matches member pointer types.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > declRefExpr
Matches expressions that refer to declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, IfStmt > ifStmt
Matches if statements.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceDecl > namespaceDecl
Matches a declaration of a namespace.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitValueInitExpr > implicitValueInitExpr
Matches implicit initializers of init list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchCase > switchCase
Matches case and default statements inside switch statements.
const internal::VariadicFunction< internal::Matcher< NamedDecl >, StringRef, internal::hasAnyNameFunc > hasAnyName
Matches NamedDecl nodes that have any of the specified names.
const internal::VariadicDynCastAllOfMatcher< Stmt, UserDefinedLiteral > userDefinedLiteral
Matches user defined literal operator call.
const AstTypeMatcher< VariableArrayType > variableArrayType
Matches C arrays with a specified size that is not an integer-constant-expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang&#39;s AST.
bool EachOfVariadicOperator(const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef< DynTypedMatcher > InnerMatchers)
const internal::VariadicDynCastAllOfMatcher< Decl, ValueDecl > valueDecl
Matches any value declaration.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCPropertyDecl > objcPropertyDecl
Matches Objective-C property declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtFinallyStmt > objcFinallyStmt
Matches Objective-C statements.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionTemplateDecl > functionTemplateDecl
Matches C++ function template declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXCatchStmt > cxxCatchStmt
Matches catch statements.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateSpecializationDecl > classTemplateSpecializationDecl
Matches C++ class template specializations.
const internal::VariadicDynCastAllOfMatcher< Stmt, MaterializeTemporaryExpr > materializeTemporaryExpr
Matches nodes where temporaries are materialized.
const internal::VariadicDynCastAllOfMatcher< Stmt, CaseStmt > caseStmt
Matches case statements inside switch statements.
const AstTypeMatcher< ParenType > parenType
Matches ParenType nodes.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDirectiveDecl > usingDirectiveDecl
Matches using namespace declarations.
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachDescendantMatcher > forEachDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher. ...
const internal::VariadicDynCastAllOfMatcher< Stmt, AsmStmt > asmStmt
Matches asm statements.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingTypenameDecl > unresolvedUsingTypenameDecl
Matches unresolved using value declarations that involve the typename.
const internal::VariadicDynCastAllOfMatcher< Stmt, MemberExpr > memberExpr
Matches member expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, AddrLabelExpr > addrLabelExpr
Matches address of label statements (GNU extension).
const internal::VariadicDynCastAllOfMatcher< Stmt, ExplicitCastExpr > explicitCastExpr
Matches explicit cast expressions.
bool IsFullyQualified
StringRef getKindName() const
Definition: Decl.h:3146
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchStmt > switchStmt
Matches switch statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedLookupExpr > unresolvedLookupExpr
Matches reference to a name that can be looked up during parsing but could not be resolved to a speci...
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryConditionalOperator > binaryConditionalOperator
Matches binary conditional operator expressions (GNU extension).
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const AstTypeMatcher< IncompleteArrayType > incompleteArrayType
Matches C arrays with unspecified size.
bool AllOfVariadicOperator(const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef< DynTypedMatcher > InnerMatchers)
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Definition: Decl.h:562
const internal::VariadicDynCastAllOfMatcher< Stmt, LabelStmt > labelStmt
Matches label statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CStyleCastExpr > cStyleCastExpr
Matches a C-style cast expression.
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceAliasDecl > namespaceAliasDecl
Matches a declaration of a namespace alias.
#define bool
Definition: stdbool.h:31
const internal::VariadicDynCastAllOfMatcher< Decl, FieldDecl > fieldDecl
Matches field declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ConditionalOperator > conditionalOperator
Matches conditional operator expressions.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
static ASTNodeKind getMostDerivedType(ASTNodeKind Kind1, ASTNodeKind Kind2)
Return the most derived type between Kind1 and Kind2.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefNameDecl > typedefNameDecl
Matches typedef name declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, SubstNonTypeTemplateParmExpr > substNonTypeTemplateParmExpr
Matches substitutions of non-type template parameters.
const internal::VariadicDynCastAllOfMatcher< Stmt, ReturnStmt > returnStmt
Matches return statements.
const AstTypeMatcher< FunctionProtoType > functionProtoType
Matches FunctionProtoType nodes.
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > cudaKernelCallExpr
Matches CUDA kernel call expression.
const AstTypeMatcher< AtomicType > atomicType
Matches atomic types.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryImplDecl > objcCategoryImplDecl
Matches Objective-C category definitions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ExprWithCleanups > exprWithCleanups
Matches expressions that introduce cleanups to be run at the end of the sub-expression&#39;s evaluation...
const internal::VariadicDynCastAllOfMatcher< Decl, FriendDecl > friendDecl
Matches friend declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, DoStmt > doStmt
Matches do statements.
const internal::ArgumentAdaptingMatcherFunc< internal::HasAncestorMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc > > hasAncestor
Matches AST nodes that have an ancestor that matches the provided matcher.
const AstTypeMatcher< TemplateSpecializationType > templateSpecializationType
Matches template specialization types.
const internal::VariadicAllOfMatcher< NestedNameSpecifierLoc > nestedNameSpecifierLoc
Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
virtual void printName(raw_ostream &os) const
Definition: Decl.cpp:1467
const internal::VariadicDynCastAllOfMatcher< Stmt, PredefinedExpr > predefinedExpr
Matches predefined identifier expressions [C99 6.4.2.2].
Kind
const internal::VariadicDynCastAllOfMatcher< Decl, LabelDecl > labelDecl
Matches a declaration of label.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > cxxMemberCallExpr
Matches member call expressions.
static StringRef getNodeName(const NamedDecl &Node, llvm::SmallString< 128 > &Scratch)
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > parmVarDecl
Matches parameter variable declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstCastExpr > cxxConstCastExpr
Matches a const_cast expression.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasDecl > typeAliasDecl
Matches type alias declarations.
const internal::VariadicAllOfMatcher< CXXCtorInitializer > cxxCtorInitializer
Matches constructor initializers.
const internal::VariadicDynCastAllOfMatcher< Stmt, GNUNullExpr > gnuNullExpr
Matches GNU __null expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, BreakStmt > breakStmt
Matches break statements.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > cxxMethodDecl
Matches method declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDynamicCastExpr > cxxDynamicCastExpr
Matches a dynamic_cast expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, DefaultStmt > defaultStmt
Matches default statements inside switch statements.
const internal::VariadicDynCastAllOfMatcher< Decl, TranslationUnitDecl > translationUnitDecl
Matches the top declaration context.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXForRangeStmt > cxxForRangeStmt
Matches range-based for statements.
const internal::VariadicAllOfMatcher< TypeLoc > typeLoc
Matches TypeLocs in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, IntegerLiteral > integerLiteral
Matches integer literals of all sizes / encodings, e.g.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstructExpr > cxxConstructExpr
Matches constructor call expressions (including implicit ones).
const internal::VariadicAllOfMatcher< QualType > qualType
Matches QualTypes in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTypeParmDecl > templateTypeParmDecl
Matches template type parameter declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCMethodDecl > objcMethodDecl
Matches Objective-C method declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDecl > usingDecl
Matches using declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ArraySubscriptExpr > arraySubscriptExpr
Matches array subscript expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryExprOrTypeTraitExpr > unaryExprOrTypeTraitExpr
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc > > hasParent
Matches AST nodes that have a parent that matches the provided matcher.
#define AST_POLYMORPHIC_SUPPORTED_TYPES(...)
Construct a type-list to be passed to the AST_POLYMORPHIC_MATCHER* macros.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCIvarDecl > objcIvarDecl
Matches Objective-C instance variable declarations.
const internal::VariadicOperatorMatcherFunc< 1, 1 > unless
Matches if the provided matcher does not match.
const internal::VariadicDynCastAllOfMatcher< Stmt, ForStmt > forStmt
Matches for statements.
BoundNodesTreeBuilder BoundNodes
ast_type_traits::DynTypedNode DynTypedNode
ast_type_traits::DynTypedNode Node
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCImplementationDecl > objcImplementationDecl
Matches Objective-C implementation declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundLiteralExpr > compoundLiteralExpr
Matches compound (i.e.
Dataflow Directional Tag Classes.
const internal::VariadicDynCastAllOfMatcher< Stmt, AtomicExpr > atomicExpr
Matches atomic builtins.
const internal::VariadicDynCastAllOfMatcher< Decl, StaticAssertDecl > staticAssertDecl
Matches a C++ static_assert declaration.
const AstTypeMatcher< ElaboratedType > elaboratedType
Matches types specified with an elaborated type keyword or with a qualified name. ...
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenListExpr > parenListExpr
Matches paren list expressions.
static bool consumeNameSuffix(StringRef &FullName, StringRef Suffix)
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConversionDecl > cxxConversionDecl
Matches conversion operator declarations.
const internal::VariadicAllOfMatcher< TemplateArgument > templateArgument
Matches template arguments.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCProtocolDecl > objcProtocolDecl
Matches Objective-C protocol declarations.
const AstTypeMatcher< DecayedType > decayedType
Matches decayed type Example matches i[] in declaration of f.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > cxxRecordDecl
Matches C++ class declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDefaultArgExpr > cxxDefaultArgExpr
Matches the value of a default argument at the call site.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingValueDecl > unresolvedUsingValueDecl
Matches unresolved using value declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, NullStmt > nullStmt
Matches null statements.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2504
A dynamically typed AST node container.
Pointer to a block type.
Definition: Type.h:2387
Complex values, per C99 6.2.5p11.
Definition: Type.h:2225
const internal::VariadicDynCastAllOfMatcher< Stmt, LambdaExpr > lambdaExpr
Matches lambda expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNewExpr > cxxNewExpr
Matches new expressions.
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2421
static llvm::ManagedStatic< TrueMatcherImpl > TrueMatcherInstance
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > initListExpr
Matches init list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDeleteExpr > cxxDeleteExpr
Matches delete expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ContinueStmt > continueStmt
Matches continue statements.
const internal::VariadicDynCastAllOfMatcher< Decl, EnumConstantDecl > enumConstantDecl
Matches enum constants.
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtCatchStmt > objcCatchStmt
Matches Objective-C statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > unaryOperator
Matches unary operator expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CharacterLiteral > characterLiteral
Matches character literals (also matches wchar_t).
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTemporaryObjectExpr > cxxTemporaryObjectExpr
Matches functional cast expressions having N != 1 arguments.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConstructorDecl > cxxConstructorDecl
Matches C++ constructor declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitCastExpr > implicitCastExpr
Matches the implicit cast nodes of Clang&#39;s AST.
const internal::VariadicAllOfMatcher< NestedNameSpecifier > nestedNameSpecifier
Matches nested name specifiers.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBoolLiteralExpr > cxxBoolLiteral
Matches bool literals.
const internal::VariadicDynCastAllOfMatcher< Stmt, StmtExpr > stmtExpr
Matches statement expression (GNU extension).
const AstTypeMatcher< ObjCObjectPointerType > objcObjectPointerType
Matches an Objective-C object pointer type, which is different from a pointer type, despite being syntactically similar.
const internal::VariadicDynCastAllOfMatcher< Decl, AccessSpecDecl > accessSpecDecl
Matches C++ access specifier declarations.
const AstTypeMatcher< TemplateTypeParmType > templateTypeParmType
Matches template type parameter types.
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:270
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundStmt > compoundStmt
Matches compound statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, StringLiteral > stringLiteral
Matches string literals (also matches wide string literals).
const AstTypeMatcher< ConstantArrayType > constantArrayType
Matches C arrays with a specified constant size.
bool matches(const til::SExpr *E1, const til::SExpr *E2)
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDestructorDecl > cxxDestructorDecl
Matches explicit C++ destructor declarations.
NamedDecl - This represents a decl with a name.
Definition: Decl.h:245
const AstTypeMatcher< ReferenceType > referenceType
Matches both lvalue and rvalue reference types.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCMessageExpr > objcMessageExpr
Matches ObjectiveC Message invocation expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, DeclaratorDecl > declaratorDecl
Matches declarator declarations (field, variable, function and non-type template parameter declaratio...
const AstTypeMatcher< LValueReferenceType > lValueReferenceType
Matches lvalue reference types.
const internal::VariadicDynCastAllOfMatcher< Stmt, WhileStmt > whileStmt
Matches while statements.
AST_TYPELOC_TRAVERSE_MATCHER_DEF(hasElementType, AST_POLYMORPHIC_SUPPORTED_TYPES(ArrayType, ComplexType))
const AstTypeMatcher< EnumType > enumType
Matches enum types.
const AstTypeMatcher< BlockPointerType > blockPointerType
Matches block pointer types, i.e.