44 #ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H 45 #define LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H 78 #include "llvm/ADT/ArrayRef.h" 79 #include "llvm/ADT/SmallVector.h" 80 #include "llvm/ADT/StringRef.h" 81 #include "llvm/Support/Casting.h" 82 #include "llvm/Support/Compiler.h" 83 #include "llvm/Support/ErrorHandling.h" 84 #include "llvm/Support/Regex.h" 109 template <
typename T>
111 return MyBoundNodes.getNodeAs<T>(
ID);
121 return MyBoundNodes.getMap();
128 BoundNodes(internal::BoundNodesMap &MyBoundNodes)
129 : MyBoundNodes(MyBoundNodes) {}
131 internal::BoundNodesMap MyBoundNodes;
137 template <
typename T>
138 internal::Matcher<T>
id(StringRef
ID,
139 const internal::BindableMatcher<T> &InnerMatcher) {
140 return InnerMatcher.bind(ID);
169 inline internal::TrueMatcher
anything() {
return internal::TrueMatcher(); }
182 extern const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
194 extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl>
206 extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
218 extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl>
228 extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
247 auto &
SourceManager = Finder->getASTContext().getSourceManager();
268 auto &
SourceManager = Finder->getASTContext().getSourceManager();
270 if (ExpansionLoc.isInvalid()) {
293 std::string, RegExp) {
294 auto &
SourceManager = Finder->getASTContext().getSourceManager();
296 if (ExpansionLoc.isInvalid()) {
306 llvm::Regex RE(RegExp);
319 extern const internal::VariadicAllOfMatcher<Decl>
decl;
329 extern const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
343 extern const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl>
namedDecl;
354 extern const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl>
labelDecl;
365 extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl>
377 extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
389 extern const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl>
recordDecl;
398 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl>
407 extern const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
420 extern const internal::VariadicDynCastAllOfMatcher<
439 extern const internal::VariadicDynCastAllOfMatcher<
452 extern const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
463 extern const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl>
477 extern const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
489 extern const internal::VariadicAllOfMatcher<CXXCtorInitializer>
501 extern const internal::VariadicAllOfMatcher<TemplateArgument>
templateArgument;
512 extern const internal::VariadicAllOfMatcher<TemplateName>
templateName;
522 extern const internal::VariadicDynCastAllOfMatcher<Decl,
534 extern const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
597 return Node.isBitField();
614 return Node.isBitField() &&
615 Node.getBitWidthValue(Finder->getASTContext()) == Width;
635 return (Initializer !=
nullptr &&
636 InnerMatcher.matches(*Initializer, Finder, Builder));
642 return Node.isMain();
656 internal::Matcher<ClassTemplateDecl>, InnerMatcher) {
658 return (Decl !=
nullptr &&
659 InnerMatcher.matches(*Decl, Finder, Builder));
665 return Node.isImplicit();
690 hasAnyTemplateArgument,
694 internal::Matcher<TemplateArgument>, InnerMatcher) {
696 internal::getTemplateSpecializationArgs(
Node);
697 return matchesFirstInRange(InnerMatcher, List.begin(), List.end(), Finder,
724 return InnerMatcher.matches(*
Node.IgnoreImplicit(), Finder, Builder);
753 internal::Matcher<Expr>, InnerMatcher) {
754 return InnerMatcher.matches(*
Node.IgnoreImpCasts(), Finder, Builder);
775 return InnerMatcher.matches(*
Node.IgnoreParenCasts(), Finder, Builder);
800 internal::Matcher<Expr>, InnerMatcher) {
801 return InnerMatcher.matches(*
Node.IgnoreParenImpCasts(), Finder, Builder);
817 return InnerMatcher.matches(
Node.IgnoreParens(), Finder, Builder);
833 const Expr *E =
Node.IgnoreParens();
834 return InnerMatcher.matches(*E, Finder, Builder);
851 return Node.isInstantiationDependent();
902 unsigned, N, internal::Matcher<TemplateArgument>, InnerMatcher) {
904 internal::getTemplateSpecializationArgs(
Node);
905 if (List.size() <= N)
907 return InnerMatcher.matches(List[N], Finder, Builder);
920 templateArgumentCountIs,
924 return internal::getTemplateSpecializationArgs(
Node).size() == N;
939 internal::Matcher<QualType>, InnerMatcher) {
942 return InnerMatcher.matches(
Node.getAsType(), Finder, Builder);
957 internal::Matcher<TemplateName>, InnerMatcher) {
960 return InnerMatcher.matches(
Node.getAsTemplate(), Finder, Builder);
977 internal::Matcher<Decl>, InnerMatcher) {
979 return InnerMatcher.matches(*
Node.getAsDecl(), Finder, Builder);
997 return InnerMatcher.matches(*
Node.getAsExpr(), Finder, Builder);
1027 internal::Matcher<QualType>, InnerMatcher) {
1030 return InnerMatcher.matches(
Node.getIntegralType(), Finder, Builder);
1048 std::string,
Value) {
1051 return Node.getAsIntegral().toString(10) ==
Value;
1064 extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1074 extern const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl>
valueDecl;
1087 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
1099 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
1110 extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl>
enumDecl;
1120 extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
1129 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl>
1138 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
1149 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
1161 extern const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl>
varDecl;
1171 extern const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl>
fieldDecl;
1181 extern const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
1190 extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl>
1199 extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
1210 extern const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl>
friendDecl;
1220 extern const internal::VariadicAllOfMatcher<Stmt>
stmt;
1230 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt>
declStmt;
1243 extern const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr>
memberExpr;
1257 extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
1269 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1281 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr>
callExpr;
1311 extern const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr>
lambdaExpr;
1320 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
1332 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
1342 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
1352 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
1362 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
1372 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
1382 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
1397 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
1410 extern const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
1422 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl>
1433 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
1442 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
1452 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt>
1462 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
1472 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
1482 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
1495 extern const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr>
1501 internal::Matcher<Expr>, InnerMatcher) {
1502 const Expr *SyntForm =
Node.getSyntacticForm();
1503 return (SyntForm !=
nullptr &&
1504 InnerMatcher.matches(*SyntForm, Finder, Builder));
1518 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1530 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
1548 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr>
1561 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1574 extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl>
usingDecl;
1585 extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
1602 extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
1616 extern const internal::VariadicDynCastAllOfMatcher<Decl,
1635 extern const internal::VariadicDynCastAllOfMatcher<Decl,
1648 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr>
1658 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr>
parenExpr;
1670 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
1681 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1695 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr>
1706 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
1727 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1739 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr>
cxxNewExpr;
1749 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr>
1760 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
1772 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
1789 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
1798 extern const internal::VariadicDynCastAllOfMatcher<Stmt, Expr>
expr;
1807 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
1821 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr>
1830 extern const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr>
blockExpr;
1838 extern const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt>
ifStmt;
1847 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt>
forStmt;
1859 const Stmt *
const Increment =
Node.getInc();
1860 return (Increment !=
nullptr &&
1861 InnerMatcher.matches(*Increment, Finder, Builder));
1874 const Stmt *
const Init =
Node.getInit();
1875 return (Init !=
nullptr && InnerMatcher.matches(*Init, Finder, Builder));
1885 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
1898 const VarDecl *
const Var =
Node.getLoopVariable();
1899 return (Var !=
nullptr && InnerMatcher.matches(*Var, Finder, Builder));
1912 const Expr *
const Init =
Node.getRangeInit();
1913 return (Init !=
nullptr && InnerMatcher.matches(*Init, Finder, Builder));
1924 extern const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt>
whileStmt;
1934 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt>
doStmt;
1944 extern const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt>
breakStmt;
1954 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt>
1965 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt>
returnStmt;
1976 extern const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt>
gotoStmt;
1987 extern const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt>
labelStmt;
1999 extern const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr>
2010 extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt>
switchStmt;
2020 extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase>
switchCase;
2030 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt>
caseStmt;
2040 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt>
2049 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt>
2059 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt>
2069 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt>
cxxTryStmt;
2078 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr>
2088 extern const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt>
nullStmt;
2098 extern const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt>
asmStmt;
2106 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
2116 extern const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral>
2129 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
2136 extern const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
2146 extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
2151 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
2157 extern const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
2167 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
2171 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
2175 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr>
2179 extern const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr>
2187 extern const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr>
atomicExpr;
2195 extern const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr>
stmtExpr;
2203 extern const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
2212 extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator>
2221 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
2230 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
2242 extern const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
2258 extern const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
2271 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
2287 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
2302 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
2313 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
2322 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
2346 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
2353 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
2369 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr>
castExpr;
2379 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
2388 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
2397 extern const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
2406 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
2421 return Node.size() == N;
2425 extern const internal::VariadicAllOfMatcher<QualType>
qualType;
2428 extern const internal::VariadicAllOfMatcher<Type>
type;
2431 extern const internal::VariadicAllOfMatcher<TypeLoc>
typeLoc;
2452 extern const internal::VariadicOperatorMatcherFunc<
2459 extern const internal::VariadicOperatorMatcherFunc<
2466 extern const internal::VariadicOperatorMatcherFunc<
2479 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
2492 internal::Matcher<QualType>, InnerMatcher) {
2493 const QualType ArgumentType =
Node.getTypeOfArgument();
2494 return InnerMatcher.matches(ArgumentType, Finder, Builder);
2516 const internal::Matcher<UnaryExprOrTypeTraitExpr> &InnerMatcher) {
2525 const internal::Matcher<UnaryExprOrTypeTraitExpr> &InnerMatcher) {
2545 inline internal::Matcher<NamedDecl>
hasName(
const std::string &Name) {
2546 return internal::Matcher<NamedDecl>(
new internal::HasNameMatcher({Name}));
2559 extern const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
2580 assert(!RegExp.empty());
2581 std::string FullNameString =
"::" +
Node.getQualifiedNameAsString();
2582 llvm::Regex RE(RegExp);
2583 return RE.match(FullNameString);
2605 inline internal::PolymorphicMatcherWithParam1<
2606 internal::HasOverloadedOperatorNameMatcher, StringRef,
2609 return internal::PolymorphicMatcherWithParam1<
2610 internal::HasOverloadedOperatorNameMatcher, StringRef,
2636 internal::Matcher<NamedDecl>,
Base) {
2637 return Finder->classIsDerivedFrom(&
Node,
Base, Builder);
2642 assert(!BaseName.empty());
2643 return isDerivedFrom(
hasName(BaseName)).matches(
Node, Finder, Builder);
2649 internal::Matcher<NamedDecl>,
Base, 0) {
2650 return Matcher<CXXRecordDecl>(
anyOf(
Base, isDerivedFrom(
Base)))
2658 assert(!BaseName.empty());
2659 return isSameOrDerivedFrom(
hasName(BaseName)).matches(
Node, Finder, Builder);
2675 return matchesFirstInPointerRange(InnerMatcher,
Node.method_begin(),
2676 Node.method_end(), Finder, Builder);
2689 return Node.isLambda();
2710 extern const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher>
has;
2726 extern const internal::ArgumentAdaptingMatcherFunc<
2727 internal::HasDescendantMatcher>
2748 extern const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher>
2778 extern const internal::ArgumentAdaptingMatcherFunc<
2779 internal::ForEachDescendantMatcher>
2798 template <
typename T>
2799 internal::Matcher<T>
findAll(
const internal::Matcher<T> &Matcher) {
2813 extern const internal::ArgumentAdaptingMatcherFunc<
2814 internal::HasParentMatcher,
2815 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
2816 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
2830 extern const internal::ArgumentAdaptingMatcherFunc<
2831 internal::HasAncestorMatcher,
2832 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
2833 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
2845 extern const internal::VariadicOperatorMatcherFunc<1, 1>
unless;
2881 inline internal::PolymorphicMatcherWithParam1<
2882 internal::HasDeclarationMatcher, internal::Matcher<Decl>,
2883 void(internal::HasDeclarationSupportedTypes)>
2885 return internal::PolymorphicMatcherWithParam1<
2886 internal::HasDeclarationMatcher, internal::Matcher<Decl>,
2887 void(internal::HasDeclarationSupportedTypes)>(InnerMatcher);
2905 return UnderlyingDecl !=
nullptr &&
2906 InnerMatcher.matches(*UnderlyingDecl, Finder, Builder);
2929 const Expr *ExprNode =
Node.getImplicitObjectArgument()
2930 ->IgnoreParenImpCasts();
2931 return (ExprNode !=
nullptr &&
2932 InnerMatcher.matches(*ExprNode, Finder, Builder));
2949 return InnerMatcher.matches(TypeDecl, Finder, Builder);
2965 return Node.isClassMethod();
2981 return Node.isInstanceMethod();
2998 return Node.isClassMessage();
3015 return Node.isInstanceMessage();
3030 const Expr *ReceiverNode =
Node.getInstanceReceiver();
3031 return (ReceiverNode !=
nullptr &&
3059 extern const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>,
3073 assert(!RegExp.empty());
3074 std::string SelectorString =
Node.getSelector().getAsString();
3075 llvm::Regex RE(RegExp);
3076 return RE.match(SelectorString);
3084 return Node.getSelector().isNull();
3096 return Node.getSelector().isUnarySelector();
3112 return Node.getSelector().isKeywordSelector();
3127 return Node.getSelector().getNumArgs() == N;
3148 const Expr *ExprNode =
Node.getCallee();
3149 return (ExprNode !=
nullptr &&
3150 InnerMatcher.matches(*ExprNode, Finder, Builder));
3184 internal::Matcher<QualType>, InnerMatcher, 0) {
3187 return InnerMatcher.matches(QT, Finder, Builder);
3212 internal::Matcher<Decl>, InnerMatcher, 1) {
3229 if (!
Node.getTypeSourceInfo())
3232 return Inner.matches(
Node.getTypeSourceInfo()->getTypeLoc(), Finder, Builder);
3245 return Name ==
Node.getAsString();
3259 QualType, pointsTo, internal::Matcher<QualType>,
3261 return (!
Node.isNull() &&
Node->isAnyPointerType() &&
3262 InnerMatcher.matches(
Node->getPointeeType(), Finder, Builder));
3269 .matches(
Node, Finder, Builder);
3284 return InnerMatcher.matches(*
Node.getUnqualifiedDesugaredType(), Finder,
3303 return (!
Node.isNull() &&
Node->isReferenceType() &&
3304 InnerMatcher.matches(
Node->getPointeeType(), Finder, Builder));
3323 return InnerMatcher.matches(
Node.getCanonicalType(), Finder, Builder);
3330 .matches(
Node, Finder, Builder);
3351 internal::Matcher<Expr>, InnerMatcher) {
3352 const Expr *ExprNode =
Node.getImplicitObjectArgument();
3353 return (ExprNode !=
nullptr &&
3354 InnerMatcher.matches(*ExprNode, Finder, Builder));
3374 internal::Matcher<QualType>, InnerMatcher, 0) {
3375 return onImplicitObjectArgument(
3376 anyOf(hasType(InnerMatcher), hasType(pointsTo(InnerMatcher))))
3377 .matches(
Node, Finder, Builder);
3382 internal::Matcher<Decl>, InnerMatcher, 1) {
3383 return onImplicitObjectArgument(
3384 anyOf(hasType(InnerMatcher), hasType(pointsTo(InnerMatcher))))
3385 .matches(
Node, Finder, Builder);
3399 const Decl *DeclNode =
Node.getDecl();
3400 return (DeclNode !=
nullptr &&
3401 InnerMatcher.matches(*DeclNode, Finder, Builder));
3419 internal::Matcher<UsingShadowDecl>, InnerMatcher) {
3422 return InnerMatcher.matches(*
UsingDecl, Finder, Builder);
3443 return matchesFirstInPointerRange(InnerMatcher,
Node.decls_begin(),
3444 Node.decls_end(), Finder, Builder);
3457 if (
Node.isSingleDecl()) {
3458 const Decl *FoundDecl =
Node.getSingleDecl();
3459 return InnerMatcher.matches(*FoundDecl, Finder, Builder);
3473 VarDecl, hasInitializer, internal::Matcher<Expr>,
3476 return (Initializer !=
nullptr &&
3477 InnerMatcher.matches(*Initializer, Finder, Builder));
3491 return Node.isStaticLocal();
3506 return Node.hasLocalStorage();
3520 return Node.hasGlobalStorage();
3587 return Node.isExceptionVariable();
3603 return Node.getNumArgs() == N;
3618 unsigned, N, internal::Matcher<Expr>, InnerMatcher) {
3619 return (N <
Node.getNumArgs() &&
3620 InnerMatcher.matches(
3621 *
Node.getArg(N)->IgnoreParenImpCasts(), Finder, Builder));
3632 ast_matchers::internal::Matcher<Expr>, InnerMatcher) {
3633 return N <
Node.getNumInits() &&
3634 InnerMatcher.matches(*
Node.getInit(N), Finder, Builder);
3672 internal::Matcher<Decl>, InnerMatcher) {
3677 std::advance(Iterator, N);
3678 return InnerMatcher.matches(**Iterator, Finder, Builder);
3695 return Node.getExceptionDecl() ==
nullptr;
3712 internal::Matcher<CXXCtorInitializer>, InnerMatcher) {
3713 return matchesFirstInPointerRange(InnerMatcher,
Node.init_begin(),
3714 Node.init_end(), Finder, Builder);
3731 internal::Matcher<FieldDecl>, InnerMatcher) {
3733 return (NodeAsDecl !=
nullptr &&
3734 InnerMatcher.matches(*NodeAsDecl, Finder, Builder));
3751 internal::Matcher<Expr>, InnerMatcher) {
3752 const Expr* NodeAsExpr =
Node.getInit();
3753 return (NodeAsExpr !=
nullptr &&
3754 InnerMatcher.matches(*NodeAsExpr, Finder, Builder));
3771 return Node.isWritten();
3791 return Node.isBaseInitializer();
3811 return Node.isMemberInitializer();
3837 internal::Matcher<Expr>, InnerMatcher) {
3838 for (
const Expr *Arg :
Node.arguments()) {
3839 BoundNodesTreeBuilder Result(*Builder);
3840 if (InnerMatcher.matches(*Arg, Finder, &Result)) {
3841 *Builder = std::move(Result);
3850 return Node.isListInitialization();
3866 return Node.requiresZeroInitialization();
3893 unsigned, N, internal::Matcher<ParmVarDecl>,
3895 return (N <
Node.parameters().size()
3896 && InnerMatcher.matches(*
Node.parameters()[N], Finder, Builder));
3920 internal::Matcher<Expr>, ArgMatcher,
3921 internal::Matcher<ParmVarDecl>, ParamMatcher) {
3922 BoundNodesTreeBuilder Result;
3926 BoundNodesTreeBuilder Matches;
3928 .matches(
Node, Finder, &Matches)
3932 bool Matched =
false;
3933 for (; ArgIndex <
Node.getNumArgs(); ++ArgIndex) {
3934 BoundNodesTreeBuilder ArgMatches(*Builder);
3935 if (ArgMatcher.matches(*(
Node.getArg(ArgIndex)->IgnoreParenCasts()),
3936 Finder, &ArgMatches)) {
3937 BoundNodesTreeBuilder ParamMatches(ArgMatches);
3939 hasParameter(ParamIndex, ParamMatcher)))),
3941 hasParameter(ParamIndex, ParamMatcher))))))
3943 Result.addMatch(ParamMatches);
3949 *Builder = std::move(Result);
3988 internal::Matcher<ParmVarDecl>,
3990 return matchesFirstInPointerRange(InnerMatcher,
Node.param_begin(),
3991 Node.param_end(), Finder, Builder);
4015 return Node.getNumParams() == N;
4043 internal::Matcher<QualType>, InnerMatcher) {
4044 return InnerMatcher.matches(
Node.getReturnType(), Finder, Builder);
4064 return Node.isExternC();
4097 return Node.isDeleted();
4110 return Node.isDefaulted();
4132 return FnTy->hasDynamicExceptionSpec();
4185 return Node.isConstexpr();
4199 internal::Matcher<Expr>, InnerMatcher) {
4200 const Expr *
const Condition =
Node.getCond();
4201 return (Condition !=
nullptr &&
4202 InnerMatcher.matches(*Condition, Finder, Builder));
4213 const Stmt *
const Then =
Node.getThen();
4214 return (Then !=
nullptr && InnerMatcher.matches(*Then, Finder, Builder));
4225 const Stmt *
const Else =
Node.getElse();
4226 return (Else !=
nullptr && InnerMatcher.matches(*Else, Finder, Builder));
4260 internal::NotEqualsBoundNodePredicate Predicate;
4263 return Builder->removeBindings(Predicate);
4275 internal::Matcher<DeclStmt>, InnerMatcher) {
4276 const DeclStmt*
const DeclarationStatement =
4277 Node.getConditionVariableDeclStmt();
4278 return DeclarationStatement !=
nullptr &&
4279 InnerMatcher.matches(*DeclarationStatement, Finder, Builder);
4292 internal::Matcher<Expr>, InnerMatcher) {
4293 if (
const Expr* Expression =
Node.getIdx())
4294 return InnerMatcher.matches(*Expression, Finder, Builder);
4309 internal::Matcher<Expr>, InnerMatcher) {
4310 if (
const Expr* Expression =
Node.getBase())
4311 return InnerMatcher.matches(*Expression, Finder, Builder);
4331 internal::Matcher<Stmt>, InnerMatcher) {
4332 const Stmt *
const Statement = internal::GetBodyMatcher<NodeType>::get(
Node);
4333 return (Statement !=
nullptr &&
4334 InnerMatcher.matches(*Statement, Finder, Builder));
4351 internal::Matcher<Stmt>, InnerMatcher) {
4353 return CS && matchesFirstInPointerRange(InnerMatcher, CS->
body_begin(),
4368 return Node.size() == N;
4396 template <
typename ValueT>
4397 internal::PolymorphicMatcherWithParam1<internal::ValueEqualsMatcher, ValueT>
4399 return internal::PolymorphicMatcherWithParam1<
4400 internal::ValueEqualsMatcher,
4409 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
4417 unsigned,
Value, 1) {
4418 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
4428 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
4442 std::string, Name) {
4443 return Name ==
Node.getOpcodeStr(
Node.getOpcode());
4463 return Node.isAssignmentOp();
4475 internal::Matcher<Expr>, InnerMatcher) {
4476 const Expr *LeftHandSide =
Node.getLHS();
4477 return (LeftHandSide !=
nullptr &&
4478 InnerMatcher.matches(*LeftHandSide, Finder, Builder));
4490 internal::Matcher<Expr>, InnerMatcher) {
4491 const Expr *RightHandSide =
Node.getRHS();
4492 return (RightHandSide !=
nullptr &&
4493 InnerMatcher.matches(*RightHandSide, Finder, Builder));
4499 const internal::Matcher<Expr> &InnerMatcher) {
4500 return anyOf(hasLHS(InnerMatcher), hasRHS(InnerMatcher));
4511 internal::Matcher<Expr>, InnerMatcher) {
4512 const Expr *
const Operand =
Node.getSubExpr();
4513 return (Operand !=
nullptr &&
4514 InnerMatcher.matches(*Operand, Finder, Builder));
4535 internal::Matcher<Expr>, InnerMatcher) {
4536 const Expr *
const SubExpression =
4537 internal::GetSourceExpressionMatcher<NodeType>::get(
Node);
4538 return (SubExpression !=
nullptr &&
4539 InnerMatcher.matches(*SubExpression, Finder, Builder));
4561 internal::Matcher<QualType>, InnerMatcher) {
4563 return InnerMatcher.matches(NodeType, Finder, Builder);
4571 internal::Matcher<QualType>, InnerMatcher) {
4572 return InnerMatcher.matches(
Node.getType(), Finder, Builder);
4584 return Node.isStruct();
4596 return Node.isUnion();
4608 return Node.isClass();
4623 internal::Matcher<Expr>, InnerMatcher) {
4624 const Expr *Expression =
Node.getTrueExpr();
4625 return (Expression !=
nullptr &&
4626 InnerMatcher.matches(*Expression, Finder, Builder));
4638 internal::Matcher<Expr>, InnerMatcher) {
4639 const Expr *Expression =
Node.getFalseExpr();
4640 return (Expression !=
nullptr &&
4641 InnerMatcher.matches(*Expression, Finder, Builder));
4668 return Node.isThisDeclarationADefinition();
4682 return Node.isVariadic();
4703 internal::Matcher<CXXRecordDecl>, InnerMatcher) {
4705 return (Parent !=
nullptr &&
4706 InnerMatcher.matches(*Parent, Finder, Builder));
4734 internal::Matcher<CXXMethodDecl>, InnerMatcher) {
4735 BoundNodesTreeBuilder Result;
4736 bool Matched =
false;
4737 for (
const auto *Overridden :
Node.overridden_methods()) {
4738 BoundNodesTreeBuilder OverriddenBuilder(*Builder);
4739 const bool OverriddenMatched =
4740 InnerMatcher.matches(*Overridden, Finder, &OverriddenBuilder);
4741 if (OverriddenMatched) {
4743 Result.addMatch(OverriddenBuilder);
4746 *Builder = std::move(Result);
4761 return Node.isVirtual();
4779 return Node.isVirtualAsWritten();
4800 return Node.template hasAttr<FinalAttr>();
4814 return Node.isPure();
4829 return Node.isConst();
4846 return Node.isCopyAssignmentOperator();
4863 return Node.isMoveAssignmentOperator();
4881 return Node.size_overridden_methods() > 0 ||
Node.hasAttr<OverrideAttr>();
4896 return Node.isUserProvided();
4926 return Node.isArrow();
4940 return Node->isIntegerType();
4954 return Node->isUnsignedIntegerType();
4968 return Node->isSignedIntegerType();
4982 return Node->isAnyCharacterType();
5002 return Node->isAnyPointerType();
5021 return Node.isConstQualified();
5040 return Node.isVolatileQualified();
5057 return Node.hasLocalQualifiers();
5073 internal::Matcher<ValueDecl>, InnerMatcher) {
5074 return InnerMatcher.matches(*
Node.getMemberDecl(), Finder, Builder);
5094 hasObjectExpression,
5097 internal::Matcher<Expr>, InnerMatcher) {
5098 if (
const auto *E = dyn_cast<UnresolvedMemberExpr>(&
Node))
5099 if (E->isImplicitAccess())
5101 if (
const auto *E = dyn_cast<CXXDependentScopeMemberExpr>(&
Node))
5102 if (E->isImplicitAccess())
5104 return InnerMatcher.matches(*
Node.getBase(), Finder, Builder);
5117 internal::Matcher<UsingShadowDecl>, InnerMatcher) {
5118 return matchesFirstInPointerRange(InnerMatcher,
Node.shadow_begin(),
5119 Node.shadow_end(), Finder, Builder);
5135 internal::Matcher<NamedDecl>, InnerMatcher) {
5136 return InnerMatcher.matches(*
Node.getTargetDecl(), Finder, Builder);
5170 Node.getTemplateSpecializationKind() ==
5172 Node.getTemplateSpecializationKind() ==
5234 internal::Matcher<QualType>, InnerMatcher, 0) {
5235 return internal::BindableMatcher<TypeLoc>(
5236 new internal::TypeLocTypeMatcher(InnerMatcher));
5248 return Node.isBooleanType();
5260 return Node.isVoidType();
5263 template <
typename NodeType>
5312 return Node.isRealFloatingType();
5365 return internal::HasSizeMatcher<NodeType>::hasSize(
Node, N);
5421 internal::Matcher<Expr>, InnerMatcher) {
5422 return InnerMatcher.matches(*
Node.getSizeExpr(), Finder, Builder);
5667 pointee, getPointee,
5788 internal::Matcher<NestedNameSpecifier>, InnerMatcher) {
5790 return InnerMatcher.matches(*Qualifier, Finder, Builder);
5812 return InnerMatcher.matches(
Node.getNamedType(), Finder, Builder);
5843 hasReplacementType, getReplacementType,
5882 return InnerType.matches(
Node.getDecayedType(), Finder, Builder);
5901 if (!DC)
return false;
5918 extern const internal::VariadicAllOfMatcher<NestedNameSpecifier>
5922 extern const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
5928 internal::BindableMatcher<NestedNameSpecifierLoc>, loc,
5929 internal::Matcher<NestedNameSpecifier>, InnerMatcher, 1) {
5930 return internal::BindableMatcher<NestedNameSpecifierLoc>(
5931 new internal::LocMatcher<NestedNameSpecifierLoc, NestedNameSpecifier>(
5948 internal::Matcher<QualType>, InnerMatcher) {
5949 if (!
Node.getAsType())
5951 return InnerMatcher.matches(
QualType(
Node.getAsType(), 0), Finder, Builder);
5966 internal::Matcher<TypeLoc>, InnerMatcher) {
5967 return Node &&
Node.getNestedNameSpecifier()->getAsType() &&
5968 InnerMatcher.matches(
Node.getTypeLoc(), Finder, Builder);
5981 internal::Matcher<NestedNameSpecifier>, InnerMatcher,
5986 return InnerMatcher.matches(*NextNode, Finder, Builder);
5999 internal::Matcher<NestedNameSpecifierLoc>, InnerMatcher,
6004 return InnerMatcher.matches(NextNode, Finder, Builder);
6018 internal::Matcher<NamespaceDecl>, InnerMatcher) {
6019 if (!
Node.getAsNamespace())
6021 return InnerMatcher.matches(*
Node.getAsNamespace(), Finder, Builder);
6032 return &
Node == Other;
6038 return &
Node == Other;
6044 return &
Node == Other;
6062 BoundNodesTreeBuilder Result;
6067 bool Matched =
false;
6069 SC = SC->getNextSwitchCase()) {
6070 BoundNodesTreeBuilder CaseBuilder(*Builder);
6071 bool CaseMatched = InnerMatcher.matches(*SC, Finder, &CaseBuilder);
6074 Result.addMatch(CaseBuilder);
6077 *Builder = std::move(Result);
6092 internal::Matcher<CXXCtorInitializer>, InnerMatcher) {
6093 BoundNodesTreeBuilder Result;
6094 bool Matched =
false;
6095 for (
const auto *I :
Node.inits()) {
6096 BoundNodesTreeBuilder InitBuilder(*Builder);
6097 if (InnerMatcher.matches(*I, Finder, &InitBuilder)) {
6099 Result.addMatch(InitBuilder);
6102 *Builder = std::move(Result);
6118 return Node.isCopyConstructor();
6133 return Node.isMoveConstructor();
6148 return Node.isDefaultConstructor();
6165 return Node.isDelegatingConstructor();
6193 return Node.isExplicit();
6222 return InnerMatcher.matches(*ES.
getExpr(), Finder, Builder);
6243 if (
const auto *FD = dyn_cast<FunctionDecl>(&
Node))
6244 return FD->isInlineSpecified();
6245 else if (
const auto *NSD = dyn_cast<NamespaceDecl>(&
Node))
6246 return NSD->isInline();
6247 llvm_unreachable(
"Not a valid polymorphic type");
6260 return Node.isAnonymousNamespace();
6300 return InnerMatcher.matches(*
Node.getLHS(), Finder, Builder);
6313 for (
const auto *
Attr :
Node.attrs()) {
6332 if (
const auto *RetValue =
Node.getRetValue())
6333 return InnerMatcher.matches(*RetValue, Finder, Builder);
6343 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
6381 const auto &Parents = Finder->getASTContext().getParents(
Node);
6385 while(!Stack.empty()) {
6386 const auto &CurNode = Stack.back();
6388 if(
const auto *FuncDeclNode = CurNode.get<
FunctionDecl>()) {
6389 if(InnerMatcher.matches(*FuncDeclNode, Finder, Builder)) {
6392 }
else if(
const auto *LambdaExprNode = CurNode.get<
LambdaExpr>()) {
6393 if(InnerMatcher.matches(*LambdaExprNode->getCallOperator(),
6398 for(
const auto &
Parent: Finder->getASTContext().getParents(CurNode))
6426 return Node.hasExternalFormalLinkage();
6437 return Node.hasDefaultArg();
6449 return Node.isArray();
6461 return Node.isArray() && *
Node.getArraySize() &&
6462 InnerMatcher.matches(**
Node.getArraySize(), Finder, Builder);
6473 return Node.hasDefinition();
6484 return Node.isScoped();
6496 return F->hasTrailingReturn();
6525 ast_matchers::internal::Matcher<Expr>, InnerMatcher) {
6526 if (
const auto *CtorExpr = dyn_cast<CXXConstructExpr>(&
Node)) {
6527 if (CtorExpr->isElidable()) {
6528 if (
const auto *MaterializeTemp =
6529 dyn_cast<MaterializeTemporaryExpr>(CtorExpr->getArg(0))) {
6530 return InnerMatcher.matches(*MaterializeTemp->GetTemporaryExpr(),
6535 return InnerMatcher.matches(
Node, Finder, Builder);
6554 extern const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
6571 return Node.isStandaloneDirective();
6603 internal::Matcher<Stmt>, InnerMatcher) {
6604 if (
Node.isStandaloneDirective())
6606 return InnerMatcher.matches(*
Node.getStructuredBlock(), Finder, Builder);
6621 internal::Matcher<OMPClause>, InnerMatcher) {
6623 return matchesFirstInPointerRange(InnerMatcher, Clauses.begin(),
6624 Clauses.end(), Finder, Builder);
6638 extern const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
6653 return Node.getDefaultKind() == OMPC_DEFAULT_none;
6668 return Node.getDefaultKind() == OMPC_DEFAULT_shared;
6700 #endif // LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThisExpr > cxxThisExpr
Matches implicit and explicit this expressions.
A call to an overloaded operator written using operator syntax.
internal::TrueMatcher anything()
Matches any node.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Decl, NonTypeTemplateParmDecl > nonTypeTemplateParmDecl
Matches non-type template parameter declarations.
Defines the clang::ASTContext interface.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
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.
Represents a function declaration or definition.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > typedefDecl
Matches typedef declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, LinkageSpecDecl > linkageSpecDecl
Matches a declaration of a linkage specification.
Smart pointer class that efficiently represents Objective-C method names.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
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.
internal::Matcher< NestedNameSpecifier > NestedNameSpecifierMatcher
AST_MATCHER_P(FieldDecl, hasBitWidth, unsigned, Width)
Matches non-static data members that are bit-fields of the specified bit width.
const AstTypeMatcher< UnaryTransformType > unaryTransformType
Matches types nodes representing unary type transformations.
Defines enumerations for the type traits support.
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
static Decl * castFromDeclContext(const DeclContext *)
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.
Stmt - This represents one statement.
internal::Matcher< Stmt > StatementMatcher
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
IfStmt - This represents an if/then/else.
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.
const internal::VariadicFunction< internal::Matcher< ObjCMessageExpr >, StringRef, internal::hasAnySelectorFunc > hasAnySelector
Matches when at least one of the supplied string equals to the Selector.getAsString() ...
C Language Family Type Representation.
Defines the SourceManager interface.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
The template argument is an expression, and we've not resolved it to one of the other forms yet...
internal::BoundNodesMap::IDToNodeMap IDToNodeMap
Type of mapping from binding identifiers to bound nodes.
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.
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++14 decltype(auto) type.
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.
The base class of the type hierarchy.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImaginaryLiteral > imaginaryLiteral
Matches imaginary literals, which are based on integer and floating point literals e...
Represents an array type, per C99 6.7.5.2 - Array Declarators.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Represent a C++ namespace.
Represents a call to a C++ constructor.
bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind, OpenMPClauseKind CKind)
Store information needed for an explicit specifier.
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
float __ovld __cnfn distance(float p0, float p1)
Returns the distance between p0 and p1.
const AstTypeMatcher< SubstTemplateTypeParmType > substTemplateTypeParmType
Matches types that represent the result of substituting a type for a template type parameter...
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> eachOf
Matches if any of the given matchers matches.
const AstTypeMatcher< AutoType > autoType
Matches types nodes representing C++11 auto types.
const AstTypeMatcher< RValueReferenceType > rValueReferenceType
Matches rvalue reference types.
const internal::VariadicAllOfMatcher< TemplateName > templateName
Matches template name.
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Represents a variable declaration or definition.
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.
AST_MATCHER(Decl, isPublic)
Matches public C++ declarations.
Matcher< NamedDecl > hasAnyNameFunc(ArrayRef< const StringRef *> NameRefs)
internal::PolymorphicMatcherWithParam1< internal::ValueEqualsMatcher, ValueT > equals(const ValueT &Value)
Matches literals that are equal to the given value of type ValueT.
ObjCMethodDecl - Represents an instance or class method declaration.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCIvarRefExpr > objcIvarRefExpr
Matches a reference to an ObjCIvar.
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
Defines the Objective-C statement AST node classes.
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.
Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
Defines the clang::Expr interface and subclasses for C++ expressions.
const AstTypeMatcher< BuiltinType > builtinType
Matches builtin Types.
internal::Matcher< QualType > TypeMatcher
AST_POLYMORPHIC_MATCHER_P2(hasTemplateArgument, AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, TemplateSpecializationType, FunctionDecl), unsigned, N, internal::Matcher< TemplateArgument >, InnerMatcher)
Matches classTemplateSpecializations, templateSpecializationType and functionDecl where the n'th Temp...
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThrowExpr > cxxThrowExpr
Matches throw expressions.
Base wrapper for a particular "section" of type source info.
const internal::VariadicDynCastAllOfMatcher< Decl, EnumDecl > enumDecl
Matches enum declarations.
const AstTypeMatcher< RecordType > recordType
Matches record types (e.g.
Represents a struct/union/class.
Represents a C99 designated initializer expression.
Represents a class template specialization, which refers to a class template with a given set of temp...
bool isNothrow(bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
DeclGroupRef::const_iterator const_decl_iterator
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateDecl > classTemplateDecl
Matches C++ class template declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryDecl > objcCategoryDecl
Matches Objective-C category declarations.
A C++ nested-name-specifier augmented with source location information.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Used for GCC's __alignof.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > cxxOperatorCallExpr
Matches overloaded operator calls.
const IDToNodeMap & getMap() const
Retrieve mapping from binding identifiers to bound nodes.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasTemplateDecl > typeAliasTemplateDecl
Matches type alias template declarations.
Represents a member of a struct/union/class.
const internal::VariadicDynCastAllOfMatcher< Stmt, DesignatedInitExpr > designatedInitExpr
Matches C99 designated initializer expressions [C99 6.7.8].
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
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.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
const AstTypeMatcher< DependentSizedArrayType > dependentSizedArrayType
Matches C++ arrays whose size is a value-dependent expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTryStmt > cxxTryStmt
Matches try statements.
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Defines the clang::attr::Kind enum.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStaticCastExpr > cxxStaticCastExpr
Matches a C++ static_cast expression.
__DEVICE__ int max(int __a, int __b)
internal::VariadicDynCastAllOfMatcher< Type, NodeType > AstTypeMatcher
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.
Describes an C or C++ initializer list.
Represents a C++ using-declaration.
const internal::VariadicDynCastAllOfMatcher< Stmt, OpaqueValueExpr > opaqueValueExpr
Matches opaque value expressions.
const AstTypeMatcher< MemberPointerType > memberPointerType
Matches member pointer types.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > declRefExpr
Matches expressions that refer to declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, IfStmt > ifStmt
Matches if statements.
AST_MATCHER_FUNCTION(internal::Matcher< Decl >, isInstantiated)
Matches declarations that are template instantiations or are inside template instantiations.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const T * getNodeAs(StringRef ID) const
Returns the AST node bound to ID.
const internal::VariadicDynCastAllOfMatcher< Stmt, OMPExecutableDirective > ompExecutableDirective
Matches any #pragma omp executable directive.
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceDecl > namespaceDecl
Matches a declaration of a namespace.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
Represents a declaration of a type.
A builtin binary operation expression such as "x + y" or "x <= y".
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
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.
This represents 'default' clause in the '#pragma omp ...' directive.
CaseStmt - Represent a case statement.
const internal::VariadicDynCastAllOfMatcher< Stmt, UserDefinedLiteral > userDefinedLiteral
Matches user defined literal operator call.
internal::Matcher< Stmt > sizeOfExpr(const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher)
Same as unaryExprOrTypeTraitExpr, but only matching sizeof.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
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's AST.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
internal::PolymorphicMatcherWithParam1< internal::HasOverloadedOperatorNameMatcher, StringRef, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl)> hasOverloadedOperatorName(StringRef Name)
Matches overloaded operator names.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
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.
internal::Matcher< T > findAll(const internal::Matcher< T > &Matcher)
Matches if the node or any descendant matches.
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.
CompoundStmt - This represents a group of statements like { stmt stmt }.
Represents a prototype with parameter type info, e.g.
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachDescendantMatcher > forEachDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher. ...
Represents a ValueDecl that came out of a declarator.
CastKind
CastKind - The kind of operation required for a conversion.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
const internal::VariadicDynCastAllOfMatcher< Stmt, AsmStmt > asmStmt
Matches asm statements.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplatePartialSpecializationDecl > classTemplatePartialSpecializationDecl
Matches C++ class template partial specializations.
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).
const internal::VariadicDynCastAllOfMatcher< Stmt, ExplicitCastExpr > explicitCastExpr
Matches explicit cast expressions.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchStmt > switchStmt
Matches switch statements.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
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.
OpenMPClauseKind
OpenMP clauses.
const internal::VariadicDynCastAllOfMatcher< Decl, FieldDecl > fieldDecl
Matches field declarations.
internal::Matcher< T > id(StringRef ID, const internal::BindableMatcher< T > &InnerMatcher)
If the provided matcher matches a node, binds the node to ID.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedMemberExpr > unresolvedMemberExpr
Matches unresolved member expressions.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents the type decltype(expr) (C++11).
const Expr * getExpr() const
const internal::VariadicDynCastAllOfMatcher< Stmt, ConditionalOperator > conditionalOperator
Matches conditional operator expressions.
static SVal getValue(SVal val, SValBuilder &svalBuilder)
Defines the clang::TypeLoc interface and its subclasses.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
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.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > cudaKernelCallExpr
Matches CUDA kernel call expression.
An expression that sends a message to the given Objective-C object or class.
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
const AstTypeMatcher< AtomicType > atomicType
Matches atomic types.
AST_TYPE_TRAVERSE_MATCHER(hasDeducedType, getDeducedType, AST_POLYMORPHIC_SUPPORTED_TYPES(AutoType))
Matches AutoType nodes where the deduced type is a specific type.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
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's evaluation...
Represents a C++ deduction guide declaration.
Represents a C++ conversion function within a class.
const internal::VariadicDynCastAllOfMatcher< Decl, FriendDecl > friendDecl
Matches friend declarations.
This template specialization was implicitly instantiated from a template.
const internal::VariadicDynCastAllOfMatcher< Stmt, DoStmt > doStmt
Matches do statements.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
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...
const AstTypeMatcher< TemplateSpecializationType > templateSpecializationType
Matches template specialization types.
This file defines OpenMP AST classes for clauses.
DoStmt - This represents a 'do/while' stmt.
const internal::VariadicAllOfMatcher< NestedNameSpecifierLoc > nestedNameSpecifierLoc
Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
Maps string IDs to AST nodes matched by parts of a matcher.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
std::string getAsString() const
Derive the full selector name (e.g.
friend class internal::BoundNodesTreeBuilder
const internal::VariadicDynCastAllOfMatcher< Stmt, PredefinedExpr > predefinedExpr
Matches predefined identifier expressions [C99 6.4.2.2].
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
AST_MATCHER_FUNCTION_P_OVERLOAD(internal::BindableMatcher< TypeLoc >, loc, internal::Matcher< QualType >, InnerMatcher, 0)
Matches TypeLocs for which the given inner QualType-matcher matches.
const internal::VariadicDynCastAllOfMatcher< Decl, LabelDecl > labelDecl
Matches a declaration of label.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > cxxMemberCallExpr
Matches member call expressions.
Sugar for parentheses used when specifying types.
StringRef getName() const
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > parmVarDecl
Matches parameter variable declarations.
This is a basic class for representing single OpenMP executable directive.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Represents the declaration of a struct/union/class/enum.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstCastExpr > cxxConstCastExpr
Matches a const_cast expression.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasDecl > typeAliasDecl
Matches type alias declarations.
Represents a call to a member function that may be written either with member call syntax (e...
const internal::VariadicAllOfMatcher< CXXCtorInitializer > cxxCtorInitializer
Matches constructor initializers.
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
static QualType getUnderlyingType(const SubRegion *R)
const internal::VariadicDynCastAllOfMatcher< Stmt, GNUNullExpr > gnuNullExpr
Matches GNU __null expression.
Represents a dependent using declaration which was not marked with typename.
const internal::VariadicDynCastAllOfMatcher< Stmt, BreakStmt > breakStmt
Matches break statements.
Cached information about one file (either on disk or in the virtual file system). ...
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > cxxMethodDecl
Matches method declarations.
AST_POLYMORPHIC_MATCHER_P(isExpansionInFileMatching, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc), std::string, RegExp)
Matches AST nodes that were expanded within files whose name is partially matching a given regex...
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDynamicCastExpr > cxxDynamicCastExpr
Matches a dynamic_cast expression.
Represents a static or instance method of a struct/union/class.
internal::Matcher< Stmt > alignOfExpr(const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher)
Same as unaryExprOrTypeTraitExpr, but only matching alignof.
static bool hasAttr(const FunctionDecl *D, bool IgnoreImplicitAttr)
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.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
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.
bool isInMainFile(SourceLocation Loc) const
Returns whether the PresumedLoc for a given SourceLocation is in the main file.
const internal::VariadicDynCastAllOfMatcher< Stmt, ArraySubscriptExpr > arraySubscriptExpr
Matches array subscript expressions.
AST_POLYMORPHIC_MATCHER_P_OVERLOAD(hasType, AST_POLYMORPHIC_SUPPORTED_TYPES(Expr, FriendDecl, TypedefNameDecl, ValueDecl), internal::Matcher< QualType >, InnerMatcher, 0)
Matches if the expression's or declaration's type matches a type matcher.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryExprOrTypeTraitExpr > unaryExprOrTypeTraitExpr
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc > > hasParent
Matches AST nodes that have a parent that matches the provided matcher.
#define AST_POLYMORPHIC_SUPPORTED_TYPES(...)
Construct a type-list to be passed to the AST_POLYMORPHIC_MATCHER* macros.
Used for C's _Alignof and C++'s alignof.
This template specialization was instantiated from a template due to an explicit instantiation defini...
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCIvarDecl > objcIvarDecl
Matches Objective-C instance variable declarations.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
const internal::VariadicOperatorMatcherFunc< 1, 1 > unless
Matches if the provided matcher does not match.
static DynTypedNode create(const T &Node)
Creates a DynTypedNode from Node.
const internal::VariadicDynCastAllOfMatcher< Stmt, ForStmt > forStmt
Matches for statements.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
Represents a pointer type decayed from an array or function type.
BoundNodesTreeBuilder BoundNodes
Defines various enumerations that describe declaration and type specifiers.
Base class for declarations which introduce a typedef-name.
ast_type_traits::DynTypedNode Node
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCImplementationDecl > objcImplementationDecl
Matches Objective-C implementation declarations.
Represents a template argument.
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundLiteralExpr > compoundLiteralExpr
Matches compound (i.e.
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
const internal::VariadicDynCastAllOfMatcher< Stmt, AtomicExpr > atomicExpr
Matches atomic builtins.
const internal::VariadicDynCastAllOfMatcher< Decl, StaticAssertDecl > staticAssertDecl
Matches a C++ static_assert declaration.
const AstTypeMatcher< ElaboratedType > elaboratedType
Matches types specified with an elaborated type keyword or with a qualified name. ...
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenListExpr > parenListExpr
Matches paren list expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConversionDecl > cxxConversionDecl
Matches conversion operator declarations.
const internal::VariadicAllOfMatcher< TemplateArgument > templateArgument
Matches template arguments.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCProtocolDecl > objcProtocolDecl
Matches Objective-C protocol declarations.
const AstTypeMatcher< DecayedType > decayedType
Matches decayed type Example matches i[] in declaration of f.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > cxxRecordDecl
Matches C++ class declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDefaultArgExpr > cxxDefaultArgExpr
Matches the value of a default argument at the call site.
This template specialization was instantiated from a template due to an explicit instantiation declar...
Represents a dependent using declaration which was marked with typename.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingValueDecl > unresolvedUsingValueDecl
Matches unresolved using value declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, NullStmt > nullStmt
Matches null statements.
A pointer to member type per C++ 8.3.3 - Pointers to members.
ExplicitCastExpr - An explicit cast written in the source code.
const internal::VariadicDynCastAllOfMatcher< Decl, IndirectFieldDecl > indirectFieldDecl
Matches indirect field declarations.
internal::Matcher< CXXCtorInitializer > CXXCtorInitializerMatcher
body_iterator body_begin()
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
SwitchStmt - This represents a 'switch' stmt.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
Complex values, per C99 6.2.5p11.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
This file defines OpenMP AST classes for executable directives and clauses.
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
Represents a C++ base or member initializer.
This template specialization was declared or defined by an explicit specialization (C++ [temp...
const internal::VariadicDynCastAllOfMatcher< Stmt, LambdaExpr > lambdaExpr
Matches lambda expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNewExpr > cxxNewExpr
Matches new expressions.
Base for LValueReferenceType and RValueReferenceType.
The template argument is a type.
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > initListExpr
Matches init list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDeleteExpr > cxxDeleteExpr
Matches delete expressions.
AST_POLYMORPHIC_MATCHER(isExpansionInMainFile, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc))
Matches AST nodes that were expanded within the main-file.
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.
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > unaryOperator
Matches unary operator expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CharacterLiteral > characterLiteral
Matches character literals (also matches wchar_t).
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
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.
Represents a C++ struct/union/class.
The template argument is a template name that was provided for a template template parameter...
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDependentScopeMemberExpr > cxxDependentScopeMemberExpr
Matches member expressions where the actual member referenced could not be resolved because the base ...
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
CXXCatchStmt - This represents a C++ catch block.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitCastExpr > implicitCastExpr
Matches the implicit cast nodes of Clang's AST.
const internal::VariadicAllOfMatcher< NestedNameSpecifier > nestedNameSpecifier
Matches nested name specifiers.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBoolLiteralExpr > cxxBoolLiteral
Matches bool literals.
WhileStmt - This represents a 'while' stmt.
internal::Matcher< NamedDecl > hasName(const std::string &Name)
Matches NamedDecl nodes that have the specified name.
internal::Matcher< NestedNameSpecifierLoc > NestedNameSpecifierLocMatcher
Declaration of a class template.
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.
StringLiteral - This represents a string literal expression, e.g.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
internal::Matcher< TypeLoc > TypeLocMatcher
A reference to a declared variable, function, enum, etc.
AST_MATCHER_P_OVERLOAD(QualType, ignoringParens, internal::Matcher< QualType >, InnerMatcher, 0)
Matches types that match InnerMatcher after any parens are stripped.
Represents a type template specialization; the template must be a class template, a type alias templa...
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.
AST_TYPELOC_TRAVERSE_MATCHER_DECL(hasElementType, getElement, AST_POLYMORPHIC_SUPPORTED_TYPES(ArrayType, ComplexType))
Matches arrays and C99 complex types that have a specific element type.
const AstTypeMatcher< ConstantArrayType > constantArrayType
Matches C arrays with a specified constant size.
bool matches(const til::SExpr *E1, const til::SExpr *E2)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDestructorDecl > cxxDestructorDecl
Matches explicit C++ destructor declarations.
This represents a decl that may have a name.
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a C array with a specified size that is not an integer-constant-expression.
Automatic storage duration (most local variables).
const AstTypeMatcher< ReferenceType > referenceType
Matches both lvalue and rvalue reference types.
attr::Kind getKind() const
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCMessageExpr > objcMessageExpr
Matches ObjectiveC Message invocation expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, DeclaratorDecl > declaratorDecl
Matches declarator declarations (field, variable, function and non-type template parameter declaratio...
Matcher< ObjCMessageExpr > hasAnySelectorFunc(ArrayRef< const StringRef *> NameRefs)
Represents Objective-C's @autoreleasepool Statement.
Represents the canonical version of C arrays with a specified constant size.
This class handles loading and caching of source files into memory.
const AstTypeMatcher< LValueReferenceType > lValueReferenceType
Matches lvalue reference types.
Attr - This represents one attribute.
const internal::VariadicDynCastAllOfMatcher< Stmt, WhileStmt > whileStmt
Matches while statements.
const AstTypeMatcher< EnumType > enumType
Matches enum types.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
internal::Matcher< Decl > DeclarationMatcher
Types of matchers for the top-level classes in the AST class hierarchy.
const AstTypeMatcher< BlockPointerType > blockPointerType
Matches block pointer types, i.e.
static bool isExternC(const NamedDecl *ND)
AST_MATCHER_P2(InitListExpr, hasInit, unsigned, N, ast_matchers::internal::Matcher< Expr >, InnerMatcher)
Matches the n'th item of an initializer list expression.