clang  11.0.0git
Registry.cpp
Go to the documentation of this file.
1 //===- Registry.cpp - Matcher registry ------------------------------------===//
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 /// \file
10 /// Registry map populated at static initialization time.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "Marshallers.h"
20 #include "llvm/ADT/Optional.h"
21 #include "llvm/ADT/STLExtras.h"
22 #include "llvm/ADT/StringMap.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/Support/ManagedStatic.h"
25 #include "llvm/Support/raw_ostream.h"
26 #include <cassert>
27 #include <iterator>
28 #include <memory>
29 #include <set>
30 #include <string>
31 #include <utility>
32 #include <vector>
33 
34 using namespace clang::ast_type_traits;
35 
36 namespace clang {
37 namespace ast_matchers {
38 namespace dynamic {
39 
40 namespace {
41 
42 using internal::MatcherDescriptor;
43 
44 using ConstructorMap =
45  llvm::StringMap<std::unique_ptr<const MatcherDescriptor>>;
46 
47 class RegistryMaps {
48 public:
49  RegistryMaps();
50  ~RegistryMaps();
51 
52  const ConstructorMap &constructors() const { return Constructors; }
53 
54 private:
55  void registerMatcher(StringRef MatcherName,
56  std::unique_ptr<MatcherDescriptor> Callback);
57 
58  ConstructorMap Constructors;
59 };
60 
61 } // namespace
62 
63 void RegistryMaps::registerMatcher(
64  StringRef MatcherName, std::unique_ptr<MatcherDescriptor> Callback) {
65  assert(Constructors.find(MatcherName) == Constructors.end());
66  Constructors[MatcherName] = std::move(Callback);
67 }
68 
69 #define REGISTER_MATCHER(name) \
70  registerMatcher(#name, internal::makeMatcherAutoMarshall( \
71  ::clang::ast_matchers::name, #name));
72 
73 #define REGISTER_MATCHER_OVERLOAD(name) \
74  registerMatcher(#name, \
75  std::make_unique<internal::OverloadedMatcherDescriptor>(name##Callbacks))
76 
77 #define SPECIFIC_MATCHER_OVERLOAD(name, Id) \
78  static_cast<::clang::ast_matchers::name##_Type##Id>( \
79  ::clang::ast_matchers::name)
80 
81 #define MATCHER_OVERLOAD_ENTRY(name, Id) \
82  internal::makeMatcherAutoMarshall(SPECIFIC_MATCHER_OVERLOAD(name, Id), \
83  #name)
84 
85 #define REGISTER_OVERLOADED_2(name) \
86  do { \
87  std::unique_ptr<MatcherDescriptor> name##Callbacks[] = { \
88  MATCHER_OVERLOAD_ENTRY(name, 0), \
89  MATCHER_OVERLOAD_ENTRY(name, 1)}; \
90  REGISTER_MATCHER_OVERLOAD(name); \
91  } while (false)
92 
93 /// Generate a registry map with all the known matchers.
94 /// Please keep sorted alphabetically!
95 RegistryMaps::RegistryMaps() {
96  // TODO: Here is the list of the missing matchers, grouped by reason.
97  //
98  // Polymorphic + argument overload:
99  // findAll
100  //
101  // Other:
102  // equalsNode
103 
104  REGISTER_OVERLOADED_2(callee);
105  REGISTER_OVERLOADED_2(hasAnyCapture);
106  REGISTER_OVERLOADED_2(hasPrefix);
107  REGISTER_OVERLOADED_2(hasType);
108  REGISTER_OVERLOADED_2(ignoringParens);
109  REGISTER_OVERLOADED_2(isDerivedFrom);
110  REGISTER_OVERLOADED_2(isDirectlyDerivedFrom);
111  REGISTER_OVERLOADED_2(isSameOrDerivedFrom);
113  REGISTER_OVERLOADED_2(pointsTo);
114  REGISTER_OVERLOADED_2(references);
115  REGISTER_OVERLOADED_2(thisPointerType);
116 
117  std::unique_ptr<MatcherDescriptor> equalsCallbacks[] = {
121  };
123 
130  REGISTER_MATCHER(argumentCountIs);
133  REGISTER_MATCHER(asString);
144  REGISTER_MATCHER(booleanType);
161  REGISTER_MATCHER(containsDeclaration);
197  REGISTER_MATCHER(declCountIs);
206  REGISTER_MATCHER(designatorCountIs);
213  REGISTER_MATCHER(equalsBoundNode);
214  REGISTER_MATCHER(equalsIntegralValue);
221  REGISTER_MATCHER(forEachArgumentWithParam);
222  REGISTER_MATCHER(isAtPosition);
223  REGISTER_MATCHER(forEachConstructorInitializer);
225  REGISTER_MATCHER(forEachOverridden);
226  REGISTER_MATCHER(forEachSwitchCase);
227  REGISTER_MATCHER(forField);
228  REGISTER_MATCHER(forFunction);
239  REGISTER_MATCHER(hasAnyArgument);
240  REGISTER_MATCHER(hasAnyBase);
241  REGISTER_MATCHER(hasAnyClause);
242  REGISTER_MATCHER(hasAnyConstructorInitializer);
243  REGISTER_MATCHER(hasAnyDeclaration);
247  REGISTER_MATCHER(hasAnyParameter);
248  REGISTER_MATCHER(hasAnyPlacementArg);
250  REGISTER_MATCHER(hasAnySubstatement);
251  REGISTER_MATCHER(hasAnyTemplateArgument);
252  REGISTER_MATCHER(hasAnyUsingShadowDecl);
253  REGISTER_MATCHER(hasArgument);
254  REGISTER_MATCHER(hasArgumentOfType);
255  REGISTER_MATCHER(hasArraySize);
257  REGISTER_MATCHER(hasAutomaticStorageDuration);
258  REGISTER_MATCHER(hasBase);
259  REGISTER_MATCHER(hasBitWidth);
260  REGISTER_MATCHER(hasBody);
261  REGISTER_MATCHER(hasCanonicalType);
262  REGISTER_MATCHER(hasCaseConstant);
263  REGISTER_MATCHER(hasCastKind);
264  REGISTER_MATCHER(hasCondition);
265  REGISTER_MATCHER(hasConditionVariableStatement);
266  REGISTER_MATCHER(hasDecayedType);
267  REGISTER_MATCHER(hasDeclContext);
269  REGISTER_MATCHER(hasDeducedType);
270  REGISTER_MATCHER(hasDefaultArgument);
273  REGISTER_MATCHER(hasDestinationType);
274  REGISTER_MATCHER(hasDynamicExceptionSpec);
276  REGISTER_MATCHER(hasElementType);
277  REGISTER_MATCHER(hasElse);
278  REGISTER_MATCHER(hasExplicitSpecifier);
279  REGISTER_MATCHER(hasExternalFormalLinkage);
280  REGISTER_MATCHER(hasFalseExpression);
281  REGISTER_MATCHER(hasGlobalStorage);
282  REGISTER_MATCHER(hasImplicitDestinationType);
283  REGISTER_MATCHER(hasInClassInitializer);
284  REGISTER_MATCHER(hasIncrement);
285  REGISTER_MATCHER(hasIndex);
286  REGISTER_MATCHER(hasInit);
287  REGISTER_MATCHER(hasInitializer);
288  REGISTER_MATCHER(hasInitStatement);
289  REGISTER_MATCHER(hasKeywordSelector);
290  REGISTER_MATCHER(hasLHS);
291  REGISTER_MATCHER(hasLocalQualifiers);
292  REGISTER_MATCHER(hasLocalStorage);
293  REGISTER_MATCHER(hasLoopInit);
294  REGISTER_MATCHER(hasLoopVariable);
295  REGISTER_MATCHER(hasMethod);
297  REGISTER_MATCHER(hasNullSelector);
298  REGISTER_MATCHER(hasObjectExpression);
300  REGISTER_MATCHER(hasOperatorName);
302  REGISTER_MATCHER(hasParameter);
304  REGISTER_MATCHER(hasQualifier);
305  REGISTER_MATCHER(hasRHS);
306  REGISTER_MATCHER(hasRangeInit);
307  REGISTER_MATCHER(hasReceiver);
308  REGISTER_MATCHER(hasReceiverType);
309  REGISTER_MATCHER(hasReplacementType);
310  REGISTER_MATCHER(hasReturnValue);
311  REGISTER_MATCHER(hasPlacementArg);
312  REGISTER_MATCHER(hasSelector);
313  REGISTER_MATCHER(hasSingleDecl);
314  REGISTER_MATCHER(hasSize);
315  REGISTER_MATCHER(hasSizeExpr);
316  REGISTER_MATCHER(hasSourceExpression);
317  REGISTER_MATCHER(hasSpecializedTemplate);
318  REGISTER_MATCHER(hasStaticStorageDuration);
319  REGISTER_MATCHER(hasStructuredBlock);
320  REGISTER_MATCHER(hasSyntacticForm);
321  REGISTER_MATCHER(hasTargetDecl);
322  REGISTER_MATCHER(hasTemplateArgument);
323  REGISTER_MATCHER(hasThen);
324  REGISTER_MATCHER(hasThreadStorageDuration);
325  REGISTER_MATCHER(hasTrailingReturn);
326  REGISTER_MATCHER(hasTrueExpression);
327  REGISTER_MATCHER(hasTypeLoc);
328  REGISTER_MATCHER(hasUnaryOperand);
329  REGISTER_MATCHER(hasUnarySelector);
330  REGISTER_MATCHER(hasUnderlyingDecl);
331  REGISTER_MATCHER(hasUnderlyingType);
332  REGISTER_MATCHER(hasUnqualifiedDesugaredType);
333  REGISTER_MATCHER(hasValueType);
335  REGISTER_MATCHER(ignoringElidableConstructorCall);
336  REGISTER_MATCHER(ignoringImpCasts);
337  REGISTER_MATCHER(ignoringImplicit);
338  REGISTER_MATCHER(ignoringParenCasts);
339  REGISTER_MATCHER(ignoringParenImpCasts);
347  REGISTER_MATCHER(innerType);
349  REGISTER_MATCHER(isAllowedToContainClauseKind);
350  REGISTER_MATCHER(isAnonymous);
351  REGISTER_MATCHER(isAnyCharacter);
352  REGISTER_MATCHER(isAnyPointer);
353  REGISTER_MATCHER(isArray);
354  REGISTER_MATCHER(isArrow);
355  REGISTER_MATCHER(isAssignmentOperator);
356  REGISTER_MATCHER(isBaseInitializer);
357  REGISTER_MATCHER(isBitField);
358  REGISTER_MATCHER(isCatchAll);
359  REGISTER_MATCHER(isClass);
360  REGISTER_MATCHER(isClassMessage);
361  REGISTER_MATCHER(isClassMethod);
363  REGISTER_MATCHER(isConst);
364  REGISTER_MATCHER(isConstQualified);
365  REGISTER_MATCHER(isConstexpr);
366  REGISTER_MATCHER(isCopyAssignmentOperator);
367  REGISTER_MATCHER(isCopyConstructor);
368  REGISTER_MATCHER(isDefaultConstructor);
369  REGISTER_MATCHER(isDefaulted);
370  REGISTER_MATCHER(isDefinition);
371  REGISTER_MATCHER(isDelegatingConstructor);
372  REGISTER_MATCHER(isDeleted);
373  REGISTER_MATCHER(isExceptionVariable);
374  REGISTER_MATCHER(isExpansionInFileMatching);
375  REGISTER_MATCHER(isExpansionInMainFile);
376  REGISTER_MATCHER(isExpansionInSystemHeader);
377  REGISTER_MATCHER(isExplicit);
378  REGISTER_MATCHER(isExplicitTemplateSpecialization);
379  REGISTER_MATCHER(isExpr);
381  REGISTER_MATCHER(isFinal);
382  REGISTER_MATCHER(isImplicit);
383  REGISTER_MATCHER(isInStdNamespace);
384  REGISTER_MATCHER(isInTemplateInstantiation);
385  REGISTER_MATCHER(isInline);
386  REGISTER_MATCHER(isInstanceMessage);
388  REGISTER_MATCHER(isInstantiated);
389  REGISTER_MATCHER(isInstantiationDependent);
390  REGISTER_MATCHER(isInteger);
391  REGISTER_MATCHER(isIntegral);
392  REGISTER_MATCHER(isLambda);
393  REGISTER_MATCHER(isListInitialization);
394  REGISTER_MATCHER(isMain);
395  REGISTER_MATCHER(isMemberInitializer);
396  REGISTER_MATCHER(isMoveAssignmentOperator);
397  REGISTER_MATCHER(isMoveConstructor);
398  REGISTER_MATCHER(isNoReturn);
399  REGISTER_MATCHER(isNoThrow);
400  REGISTER_MATCHER(isNoneKind);
401  REGISTER_MATCHER(isOverride);
402  REGISTER_MATCHER(isPrivate);
403  REGISTER_MATCHER(isProtected);
404  REGISTER_MATCHER(isPublic);
405  REGISTER_MATCHER(isPure);
406  REGISTER_MATCHER(isScoped);
407  REGISTER_MATCHER(isSharedKind);
408  REGISTER_MATCHER(isSignedInteger);
409  REGISTER_MATCHER(isStandaloneDirective);
410  REGISTER_MATCHER(isStaticLocal);
411  REGISTER_MATCHER(isStaticStorageClass);
412  REGISTER_MATCHER(isStruct);
414  REGISTER_MATCHER(isTypeDependent);
415  REGISTER_MATCHER(isUnion);
416  REGISTER_MATCHER(isUnsignedInteger);
417  REGISTER_MATCHER(isUserProvided);
418  REGISTER_MATCHER(isValueDependent);
419  REGISTER_MATCHER(isVariadic);
420  REGISTER_MATCHER(isVirtual);
421  REGISTER_MATCHER(isVirtualAsWritten);
422  REGISTER_MATCHER(isVolatileQualified);
423  REGISTER_MATCHER(isWritten);
429  REGISTER_MATCHER(matchesName);
430  REGISTER_MATCHER(matchesSelector);
436  REGISTER_MATCHER(namesType);
442  REGISTER_MATCHER(nullPointerConstant);
444  REGISTER_MATCHER(numSelectorArgs);
460  REGISTER_MATCHER(ofClass);
461  REGISTER_MATCHER(ofKind);
464  REGISTER_MATCHER(on);
465  REGISTER_MATCHER(onImplicitObjectArgument);
468  REGISTER_MATCHER(parameterCountIs);
473  REGISTER_MATCHER(pointee);
478  REGISTER_MATCHER(realFloatingPointType);
482  REGISTER_MATCHER(refersToDeclaration);
483  REGISTER_MATCHER(refersToIntegralType);
484  REGISTER_MATCHER(refersToTemplate);
485  REGISTER_MATCHER(refersToType);
486  REGISTER_MATCHER(requiresZeroInitialization);
488  REGISTER_MATCHER(returns);
490  REGISTER_MATCHER(specifiesNamespace);
491  REGISTER_MATCHER(specifiesType);
492  REGISTER_MATCHER(specifiesTypeLoc);
493  REGISTER_MATCHER(statementCountIs);
505  REGISTER_MATCHER(templateArgumentCountIs);
510  REGISTER_MATCHER(throughUsingDecl);
511  REGISTER_MATCHER(to);
529  REGISTER_MATCHER(usesADL);
535  REGISTER_MATCHER(voidType);
537  REGISTER_MATCHER(withInitializer);
538 }
539 
540 RegistryMaps::~RegistryMaps() = default;
541 
542 static llvm::ManagedStatic<RegistryMaps> RegistryData;
543 
544 // static
545 llvm::Optional<MatcherCtor> Registry::lookupMatcherCtor(StringRef MatcherName) {
546  auto it = RegistryData->constructors().find(MatcherName);
547  return it == RegistryData->constructors().end()
549  : it->second.get();
550 }
551 
552 static llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
553  const std::set<ASTNodeKind> &KS) {
554  unsigned Count = 0;
555  for (std::set<ASTNodeKind>::const_iterator I = KS.begin(), E = KS.end();
556  I != E; ++I) {
557  if (I != KS.begin())
558  OS << "|";
559  if (Count++ == 3) {
560  OS << "...";
561  break;
562  }
563  OS << *I;
564  }
565  return OS;
566 }
567 
568 std::vector<ArgKind> Registry::getAcceptedCompletionTypes(
569  ArrayRef<std::pair<MatcherCtor, unsigned>> Context) {
570  ASTNodeKind InitialTypes[] = {
571  ASTNodeKind::getFromNodeKind<Decl>(),
572  ASTNodeKind::getFromNodeKind<QualType>(),
573  ASTNodeKind::getFromNodeKind<Type>(),
574  ASTNodeKind::getFromNodeKind<Stmt>(),
575  ASTNodeKind::getFromNodeKind<NestedNameSpecifier>(),
576  ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>(),
577  ASTNodeKind::getFromNodeKind<TypeLoc>()};
578 
579  // Starting with the above seed of acceptable top-level matcher types, compute
580  // the acceptable type set for the argument indicated by each context element.
581  std::set<ArgKind> TypeSet(std::begin(InitialTypes), std::end(InitialTypes));
582  for (const auto &CtxEntry : Context) {
583  MatcherCtor Ctor = CtxEntry.first;
584  unsigned ArgNumber = CtxEntry.second;
585  std::vector<ArgKind> NextTypeSet;
586  for (const ArgKind &Kind : TypeSet) {
587  if (Kind.getArgKind() == Kind.AK_Matcher &&
588  Ctor->isConvertibleTo(Kind.getMatcherKind()) &&
589  (Ctor->isVariadic() || ArgNumber < Ctor->getNumArgs()))
590  Ctor->getArgKinds(Kind.getMatcherKind(), ArgNumber, NextTypeSet);
591  }
592  TypeSet.clear();
593  TypeSet.insert(NextTypeSet.begin(), NextTypeSet.end());
594  }
595  return std::vector<ArgKind>(TypeSet.begin(), TypeSet.end());
596 }
597 
598 std::vector<MatcherCompletion>
599 Registry::getMatcherCompletions(ArrayRef<ArgKind> AcceptedTypes) {
600  std::vector<MatcherCompletion> Completions;
601 
602  // Search the registry for acceptable matchers.
603  for (const auto &M : RegistryData->constructors()) {
604  const MatcherDescriptor& Matcher = *M.getValue();
605  StringRef Name = M.getKey();
606 
607  std::set<ASTNodeKind> RetKinds;
608  unsigned NumArgs = Matcher.isVariadic() ? 1 : Matcher.getNumArgs();
609  bool IsPolymorphic = Matcher.isPolymorphic();
610  std::vector<std::vector<ArgKind>> ArgsKinds(NumArgs);
611  unsigned MaxSpecificity = 0;
612  for (const ArgKind& Kind : AcceptedTypes) {
613  if (Kind.getArgKind() != Kind.AK_Matcher)
614  continue;
615  unsigned Specificity;
616  ASTNodeKind LeastDerivedKind;
617  if (Matcher.isConvertibleTo(Kind.getMatcherKind(), &Specificity,
618  &LeastDerivedKind)) {
619  if (MaxSpecificity < Specificity)
620  MaxSpecificity = Specificity;
621  RetKinds.insert(LeastDerivedKind);
622  for (unsigned Arg = 0; Arg != NumArgs; ++Arg)
623  Matcher.getArgKinds(Kind.getMatcherKind(), Arg, ArgsKinds[Arg]);
624  if (IsPolymorphic)
625  break;
626  }
627  }
628 
629  if (!RetKinds.empty() && MaxSpecificity > 0) {
630  std::string Decl;
631  llvm::raw_string_ostream OS(Decl);
632 
633  if (IsPolymorphic) {
634  OS << "Matcher<T> " << Name << "(Matcher<T>";
635  } else {
636  OS << "Matcher<" << RetKinds << "> " << Name << "(";
637  for (const std::vector<ArgKind> &Arg : ArgsKinds) {
638  if (&Arg != &ArgsKinds[0])
639  OS << ", ";
640 
641  bool FirstArgKind = true;
642  std::set<ASTNodeKind> MatcherKinds;
643  // Two steps. First all non-matchers, then matchers only.
644  for (const ArgKind &AK : Arg) {
645  if (AK.getArgKind() == ArgKind::AK_Matcher) {
646  MatcherKinds.insert(AK.getMatcherKind());
647  } else {
648  if (!FirstArgKind) OS << "|";
649  FirstArgKind = false;
650  OS << AK.asString();
651  }
652  }
653  if (!MatcherKinds.empty()) {
654  if (!FirstArgKind) OS << "|";
655  OS << "Matcher<" << MatcherKinds << ">";
656  }
657  }
658  }
659  if (Matcher.isVariadic())
660  OS << "...";
661  OS << ")";
662 
663  std::string TypedText = std::string(Name);
664  TypedText += "(";
665  if (ArgsKinds.empty())
666  TypedText += ")";
667  else if (ArgsKinds[0][0].getArgKind() == ArgKind::AK_String)
668  TypedText += "\"";
669 
670  Completions.emplace_back(TypedText, OS.str(), MaxSpecificity);
671  }
672  }
673 
674  return Completions;
675 }
676 
677 VariantMatcher Registry::constructMatcher(MatcherCtor Ctor,
678  SourceRange NameRange,
680  Diagnostics *Error) {
681  return Ctor->create(NameRange, Args, Error);
682 }
683 
684 VariantMatcher Registry::constructBoundMatcher(MatcherCtor Ctor,
685  SourceRange NameRange,
686  StringRef BindID,
688  Diagnostics *Error) {
689  VariantMatcher Out = constructMatcher(Ctor, NameRange, Args, Error);
690  if (Out.isNull()) return Out;
691 
693  if (Result.hasValue()) {
694  llvm::Optional<DynTypedMatcher> Bound = Result->tryBind(BindID);
695  if (Bound.hasValue()) {
696  return VariantMatcher::SingleMatcher(*Bound);
697  }
698  }
699  Error->addError(NameRange, Error->ET_RegistryNotBindable);
700  return VariantMatcher();
701 }
702 
703 } // namespace dynamic
704 } // namespace ast_matchers
705 } // namespace clang
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThisExpr > cxxThisExpr
Matches implicit and explicit this expressions.
internal::TrueMatcher anything()
Matches any node.
Definition: ASTMatchers.h:164
const internal::VariadicDynCastAllOfMatcher< Decl, NonTypeTemplateParmDecl > nonTypeTemplateParmDecl
Matches non-type template parameter declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtThrowStmt > objcThrowStmt
Matches Objective-C @throw statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenExpr > parenExpr
Matches parentheses used in expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > typedefDecl
Matches typedef declarations.
virtual bool isConvertibleTo(ASTNodeKind Kind, unsigned *Specificity=nullptr, ASTNodeKind *LeastDerivedKind=nullptr) const =0
Returns whether this matcher is convertible to the given type.
const internal::VariadicDynCastAllOfMatcher< Decl, LinkageSpecDecl > linkageSpecDecl
Matches a declaration of a linkage specification.
RangeSelector member(std::string ID)
Given a MemberExpr, selects the member token.
const AstTypeMatcher< DecltypeType > decltypeType
Matches types nodes representing C++11 decltype(<expr>) types.
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachMatcher > forEach
Matches AST nodes that have child AST nodes that match the provided matcher.
const AstTypeMatcher< UnaryTransformType > unaryTransformType
Matches types nodes representing unary type transformations.
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXUnresolvedConstructExpr > cxxUnresolvedConstructExpr
Matches unresolved constructor call expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCInterfaceDecl > objcInterfaceDecl
Matches Objective-C interface declarations.
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > has
Matches AST nodes that have child AST nodes that match the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBindTemporaryExpr > cxxBindTemporaryExpr
Matches nodes where temporaries are created.
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
Registry of all known matchers.
const internal::VariadicOperatorMatcherFunc< 1, 1 > optionally
Matches any node regardless of the submatcher.
internal::PolymorphicMatcherWithParam1< internal::HasDeclarationMatcher, internal::Matcher< Decl >, void(internal::HasDeclarationSupportedTypes)> hasDeclaration(const internal::Matcher< Decl > &InnerMatcher)
Matches a node if the declaration associated with that node matches the given matcher.
Definition: ASTMatchers.h:3188
const internal::VariadicFunction< internal::Matcher< ObjCMessageExpr >, StringRef, internal::hasAnySelectorFunc > hasAnySelector
Matches when at least one of the supplied string equals to the Selector.getAsString() ...
internal::BindableMatcher< Stmt > alignOfExpr(const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher)
Same as unaryExprOrTypeTraitExpr, but only matching alignof.
Definition: ASTMatchers.h:2686
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
const internal::VariadicDynCastAllOfMatcher< OMPClause, OMPDefaultClause > ompDefaultClause
Matches OpenMP default clause.
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> anyOf
Matches if any of the given matchers matches.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > hasDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher. ...
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImaginaryLiteral > imaginaryLiteral
Matches imaginary literals, which are based on integer and floating point literals e...
const AstTypeMatcher< SubstTemplateTypeParmType > substTemplateTypeParmType
Matches types that represent the result of substituting a type for a template type parameter...
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> eachOf
Matches if any of the given matchers matches.
const AstTypeMatcher< AutoType > autoType
Matches types nodes representing C++11 auto types.
const AstTypeMatcher< RValueReferenceType > rValueReferenceType
Matches rvalue reference types.
llvm::Optional< DynTypedMatcher > getSingleMatcher() const
Return a single matcher, if there is no ambiguity.
const internal::VariadicAllOfMatcher< TemplateName > templateName
Matches template name.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtTryStmt > objcTryStmt
Matches Objective-C statements.
const AstTypeMatcher< PointerType > pointerType
Matches pointer types, but does not match Objective-C object pointer types.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> allOf
Matches if all given matchers match.
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryOperator > binaryOperator
Matches binary operator expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStdInitializerListExpr > cxxStdInitializerListExpr
Matches C++ initializer list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCIvarRefExpr > objcIvarRefExpr
Matches a reference to an ObjCIvar.
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionDecl > functionDecl
Matches function declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, BlockExpr > blockExpr
Matches a reference to a block.
const internal::VariadicDynCastAllOfMatcher< Decl, NamedDecl > namedDecl
Matches a declaration of anything that could have a name.
const AstTypeMatcher< BuiltinType > builtinType
Matches builtin Types.
static llvm::ManagedStatic< RegistryMaps > RegistryData
Definition: Registry.cpp:542
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThrowExpr > cxxThrowExpr
Matches throw expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, EnumDecl > enumDecl
Matches enum declarations.
const AstTypeMatcher< RecordType > recordType
Matches record types (e.g.
#define REGISTER_OVERLOADED_2(name)
Definition: Registry.cpp:85
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateDecl > classTemplateDecl
Matches C++ class template declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryDecl > objcCategoryDecl
Matches Objective-C category declarations.
bool isComparisonOperator(OverloadedOperatorKind OK)
Definition: Iterator.cpp:71
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > cxxOperatorCallExpr
Matches overloaded operator calls.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasTemplateDecl > typeAliasTemplateDecl
Matches type alias template declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, DesignatedInitExpr > designatedInitExpr
Matches C99 designated initializer expressions [C99 6.7.8].
const AstTypeMatcher< InjectedClassNameType > injectedClassNameType
Matches injected class name types.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNullPtrLiteralExpr > cxxNullPtrLiteralExpr
Matches nullptr literal.
const internal::VariadicDynCastAllOfMatcher< Stmt, ConstantExpr > constantExpr
Matches a constant expression wrapper.
const AstTypeMatcher< DeducedTemplateSpecializationType > deducedTemplateSpecializationType
Matches C++17 deduced template specialization types, e.g.
const AstTypeMatcher< DependentSizedArrayType > dependentSizedArrayType
Matches C++ arrays whose size is a value-dependent expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTryStmt > cxxTryStmt
Matches try statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStaticCastExpr > cxxStaticCastExpr
Matches a C++ static_cast expression.
const AstTypeMatcher< TypedefType > typedefType
Matches typedef types.
const internal::VariadicDynCastAllOfMatcher< Stmt, GotoStmt > gotoStmt
Matches goto statements.
const AstTypeMatcher< ComplexType > complexType
Matches C99 complex types.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFunctionalCastExpr > cxxFunctionalCastExpr
Matches functional cast expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXReinterpretCastExpr > cxxReinterpretCastExpr
Matches a reinterpret_cast expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, FloatingLiteral > floatLiteral
Matches float literals of all sizes / encodings, e.g.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclStmt > declStmt
Matches declaration statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, OpaqueValueExpr > opaqueValueExpr
Matches opaque value expressions.
const AstTypeMatcher< MemberPointerType > memberPointerType
Matches member pointer types.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > declRefExpr
Matches expressions that refer to declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, IfStmt > ifStmt
Matches if statements.
const internal::VariadicDynCastAllOfMatcher< Decl, TagDecl > tagDecl
Matches tag declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, OMPExecutableDirective > ompExecutableDirective
Matches any #pragma omp executable directive.
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceDecl > namespaceDecl
Matches a declaration of a namespace.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitValueInitExpr > implicitValueInitExpr
Matches implicit initializers of init list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchCase > switchCase
Matches case and default statements inside switch statements.
const internal::VariadicFunction< internal::Matcher< NamedDecl >, StringRef, internal::hasAnyNameFunc > hasAnyName
Matches NamedDecl nodes that have any of the specified names.
const internal::VariadicDynCastAllOfMatcher< Stmt, UserDefinedLiteral > userDefinedLiteral
Matches user defined literal operator call.
Functions templates and classes to wrap matcher construct functions.
const AstTypeMatcher< VariableArrayType > variableArrayType
Matches C arrays with a specified size that is not an integer-constant-expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang&#39;s AST.
const internal::VariadicDynCastAllOfMatcher< Decl, ValueDecl > valueDecl
Matches any value declaration.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCPropertyDecl > objcPropertyDecl
Matches Objective-C property declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtFinallyStmt > objcFinallyStmt
Matches Objective-C statements.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionTemplateDecl > functionTemplateDecl
Matches C++ function template declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXCatchStmt > cxxCatchStmt
Matches catch statements.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateSpecializationDecl > classTemplateSpecializationDecl
Matches C++ class template specializations.
const internal::VariadicDynCastAllOfMatcher< Stmt, MaterializeTemporaryExpr > materializeTemporaryExpr
Matches nodes where temporaries are materialized.
const internal::VariadicDynCastAllOfMatcher< Stmt, CaseStmt > caseStmt
Matches case statements inside switch statements.
const AstTypeMatcher< ParenType > parenType
Matches ParenType nodes.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDirectiveDecl > usingDirectiveDecl
Matches using namespace declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ChooseExpr > chooseExpr
Matches GNU __builtin_choose_expr.
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachDescendantMatcher > forEachDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher. ...
const internal::VariadicDynCastAllOfMatcher< Stmt, AsmStmt > asmStmt
Matches asm statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAutoreleasePoolStmt > autoreleasePoolStmt
Matches an Objective-C autorelease pool statement.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDeductionGuideDecl > cxxDeductionGuideDecl
Matches user-defined and implicitly generated deduction guide.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingTypenameDecl > unresolvedUsingTypenameDecl
Matches unresolved using value declarations that involve the typename.
const internal::VariadicDynCastAllOfMatcher< Stmt, MemberExpr > memberExpr
Matches member expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, AddrLabelExpr > addrLabelExpr
Matches address of label statements (GNU extension).
bool equals(const til::SExpr *E1, const til::SExpr *E2)
const internal::VariadicDynCastAllOfMatcher< Stmt, ExplicitCastExpr > explicitCastExpr
Matches explicit cast expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchStmt > switchStmt
Matches switch statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedLookupExpr > unresolvedLookupExpr
Matches reference to a name that can be looked up during parsing but could not be resolved to a speci...
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryConditionalOperator > binaryConditionalOperator
Matches binary conditional operator expressions (GNU extension).
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const AstTypeMatcher< IncompleteArrayType > incompleteArrayType
Matches C arrays with unspecified size.
const internal::VariadicDynCastAllOfMatcher< Stmt, LabelStmt > labelStmt
Matches label statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CStyleCastExpr > cStyleCastExpr
Matches a C-style cast expression.
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceAliasDecl > namespaceAliasDecl
Matches a declaration of a namespace alias.
#define REGISTER_MATCHER(name)
Definition: Registry.cpp:69
const internal::VariadicDynCastAllOfMatcher< Decl, FieldDecl > fieldDecl
Matches field declarations.
virtual VariantMatcher create(SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error) const =0
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedMemberExpr > unresolvedMemberExpr
Matches unresolved member expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ConditionalOperator > conditionalOperator
Matches conditional operator expressions.
Diagnostics class to manage error messages.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefNameDecl > typedefNameDecl
Matches typedef name declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, SubstNonTypeTemplateParmExpr > substNonTypeTemplateParmExpr
Matches substitutions of non-type template parameters.
const internal::VariadicDynCastAllOfMatcher< Stmt, ReturnStmt > returnStmt
Matches return statements.
const AstTypeMatcher< FunctionProtoType > functionProtoType
Matches FunctionProtoType nodes.
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > cudaKernelCallExpr
Matches CUDA kernel call expression.
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
const AstTypeMatcher< AtomicType > atomicType
Matches atomic types.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryImplDecl > objcCategoryImplDecl
Matches Objective-C category definitions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ExprWithCleanups > exprWithCleanups
Matches expressions that introduce cleanups to be run at the end of the sub-expression&#39;s evaluation...
internal::PolymorphicMatcherWithParam1< internal::HasOverloadedOperatorNameMatcher, std::vector< std::string >, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl)> hasOverloadedOperatorName(StringRef Name)
Matches overloaded operator names.
Definition: ASTMatchers.h:2780
const internal::VariadicDynCastAllOfMatcher< Decl, FriendDecl > friendDecl
Matches friend declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, DoStmt > doStmt
Matches do statements.
const internal::ArgumentAdaptingMatcherFunc< internal::HasAncestorMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc > > hasAncestor
Matches AST nodes that have an ancestor that matches the provided matcher.
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
Definition: Specifiers.h:203
const AstTypeMatcher< TemplateSpecializationType > templateSpecializationType
Matches template specialization types.
internal::Matcher< BinaryOperator > hasOperands(const internal::Matcher< Expr > &Matcher1, const internal::Matcher< Expr > &Matcher2)
Matches if both matchers match with opposite sides of the binary operator.
Definition: ASTMatchers.h:4962
Helper class to manage error messages.
Definition: Diagnostics.h:50
const internal::VariadicAllOfMatcher< NestedNameSpecifierLoc > nestedNameSpecifierLoc
Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
ArgStream addError(SourceRange Range, ErrorType Error)
Add an error to the diagnostics.
Definition: Diagnostics.cpp:65
const internal::VariadicDynCastAllOfMatcher< Stmt, PredefinedExpr > predefinedExpr
Matches predefined identifier expressions [C99 6.4.2.2].
Kind
const internal::VariadicDynCastAllOfMatcher< Decl, LabelDecl > labelDecl
Matches a declaration of label.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > cxxMemberCallExpr
Matches member call expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > parmVarDecl
Matches parameter variable declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstCastExpr > cxxConstCastExpr
Matches a const_cast expression.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasDecl > typeAliasDecl
Matches type alias declarations.
const internal::VariadicAllOfMatcher< CXXCtorInitializer > cxxCtorInitializer
Matches constructor initializers.
const internal::VariadicDynCastAllOfMatcher< Stmt, GNUNullExpr > gnuNullExpr
Matches GNU __null expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, BreakStmt > breakStmt
Matches break statements.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > cxxMethodDecl
Matches method declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDynamicCastExpr > cxxDynamicCastExpr
Matches a dynamic_cast expression.
static bool hasAttr(const FunctionDecl *D, bool IgnoreImplicitAttr)
Definition: SemaCUDA.cpp:99
const internal::VariadicDynCastAllOfMatcher< Stmt, DefaultStmt > defaultStmt
Matches default statements inside switch statements.
const internal::VariadicDynCastAllOfMatcher< Decl, TranslationUnitDecl > translationUnitDecl
Matches the top declaration context.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXForRangeStmt > cxxForRangeStmt
Matches range-based for statements.
const internal::VariadicAllOfMatcher< TypeLoc > typeLoc
Matches TypeLocs in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, IntegerLiteral > integerLiteral
Matches integer literals of all sizes / encodings, e.g.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstructExpr > cxxConstructExpr
Matches constructor call expressions (including implicit ones).
const internal::VariadicAllOfMatcher< QualType > qualType
Matches QualTypes in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTypeParmDecl > templateTypeParmDecl
Matches template type parameter declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCMethodDecl > objcMethodDecl
Matches Objective-C method declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDecl > usingDecl
Matches using declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ArraySubscriptExpr > arraySubscriptExpr
Matches array subscript expressions.
virtual bool isVariadic() const =0
Returns whether the matcher is variadic.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryExprOrTypeTraitExpr > unaryExprOrTypeTraitExpr
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc > > hasParent
Matches AST nodes that have a parent that matches the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCIvarDecl > objcIvarDecl
Matches Objective-C instance variable declarations.
const internal::VariadicOperatorMatcherFunc< 1, 1 > unless
Matches if the provided matcher does not match.
const internal::VariadicDynCastAllOfMatcher< Stmt, ForStmt > forStmt
Matches for statements.
virtual unsigned getNumArgs() const =0
Returns the number of arguments accepted by the matcher if not variadic.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCImplementationDecl > objcImplementationDecl
Matches Objective-C implementation declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundLiteralExpr > compoundLiteralExpr
Matches compound (i.e.
Dataflow Directional Tag Classes.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
const internal::VariadicFunction< internal::PolymorphicMatcherWithParam1< internal::HasOverloadedOperatorNameMatcher, std::vector< std::string >, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl)>, StringRef, internal::hasAnyOverloadedOperatorNameFunc > hasAnyOverloadedOperatorName
Matches overloaded operator names.
const internal::VariadicDynCastAllOfMatcher< Stmt, AtomicExpr > atomicExpr
Matches atomic builtins.
Kind identifier.
Definition: ASTTypeTraits.h:56
const internal::VariadicDynCastAllOfMatcher< Decl, StaticAssertDecl > staticAssertDecl
Matches a C++ static_assert declaration.
const AstTypeMatcher< ElaboratedType > elaboratedType
Matches types specified with an elaborated type keyword or with a qualified name. ...
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenListExpr > parenListExpr
Matches paren list expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConversionDecl > cxxConversionDecl
Matches conversion operator declarations.
const internal::VariadicAllOfMatcher< TemplateArgument > templateArgument
Matches template arguments.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCProtocolDecl > objcProtocolDecl
Matches Objective-C protocol declarations.
const AstTypeMatcher< DecayedType > decayedType
Matches decayed type Example matches i[] in declaration of f.
internal::BindableMatcher< Stmt > sizeOfExpr(const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher)
Same as unaryExprOrTypeTraitExpr, but only matching sizeof.
Definition: ASTMatchers.h:2695
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > cxxRecordDecl
Matches C++ class declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDefaultArgExpr > cxxDefaultArgExpr
Matches the value of a default argument at the call site.
virtual void getArgKinds(ASTNodeKind ThisKind, unsigned ArgNo, std::vector< ArgKind > &ArgKinds) const =0
Given that the matcher is being converted to type ThisKind, append the set of argument types accepted...
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingValueDecl > unresolvedUsingValueDecl
Matches unresolved using value declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, NullStmt > nullStmt
Matches null statements.
bool isNull() const
Whether the matcher is null.
Definition: VariantValue.h:158
const internal::VariadicDynCastAllOfMatcher< Decl, IndirectFieldDecl > indirectFieldDecl
Matches indirect field declarations.
#define MATCHER_OVERLOAD_ENTRY(name, Id)
Definition: Registry.cpp:81
const internal::VariadicDynCastAllOfMatcher< Stmt, LambdaExpr > lambdaExpr
Matches lambda expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNewExpr > cxxNewExpr
Matches new expressions.
internal::Matcher< NamedDecl > hasName(StringRef Name)
Matches NamedDecl nodes that have the specified name.
Definition: ASTMatchers.h:2716
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNoexceptExpr > cxxNoexceptExpr
Matches noexcept expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > initListExpr
Matches init list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDeleteExpr > cxxDeleteExpr
Matches delete expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ContinueStmt > continueStmt
Matches continue statements.
const internal::VariadicDynCastAllOfMatcher< Decl, EnumConstantDecl > enumConstantDecl
Matches enum constants.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtCatchStmt > objcCatchStmt
Matches Objective-C statements.
internal::Matcher< BinaryOperator > hasEitherOperand(const internal::Matcher< Expr > &InnerMatcher)
Matches if either the left hand side or the right hand side of a binary operator matches.
Definition: ASTMatchers.h:4946
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > unaryOperator
Matches unary operator expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CharacterLiteral > characterLiteral
Matches character literals (also matches wchar_t).
static bool isInstanceMethod(const Decl *D)
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTemporaryObjectExpr > cxxTemporaryObjectExpr
Matches functional cast expressions having N != 1 arguments.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConstructorDecl > cxxConstructorDecl
Matches C++ constructor declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDependentScopeMemberExpr > cxxDependentScopeMemberExpr
Matches member expressions where the actual member referenced could not be resolved because the base ...
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitCastExpr > implicitCastExpr
Matches the implicit cast nodes of Clang&#39;s AST.
const internal::VariadicAllOfMatcher< NestedNameSpecifier > nestedNameSpecifier
Matches nested name specifiers.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBoolLiteralExpr > cxxBoolLiteral
Matches bool literals.
const internal::VariadicDynCastAllOfMatcher< Stmt, StmtExpr > stmtExpr
Matches statement expression (GNU extension).
const AstTypeMatcher< ObjCObjectPointerType > objcObjectPointerType
Matches an Objective-C object pointer type, which is different from a pointer type, despite being syntactically similar.
const internal::VariadicDynCastAllOfMatcher< Decl, AccessSpecDecl > accessSpecDecl
Matches C++ access specifier declarations.
const AstTypeMatcher< TemplateTypeParmType > templateTypeParmType
Matches template type parameter types.
Polymorphic value type.
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundStmt > compoundStmt
Matches compound statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, StringLiteral > stringLiteral
Matches string literals (also matches wide string literals).
const internal::VariadicDynCastAllOfMatcher< Decl, BlockDecl > blockDecl
Matches block declarations.
const AstTypeMatcher< ConstantArrayType > constantArrayType
Matches C arrays with a specified constant size.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDestructorDecl > cxxDestructorDecl
Matches explicit C++ destructor declarations.
const AstTypeMatcher< ReferenceType > referenceType
Matches both lvalue and rvalue reference types.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCMessageExpr > objcMessageExpr
Matches ObjectiveC Message invocation expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, DeclaratorDecl > declaratorDecl
Matches declarator declarations (field, variable, function and non-type template parameter declaratio...
const internal::VariadicFunction< internal::PolymorphicMatcherWithParam1< internal::HasAnyOperatorNameMatcher, std::vector< std::string >, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, UnaryOperator)>, StringRef, internal::hasAnyOperatorNameFunc > hasAnyOperatorName
Matches operator expressions (binary or unary) that have any of the specified names.
const AstTypeMatcher< LValueReferenceType > lValueReferenceType
Matches lvalue reference types.
const internal::VariadicDynCastAllOfMatcher< Stmt, WhileStmt > whileStmt
Matches while statements.
const AstTypeMatcher< EnumType > enumType
Matches enum types.
const AstTypeMatcher< BlockPointerType > blockPointerType
Matches block pointer types, i.e.
static bool isExternC(const NamedDecl *ND)
Definition: Mangle.cpp:57
#define REGISTER_MATCHER_OVERLOAD(name)
Definition: Registry.cpp:73