clang  7.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 
42 AST_MATCHER_P(ObjCMessageExpr, hasAnySelectorMatcher, std::vector<std::string>,
43  Matches) {
44  std::string SelString = Node.getSelector().getAsString();
45  for (const std::string &S : Matches)
46  if (S == SelString)
47  return true;
48  return false;
49 }
50 
51 namespace internal {
52 
54  ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder,
55  ArrayRef<DynTypedMatcher> InnerMatchers);
56 
58  ASTMatchFinder *Finder,
59  BoundNodesTreeBuilder *Builder,
60  ArrayRef<DynTypedMatcher> InnerMatchers);
61 
63  ASTMatchFinder *Finder,
64  BoundNodesTreeBuilder *Builder,
65  ArrayRef<DynTypedMatcher> InnerMatchers);
66 
68  ASTMatchFinder *Finder,
69  BoundNodesTreeBuilder *Builder,
70  ArrayRef<DynTypedMatcher> InnerMatchers);
71 
72 void BoundNodesTreeBuilder::visitMatches(Visitor *ResultVisitor) {
73  if (Bindings.empty())
74  Bindings.push_back(BoundNodesMap());
75  for (BoundNodesMap &Binding : Bindings) {
76  ResultVisitor->visitMatch(BoundNodes(Binding));
77  }
78 }
79 
80 namespace {
81 
82 using VariadicOperatorFunction = bool (*)(
83  const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder,
84  BoundNodesTreeBuilder *Builder, ArrayRef<DynTypedMatcher> InnerMatchers);
85 
86 template <VariadicOperatorFunction Func>
87 class VariadicMatcher : public DynMatcherInterface {
88 public:
89  VariadicMatcher(std::vector<DynTypedMatcher> InnerMatchers)
90  : InnerMatchers(std::move(InnerMatchers)) {}
91 
92  bool dynMatches(const ast_type_traits::DynTypedNode &DynNode,
93  ASTMatchFinder *Finder,
94  BoundNodesTreeBuilder *Builder) const override {
95  return Func(DynNode, Finder, Builder, InnerMatchers);
96  }
97 
98 private:
99  std::vector<DynTypedMatcher> InnerMatchers;
100 };
101 
102 class IdDynMatcher : public DynMatcherInterface {
103 public:
104  IdDynMatcher(StringRef ID,
106  : ID(ID), InnerMatcher(std::move(InnerMatcher)) {}
107 
108  bool dynMatches(const ast_type_traits::DynTypedNode &DynNode,
109  ASTMatchFinder *Finder,
110  BoundNodesTreeBuilder *Builder) const override {
111  bool Result = InnerMatcher->dynMatches(DynNode, Finder, Builder);
112  if (Result) Builder->setBinding(ID, DynNode);
113  return Result;
114  }
115 
116 private:
117  const std::string ID;
118  const IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher;
119 };
120 
121 /// A matcher that always returns true.
122 ///
123 /// We only ever need one instance of this matcher, so we create a global one
124 /// and reuse it to reduce the overhead of the matcher and increase the chance
125 /// of cache hits.
126 class TrueMatcherImpl : public DynMatcherInterface {
127 public:
128  TrueMatcherImpl() {
129  Retain(); // Reference count will never become zero.
130  }
131 
132  bool dynMatches(const ast_type_traits::DynTypedNode &, ASTMatchFinder *,
133  BoundNodesTreeBuilder *) const override {
134  return true;
135  }
136 };
137 
138 } // namespace
139 
140 static llvm::ManagedStatic<TrueMatcherImpl> TrueMatcherInstance;
141 
142 DynTypedMatcher DynTypedMatcher::constructVariadic(
143  DynTypedMatcher::VariadicOperator Op,
144  ast_type_traits::ASTNodeKind SupportedKind,
145  std::vector<DynTypedMatcher> InnerMatchers) {
146  assert(!InnerMatchers.empty() && "Array must not be empty.");
147  assert(std::all_of(InnerMatchers.begin(), InnerMatchers.end(),
148  [SupportedKind](const DynTypedMatcher &M) {
149  return M.canConvertTo(SupportedKind);
150  }) &&
151  "InnerMatchers must be convertible to SupportedKind!");
152 
153  // We must relax the restrict kind here.
154  // The different operators might deal differently with a mismatch.
155  // Make it the same as SupportedKind, since that is the broadest type we are
156  // allowed to accept.
157  auto RestrictKind = SupportedKind;
158 
159  switch (Op) {
160  case VO_AllOf:
161  // In the case of allOf() we must pass all the checks, so making
162  // RestrictKind the most restrictive can save us time. This way we reject
163  // invalid types earlier and we can elide the kind checks inside the
164  // matcher.
165  for (auto &IM : InnerMatchers) {
167  RestrictKind, IM.RestrictKind);
168  }
169  return DynTypedMatcher(
170  SupportedKind, RestrictKind,
171  new VariadicMatcher<AllOfVariadicOperator>(std::move(InnerMatchers)));
172 
173  case VO_AnyOf:
174  return DynTypedMatcher(
175  SupportedKind, RestrictKind,
176  new VariadicMatcher<AnyOfVariadicOperator>(std::move(InnerMatchers)));
177 
178  case VO_EachOf:
179  return DynTypedMatcher(
180  SupportedKind, RestrictKind,
181  new VariadicMatcher<EachOfVariadicOperator>(std::move(InnerMatchers)));
182 
183  case VO_UnaryNot:
184  // FIXME: Implement the Not operator to take a single matcher instead of a
185  // vector.
186  return DynTypedMatcher(
187  SupportedKind, RestrictKind,
188  new VariadicMatcher<NotUnaryOperator>(std::move(InnerMatchers)));
189  }
190  llvm_unreachable("Invalid Op value.");
191 }
192 
193 DynTypedMatcher DynTypedMatcher::trueMatcher(
194  ast_type_traits::ASTNodeKind NodeKind) {
195  return DynTypedMatcher(NodeKind, NodeKind, &*TrueMatcherInstance);
196 }
197 
198 bool DynTypedMatcher::canMatchNodesOfKind(
200  return RestrictKind.isBaseOf(Kind);
201 }
202 
203 DynTypedMatcher DynTypedMatcher::dynCastTo(
204  const ast_type_traits::ASTNodeKind Kind) const {
205  auto Copy = *this;
206  Copy.SupportedKind = Kind;
207  Copy.RestrictKind =
209  return Copy;
210 }
211 
213  ASTMatchFinder *Finder,
214  BoundNodesTreeBuilder *Builder) const {
215  if (RestrictKind.isBaseOf(DynNode.getNodeKind()) &&
216  Implementation->dynMatches(DynNode, Finder, Builder)) {
217  return true;
218  }
219  // Delete all bindings when a matcher does not match.
220  // This prevents unexpected exposure of bound nodes in unmatches
221  // branches of the match tree.
222  Builder->removeBindings([](const BoundNodesMap &) { return true; });
223  return false;
224 }
225 
226 bool DynTypedMatcher::matchesNoKindCheck(
227  const ast_type_traits::DynTypedNode &DynNode, ASTMatchFinder *Finder,
228  BoundNodesTreeBuilder *Builder) const {
229  assert(RestrictKind.isBaseOf(DynNode.getNodeKind()));
230  if (Implementation->dynMatches(DynNode, Finder, Builder)) {
231  return true;
232  }
233  // Delete all bindings when a matcher does not match.
234  // This prevents unexpected exposure of bound nodes in unmatches
235  // branches of the match tree.
236  Builder->removeBindings([](const BoundNodesMap &) { return true; });
237  return false;
238 }
239 
240 llvm::Optional<DynTypedMatcher> DynTypedMatcher::tryBind(StringRef ID) const {
241  if (!AllowBind) return llvm::None;
242  auto Result = *this;
243  Result.Implementation =
244  new IdDynMatcher(ID, std::move(Result.Implementation));
245  return std::move(Result);
246 }
247 
248 bool DynTypedMatcher::canConvertTo(ast_type_traits::ASTNodeKind To) const {
249  const auto From = getSupportedKind();
250  auto QualKind = ast_type_traits::ASTNodeKind::getFromNodeKind<QualType>();
251  auto TypeKind = ast_type_traits::ASTNodeKind::getFromNodeKind<Type>();
252  /// Mimic the implicit conversions of Matcher<>.
253  /// - From Matcher<Type> to Matcher<QualType>
254  if (From.isSame(TypeKind) && To.isSame(QualKind)) return true;
255  /// - From Matcher<Base> to Matcher<Derived>
256  return From.isBaseOf(To);
257 }
258 
259 void BoundNodesTreeBuilder::addMatch(const BoundNodesTreeBuilder &Other) {
260  Bindings.append(Other.Bindings.begin(), Other.Bindings.end());
261 }
262 
264  ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder,
265  ArrayRef<DynTypedMatcher> InnerMatchers) {
266  if (InnerMatchers.size() != 1)
267  return false;
268 
269  // The 'unless' matcher will always discard the result:
270  // If the inner matcher doesn't match, unless returns true,
271  // but the inner matcher cannot have bound anything.
272  // If the inner matcher matches, the result is false, and
273  // any possible binding will be discarded.
274  // We still need to hand in all the bound nodes up to this
275  // point so the inner matcher can depend on bound nodes,
276  // and we need to actively discard the bound nodes, otherwise
277  // the inner matcher will reset the bound nodes if it doesn't
278  // match, but this would be inversed by 'unless'.
279  BoundNodesTreeBuilder Discard(*Builder);
280  return !InnerMatchers[0].matches(DynNode, Finder, &Discard);
281 }
282 
284  ASTMatchFinder *Finder,
285  BoundNodesTreeBuilder *Builder,
286  ArrayRef<DynTypedMatcher> InnerMatchers) {
287  // allOf leads to one matcher for each alternative in the first
288  // matcher combined with each alternative in the second matcher.
289  // Thus, we can reuse the same Builder.
290  for (const DynTypedMatcher &InnerMatcher : InnerMatchers) {
291  if (!InnerMatcher.matchesNoKindCheck(DynNode, Finder, Builder))
292  return false;
293  }
294  return true;
295 }
296 
298  ASTMatchFinder *Finder,
299  BoundNodesTreeBuilder *Builder,
300  ArrayRef<DynTypedMatcher> InnerMatchers) {
301  BoundNodesTreeBuilder Result;
302  bool Matched = false;
303  for (const DynTypedMatcher &InnerMatcher : InnerMatchers) {
304  BoundNodesTreeBuilder BuilderInner(*Builder);
305  if (InnerMatcher.matches(DynNode, Finder, &BuilderInner)) {
306  Matched = true;
307  Result.addMatch(BuilderInner);
308  }
309  }
310  *Builder = std::move(Result);
311  return Matched;
312 }
313 
315  ASTMatchFinder *Finder,
316  BoundNodesTreeBuilder *Builder,
317  ArrayRef<DynTypedMatcher> InnerMatchers) {
318  for (const DynTypedMatcher &InnerMatcher : InnerMatchers) {
319  BoundNodesTreeBuilder Result = *Builder;
320  if (InnerMatcher.matches(DynNode, Finder, &Result)) {
321  *Builder = std::move(Result);
322  return true;
323  }
324  }
325  return false;
326 }
327 
328 inline static
329 std::vector<std::string> vectorFromRefs(ArrayRef<const StringRef *> NameRefs) {
330  std::vector<std::string> Names;
331  for (auto *Name : NameRefs)
332  Names.emplace_back(*Name);
333  return Names;
334 }
335 
336 Matcher<NamedDecl> hasAnyNameFunc(ArrayRef<const StringRef *> NameRefs) {
337  std::vector<std::string> Names = vectorFromRefs(NameRefs);
338  return internal::Matcher<NamedDecl>(new internal::HasNameMatcher(Names));
339 }
340 
341 Matcher<ObjCMessageExpr> hasAnySelectorFunc(
342  ArrayRef<const StringRef *> NameRefs) {
343  return hasAnySelectorMatcher(vectorFromRefs(NameRefs));
344 }
345 
346 HasNameMatcher::HasNameMatcher(std::vector<std::string> N)
347  : UseUnqualifiedMatch(std::all_of(
348  N.begin(), N.end(),
349  [](StringRef Name) { return Name.find("::") == Name.npos; })),
350  Names(std::move(N)) {
351 #ifndef NDEBUG
352  for (StringRef Name : Names)
353  assert(!Name.empty());
354 #endif
355 }
356 
357 static bool consumeNameSuffix(StringRef &FullName, StringRef Suffix) {
358  StringRef Name = FullName;
359  if (!Name.endswith(Suffix))
360  return false;
361  Name = Name.drop_back(Suffix.size());
362  if (!Name.empty()) {
363  if (!Name.endswith("::"))
364  return false;
365  Name = Name.drop_back(2);
366  }
367  FullName = Name;
368  return true;
369 }
370 
371 static StringRef getNodeName(const NamedDecl &Node,
372  llvm::SmallString<128> &Scratch) {
373  // Simple name.
374  if (Node.getIdentifier())
375  return Node.getName();
376 
377  if (Node.getDeclName()) {
378  // Name needs to be constructed.
379  Scratch.clear();
380  llvm::raw_svector_ostream OS(Scratch);
381  Node.printName(OS);
382  return OS.str();
383  }
384 
385  return "(anonymous)";
386 }
387 
388 static StringRef getNodeName(const RecordDecl &Node,
389  llvm::SmallString<128> &Scratch) {
390  if (Node.getIdentifier()) {
391  return Node.getName();
392  }
393  Scratch.clear();
394  return ("(anonymous " + Node.getKindName() + ")").toStringRef(Scratch);
395 }
396 
397 static StringRef getNodeName(const NamespaceDecl &Node,
398  llvm::SmallString<128> &Scratch) {
399  return Node.isAnonymousNamespace() ? "(anonymous namespace)" : Node.getName();
400 }
401 
402 namespace {
403 
404 class PatternSet {
405 public:
406  PatternSet(ArrayRef<std::string> Names) {
407  for (StringRef Name : Names)
408  Patterns.push_back({Name, Name.startswith("::")});
409  }
410 
411  /// Consumes the name suffix from each pattern in the set and removes the ones
412  /// that didn't match.
413  /// Return true if there are still any patterns left.
414  bool consumeNameSuffix(StringRef NodeName, bool CanSkip) {
415  for (size_t I = 0; I < Patterns.size();) {
417  NodeName) ||
418  CanSkip) {
419  ++I;
420  } else {
421  Patterns.erase(Patterns.begin() + I);
422  }
423  }
424  return !Patterns.empty();
425  }
426 
427  /// Check if any of the patterns are a match.
428  /// A match will be a pattern that was fully consumed, that also matches the
429  /// 'fully qualified' requirement.
430  bool foundMatch(bool AllowFullyQualified) const {
431  for (auto& P: Patterns)
432  if (P.P.empty() && (AllowFullyQualified || !P.IsFullyQualified))
433  return true;
434  return false;
435  }
436 
437 private:
438  struct Pattern {
439  StringRef P;
441  };
442 
444 };
445 
446 } // namespace
447 
448 bool HasNameMatcher::matchesNodeUnqualified(const NamedDecl &Node) const {
449  assert(UseUnqualifiedMatch);
450  llvm::SmallString<128> Scratch;
451  StringRef NodeName = getNodeName(Node, Scratch);
452  return std::any_of(Names.begin(), Names.end(), [&](StringRef Name) {
453  return consumeNameSuffix(Name, NodeName) && Name.empty();
454  });
455 }
456 
457 bool HasNameMatcher::matchesNodeFullFast(const NamedDecl &Node) const {
458  PatternSet Patterns(Names);
459  llvm::SmallString<128> Scratch;
460 
461  // This function is copied and adapted from NamedDecl::printQualifiedName()
462  // By matching each part individually we optimize in a couple of ways:
463  // - We can exit early on the first failure.
464  // - We can skip inline/anonymous namespaces without another pass.
465  // - We print one name at a time, reducing the chance of overflowing the
466  // inlined space of the SmallString.
467 
468  // First, match the name.
469  if (!Patterns.consumeNameSuffix(getNodeName(Node, Scratch),
470  /*CanSkip=*/false))
471  return false;
472 
473  // Try to match each declaration context.
474  // We are allowed to skip anonymous and inline namespaces if they don't match.
475  const DeclContext *Ctx = Node.getDeclContext();
476 
477  if (Ctx->isFunctionOrMethod())
478  return Patterns.foundMatch(/*AllowFullyQualified=*/false);
479 
480  for (; Ctx && isa<NamedDecl>(Ctx); Ctx = Ctx->getParent()) {
481  if (Patterns.foundMatch(/*AllowFullyQualified=*/false))
482  return true;
483 
484  if (const auto *ND = dyn_cast<NamespaceDecl>(Ctx)) {
485  // If it matches (or we can skip it), continue.
486  if (Patterns.consumeNameSuffix(getNodeName(*ND, Scratch),
487  /*CanSkip=*/ND->isAnonymousNamespace() ||
488  ND->isInline()))
489  continue;
490  return false;
491  }
492  if (const auto *RD = dyn_cast<RecordDecl>(Ctx)) {
493  if (!isa<ClassTemplateSpecializationDecl>(Ctx)) {
494  if (Patterns.consumeNameSuffix(getNodeName(*RD, Scratch),
495  /*CanSkip=*/false))
496  continue;
497 
498  return false;
499  }
500  }
501 
502  // We don't know how to deal with this DeclContext.
503  // Fallback to the slow version of the code.
504  return matchesNodeFullSlow(Node);
505  }
506 
507  return Patterns.foundMatch(/*AllowFullyQualified=*/true);
508 }
509 
510 bool HasNameMatcher::matchesNodeFullSlow(const NamedDecl &Node) const {
511  const bool SkipUnwrittenCases[] = {false, true};
512  for (bool SkipUnwritten : SkipUnwrittenCases) {
513  llvm::SmallString<128> NodeName = StringRef("::");
514  llvm::raw_svector_ostream OS(NodeName);
515 
516  if (SkipUnwritten) {
517  PrintingPolicy Policy = Node.getASTContext().getPrintingPolicy();
518  Policy.SuppressUnwrittenScope = true;
519  Node.printQualifiedName(OS, Policy);
520  } else {
521  Node.printQualifiedName(OS);
522  }
523 
524  const StringRef FullName = OS.str();
525 
526  for (const StringRef Pattern : Names) {
527  if (Pattern.startswith("::")) {
528  if (FullName == Pattern)
529  return true;
530  } else if (FullName.endswith(Pattern) &&
531  FullName.drop_back(Pattern.size()).endswith("::")) {
532  return true;
533  }
534  }
535  }
536 
537  return false;
538 }
539 
540 bool HasNameMatcher::matchesNode(const NamedDecl &Node) const {
541  assert(matchesNodeFullFast(Node) == matchesNodeFullSlow(Node));
542  if (UseUnqualifiedMatch) {
543  assert(matchesNodeUnqualified(Node) == matchesNodeFullFast(Node));
544  return matchesNodeUnqualified(Node);
545  }
546  return matchesNodeFullFast(Node);
547 }
548 
549 } // end namespace internal
550 
551 const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
553 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl> typedefDecl;
554 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
556 const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl> typeAliasDecl;
557 const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
559 const internal::VariadicAllOfMatcher<Decl> decl;
560 const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
562 const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl;
563 const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl> labelDecl;
564 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl> namespaceDecl;
565 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
567 const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl> recordDecl;
568 const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl> cxxRecordDecl;
569 const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
571 const internal::VariadicDynCastAllOfMatcher<Decl,
574 const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
576 const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl> parmVarDecl;
577 const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
579 const internal::VariadicAllOfMatcher<CXXCtorInitializer> cxxCtorInitializer;
580 const internal::VariadicAllOfMatcher<TemplateArgument> templateArgument;
581 const internal::VariadicAllOfMatcher<TemplateName> templateName;
582 const internal::VariadicDynCastAllOfMatcher<Decl, NonTypeTemplateParmDecl>
584 const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
586 const internal::VariadicAllOfMatcher<QualType> qualType;
587 const internal::VariadicAllOfMatcher<Type> type;
588 const internal::VariadicAllOfMatcher<TypeLoc> typeLoc;
589 const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryExprOrTypeTraitExpr>
591 const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl> valueDecl;
592 const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
594 const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
596 const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl> enumDecl;
597 const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
599 const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl> cxxMethodDecl;
600 const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
602 const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl;
603 const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> fieldDecl;
604 const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl> functionDecl;
605 const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
607 const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl> friendDecl;
608 const internal::VariadicAllOfMatcher<Stmt> stmt;
609 const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt> declStmt;
610 const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr> memberExpr;
611 const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr> callExpr;
612 const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr> lambdaExpr;
613 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
615 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
617 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
619 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
621 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
623 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
625 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
627 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
629 const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
631 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl> objcIvarDecl;
632 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
634 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
636 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt> objcTryStmt;
637 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
639 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
641 const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
643 const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr> initListExpr;
644 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStdInitializerListExpr>
646 const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
648 const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr> parenListExpr;
649 const internal::VariadicDynCastAllOfMatcher<Stmt, SubstNonTypeTemplateParmExpr>
651 const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl> usingDecl;
652 const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
654 const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
656 const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingValueDecl>
658 const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingTypenameDecl>
660 const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr> parenExpr;
661 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
663 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXUnresolvedConstructExpr>
665 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr> cxxThisExpr;
666 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
668 const internal::VariadicDynCastAllOfMatcher<Stmt, MaterializeTemporaryExpr>
670 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr> cxxNewExpr;
671 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr> cxxDeleteExpr;
672 const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
674 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
676 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
678 const internal::VariadicDynCastAllOfMatcher<Stmt, Expr> expr;
679 const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr> declRefExpr;
680 const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt> ifStmt;
681 const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt> forStmt;
682 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
684 const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt> whileStmt;
685 const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt> doStmt;
686 const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt> breakStmt;
687 const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt> continueStmt;
688 const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt> returnStmt;
689 const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt> gotoStmt;
690 const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt> labelStmt;
691 const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr> addrLabelExpr;
692 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt> switchStmt;
693 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase> switchCase;
694 const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt> caseStmt;
695 const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt> defaultStmt;
696 const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt> compoundStmt;
697 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt> cxxCatchStmt;
698 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt> cxxTryStmt;
699 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr> cxxThrowExpr;
700 const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt> nullStmt;
701 const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt> asmStmt;
702 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
704 const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral> stringLiteral;
705 const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
707 const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
709 const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral> floatLiteral;
710 const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
712 const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
714 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
716 const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr> gnuNullExpr;
717 const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr> atomicExpr;
718 const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr> stmtExpr;
719 const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
721 const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator> unaryOperator;
722 const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
724 const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryConditionalOperator>
726 const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
728 const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
730 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
732 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
734 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
736 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
738 const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
740 const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
742 const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
744 const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr> castExpr;
745 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
747 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
749 const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
751 const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
753 const internal::VariadicOperatorMatcherFunc<
755  eachOf = {internal::DynTypedMatcher::VO_EachOf};
756 const internal::VariadicOperatorMatcherFunc<
758  anyOf = {internal::DynTypedMatcher::VO_AnyOf};
759 const internal::VariadicOperatorMatcherFunc<
761  allOf = {internal::DynTypedMatcher::VO_AllOf};
762 const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
765 const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>, StringRef,
768 const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher> has = {};
769 const internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher>
771 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher> forEach =
772  {};
773 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachDescendantMatcher>
775 const internal::ArgumentAdaptingMatcherFunc<
776  internal::HasParentMatcher,
777  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
778  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
779  hasParent = {};
780 const internal::ArgumentAdaptingMatcherFunc<
781  internal::HasAncestorMatcher,
782  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
783  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
785 const internal::VariadicOperatorMatcherFunc<1, 1> unless = {
786  internal::DynTypedMatcher::VO_UnaryNot};
787 const internal::VariadicAllOfMatcher<NestedNameSpecifier> nestedNameSpecifier;
788 const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
790 const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
822 AST_TYPELOC_TRAVERSE_MATCHER_DEF(hasElementType,
824  ComplexType));
828  pointee,
831 
832 } // end namespace ast_matchers
833 } // 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:2354
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachMatcher > forEach
Matches AST nodes that have child AST nodes that match the provided matcher.
AST_MATCHER_P(FieldDecl, hasBitWidth, unsigned, Width)
Matches non-static data members that are bit-fields of the specified bit width.
Definition: ASTMatchers.h:593
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 internal::VariadicFunction< internal::Matcher< ObjCMessageExpr >, StringRef, internal::hasAnySelectorFunc > hasAnySelector
Matches when at least one of the supplied string equals to the Selector.getAsString() ...
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:2629
Represent a C++ namespace.
Definition: Decl.h:514
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
Get the identifier that names this declaration, if there is one.
Definition: Decl.h:269
const internal::VariadicDynCastAllOfMatcher< Decl, EnumDecl > enumDecl
Matches enum declarations.
const AstTypeMatcher< RecordType > recordType
Matches record types (e.g.
Represents a struct/union/class.
Definition: Decl.h:3548
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:297
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.
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:4862
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:3212
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:570
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.
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:903
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:1496
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.
static std::vector< std::string > vectorFromRefs(ArrayRef< const StringRef *> NameRefs)
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 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:2573
A dynamically typed AST node container.
Pointer to a block type.
Definition: Type.h:2456
Complex values, per C99 6.2.5p11.
Definition: Type.h:2294
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:2490
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.
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
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:275
__DEVICE__ int max(int __a, int __b)
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundStmt > compoundStmt
Matches compound statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, StringLiteral > stringLiteral
Matches string literals (also matches wide string literals).
const internal::VariadicDynCastAllOfMatcher< Decl, BlockDecl > blockDecl
Matches block declarations.
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.
This represents a decl that may have a name.
Definition: Decl.h:248
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...
Matcher< ObjCMessageExpr > hasAnySelectorFunc(ArrayRef< const StringRef *> NameRefs)
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.