clang  14.0.0git
ASTMatchersInternal.cpp
Go to the documentation of this file.
1 //===- ASTMatchersInternal.cpp - Structural query framework ---------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Implements the base layer of the matcher framework.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/Decl.h"
17 #include "clang/AST/DeclTemplate.h"
21 #include "clang/Basic/LLVM.h"
22 #include "clang/Lex/Lexer.h"
23 #include "llvm/ADT/ArrayRef.h"
24 #include "llvm/ADT/IntrusiveRefCntPtr.h"
25 #include "llvm/ADT/None.h"
26 #include "llvm/ADT/SmallString.h"
27 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/StringRef.h"
29 #include "llvm/Support/Casting.h"
30 #include "llvm/Support/ErrorHandling.h"
31 #include "llvm/Support/ManagedStatic.h"
32 #include "llvm/Support/Regex.h"
33 #include "llvm/Support/WithColor.h"
34 #include "llvm/Support/raw_ostream.h"
35 #include <algorithm>
36 #include <cassert>
37 #include <cstddef>
38 #include <string>
39 #include <utility>
40 #include <vector>
41 
42 namespace clang {
43 namespace ast_matchers {
44 
45 AST_MATCHER_P(ObjCMessageExpr, hasAnySelectorMatcher, std::vector<std::string>,
46  Matches) {
47  return llvm::is_contained(Matches, Node.getSelector().getAsString());
48 }
49 
50 namespace internal {
51 
52 static bool notUnaryOperator(const DynTypedNode &DynNode,
53  ASTMatchFinder *Finder,
54  BoundNodesTreeBuilder *Builder,
55  ArrayRef<DynTypedMatcher> InnerMatchers);
56 
57 static bool allOfVariadicOperator(const DynTypedNode &DynNode,
58  ASTMatchFinder *Finder,
59  BoundNodesTreeBuilder *Builder,
60  ArrayRef<DynTypedMatcher> InnerMatchers);
61 
62 static bool eachOfVariadicOperator(const DynTypedNode &DynNode,
63  ASTMatchFinder *Finder,
64  BoundNodesTreeBuilder *Builder,
65  ArrayRef<DynTypedMatcher> InnerMatchers);
66 
67 static bool anyOfVariadicOperator(const DynTypedNode &DynNode,
68  ASTMatchFinder *Finder,
69  BoundNodesTreeBuilder *Builder,
70  ArrayRef<DynTypedMatcher> InnerMatchers);
71 
72 static bool optionallyVariadicOperator(const DynTypedNode &DynNode,
73  ASTMatchFinder *Finder,
74  BoundNodesTreeBuilder *Builder,
75  ArrayRef<DynTypedMatcher> InnerMatchers);
76 
78  const Matcher<CXXBaseSpecifier> &BaseSpecMatcher,
79  ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder) {
80  if (!Node.hasDefinition())
81  return false;
82 
83  CXXBasePaths Paths;
84  Paths.setOrigin(&Node);
85 
86  const auto basePredicate =
87  [Finder, Builder, &BaseSpecMatcher](const CXXBaseSpecifier *BaseSpec,
88  CXXBasePath &IgnoredParam) {
89  BoundNodesTreeBuilder Result(*Builder);
90  if (BaseSpecMatcher.matches(*BaseSpec, Finder, Builder)) {
91  *Builder = std::move(Result);
92  return true;
93  }
94  return false;
95  };
96 
97  return Node.lookupInBases(basePredicate, Paths,
98  /*LookupInDependent =*/true);
99 }
100 
101 void BoundNodesTreeBuilder::visitMatches(Visitor *ResultVisitor) {
102  if (Bindings.empty())
103  Bindings.push_back(BoundNodesMap());
104  for (BoundNodesMap &Binding : Bindings) {
105  ResultVisitor->visitMatch(BoundNodes(Binding));
106  }
107 }
108 
109 namespace {
110 
111 using VariadicOperatorFunction = bool (*)(
112  const DynTypedNode &DynNode, ASTMatchFinder *Finder,
113  BoundNodesTreeBuilder *Builder, ArrayRef<DynTypedMatcher> InnerMatchers);
114 
115 template <VariadicOperatorFunction Func>
116 class VariadicMatcher : public DynMatcherInterface {
117 public:
118  VariadicMatcher(std::vector<DynTypedMatcher> InnerMatchers)
119  : InnerMatchers(std::move(InnerMatchers)) {}
120 
121  bool dynMatches(const DynTypedNode &DynNode, ASTMatchFinder *Finder,
122  BoundNodesTreeBuilder *Builder) const override {
123  return Func(DynNode, Finder, Builder, InnerMatchers);
124  }
125 
126 private:
127  std::vector<DynTypedMatcher> InnerMatchers;
128 };
129 
130 class IdDynMatcher : public DynMatcherInterface {
131 public:
132  IdDynMatcher(StringRef ID,
133  IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher)
134  : ID(ID), InnerMatcher(std::move(InnerMatcher)) {}
135 
136  bool dynMatches(const DynTypedNode &DynNode, ASTMatchFinder *Finder,
137  BoundNodesTreeBuilder *Builder) const override {
138  bool Result = InnerMatcher->dynMatches(DynNode, Finder, Builder);
139  if (Result) Builder->setBinding(ID, DynNode);
140  return Result;
141  }
142 
144  return InnerMatcher->TraversalKind();
145  }
146 
147 private:
148  const std::string ID;
149  const IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher;
150 };
151 
152 /// A matcher that always returns true.
153 class TrueMatcherImpl : public DynMatcherInterface {
154 public:
155  TrueMatcherImpl() = default;
156 
157  bool dynMatches(const DynTypedNode &, ASTMatchFinder *,
158  BoundNodesTreeBuilder *) const override {
159  return true;
160  }
161 };
162 
163 /// A matcher that specifies a particular \c TraversalKind.
164 ///
165 /// The kind provided to the constructor overrides any kind that may be
166 /// specified by the `InnerMatcher`.
167 class DynTraversalMatcherImpl : public DynMatcherInterface {
168 public:
169  explicit DynTraversalMatcherImpl(
171  IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher)
172  : TK(TK), InnerMatcher(std::move(InnerMatcher)) {}
173 
174  bool dynMatches(const DynTypedNode &DynNode, ASTMatchFinder *Finder,
175  BoundNodesTreeBuilder *Builder) const override {
176  return this->InnerMatcher->dynMatches(DynNode, Finder, Builder);
177  }
178 
180  return TK;
181  }
182 
183 private:
185  IntrusiveRefCntPtr<DynMatcherInterface> InnerMatcher;
186 };
187 
188 } // namespace
189 
190 bool ASTMatchFinder::isTraversalIgnoringImplicitNodes() const {
191  return getASTContext().getParentMapContext().getTraversalKind() ==
193 }
194 
195 DynTypedMatcher
196 DynTypedMatcher::constructVariadic(DynTypedMatcher::VariadicOperator Op,
197  ASTNodeKind SupportedKind,
198  std::vector<DynTypedMatcher> InnerMatchers) {
199  assert(!InnerMatchers.empty() && "Array must not be empty.");
200  assert(llvm::all_of(InnerMatchers,
201  [SupportedKind](const DynTypedMatcher &M) {
202  return M.canConvertTo(SupportedKind);
203  }) &&
204  "InnerMatchers must be convertible to SupportedKind!");
205 
206  // We must relax the restrict kind here.
207  // The different operators might deal differently with a mismatch.
208  // Make it the same as SupportedKind, since that is the broadest type we are
209  // allowed to accept.
210  auto RestrictKind = SupportedKind;
211 
212  switch (Op) {
213  case VO_AllOf:
214  // In the case of allOf() we must pass all the checks, so making
215  // RestrictKind the most restrictive can save us time. This way we reject
216  // invalid types earlier and we can elide the kind checks inside the
217  // matcher.
218  for (auto &IM : InnerMatchers) {
219  RestrictKind =
220  ASTNodeKind::getMostDerivedType(RestrictKind, IM.RestrictKind);
221  }
222  return DynTypedMatcher(
223  SupportedKind, RestrictKind,
224  new VariadicMatcher<allOfVariadicOperator>(std::move(InnerMatchers)));
225 
226  case VO_AnyOf:
227  return DynTypedMatcher(
228  SupportedKind, RestrictKind,
229  new VariadicMatcher<anyOfVariadicOperator>(std::move(InnerMatchers)));
230 
231  case VO_EachOf:
232  return DynTypedMatcher(
233  SupportedKind, RestrictKind,
234  new VariadicMatcher<eachOfVariadicOperator>(std::move(InnerMatchers)));
235 
236  case VO_Optionally:
237  return DynTypedMatcher(SupportedKind, RestrictKind,
238  new VariadicMatcher<optionallyVariadicOperator>(
239  std::move(InnerMatchers)));
240 
241  case VO_UnaryNot:
242  // FIXME: Implement the Not operator to take a single matcher instead of a
243  // vector.
244  return DynTypedMatcher(
245  SupportedKind, RestrictKind,
246  new VariadicMatcher<notUnaryOperator>(std::move(InnerMatchers)));
247  }
248  llvm_unreachable("Invalid Op value.");
249 }
250 
251 DynTypedMatcher
252 DynTypedMatcher::constructRestrictedWrapper(const DynTypedMatcher &InnerMatcher,
253  ASTNodeKind RestrictKind) {
254  DynTypedMatcher Copy = InnerMatcher;
255  Copy.RestrictKind = RestrictKind;
256  return Copy;
257 }
258 
259 DynTypedMatcher DynTypedMatcher::withTraversalKind(TraversalKind TK) {
260  auto Copy = *this;
261  Copy.Implementation =
262  new DynTraversalMatcherImpl(TK, std::move(Copy.Implementation));
263  return Copy;
264 }
265 
266 DynTypedMatcher DynTypedMatcher::trueMatcher(ASTNodeKind NodeKind) {
267  // We only ever need one instance of TrueMatcherImpl, so we create a static
268  // instance and reuse it to reduce the overhead of the matcher and increase
269  // the chance of cache hits.
270  static const llvm::IntrusiveRefCntPtr<TrueMatcherImpl> Instance =
271  new TrueMatcherImpl();
272  return DynTypedMatcher(NodeKind, NodeKind, Instance);
273 }
274 
275 bool DynTypedMatcher::canMatchNodesOfKind(ASTNodeKind Kind) const {
276  return RestrictKind.isBaseOf(Kind);
277 }
278 
279 DynTypedMatcher DynTypedMatcher::dynCastTo(const ASTNodeKind Kind) const {
280  auto Copy = *this;
281  Copy.SupportedKind = Kind;
282  Copy.RestrictKind = ASTNodeKind::getMostDerivedType(Kind, RestrictKind);
283  return Copy;
284 }
285 
286 bool DynTypedMatcher::matches(const DynTypedNode &DynNode,
287  ASTMatchFinder *Finder,
288  BoundNodesTreeBuilder *Builder) const {
289  TraversalKindScope RAII(Finder->getASTContext(),
290  Implementation->TraversalKind());
291 
292  if (Finder->isTraversalIgnoringImplicitNodes() &&
293  Finder->IsMatchingInASTNodeNotSpelledInSource())
294  return false;
295 
296  if (!Finder->isTraversalIgnoringImplicitNodes() &&
297  Finder->IsMatchingInASTNodeNotAsIs())
298  return false;
299 
300  auto N =
301  Finder->getASTContext().getParentMapContext().traverseIgnored(DynNode);
302 
303  if (RestrictKind.isBaseOf(N.getNodeKind()) &&
304  Implementation->dynMatches(N, Finder, Builder)) {
305  return true;
306  }
307  // Delete all bindings when a matcher does not match.
308  // This prevents unexpected exposure of bound nodes in unmatches
309  // branches of the match tree.
310  Builder->removeBindings([](const BoundNodesMap &) { return true; });
311  return false;
312 }
313 
314 bool DynTypedMatcher::matchesNoKindCheck(const DynTypedNode &DynNode,
315  ASTMatchFinder *Finder,
316  BoundNodesTreeBuilder *Builder) const {
317  TraversalKindScope raii(Finder->getASTContext(),
318  Implementation->TraversalKind());
319 
320  if (Finder->isTraversalIgnoringImplicitNodes() &&
321  Finder->IsMatchingInASTNodeNotSpelledInSource())
322  return false;
323 
324  if (!Finder->isTraversalIgnoringImplicitNodes() &&
325  Finder->IsMatchingInASTNodeNotAsIs())
326  return false;
327 
328  auto N =
329  Finder->getASTContext().getParentMapContext().traverseIgnored(DynNode);
330 
331  assert(RestrictKind.isBaseOf(N.getNodeKind()));
332  if (Implementation->dynMatches(N, Finder, Builder)) {
333  return true;
334  }
335  // Delete all bindings when a matcher does not match.
336  // This prevents unexpected exposure of bound nodes in unmatches
337  // branches of the match tree.
338  Builder->removeBindings([](const BoundNodesMap &) { return true; });
339  return false;
340 }
341 
342 llvm::Optional<DynTypedMatcher> DynTypedMatcher::tryBind(StringRef ID) const {
343  if (!AllowBind) return llvm::None;
344  auto Result = *this;
345  Result.Implementation =
346  new IdDynMatcher(ID, std::move(Result.Implementation));
347  return std::move(Result);
348 }
349 
350 bool DynTypedMatcher::canConvertTo(ASTNodeKind To) const {
351  const auto From = getSupportedKind();
352  auto QualKind = ASTNodeKind::getFromNodeKind<QualType>();
353  auto TypeKind = ASTNodeKind::getFromNodeKind<Type>();
354  /// Mimic the implicit conversions of Matcher<>.
355  /// - From Matcher<Type> to Matcher<QualType>
356  if (From.isSame(TypeKind) && To.isSame(QualKind)) return true;
357  /// - From Matcher<Base> to Matcher<Derived>
358  return From.isBaseOf(To);
359 }
360 
361 void BoundNodesTreeBuilder::addMatch(const BoundNodesTreeBuilder &Other) {
362  Bindings.append(Other.Bindings.begin(), Other.Bindings.end());
363 }
364 
365 static bool notUnaryOperator(const DynTypedNode &DynNode,
366  ASTMatchFinder *Finder,
367  BoundNodesTreeBuilder *Builder,
368  ArrayRef<DynTypedMatcher> InnerMatchers) {
369  if (InnerMatchers.size() != 1)
370  return false;
371 
372  // The 'unless' matcher will always discard the result:
373  // If the inner matcher doesn't match, unless returns true,
374  // but the inner matcher cannot have bound anything.
375  // If the inner matcher matches, the result is false, and
376  // any possible binding will be discarded.
377  // We still need to hand in all the bound nodes up to this
378  // point so the inner matcher can depend on bound nodes,
379  // and we need to actively discard the bound nodes, otherwise
380  // the inner matcher will reset the bound nodes if it doesn't
381  // match, but this would be inversed by 'unless'.
382  BoundNodesTreeBuilder Discard(*Builder);
383  return !InnerMatchers[0].matches(DynNode, Finder, &Discard);
384 }
385 
386 static bool allOfVariadicOperator(const DynTypedNode &DynNode,
387  ASTMatchFinder *Finder,
388  BoundNodesTreeBuilder *Builder,
389  ArrayRef<DynTypedMatcher> InnerMatchers) {
390  // allOf leads to one matcher for each alternative in the first
391  // matcher combined with each alternative in the second matcher.
392  // Thus, we can reuse the same Builder.
393  return llvm::all_of(InnerMatchers, [&](const DynTypedMatcher &InnerMatcher) {
394  return InnerMatcher.matchesNoKindCheck(DynNode, Finder, Builder);
395  });
396 }
397 
398 static bool eachOfVariadicOperator(const DynTypedNode &DynNode,
399  ASTMatchFinder *Finder,
400  BoundNodesTreeBuilder *Builder,
401  ArrayRef<DynTypedMatcher> InnerMatchers) {
402  BoundNodesTreeBuilder Result;
403  bool Matched = false;
404  for (const DynTypedMatcher &InnerMatcher : InnerMatchers) {
405  BoundNodesTreeBuilder BuilderInner(*Builder);
406  if (InnerMatcher.matches(DynNode, Finder, &BuilderInner)) {
407  Matched = true;
408  Result.addMatch(BuilderInner);
409  }
410  }
411  *Builder = std::move(Result);
412  return Matched;
413 }
414 
415 static bool anyOfVariadicOperator(const DynTypedNode &DynNode,
416  ASTMatchFinder *Finder,
417  BoundNodesTreeBuilder *Builder,
418  ArrayRef<DynTypedMatcher> InnerMatchers) {
419  for (const DynTypedMatcher &InnerMatcher : InnerMatchers) {
420  BoundNodesTreeBuilder Result = *Builder;
421  if (InnerMatcher.matches(DynNode, Finder, &Result)) {
422  *Builder = std::move(Result);
423  return true;
424  }
425  }
426  return false;
427 }
428 
429 static bool
430 optionallyVariadicOperator(const DynTypedNode &DynNode, ASTMatchFinder *Finder,
431  BoundNodesTreeBuilder *Builder,
432  ArrayRef<DynTypedMatcher> InnerMatchers) {
433  if (InnerMatchers.size() != 1)
434  return false;
435 
436  BoundNodesTreeBuilder Result(*Builder);
437  if (InnerMatchers[0].matches(DynNode, Finder, &Result))
438  *Builder = std::move(Result);
439  return true;
440 }
441 
442 inline static
443 std::vector<std::string> vectorFromRefs(ArrayRef<const StringRef *> NameRefs) {
444  std::vector<std::string> Names;
445  Names.reserve(NameRefs.size());
446  for (auto *Name : NameRefs)
447  Names.emplace_back(*Name);
448  return Names;
449 }
450 
451 Matcher<NamedDecl> hasAnyNameFunc(ArrayRef<const StringRef *> NameRefs) {
452  return internal::Matcher<NamedDecl>(
453  new internal::HasNameMatcher(vectorFromRefs(NameRefs)));
454 }
455 
456 Matcher<ObjCMessageExpr> hasAnySelectorFunc(
457  ArrayRef<const StringRef *> NameRefs) {
458  return hasAnySelectorMatcher(vectorFromRefs(NameRefs));
459 }
460 
462  return HasOpNameMatcher(vectorFromRefs(NameRefs));
463 }
464 
465 HasOverloadOpNameMatcher
467  return HasOverloadOpNameMatcher(vectorFromRefs(NameRefs));
468 }
469 
470 HasNameMatcher::HasNameMatcher(std::vector<std::string> N)
471  : UseUnqualifiedMatch(llvm::all_of(
472  N, [](StringRef Name) { return Name.find("::") == Name.npos; })),
473  Names(std::move(N)) {
474 #ifndef NDEBUG
475  for (StringRef Name : Names)
476  assert(!Name.empty());
477 #endif
478 }
479 
480 static bool consumeNameSuffix(StringRef &FullName, StringRef Suffix) {
481  StringRef Name = FullName;
482  if (!Name.endswith(Suffix))
483  return false;
484  Name = Name.drop_back(Suffix.size());
485  if (!Name.empty()) {
486  if (!Name.endswith("::"))
487  return false;
488  Name = Name.drop_back(2);
489  }
490  FullName = Name;
491  return true;
492 }
493 
494 static StringRef getNodeName(const NamedDecl &Node,
495  llvm::SmallString<128> &Scratch) {
496  // Simple name.
497  if (Node.getIdentifier())
498  return Node.getName();
499 
500  if (Node.getDeclName()) {
501  // Name needs to be constructed.
502  Scratch.clear();
503  llvm::raw_svector_ostream OS(Scratch);
504  Node.printName(OS);
505  return OS.str();
506  }
507 
508  return "(anonymous)";
509 }
510 
511 static StringRef getNodeName(const RecordDecl &Node,
512  llvm::SmallString<128> &Scratch) {
513  if (Node.getIdentifier()) {
514  return Node.getName();
515  }
516  Scratch.clear();
517  return ("(anonymous " + Node.getKindName() + ")").toStringRef(Scratch);
518 }
519 
520 static StringRef getNodeName(const NamespaceDecl &Node,
521  llvm::SmallString<128> &Scratch) {
522  return Node.isAnonymousNamespace() ? "(anonymous namespace)" : Node.getName();
523 }
524 
525 namespace {
526 
527 class PatternSet {
528 public:
529  PatternSet(ArrayRef<std::string> Names) {
530  Patterns.reserve(Names.size());
531  for (StringRef Name : Names)
532  Patterns.push_back({Name, Name.startswith("::")});
533  }
534 
535  /// Consumes the name suffix from each pattern in the set and removes the ones
536  /// that didn't match.
537  /// Return true if there are still any patterns left.
538  bool consumeNameSuffix(StringRef NodeName, bool CanSkip) {
539  for (size_t I = 0; I < Patterns.size();) {
541  NodeName) ||
542  CanSkip) {
543  ++I;
544  } else {
545  Patterns.erase(Patterns.begin() + I);
546  }
547  }
548  return !Patterns.empty();
549  }
550 
551  /// Check if any of the patterns are a match.
552  /// A match will be a pattern that was fully consumed, that also matches the
553  /// 'fully qualified' requirement.
554  bool foundMatch(bool AllowFullyQualified) const {
555  return llvm::any_of(Patterns, [&](const Pattern &Pattern) {
556  return Pattern.P.empty() &&
557  (AllowFullyQualified || !Pattern.IsFullyQualified);
558  });
559  }
560 
561 private:
562  struct Pattern {
563  StringRef P;
565  };
566 
568 };
569 
570 } // namespace
571 
572 bool HasNameMatcher::matchesNodeUnqualified(const NamedDecl &Node) const {
573  assert(UseUnqualifiedMatch);
574  llvm::SmallString<128> Scratch;
575  StringRef NodeName = getNodeName(Node, Scratch);
576  return llvm::any_of(Names, [&](StringRef Name) {
577  return consumeNameSuffix(Name, NodeName) && Name.empty();
578  });
579 }
580 
581 bool HasNameMatcher::matchesNodeFullFast(const NamedDecl &Node) const {
582  PatternSet Patterns(Names);
583  llvm::SmallString<128> Scratch;
584 
585  // This function is copied and adapted from NamedDecl::printQualifiedName()
586  // By matching each part individually we optimize in a couple of ways:
587  // - We can exit early on the first failure.
588  // - We can skip inline/anonymous namespaces without another pass.
589  // - We print one name at a time, reducing the chance of overflowing the
590  // inlined space of the SmallString.
591 
592  // First, match the name.
593  if (!Patterns.consumeNameSuffix(getNodeName(Node, Scratch),
594  /*CanSkip=*/false))
595  return false;
596 
597  // Try to match each declaration context.
598  // We are allowed to skip anonymous and inline namespaces if they don't match.
599  const DeclContext *Ctx = Node.getDeclContext();
600 
601  if (Ctx->isFunctionOrMethod())
602  return Patterns.foundMatch(/*AllowFullyQualified=*/false);
603 
604  for (; Ctx; Ctx = Ctx->getParent()) {
605  // Linkage Spec can just be ignored
606  // FIXME: Any other DeclContext kinds that can be safely disregarded
607  if (isa<LinkageSpecDecl>(Ctx))
608  continue;
609  if (!isa<NamedDecl>(Ctx))
610  break;
611  if (Patterns.foundMatch(/*AllowFullyQualified=*/false))
612  return true;
613 
614  if (const auto *ND = dyn_cast<NamespaceDecl>(Ctx)) {
615  // If it matches (or we can skip it), continue.
616  if (Patterns.consumeNameSuffix(getNodeName(*ND, Scratch),
617  /*CanSkip=*/ND->isAnonymousNamespace() ||
618  ND->isInline()))
619  continue;
620  return false;
621  }
622  if (const auto *RD = dyn_cast<RecordDecl>(Ctx)) {
623  if (!isa<ClassTemplateSpecializationDecl>(Ctx)) {
624  if (Patterns.consumeNameSuffix(getNodeName(*RD, Scratch),
625  /*CanSkip=*/false))
626  continue;
627 
628  return false;
629  }
630  }
631 
632  // We don't know how to deal with this DeclContext.
633  // Fallback to the slow version of the code.
634  return matchesNodeFullSlow(Node);
635  }
636 
637  return Patterns.foundMatch(/*AllowFullyQualified=*/true);
638 }
639 
640 bool HasNameMatcher::matchesNodeFullSlow(const NamedDecl &Node) const {
641  const bool SkipUnwrittenCases[] = {false, true};
642  for (bool SkipUnwritten : SkipUnwrittenCases) {
643  llvm::SmallString<128> NodeName = StringRef("::");
644  llvm::raw_svector_ostream OS(NodeName);
645 
646  PrintingPolicy Policy = Node.getASTContext().getPrintingPolicy();
647  Policy.SuppressUnwrittenScope = SkipUnwritten;
648  Policy.SuppressInlineNamespace = SkipUnwritten;
649  Node.printQualifiedName(OS, Policy);
650 
651  const StringRef FullName = OS.str();
652 
653  for (const StringRef Pattern : Names) {
654  if (Pattern.startswith("::")) {
655  if (FullName == Pattern)
656  return true;
657  } else if (FullName.endswith(Pattern) &&
658  FullName.drop_back(Pattern.size()).endswith("::")) {
659  return true;
660  }
661  }
662  }
663 
664  return false;
665 }
666 
667 bool HasNameMatcher::matchesNode(const NamedDecl &Node) const {
668  assert(matchesNodeFullFast(Node) == matchesNodeFullSlow(Node));
669  if (UseUnqualifiedMatch) {
670  assert(matchesNodeUnqualified(Node) == matchesNodeFullFast(Node));
671  return matchesNodeUnqualified(Node);
672  }
673  return matchesNodeFullFast(Node);
674 }
675 
676 // Checks whether \p Loc points to a token with source text of \p TokenText.
677 static bool isTokenAtLoc(const SourceManager &SM, const LangOptions &LangOpts,
678  StringRef Text, SourceLocation Loc) {
679  llvm::SmallString<16> Buffer;
680  bool Invalid = false;
681  // Since `Loc` may point into an expansion buffer, which has no corresponding
682  // source, we need to look at the spelling location to read the actual source.
683  StringRef TokenText = Lexer::getSpelling(SM.getSpellingLoc(Loc), Buffer, SM,
684  LangOpts, &Invalid);
685  return !Invalid && Text == TokenText;
686 }
687 
689 getExpansionLocOfMacro(StringRef MacroName, SourceLocation Loc,
690  const ASTContext &Context) {
691  auto &SM = Context.getSourceManager();
692  const LangOptions &LangOpts = Context.getLangOpts();
693  while (Loc.isMacroID()) {
694  SrcMgr::ExpansionInfo Expansion =
695  SM.getSLocEntry(SM.getFileID(Loc)).getExpansion();
696  if (Expansion.isMacroArgExpansion())
697  // Check macro argument for an expansion of the given macro. For example,
698  // `F(G(3))`, where `MacroName` is `G`.
700  MacroName, Expansion.getSpellingLoc(), Context))
701  return ArgLoc;
702  Loc = Expansion.getExpansionLocStart();
703  if (isTokenAtLoc(SM, LangOpts, MacroName, Loc))
704  return Loc;
705  }
706  return llvm::None;
707 }
708 
709 std::shared_ptr<llvm::Regex> createAndVerifyRegex(StringRef Regex,
710  llvm::Regex::RegexFlags Flags,
711  StringRef MatcherID) {
712  assert(!Regex.empty() && "Empty regex string");
713  auto SharedRegex = std::make_shared<llvm::Regex>(Regex, Flags);
715  if (!SharedRegex->isValid(Error)) {
716  llvm::WithColor::error()
717  << "building matcher '" << MatcherID << "': " << Error << "\n";
718  llvm::WithColor::note() << " input was '" << Regex << "'\n";
719  }
720  return SharedRegex;
721 }
722 } // end namespace internal
723 
724 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAutoreleasePoolStmt>
726 const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
728 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl> typedefDecl;
729 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
731 const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl> typeAliasDecl;
732 const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
734 const internal::VariadicAllOfMatcher<Decl> decl;
735 const internal::VariadicDynCastAllOfMatcher<Decl, DecompositionDecl> decompositionDecl;
736 const internal::VariadicDynCastAllOfMatcher<Decl, BindingDecl> bindingDecl;
737 const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
739 const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl;
740 const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl> labelDecl;
741 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl> namespaceDecl;
742 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
744 const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl> recordDecl;
745 const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl> cxxRecordDecl;
746 const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
748 const internal::VariadicDynCastAllOfMatcher<Decl,
751 const internal::VariadicDynCastAllOfMatcher<
754 const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
756 const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl> parmVarDecl;
757 const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
759 const internal::VariadicAllOfMatcher<CXXBaseSpecifier> cxxBaseSpecifier;
760 const internal::VariadicAllOfMatcher<CXXCtorInitializer> cxxCtorInitializer;
761 const internal::VariadicAllOfMatcher<TemplateArgument> templateArgument;
762 const internal::VariadicAllOfMatcher<TemplateArgumentLoc> templateArgumentLoc;
763 const internal::VariadicAllOfMatcher<TemplateName> templateName;
764 const internal::VariadicDynCastAllOfMatcher<Decl, NonTypeTemplateParmDecl>
766 const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
768 const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTemplateParmDecl>
770 
771 const internal::VariadicAllOfMatcher<QualType> qualType;
772 const internal::VariadicAllOfMatcher<Type> type;
773 const internal::VariadicAllOfMatcher<TypeLoc> typeLoc;
774 const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryExprOrTypeTraitExpr>
776 const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl> valueDecl;
777 const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
779 const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
781 const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl> enumDecl;
782 const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
784 const internal::VariadicDynCastAllOfMatcher<Decl, TagDecl> tagDecl;
785 const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl> cxxMethodDecl;
786 const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
788 const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl;
789 const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> fieldDecl;
790 const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
792 const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl> functionDecl;
793 const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
795 const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl> friendDecl;
796 const internal::VariadicAllOfMatcher<Stmt> stmt;
797 const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt> declStmt;
798 const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr> memberExpr;
799 const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
801 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDependentScopeMemberExpr>
803 const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr> callExpr;
804 const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr> lambdaExpr;
805 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
807 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
809 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
811 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
813 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
815 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
817 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
819 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
821 const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
823 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl> objcIvarDecl;
824 const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
826 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
828 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt> objcTryStmt;
829 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
831 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
833 const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
835 const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr> initListExpr;
836 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStdInitializerListExpr>
838 const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
840 const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr> parenListExpr;
841 const internal::VariadicDynCastAllOfMatcher<Stmt, SubstNonTypeTemplateParmExpr>
843 const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl> usingDecl;
844 const internal::VariadicDynCastAllOfMatcher<Decl, UsingEnumDecl> usingEnumDecl;
845 const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
847 const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
849 const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingValueDecl>
851 const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingTypenameDecl>
853 const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr> constantExpr;
854 const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr> parenExpr;
855 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
857 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXUnresolvedConstructExpr>
859 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr> cxxThisExpr;
860 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
862 const internal::VariadicDynCastAllOfMatcher<Stmt, MaterializeTemporaryExpr>
864 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr> cxxNewExpr;
865 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr> cxxDeleteExpr;
866 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNoexceptExpr>
868 const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
870 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
872 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
874 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXRewrittenBinaryOperator>
876 const internal::VariadicDynCastAllOfMatcher<Stmt, Expr> expr;
877 const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr> declRefExpr;
878 const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr> objcIvarRefExpr;
879 const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr> blockExpr;
880 const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt> ifStmt;
881 const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt> forStmt;
882 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
884 const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt> whileStmt;
885 const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt> doStmt;
886 const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt> breakStmt;
887 const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt> continueStmt;
888 const internal::VariadicDynCastAllOfMatcher<Stmt, CoreturnStmt> coreturnStmt;
889 const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt> returnStmt;
890 const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt> gotoStmt;
891 const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt> labelStmt;
892 const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr> addrLabelExpr;
893 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt> switchStmt;
894 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase> switchCase;
895 const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt> caseStmt;
896 const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt> defaultStmt;
897 const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt> compoundStmt;
898 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt> cxxCatchStmt;
899 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt> cxxTryStmt;
900 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr> cxxThrowExpr;
901 const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt> nullStmt;
902 const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt> asmStmt;
903 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
905 const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral> stringLiteral;
906 const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
908 const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
910 const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral> floatLiteral;
911 const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral> imaginaryLiteral;
912 const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
914 const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
916 const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
918 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
920 const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr> chooseExpr;
921 const internal::VariadicDynCastAllOfMatcher<Stmt, CoawaitExpr>
923 const internal::VariadicDynCastAllOfMatcher<Stmt, DependentCoawaitExpr>
925 const internal::VariadicDynCastAllOfMatcher<Stmt, CoyieldExpr>
927 const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr> gnuNullExpr;
928 const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr>
930 const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr> atomicExpr;
931 const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr> stmtExpr;
932 const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
934 const internal::MapAnyOfMatcher<BinaryOperator, CXXOperatorCallExpr,
937 const internal::MapAnyOfMatcher<CallExpr, CXXConstructExpr> invocation;
938 const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator> unaryOperator;
939 const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
941 const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryConditionalOperator>
943 const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
945 const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
947 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
949 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
951 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
953 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
955 const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
957 const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
959 const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
961 const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr> castExpr;
962 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
964 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
966 const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
968 const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
970 const internal::VariadicOperatorMatcherFunc<
972  eachOf = {internal::DynTypedMatcher::VO_EachOf};
973 const internal::VariadicOperatorMatcherFunc<
975  anyOf = {internal::DynTypedMatcher::VO_AnyOf};
976 const internal::VariadicOperatorMatcherFunc<
978  allOf = {internal::DynTypedMatcher::VO_AllOf};
979 const internal::VariadicOperatorMatcherFunc<1, 1> optionally = {
980  internal::DynTypedMatcher::VO_Optionally};
981 const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
984 
985 const internal::VariadicFunction<internal::HasOpNameMatcher, StringRef,
988 const internal::VariadicFunction<internal::HasOverloadOpNameMatcher, StringRef,
991 const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>, StringRef,
994 const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher> has = {};
995 const internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher>
997 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher> forEach =
998  {};
999 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachDescendantMatcher>
1001 const internal::ArgumentAdaptingMatcherFunc<
1002  internal::HasParentMatcher,
1003  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
1004  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
1006 const internal::ArgumentAdaptingMatcherFunc<
1007  internal::HasAncestorMatcher,
1008  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
1009  internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
1011 const internal::VariadicOperatorMatcherFunc<1, 1> unless = {
1012  internal::DynTypedMatcher::VO_UnaryNot};
1013 const internal::VariadicAllOfMatcher<NestedNameSpecifier> nestedNameSpecifier;
1014 const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
1016 const internal::VariadicAllOfMatcher<Attr> attr;
1017 const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
1052 AST_TYPELOC_TRAVERSE_MATCHER_DEF(hasElementType,
1054  ComplexType));
1058  pointee,
1061 
1062 const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
1064 const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
1066 const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
1068 
1069 } // end namespace ast_matchers
1070 } // end namespace clang
clang::ast_matchers::hasParent
const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > hasParent
Matches AST nodes that have a parent that matches the provided matcher.
Definition: ASTMatchersInternal.cpp:1005
clang::ast_matchers::enumConstantDecl
const internal::VariadicDynCastAllOfMatcher< Decl, EnumConstantDecl > enumConstantDecl
Matches enum constants.
Definition: ASTMatchersInternal.cpp:783
clang::ast_matchers::internal::consumeNameSuffix
static bool consumeNameSuffix(StringRef &FullName, StringRef Suffix)
Definition: ASTMatchersInternal.cpp:480
clang::ast_matchers::decompositionDecl
const internal::VariadicDynCastAllOfMatcher< Decl, DecompositionDecl > decompositionDecl
Matches decomposition-declarations.
Definition: ASTMatchersInternal.cpp:735
clang::ast_matchers::substTemplateTypeParmType
const AstTypeMatcher< SubstTemplateTypeParmType > substTemplateTypeParmType
Matches types that represent the result of substituting a type for a template type parameter.
Definition: ASTMatchersInternal.cpp:1048
clang::ast_matchers::stmtExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, StmtExpr > stmtExpr
Matches statement expression (GNU extension).
Definition: ASTMatchersInternal.cpp:931
clang::TraversalKind
TraversalKind
Defines how we descend a level in the AST when we pass through expressions.
Definition: ASTTypeTraits.h:37
clang::ast_matchers::invocation
const internal::MapAnyOfMatcher< CallExpr, CXXConstructExpr > invocation
Matches function calls and constructor calls.
Definition: ASTMatchersInternal.cpp:937
clang::ast_matchers::internal::getExpansionLocOfMacro
llvm::Optional< SourceLocation > getExpansionLocOfMacro(StringRef MacroName, SourceLocation Loc, const ASTContext &Context)
Definition: ASTMatchersInternal.cpp:689
max
__DEVICE__ int max(int __a, int __b)
Definition: __clang_cuda_math.h:196
clang::ast_matchers::templateTemplateParmDecl
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTemplateParmDecl > templateTemplateParmDecl
Matches template template parameter declarations.
Definition: ASTMatchersInternal.cpp:769
clang::ast_matchers::switchCase
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchCase > switchCase
Matches case and default statements inside switch statements.
Definition: ASTMatchersInternal.cpp:894
clang::ast_matchers::hasAnyName
const internal::VariadicFunction< internal::Matcher< NamedDecl >, StringRef, internal::hasAnyNameFunc > hasAnyName
Matches NamedDecl nodes that have any of the specified names.
Definition: ASTMatchersInternal.cpp:983
llvm
Definition: Dominators.h:30
clang::ast_matchers::imaginaryLiteral
const internal::VariadicDynCastAllOfMatcher< Stmt, ImaginaryLiteral > imaginaryLiteral
Matches imaginary literals, which are based on integer and floating point literals e....
Definition: ASTMatchersInternal.cpp:911
clang::ast_matchers::userDefinedLiteral
const internal::VariadicDynCastAllOfMatcher< Stmt, UserDefinedLiteral > userDefinedLiteral
Matches user defined literal operator call.
Definition: ASTMatchersInternal.cpp:915
clang::ast_matchers::initListExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > initListExpr
Matches init list expressions.
Definition: ASTMatchersInternal.cpp:835
clang::ast_matchers::blockExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, BlockExpr > blockExpr
Matches a reference to a block.
Definition: ASTMatchersInternal.cpp:879
Error
llvm::Error Error
Definition: ByteCodeEmitter.cpp:20
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::ast_matchers::stmt
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
Definition: ASTMatchersInternal.cpp:796
clang::ast_matchers::cxxBaseSpecifier
const internal::VariadicAllOfMatcher< CXXBaseSpecifier > cxxBaseSpecifier
Matches class bases.
Definition: ASTMatchersInternal.cpp:759
clang::ast_matchers::lValueReferenceType
const AstTypeMatcher< LValueReferenceType > lValueReferenceType
Matches lvalue reference types.
Definition: ASTMatchersInternal.cpp:1039
clang::ast_matchers::stringLiteral
const internal::VariadicDynCastAllOfMatcher< Stmt, StringLiteral > stringLiteral
Matches string literals (also matches wide string literals).
Definition: ASTMatchersInternal.cpp:905
clang::SrcMgr::ExpansionInfo::isMacroArgExpansion
bool isMacroArgExpansion() const
Definition: SourceManager.h:386
clang::Lexer::getSpelling
static unsigned getSpelling(const Token &Tok, const char *&Buffer, const SourceManager &SourceMgr, const LangOptions &LangOpts, bool *Invalid=nullptr)
getSpelling - This method is used to get the spelling of a token into a preallocated buffer,...
Definition: Lexer.cpp:400
clang::ast_matchers::anyOf
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> anyOf
Matches if any of the given matchers matches.
Definition: ASTMatchersInternal.cpp:975
clang::ast_matchers::cxxFunctionalCastExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFunctionalCastExpr > cxxFunctionalCastExpr
Matches functional cast expressions.
Definition: ASTMatchersInternal.cpp:963
llvm::SmallVector
Definition: LLVM.h:38
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::ast_matchers::cxxThrowExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThrowExpr > cxxThrowExpr
Matches throw expressions.
Definition: ASTMatchersInternal.cpp:900
clang::ast_matchers::nestedNameSpecifierLoc
const internal::VariadicAllOfMatcher< NestedNameSpecifierLoc > nestedNameSpecifierLoc
Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
Definition: ASTMatchersInternal.cpp:1015
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::ast_matchers::declaratorDecl
const internal::VariadicDynCastAllOfMatcher< Decl, DeclaratorDecl > declaratorDecl
Matches declarator declarations (field, variable, function and non-type template parameter declaratio...
Definition: ASTMatchersInternal.cpp:755
clang::ast_matchers::genericSelectionExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, GenericSelectionExpr > genericSelectionExpr
Matches C11 _Generic expression.
Definition: ASTMatchersInternal.cpp:929
clang::ast_matchers::unaryTransformType
const AstTypeMatcher< UnaryTransformType > unaryTransformType
Matches types nodes representing unary type transformations.
Definition: ASTMatchersInternal.cpp:1044
clang::ast_matchers::type
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchersInternal.cpp:772
clang::ast_matchers::cxxCtorInitializer
const internal::VariadicAllOfMatcher< CXXCtorInitializer > cxxCtorInitializer
Matches constructor initializers.
Definition: ASTMatchersInternal.cpp:760
clang::ast_matchers::memberExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, MemberExpr > memberExpr
Matches member expressions.
Definition: ASTMatchersInternal.cpp:798
clang::ast_matchers::objcThrowStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtThrowStmt > objcThrowStmt
Matches Objective-C @throw statements.
Definition: ASTMatchersInternal.cpp:827
clang::ast_matchers::designatedInitExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, DesignatedInitExpr > designatedInitExpr
Matches C99 designated initializer expressions [C99 6.7.8].
Definition: ASTMatchersInternal.cpp:969
clang::ast_matchers::hasAnyOverloadedOperatorName
const internal::VariadicFunction< internal::PolymorphicMatcher< internal::HasOverloadedOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl), std::vector< std::string > >, StringRef, internal::hasAnyOverloadedOperatorNameFunc > hasAnyOverloadedOperatorName
Matches overloaded operator names.
Definition: ASTMatchersInternal.cpp:990
clang::ast_matchers::internal::isTokenAtLoc
static bool isTokenAtLoc(const SourceManager &SM, const LangOptions &LangOpts, StringRef Text, SourceLocation Loc)
Definition: ASTMatchersInternal.cpp:677
clang::ast_matchers::allOf
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> allOf
Matches if all given matchers match.
Definition: ASTMatchersInternal.cpp:978
clang::ast_matchers::unresolvedUsingTypenameDecl
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingTypenameDecl > unresolvedUsingTypenameDecl
Matches unresolved using value declarations that involve the typename.
Definition: ASTMatchersInternal.cpp:852
clang::ast_matchers::AstTypeMatcher
internal::VariadicDynCastAllOfMatcher< Type, NodeType > AstTypeMatcher
Definition: ASTMatchers.h:6363
clang::ast_matchers::templateTypeParmDecl
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTypeParmDecl > templateTypeParmDecl
Matches template type parameter declarations.
Definition: ASTMatchersInternal.cpp:767
clang::ast_matchers::decltypeType
const AstTypeMatcher< DecltypeType > decltypeType
Matches types nodes representing C++11 decltype(<expr>) types.
Definition: ASTMatchersInternal.cpp:1030
llvm::Optional
Definition: LLVM.h:40
clang::ast_matchers::explicitCastExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ExplicitCastExpr > explicitCastExpr
Matches explicit cast expressions.
Definition: ASTMatchersInternal.cpp:958
clang::ast_matchers::tagType
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
Definition: ASTMatchersInternal.cpp:1046
clang::ast_matchers::internal::hasAnyOverloadedOperatorNameFunc
HasOverloadOpNameMatcher hasAnyOverloadedOperatorNameFunc(ArrayRef< const StringRef * > NameRefs)
Definition: ASTMatchersInternal.cpp:466
clang::ast_matchers::returnStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ReturnStmt > returnStmt
Matches return statements.
Definition: ASTMatchersInternal.cpp:889
clang::ast_matchers::functionProtoType
const AstTypeMatcher< FunctionProtoType > functionProtoType
Matches FunctionProtoType nodes.
Definition: ASTMatchersInternal.cpp:1032
clang::ast_matchers::internal::hasAnyNameFunc
Matcher< NamedDecl > hasAnyNameFunc(ArrayRef< const StringRef * > NameRefs)
Definition: ASTMatchersInternal.cpp:451
clang::ast_matchers::internal::anyOfVariadicOperator
static bool anyOfVariadicOperator(const DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef< DynTypedMatcher > InnerMatchers)
Definition: ASTMatchersInternal.cpp:415
clang::ast_matchers::cxxConstructorDecl
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConstructorDecl > cxxConstructorDecl
Matches C++ constructor declarations.
Definition: ASTMatchersInternal.cpp:778
clang::ast_matchers::deducedTemplateSpecializationType
const AstTypeMatcher< DeducedTemplateSpecializationType > deducedTemplateSpecializationType
Matches C++17 deduced template specialization types, e.g.
Definition: ASTMatchersInternal.cpp:1024
clang::ClassTemplatePartialSpecializationDecl
Definition: DeclTemplate.h:2071
clang::ast_matchers::ompDefaultClause
const internal::VariadicDynCastAllOfMatcher< OMPClause, OMPDefaultClause > ompDefaultClause
Matches OpenMP default clause.
Definition: ASTMatchersInternal.cpp:1065
clang::ast_matchers::implicitValueInitExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitValueInitExpr > implicitValueInitExpr
Matches implicit initializers of init list expressions.
Definition: ASTMatchersInternal.cpp:839
clang::ast_matchers::constantExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ConstantExpr > constantExpr
Matches a constant expression wrapper.
Definition: ASTMatchersInternal.cpp:853
clang::ast_matchers::objcInterfaceDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCInterfaceDecl > objcInterfaceDecl
Matches Objective-C interface declarations.
Definition: ASTMatchersInternal.cpp:810
clang::ast_matchers::cxxTryStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTryStmt > cxxTryStmt
Matches try statements.
Definition: ASTMatchersInternal.cpp:899
clang::ast_matchers::valueDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ValueDecl > valueDecl
Matches any value declaration.
Definition: ASTMatchersInternal.cpp:776
clang::ast_matchers::materializeTemporaryExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, MaterializeTemporaryExpr > materializeTemporaryExpr
Matches nodes where temporaries are materialized.
Definition: ASTMatchersInternal.cpp:863
clang::ast_matchers::blockDecl
const internal::VariadicDynCastAllOfMatcher< Decl, BlockDecl > blockDecl
Matches block declarations.
Definition: ASTMatchersInternal.cpp:822
clang::ast_matchers::rValueReferenceType
const AstTypeMatcher< RValueReferenceType > rValueReferenceType
Matches rvalue reference types.
Definition: ASTMatchersInternal.cpp:1040
clang::ast_matchers::opaqueValueExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, OpaqueValueExpr > opaqueValueExpr
Matches opaque value expressions.
Definition: ASTMatchersInternal.cpp:944
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:626
clang::ast_matchers::floatLiteral
const internal::VariadicDynCastAllOfMatcher< Stmt, FloatingLiteral > floatLiteral
Matches float literals of all sizes / encodings, e.g.
Definition: ASTMatchersInternal.cpp:910
clang::ast_matchers::labelStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, LabelStmt > labelStmt
Matches label statements.
Definition: ASTMatchersInternal.cpp:891
MatcherID
DynTypedMatcher::MatcherIDType MatcherID
Definition: ASTMatchFinder.cpp:66
Decl.h
ParentMapContext.h
clang::ast_matchers::cxxDeleteExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDeleteExpr > cxxDeleteExpr
Matches delete expressions.
Definition: ASTMatchersInternal.cpp:865
clang::ast_matchers::templateName
const internal::VariadicAllOfMatcher< TemplateName > templateName
Matches template name.
Definition: ASTMatchersInternal.cpp:763
clang::ast_matchers::forEachDescendant
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachDescendantMatcher > forEachDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher.
Definition: ASTMatchersInternal.cpp:1000
clang::ast_matchers::cxxBoolLiteral
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBoolLiteralExpr > cxxBoolLiteral
Matches bool literals.
Definition: ASTMatchersInternal.cpp:904
clang::ast_matchers::cxxForRangeStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXForRangeStmt > cxxForRangeStmt
Matches range-based for statements.
Definition: ASTMatchersInternal.cpp:883
clang::ast_matchers::typeLoc
const internal::VariadicAllOfMatcher< TypeLoc > typeLoc
Matches TypeLocs in the clang AST.
Definition: ASTMatchersInternal.cpp:773
clang::ast_matchers::forEach
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachMatcher > forEach
Matches AST nodes that have child AST nodes that match the provided matcher.
Definition: ASTMatchersInternal.cpp:997
PrettyPrinter.h
clang::ast_matchers::cxxOperatorCallExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > cxxOperatorCallExpr
Matches overloaded operator calls.
Definition: ASTMatchersInternal.cpp:873
clang::ast_matchers::objcPropertyDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCPropertyDecl > objcPropertyDecl
Matches Objective-C property declarations.
Definition: ASTMatchersInternal.cpp:825
clang::ast_matchers::unresolvedUsingValueDecl
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingValueDecl > unresolvedUsingValueDecl
Matches unresolved using value declarations.
Definition: ASTMatchersInternal.cpp:850
clang::ast_matchers::atomicType
const AstTypeMatcher< AtomicType > atomicType
Matches atomic types.
Definition: ASTMatchersInternal.cpp:1028
clang::ast_matchers::expr
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchersInternal.cpp:876
clang::ast_matchers::cxxDependentScopeMemberExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDependentScopeMemberExpr > cxxDependentScopeMemberExpr
Matches member expressions where the actual member referenced could not be resolved because the base ...
Definition: ASTMatchersInternal.cpp:802
clang::ast_matchers::attr
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
Definition: ASTMatchersInternal.cpp:1016
clang::ast_matchers::templateArgument
const internal::VariadicAllOfMatcher< TemplateArgument > templateArgument
Matches template arguments.
Definition: ASTMatchersInternal.cpp:761
DeclTemplate.h
clang::ast_matchers::objcIvarRefExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCIvarRefExpr > objcIvarRefExpr
Matches a reference to an ObjCIvar.
Definition: ASTMatchersInternal.cpp:878
clang::ast_matchers::tagDecl
const internal::VariadicDynCastAllOfMatcher< Decl, TagDecl > tagDecl
Matches tag declarations.
Definition: ASTMatchersInternal.cpp:784
clang::ast_matchers::objcCategoryDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryDecl > objcCategoryDecl
Matches Objective-C category declarations.
Definition: ASTMatchersInternal.cpp:816
clang::CXXRewrittenBinaryOperator
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:284
clang::ast_matchers::usingDecl
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDecl > usingDecl
Matches using declarations.
Definition: ASTMatchersInternal.cpp:843
clang::ast_matchers::substNonTypeTemplateParmExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, SubstNonTypeTemplateParmExpr > substNonTypeTemplateParmExpr
Matches substitutions of non-type template parameters.
Definition: ASTMatchersInternal.cpp:842
clang::ast_matchers::objcFinallyStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtFinallyStmt > objcFinallyStmt
Matches Objective-C @finally statements.
Definition: ASTMatchersInternal.cpp:832
Node
DynTypedNode Node
Definition: ASTMatchFinder.cpp:67
clang::ast_matchers::internal::eachOfVariadicOperator
static bool eachOfVariadicOperator(const DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef< DynTypedMatcher > InnerMatchers)
Definition: ASTMatchersInternal.cpp:398
clang::BinaryOperator
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3803
clang::ast_matchers::functionType
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
Definition: ASTMatchersInternal.cpp:1031
clang::SrcMgr::ExpansionInfo
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded,...
Definition: SourceManager.h:347
clang::ast_matchers::cxxUnresolvedConstructExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXUnresolvedConstructExpr > cxxUnresolvedConstructExpr
Matches unresolved constructor call expressions.
Definition: ASTMatchersInternal.cpp:858
clang::ast_matchers::builtinType
const AstTypeMatcher< BuiltinType > builtinType
Matches builtin Types.
Definition: ASTMatchersInternal.cpp:1019
clang::ast_matchers::namespaceAliasDecl
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceAliasDecl > namespaceAliasDecl
Matches a declaration of a namespace alias.
Definition: ASTMatchersInternal.cpp:743
clang::ast_matchers::bindingDecl
const internal::VariadicDynCastAllOfMatcher< Decl, BindingDecl > bindingDecl
Matches binding declarations Example matches foo and bar (matcher = bindingDecl()
Definition: ASTMatchersInternal.cpp:736
clang::ast_matchers::enumDecl
const internal::VariadicDynCastAllOfMatcher< Decl, EnumDecl > enumDecl
Matches enum declarations.
Definition: ASTMatchersInternal.cpp:781
clang::ast_matchers::internal::createAndVerifyRegex
std::shared_ptr< llvm::Regex > createAndVerifyRegex(StringRef Regex, llvm::Regex::RegexFlags Flags, StringRef MatcherID)
Definition: ASTMatchersInternal.cpp:709
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:211
ASTMatchers.h
clang::ast_matchers::objcProtocolDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCProtocolDecl > objcProtocolDecl
Matches Objective-C protocol declarations.
Definition: ASTMatchersInternal.cpp:814
clang::ArrayType
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2883
clang::ast_matchers::switchStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchStmt > switchStmt
Matches switch statements.
Definition: ASTMatchersInternal.cpp:893
clang::ast_matchers::cxxReinterpretCastExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXReinterpretCastExpr > cxxReinterpretCastExpr
Matches a reinterpret_cast expression.
Definition: ASTMatchersInternal.cpp:948
clang::ast_matchers::cxxThisExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThisExpr > cxxThisExpr
Matches implicit and explicit this expressions.
Definition: ASTMatchersInternal.cpp:859
clang::ast_matchers::breakStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, BreakStmt > breakStmt
Matches break statements.
Definition: ASTMatchersInternal.cpp:886
clang::ast_matchers::cxxMethodDecl
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > cxxMethodDecl
Matches method declarations.
Definition: ASTMatchersInternal.cpp:785
clang::ast_matchers::unaryExprOrTypeTraitExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryExprOrTypeTraitExpr > unaryExprOrTypeTraitExpr
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
Definition: ASTMatchersInternal.cpp:775
clang::ast_matchers::cxxNullPtrLiteralExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNullPtrLiteralExpr > cxxNullPtrLiteralExpr
Matches nullptr literal.
Definition: ASTMatchersInternal.cpp:919
clang::ast_matchers::internal::notUnaryOperator
static bool notUnaryOperator(const DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef< DynTypedMatcher > InnerMatchers)
Definition: ASTMatchersInternal.cpp:365
clang::ast_matchers::cxxStdInitializerListExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStdInitializerListExpr > cxxStdInitializerListExpr
Matches C++ initializer list expressions.
Definition: ASTMatchersInternal.cpp:837
clang::ast_matchers::usingDirectiveDecl
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDirectiveDecl > usingDirectiveDecl
Matches using namespace declarations.
Definition: ASTMatchersInternal.cpp:846
clang::ast_matchers::chooseExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ChooseExpr > chooseExpr
Matches GNU __builtin_choose_expr.
Definition: ASTMatchersInternal.cpp:920
clang::ast_matchers::whileStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, WhileStmt > whileStmt
Matches while statements.
Definition: ASTMatchersInternal.cpp:884
clang::ast_matchers::hasAnySelector
const internal::VariadicFunction< internal::Matcher< ObjCMessageExpr >, StringRef, internal::hasAnySelectorFunc > hasAnySelector
Matches when at least one of the supplied string equals to the Selector.getAsString()
Definition: ASTMatchersInternal.cpp:993
clang::ast_matchers::typedefType
const AstTypeMatcher< TypedefType > typedefType
Matches typedef types.
Definition: ASTMatchersInternal.cpp:1041
clang::ast_matchers::linkageSpecDecl
const internal::VariadicDynCastAllOfMatcher< Decl, LinkageSpecDecl > linkageSpecDecl
Matches a declaration of a linkage specification.
Definition: ASTMatchersInternal.cpp:738
clang::ast_matchers::nestedNameSpecifier
const internal::VariadicAllOfMatcher< NestedNameSpecifier > nestedNameSpecifier
Matches nested name specifiers.
Definition: ASTMatchersInternal.cpp:1013
clang::ast_matchers::binaryOperation
const internal::MapAnyOfMatcher< BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator > binaryOperation
Matches nodes which can be used with binary operators.
Definition: ASTMatchersInternal.cpp:936
clang::SrcMgr::ExpansionInfo::getSpellingLoc
SourceLocation getSpellingLoc() const
Definition: SourceManager.h:365
clang::ast_matchers::asmStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, AsmStmt > asmStmt
Matches asm statements.
Definition: ASTMatchersInternal.cpp:902
clang::diff::DynTypedNode
DynTypedNode DynTypedNode
Definition: ASTDiffInternal.h:18
clang::ast_matchers::cxxConstCastExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstCastExpr > cxxConstCastExpr
Matches a const_cast expression.
Definition: ASTMatchersInternal.cpp:954
llvm::SmallString< 128 >
clang::ast_matchers::nonTypeTemplateParmDecl
const internal::VariadicDynCastAllOfMatcher< Decl, NonTypeTemplateParmDecl > nonTypeTemplateParmDecl
Matches non-type template parameter declarations.
Definition: ASTMatchersInternal.cpp:765
bool
#define bool
Definition: stdbool.h:15
ASTContext.h
clang::ast_matchers::atomicExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, AtomicExpr > atomicExpr
Matches atomic builtins.
Definition: ASTMatchersInternal.cpp:930
clang::ast_matchers::coyieldExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CoyieldExpr > coyieldExpr
Matches co_yield expressions.
Definition: ASTMatchersInternal.cpp:926
clang::ast_matchers::cxxMemberCallExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > cxxMemberCallExpr
Matches member call expressions.
Definition: ASTMatchersInternal.cpp:806
ASTMatchersInternal.h
clang::ast_matchers::ifStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, IfStmt > ifStmt
Matches if statements.
Definition: ASTMatchersInternal.cpp:880
clang::ast_matchers::memberPointerType
const AstTypeMatcher< MemberPointerType > memberPointerType
Matches member pointer types.
Definition: ASTMatchersInternal.cpp:1035
clang::ast_matchers::cxxRewrittenBinaryOperator
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXRewrittenBinaryOperator > cxxRewrittenBinaryOperator
Matches rewritten binary operators.
Definition: ASTMatchersInternal.cpp:875
clang::ast_matchers::binaryOperator
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryOperator > binaryOperator
Matches binary operator expressions.
Definition: ASTMatchersInternal.cpp:933
clang::ast_matchers::namespaceDecl
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceDecl > namespaceDecl
Matches a declaration of a namespace.
Definition: ASTMatchersInternal.cpp:741
clang::ast_matchers::labelDecl
const internal::VariadicDynCastAllOfMatcher< Decl, LabelDecl > labelDecl
Matches a declaration of label.
Definition: ASTMatchersInternal.cpp:740
clang::ast_matchers::parenListExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenListExpr > parenListExpr
Matches paren list expressions.
Definition: ASTMatchersInternal.cpp:840
clang::ast_matchers::nullStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, NullStmt > nullStmt
Matches null statements.
Definition: ASTMatchersInternal.cpp:901
clang::ast_matchers::autoreleasePoolStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAutoreleasePoolStmt > autoreleasePoolStmt
Matches an Objective-C autorelease pool statement.
Definition: ASTMatchersInternal.cpp:725
clang::ast_matchers::objcCatchStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtCatchStmt > objcCatchStmt
Matches Objective-C @catch statements.
Definition: ASTMatchersInternal.cpp:830
clang::ast_matchers::usingEnumDecl
const internal::VariadicDynCastAllOfMatcher< Decl, UsingEnumDecl > usingEnumDecl
Matches using-enum declarations.
Definition: ASTMatchersInternal.cpp:844
clang::ast_matchers::unless
const internal::VariadicOperatorMatcherFunc< 1, 1 > unless
Matches if the provided matcher does not match.
Definition: ASTMatchersInternal.cpp:1011
clang::BlockPointerType
Pointer to a block type.
Definition: Type.h:2720
BoundNodes
BoundNodesTreeBuilder BoundNodes
Definition: ASTMatchFinder.cpp:68
clang::ast_matchers::doStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, DoStmt > doStmt
Matches do statements.
Definition: ASTMatchersInternal.cpp:885
clang::ast_matchers::arrayType
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
Definition: ASTMatchersInternal.cpp:1020
clang::ObjCMessageExpr
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:940
clang::ast_matchers::internal::allOfVariadicOperator
static bool allOfVariadicOperator(const DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef< DynTypedMatcher > InnerMatchers)
Definition: ASTMatchersInternal.cpp:386
clang::ast_matchers::objcImplementationDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCImplementationDecl > objcImplementationDecl
Matches Objective-C implementation declarations.
Definition: ASTMatchersInternal.cpp:812
clang::ast_matchers::functionTemplateDecl
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionTemplateDecl > functionTemplateDecl
Matches C++ function template declarations.
Definition: ASTMatchersInternal.cpp:794
clang::ast_matchers::typedefNameDecl
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefNameDecl > typedefNameDecl
Matches typedef name declarations.
Definition: ASTMatchersInternal.cpp:730
AST_POLYMORPHIC_SUPPORTED_TYPES
#define AST_POLYMORPHIC_SUPPORTED_TYPES(...)
Construct a type-list to be passed to the AST_POLYMORPHIC_MATCHER* macros.
Definition: ASTMatchersMacros.h:221
clang::ast_matchers::parenExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenExpr > parenExpr
Matches parentheses used in expressions.
Definition: ASTMatchersInternal.cpp:854
clang::ast_matchers::cStyleCastExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CStyleCastExpr > cStyleCastExpr
Matches a C-style cast expression.
Definition: ASTMatchersInternal.cpp:956
clang::ast_matchers::hasAncestor
const internal::ArgumentAdaptingMatcherFunc< internal::HasAncestorMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > hasAncestor
Matches AST nodes that have an ancestor that matches the provided matcher.
Definition: ASTMatchersInternal.cpp:1010
clang::ast_matchers::gnuNullExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, GNUNullExpr > gnuNullExpr
Matches GNU __null expression.
Definition: ASTMatchersInternal.cpp:927
clang::ast_matchers::exprWithCleanups
const internal::VariadicDynCastAllOfMatcher< Stmt, ExprWithCleanups > exprWithCleanups
Matches expressions that introduce cleanups to be run at the end of the sub-expression's evaluation.
Definition: ASTMatchersInternal.cpp:834
clang::ast_matchers::translationUnitDecl
const internal::VariadicDynCastAllOfMatcher< Decl, TranslationUnitDecl > translationUnitDecl
Matches the top declaration context.
Definition: ASTMatchersInternal.cpp:727
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
clang::ast_matchers::eachOf
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> eachOf
Matches if any of the given matchers matches.
Definition: ASTMatchersInternal.cpp:972
clang::ast_matchers::autoType
const AstTypeMatcher< AutoType > autoType
Matches types nodes representing C++11 auto types.
Definition: ASTMatchersInternal.cpp:1029
clang::ast_matchers::decl
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
Definition: ASTMatchersInternal.cpp:734
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::ast_matchers::unaryOperator
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > unaryOperator
Matches unary operator expressions.
Definition: ASTMatchersInternal.cpp:938
clang::ast_matchers::typedefDecl
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > typedefDecl
Matches typedef declarations.
Definition: ASTMatchersInternal.cpp:728
clang::ast_matchers::variableArrayType
const AstTypeMatcher< VariableArrayType > variableArrayType
Matches C arrays with a specified size that is not an integer-constant-expression.
Definition: ASTMatchersInternal.cpp:1027
clang::ast_matchers::objcTryStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtTryStmt > objcTryStmt
Matches Objective-C @try statements.
Definition: ASTMatchersInternal.cpp:828
clang::ast_matchers::compoundStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundStmt > compoundStmt
Matches compound statements.
Definition: ASTMatchersInternal.cpp:897
clang::ast_matchers::friendDecl
const internal::VariadicDynCastAllOfMatcher< Decl, FriendDecl > friendDecl
Matches friend declarations.
Definition: ASTMatchersInternal.cpp:795
clang::ast_matchers::gotoStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, GotoStmt > gotoStmt
Matches goto statements.
Definition: ASTMatchersInternal.cpp:890
clang::ast_matchers::objcIvarDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCIvarDecl > objcIvarDecl
Matches Objective-C instance variable declarations.
Definition: ASTMatchersInternal.cpp:823
clang::ComplexType
Complex values, per C99 6.2.5p11.
Definition: Type.h:2587
clang::ast_matchers::castExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
Definition: ASTMatchersInternal.cpp:961
clang::ast_matchers::incompleteArrayType
const AstTypeMatcher< IncompleteArrayType > incompleteArrayType
Matches C arrays with unspecified size.
Definition: ASTMatchersInternal.cpp:1026
clang::SrcMgr::ExpansionInfo::getExpansionLocStart
SourceLocation getExpansionLocStart() const
Definition: SourceManager.h:369
clang::ast_matchers::typeAliasDecl
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasDecl > typeAliasDecl
Matches type alias declarations.
Definition: ASTMatchersInternal.cpp:731
clang::ast_matchers::predefinedExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, PredefinedExpr > predefinedExpr
Matches predefined identifier expressions [C99 6.4.2.2].
Definition: ASTMatchersInternal.cpp:967
llvm::ArrayRef
Definition: LLVM.h:34
clang::ast_matchers::objcCategoryImplDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryImplDecl > objcCategoryImplDecl
Matches Objective-C category definitions.
Definition: ASTMatchersInternal.cpp:818
Lexer.h
clang::ast_matchers::cxxDynamicCastExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDynamicCastExpr > cxxDynamicCastExpr
Matches a dynamic_cast expression.
Definition: ASTMatchersInternal.cpp:952
clang::ast_matchers::compoundLiteralExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundLiteralExpr > compoundLiteralExpr
Matches compound (i.e.
Definition: ASTMatchersInternal.cpp:917
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
clang::ast_matchers::objcMessageExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCMessageExpr > objcMessageExpr
Matches ObjectiveC Message invocation expressions.
Definition: ASTMatchersInternal.cpp:808
clang::ast_matchers::dependentCoawaitExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, DependentCoawaitExpr > dependentCoawaitExpr
Matches co_await expressions where the type of the promise is dependent.
Definition: ASTMatchersInternal.cpp:924
clang::ast_matchers::recordDecl
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
Definition: ASTMatchersInternal.cpp:744
clang::ast_matchers::cxxStaticCastExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStaticCastExpr > cxxStaticCastExpr
Matches a C++ static_cast expression.
Definition: ASTMatchersInternal.cpp:950
clang::ast_matchers::blockPointerType
const AstTypeMatcher< BlockPointerType > blockPointerType
Matches block pointer types, i.e.
Definition: ASTMatchersInternal.cpp:1034
LLVM.h
clang::ast_matchers::cxxDestructorDecl
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDestructorDecl > cxxDestructorDecl
Matches explicit C++ destructor declarations.
Definition: ASTMatchersInternal.cpp:780
clang::ast_matchers::cxxCatchStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXCatchStmt > cxxCatchStmt
Matches catch statements.
Definition: ASTMatchersInternal.cpp:898
clang::ast_matchers::complexType
const AstTypeMatcher< ComplexType > complexType
Matches C99 complex types.
Definition: ASTMatchersInternal.cpp:1021
clang::ast_matchers::arraySubscriptExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ArraySubscriptExpr > arraySubscriptExpr
Matches array subscript expressions.
Definition: ASTMatchersInternal.cpp:869
clang::TK_IgnoreUnlessSpelledInSource
@ TK_IgnoreUnlessSpelledInSource
Ignore AST nodes not written in the source.
Definition: ASTTypeTraits.h:42
clang::ast_matchers::characterLiteral
const internal::VariadicDynCastAllOfMatcher< Stmt, CharacterLiteral > characterLiteral
Matches character literals (also matches wchar_t).
Definition: ASTMatchersInternal.cpp:907
clang::ast_matchers::hasDescendant
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > hasDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher.
Definition: ASTMatchersInternal.cpp:996
clang::ast_matchers::internal::getNodeName
static StringRef getNodeName(const NamespaceDecl &Node, llvm::SmallString< 128 > &Scratch)
Definition: ASTMatchersInternal.cpp:520
clang::ast_matchers::internal::optionallyVariadicOperator
static bool optionallyVariadicOperator(const DynTypedNode &DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, ArrayRef< DynTypedMatcher > InnerMatchers)
Definition: ASTMatchersInternal.cpp:430
clang::ast_matchers::callExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
Definition: ASTMatchersInternal.cpp:803
clang::ast_matchers::cxxDefaultArgExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDefaultArgExpr > cxxDefaultArgExpr
Matches the value of a default argument at the call site.
Definition: ASTMatchersInternal.cpp:871
ASTTypeTraits.h
clang::ast_matchers::addrLabelExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, AddrLabelExpr > addrLabelExpr
Matches address of label statements (GNU extension).
Definition: ASTMatchersInternal.cpp:892
clang::threadSafety::sx::matches
bool matches(const til::SExpr *E1, const til::SExpr *E2)
Definition: ThreadSafetyCommon.h:67
clang::ast_matchers::internal::hasAnyOperatorNameFunc
HasOpNameMatcher hasAnyOperatorNameFunc(ArrayRef< const StringRef * > NameRefs)
Definition: ASTMatchersInternal.cpp:461
clang::SourceLocation::isMacroID
bool isMacroID() const
Definition: SourceLocation.h:105
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang::MemberPointerType
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2831
clang::ast_matchers::internal::matchesAnyBase
bool matchesAnyBase(const CXXRecordDecl &Node, const Matcher< CXXBaseSpecifier > &BaseSpecMatcher, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder)
Definition: ASTMatchersInternal.cpp:77
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::ast_matchers::functionDecl
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionDecl > functionDecl
Matches function declarations.
Definition: ASTMatchersInternal.cpp:792
clang::ast_matchers::indirectFieldDecl
const internal::VariadicDynCastAllOfMatcher< Decl, IndirectFieldDecl > indirectFieldDecl
Matches indirect field declarations.
Definition: ASTMatchersInternal.cpp:791
clang::ast_matchers::internal::hasAnySelectorFunc
Matcher< ObjCMessageExpr > hasAnySelectorFunc(ArrayRef< const StringRef * > NameRefs)
Definition: ASTMatchersInternal.cpp:456
clang::ast_matchers::declRefExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > declRefExpr
Matches expressions that refer to declarations.
Definition: ASTMatchersInternal.cpp:877
std
Definition: Format.h:3899
clang::PointerType
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition: Type.h:2640
clang::ast_matchers::pointerType
const AstTypeMatcher< PointerType > pointerType
Matches pointer types, but does not match Objective-C object pointer types.
Definition: ASTMatchersInternal.cpp:1036
clang::ast_matchers::recordType
const AstTypeMatcher< RecordType > recordType
Matches record types (e.g.
Definition: ASTMatchersInternal.cpp:1045
clang::ast_matchers::hasAnyOperatorName
const internal::VariadicFunction< internal::PolymorphicMatcher< internal::HasAnyOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator, UnaryOperator), std::vector< std::string > >, StringRef, internal::hasAnyOperatorNameFunc > hasAnyOperatorName
Matches operator expressions (binary or unary) that have any of the specified names.
Definition: ASTMatchersInternal.cpp:987
clang::ast_matchers::decayedType
const AstTypeMatcher< DecayedType > decayedType
Matches decayed type Example matches i[] in declaration of f.
Definition: ASTMatchersInternal.cpp:1051
clang::ast_matchers::optionally
const internal::VariadicOperatorMatcherFunc< 1, 1 > optionally
Matches any node regardless of the submatcher.
Definition: ASTMatchersInternal.cpp:979
clang::Builtin::ID
ID
Definition: Builtins.h:48
clang::CXXBasePath
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
Definition: CXXInheritance.h:70
AST_TYPELOC_TRAVERSE_MATCHER_DEF
#define AST_TYPELOC_TRAVERSE_MATCHER_DEF(MatcherName, ReturnTypesF)
Definition: ASTMatchersMacros.h:419
clang::ast_matchers::binaryConditionalOperator
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryConditionalOperator > binaryConditionalOperator
Matches binary conditional operator expressions (GNU extension).
Definition: ASTMatchersInternal.cpp:942
IsFullyQualified
bool IsFullyQualified
Definition: ASTMatchersInternal.cpp:564
clang
Definition: CalledOnceCheck.h:17
Text
StringRef Text
Definition: Format.cpp:2334
clang::ast_matchers::fixedPointLiteral
const internal::VariadicDynCastAllOfMatcher< Stmt, FixedPointLiteral > fixedPointLiteral
Matches fixed point literals.
Definition: ASTMatchersInternal.cpp:913
clang::syntax::NodeKind
NodeKind
A kind of a syntax node, used for implementing casts.
Definition: Nodes.h:37
clang::ast_matchers::referenceType
const AstTypeMatcher< ReferenceType > referenceType
Matches both lvalue and rvalue reference types.
Definition: ASTMatchersInternal.cpp:1038
clang::ast_matchers::typeAliasTemplateDecl
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasTemplateDecl > typeAliasTemplateDecl
Matches type alias template declarations.
Definition: ASTMatchersInternal.cpp:733
clang::ast_matchers::classTemplateSpecializationDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateSpecializationDecl > classTemplateSpecializationDecl
Matches C++ class template specializations.
Definition: ASTMatchersInternal.cpp:750
clang::ast_matchers::defaultStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, DefaultStmt > defaultStmt
Matches default statements inside switch statements.
Definition: ASTMatchersInternal.cpp:896
clang::ast_matchers::cxxNewExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNewExpr > cxxNewExpr
Matches new expressions.
Definition: ASTMatchersInternal.cpp:864
clang::ast_matchers::injectedClassNameType
const AstTypeMatcher< InjectedClassNameType > injectedClassNameType
Matches injected class name types.
Definition: ASTMatchersInternal.cpp:1050
clang::ast_matchers::caseStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, CaseStmt > caseStmt
Matches case statements inside switch statements.
Definition: ASTMatchersInternal.cpp:895
clang::ast_matchers::elaboratedType
const AstTypeMatcher< ElaboratedType > elaboratedType
Matches types specified with an elaborated type keyword or with a qualified name.
Definition: ASTMatchersInternal.cpp:1047
clang::ast_matchers::objcMethodDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCMethodDecl > objcMethodDecl
Matches Objective-C method declarations.
Definition: ASTMatchersInternal.cpp:820
clang::ast_matchers::forStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ForStmt > forStmt
Matches for statements.
Definition: ASTMatchersInternal.cpp:881
clang::ast_matchers::dependentSizedArrayType
const AstTypeMatcher< DependentSizedArrayType > dependentSizedArrayType
Matches C++ arrays whose size is a value-dependent expression.
Definition: ASTMatchersInternal.cpp:1025
clang::CXXBaseSpecifier
Represents a base class of a C++ class.
Definition: DeclCXX.h:147
clang::ast_matchers::classTemplatePartialSpecializationDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplatePartialSpecializationDecl > classTemplatePartialSpecializationDecl
Matches C++ class template partial specializations.
Definition: ASTMatchersInternal.cpp:753
clang::ast_matchers::namedDecl
const internal::VariadicDynCastAllOfMatcher< Decl, NamedDecl > namedDecl
Matches a declaration of anything that could have a name.
Definition: ASTMatchersInternal.cpp:739
clang::ast_matchers::lambdaExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, LambdaExpr > lambdaExpr
Matches lambda expressions.
Definition: ASTMatchersInternal.cpp:804
clang::ast_matchers::accessSpecDecl
const internal::VariadicDynCastAllOfMatcher< Decl, AccessSpecDecl > accessSpecDecl
Matches C++ access specifier declarations.
Definition: ASTMatchersInternal.cpp:758
clang::ast_matchers::cxxTemporaryObjectExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTemporaryObjectExpr > cxxTemporaryObjectExpr
Matches functional cast expressions having N != 1 arguments.
Definition: ASTMatchersInternal.cpp:965
clang::ast_matchers::unresolvedMemberExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedMemberExpr > unresolvedMemberExpr
Matches unresolved member expressions.
Definition: ASTMatchersInternal.cpp:800
clang::ast_matchers::coawaitExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CoawaitExpr > coawaitExpr
Matches co_await expressions.
Definition: ASTMatchersInternal.cpp:922
clang::ast_matchers::ompExecutableDirective
const internal::VariadicDynCastAllOfMatcher< Stmt, OMPExecutableDirective > ompExecutableDirective
Matches any #pragma omp executable directive.
Definition: ASTMatchersInternal.cpp:1063
clang::CXXBasePaths
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Definition: CXXInheritance.h:117
clang::DynTypedNode
A dynamically typed AST node container.
Definition: ASTTypeTraits.h:238
clang::ast_matchers::unresolvedLookupExpr
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...
Definition: ASTMatchersInternal.cpp:848
clang::ReferenceType
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2751
clang::ast_matchers::cxxRecordDecl
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > cxxRecordDecl
Matches C++ class declarations.
Definition: ASTMatchersInternal.cpp:745
clang::ast_matchers::cudaKernelCallExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > cudaKernelCallExpr
Matches CUDA kernel call expression.
Definition: ASTMatchersInternal.cpp:1018
clang::AtomicType
Definition: Type.h:6243
clang::ast_matchers::cxxNoexceptExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNoexceptExpr > cxxNoexceptExpr
Matches noexcept expressions.
Definition: ASTMatchersInternal.cpp:867
clang::ast_matchers::internal::vectorFromRefs
static std::vector< std::string > vectorFromRefs(ArrayRef< const StringRef * > NameRefs)
Definition: ASTMatchersInternal.cpp:443
clang::ast_matchers::staticAssertDecl
const internal::VariadicDynCastAllOfMatcher< Decl, StaticAssertDecl > staticAssertDecl
Matches a C++ static_assert declaration.
Definition: ASTMatchersInternal.cpp:946
clang::ASTNodeKind::getMostDerivedType
static ASTNodeKind getMostDerivedType(ASTNodeKind Kind1, ASTNodeKind Kind2)
Return the most derived type between Kind1 and Kind2.
Definition: ASTTypeTraits.cpp:83
clang::ast_matchers::integerLiteral
const internal::VariadicDynCastAllOfMatcher< Stmt, IntegerLiteral > integerLiteral
Matches integer literals of all sizes / encodings, e.g.
Definition: ASTMatchersInternal.cpp:909
clang::ast_matchers::cxxConversionDecl
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConversionDecl > cxxConversionDecl
Matches conversion operator declarations.
Definition: ASTMatchersInternal.cpp:787
clang::ast_matchers::enumType
const AstTypeMatcher< EnumType > enumType
Matches enum types.
Definition: ASTMatchersInternal.cpp:1042
SM
#define SM(sm)
Definition: Cuda.cpp:78
clang::ast_matchers::cxxConstructExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstructExpr > cxxConstructExpr
Matches constructor call expressions (including implicit ones).
Definition: ASTMatchersInternal.cpp:856
clang::ast_matchers::objcObjectPointerType
const AstTypeMatcher< ObjCObjectPointerType > objcObjectPointerType
Matches an Objective-C object pointer type, which is different from a pointer type,...
Definition: ASTMatchersInternal.cpp:1037
clang::ast_matchers::templateArgumentLoc
const internal::VariadicAllOfMatcher< TemplateArgumentLoc > templateArgumentLoc
Matches template arguments (with location info).
Definition: ASTMatchersInternal.cpp:762
clang::ast_matchers::varDecl
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
Definition: ASTMatchersInternal.cpp:788
clang::ast_matchers::has
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > has
Matches AST nodes that have child AST nodes that match the provided matcher.
Definition: ASTMatchersInternal.cpp:994
clang::ast_matchers::cxxBindTemporaryExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBindTemporaryExpr > cxxBindTemporaryExpr
Matches nodes where temporaries are created.
Definition: ASTMatchersInternal.cpp:861
clang::ClassTemplateSpecializationDecl
Represents a class template specialization, which refers to a class template with a given set of temp...
Definition: DeclTemplate.h:1799
clang::ast_matchers::templateTypeParmType
const AstTypeMatcher< TemplateTypeParmType > templateTypeParmType
Matches template type parameter types.
Definition: ASTMatchersInternal.cpp:1049
clang::ast_matchers::implicitCastExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitCastExpr > implicitCastExpr
Matches the implicit cast nodes of Clang's AST.
Definition: ASTMatchersInternal.cpp:960
clang::ast_matchers::declStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclStmt > declStmt
Matches declaration statements.
Definition: ASTMatchersInternal.cpp:797
clang::NamespaceDecl
Represent a C++ namespace.
Definition: Decl.h:542
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3859
clang::CXXOperatorCallExpr
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:82
clang::ast_matchers::fieldDecl
const internal::VariadicDynCastAllOfMatcher< Decl, FieldDecl > fieldDecl
Matches field declarations.
Definition: ASTMatchersInternal.cpp:789
clang::ast_matchers::classTemplateDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateDecl > classTemplateDecl
Matches C++ class template declarations.
Definition: ASTMatchersInternal.cpp:747
clang::ast_matchers::parmVarDecl
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > parmVarDecl
Matches parameter variable declarations.
Definition: ASTMatchersInternal.cpp:756
clang::ast_matchers::templateSpecializationType
const AstTypeMatcher< TemplateSpecializationType > templateSpecializationType
Matches template specialization types.
Definition: ASTMatchersInternal.cpp:1043
clang::ast_matchers::conditionalOperator
const internal::VariadicDynCastAllOfMatcher< Stmt, ConditionalOperator > conditionalOperator
Matches conditional operator expressions.
Definition: ASTMatchersInternal.cpp:940
clang::ast_matchers::constantArrayType
const AstTypeMatcher< ConstantArrayType > constantArrayType
Matches C arrays with a specified constant size.
Definition: ASTMatchersInternal.cpp:1022
llvm::IntrusiveRefCntPtr
Definition: LLVM.h:47
clang::ast_matchers::continueStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, ContinueStmt > continueStmt
Matches continue statements.
Definition: ASTMatchersInternal.cpp:887
clang::ast_matchers::coreturnStmt
const internal::VariadicDynCastAllOfMatcher< Stmt, CoreturnStmt > coreturnStmt
Matches co_return statements.
Definition: ASTMatchersInternal.cpp:888
clang::ento::ObjKind::OS
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
clang::ast_matchers::cxxDeductionGuideDecl
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDeductionGuideDecl > cxxDeductionGuideDecl
Matches user-defined and implicitly generated deduction guide.
Definition: ASTMatchersInternal.cpp:1067
clang::ast_matchers::AST_MATCHER_P
AST_MATCHER_P(FieldDecl, hasBitWidth, unsigned, Width)
Matches non-static data members that are bit-fields of the specified bit width.
Definition: ASTMatchers.h:707
clang::ast_matchers::qualType
const internal::VariadicAllOfMatcher< QualType > qualType
Matches QualTypes in the clang AST.
Definition: ASTMatchersInternal.cpp:771
clang::ast_matchers::parenType
const AstTypeMatcher< ParenType > parenType
Matches ParenType nodes.
Definition: ASTMatchersInternal.cpp:1033