45 #ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H 46 #define LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H 77 #include "llvm/ADT/ArrayRef.h" 78 #include "llvm/ADT/SmallVector.h" 79 #include "llvm/ADT/StringRef.h" 80 #include "llvm/Support/Casting.h" 81 #include "llvm/Support/Compiler.h" 82 #include "llvm/Support/ErrorHandling.h" 83 #include "llvm/Support/Regex.h" 108 template <
typename T>
110 return MyBoundNodes.getNodeAs<T>(
ID);
120 return MyBoundNodes.getMap();
127 BoundNodes(internal::BoundNodesMap &MyBoundNodes)
128 : MyBoundNodes(MyBoundNodes) {}
130 internal::BoundNodesMap MyBoundNodes;
136 template <
typename T>
137 internal::Matcher<T>
id(StringRef
ID,
138 const internal::BindableMatcher<T> &InnerMatcher) {
139 return InnerMatcher.bind(ID);
168 inline internal::TrueMatcher
anything() {
return internal::TrueMatcher(); }
181 extern const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
193 extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl>
205 extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
217 extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl>
227 extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
246 auto &
SourceManager = Finder->getASTContext().getSourceManager();
267 auto &
SourceManager = Finder->getASTContext().getSourceManager();
269 if (ExpansionLoc.isInvalid()) {
292 std::string, RegExp) {
293 auto &
SourceManager = Finder->getASTContext().getSourceManager();
295 if (ExpansionLoc.isInvalid()) {
305 llvm::Regex RE(RegExp);
318 extern const internal::VariadicAllOfMatcher<Decl>
decl;
328 extern const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
342 extern const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl>
namedDecl;
353 extern const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl>
labelDecl;
364 extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl>
376 extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
388 extern const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl>
recordDecl;
397 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl>
406 extern const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
419 extern const internal::VariadicDynCastAllOfMatcher<
438 extern const internal::VariadicDynCastAllOfMatcher<
451 extern const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
462 extern const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl>
476 extern const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
488 extern const internal::VariadicAllOfMatcher<CXXCtorInitializer>
500 extern const internal::VariadicAllOfMatcher<TemplateArgument>
templateArgument;
511 extern const internal::VariadicAllOfMatcher<TemplateName>
templateName;
521 extern const internal::VariadicDynCastAllOfMatcher<Decl,
533 extern const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
596 return Node.isBitField();
613 return Node.isBitField() &&
614 Node.getBitWidthValue(Finder->getASTContext()) == Width;
633 const Expr *Initializer =
Node.getInClassInitializer();
634 return (Initializer !=
nullptr &&
635 InnerMatcher.matches(*Initializer, Finder, Builder));
641 return Node.isMain();
655 internal::Matcher<ClassTemplateDecl>, InnerMatcher) {
657 return (Decl !=
nullptr &&
658 InnerMatcher.matches(*Decl, Finder, Builder));
664 return Node.isImplicit();
689 hasAnyTemplateArgument,
693 internal::Matcher<TemplateArgument>, InnerMatcher) {
695 internal::getTemplateSpecializationArgs(
Node);
696 return matchesFirstInRange(InnerMatcher, List.begin(), List.end(), Finder,
723 return InnerMatcher.matches(*
Node.IgnoreImplicit(), Finder, Builder);
752 internal::Matcher<Expr>, InnerMatcher) {
753 return InnerMatcher.matches(*
Node.IgnoreImpCasts(), Finder, Builder);
774 return InnerMatcher.matches(*
Node.IgnoreParenCasts(), Finder, Builder);
799 internal::Matcher<Expr>, InnerMatcher) {
800 return InnerMatcher.matches(*
Node.IgnoreParenImpCasts(), Finder, Builder);
816 return InnerMatcher.matches(
Node.IgnoreParens(), Finder, Builder);
832 const Expr *E =
Node.IgnoreParens();
833 return InnerMatcher.matches(*E, Finder, Builder);
850 return Node.isInstantiationDependent();
901 unsigned, N, internal::Matcher<TemplateArgument>, InnerMatcher) {
903 internal::getTemplateSpecializationArgs(
Node);
904 if (List.size() <= N)
906 return InnerMatcher.matches(List[N], Finder, Builder);
919 templateArgumentCountIs,
923 return internal::getTemplateSpecializationArgs(
Node).size() == N;
938 internal::Matcher<QualType>, InnerMatcher) {
941 return InnerMatcher.matches(
Node.getAsType(), Finder, Builder);
956 internal::Matcher<TemplateName>, InnerMatcher) {
959 return InnerMatcher.matches(
Node.getAsTemplate(), Finder, Builder);
976 internal::Matcher<Decl>, InnerMatcher) {
978 return InnerMatcher.matches(*
Node.getAsDecl(), Finder, Builder);
996 return InnerMatcher.matches(*
Node.getAsExpr(), Finder, Builder);
1026 internal::Matcher<QualType>, InnerMatcher) {
1029 return InnerMatcher.matches(
Node.getIntegralType(), Finder, Builder);
1047 std::string,
Value) {
1050 return Node.getAsIntegral().toString(10) ==
Value;
1063 extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1073 extern const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl>
valueDecl;
1086 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
1098 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
1109 extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl>
enumDecl;
1119 extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
1128 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl>
1137 extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
1149 extern const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl>
varDecl;
1159 extern const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl>
fieldDecl;
1169 extern const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
1178 extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl>
1187 extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
1198 extern const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl>
friendDecl;
1208 extern const internal::VariadicAllOfMatcher<Stmt>
stmt;
1218 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt>
declStmt;
1231 extern const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr>
memberExpr;
1245 extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
1257 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1269 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr>
callExpr;
1299 extern const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr>
lambdaExpr;
1308 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
1320 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
1330 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
1340 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
1350 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
1360 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
1370 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
1385 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
1398 extern const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
1410 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl>
1421 extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
1430 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
1440 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt>
1450 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
1460 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
1470 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
1483 extern const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr>
1489 internal::Matcher<Expr>, InnerMatcher) {
1490 const Expr *SyntForm =
Node.getSyntacticForm();
1491 return (SyntForm !=
nullptr &&
1492 InnerMatcher.matches(*SyntForm, Finder, Builder));
1506 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1518 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
1536 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr>
1549 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1562 extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl>
usingDecl;
1573 extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
1590 extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
1604 extern const internal::VariadicDynCastAllOfMatcher<Decl,
1623 extern const internal::VariadicDynCastAllOfMatcher<Decl,
1636 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr>
1646 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr>
parenExpr;
1658 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
1669 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1683 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr>
1694 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
1715 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
1727 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr>
cxxNewExpr;
1737 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr>
1748 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
1760 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
1777 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
1786 extern const internal::VariadicDynCastAllOfMatcher<Stmt, Expr>
expr;
1795 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
1809 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr>
1818 extern const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr>
blockExpr;
1826 extern const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt>
ifStmt;
1835 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt>
forStmt;
1847 const Stmt *
const Increment =
Node.getInc();
1848 return (Increment !=
nullptr &&
1849 InnerMatcher.matches(*Increment, Finder, Builder));
1862 const Stmt *
const Init =
Node.getInit();
1863 return (Init !=
nullptr && InnerMatcher.matches(*Init, Finder, Builder));
1873 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
1886 const VarDecl *
const Var =
Node.getLoopVariable();
1887 return (Var !=
nullptr && InnerMatcher.matches(*Var, Finder, Builder));
1900 const Expr *
const Init =
Node.getRangeInit();
1901 return (Init !=
nullptr && InnerMatcher.matches(*Init, Finder, Builder));
1912 extern const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt>
whileStmt;
1922 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt>
doStmt;
1932 extern const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt>
breakStmt;
1942 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt>
1953 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt>
returnStmt;
1964 extern const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt>
gotoStmt;
1975 extern const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt>
labelStmt;
1987 extern const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr>
1998 extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt>
switchStmt;
2008 extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase>
switchCase;
2018 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt>
caseStmt;
2028 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt>
2037 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt>
2047 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt>
2057 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt>
cxxTryStmt;
2066 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr>
2076 extern const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt>
nullStmt;
2086 extern const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt>
asmStmt;
2094 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
2104 extern const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral>
2117 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
2124 extern const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
2134 extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
2139 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
2145 extern const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
2155 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
2159 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
2163 extern const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr>
2171 extern const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr>
atomicExpr;
2179 extern const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr>
stmtExpr;
2187 extern const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
2196 extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator>
2205 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
2214 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
2226 extern const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
2242 extern const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
2255 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
2271 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
2286 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
2297 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
2306 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
2330 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
2337 extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
2353 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr>
castExpr;
2363 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
2372 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
2381 extern const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
2390 extern const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
2405 return Node.size() == N;
2409 extern const internal::VariadicAllOfMatcher<QualType>
qualType;
2412 extern const internal::VariadicAllOfMatcher<Type>
type;
2415 extern const internal::VariadicAllOfMatcher<TypeLoc>
typeLoc;
2436 extern const internal::VariadicOperatorMatcherFunc<
2443 extern const internal::VariadicOperatorMatcherFunc<
2450 extern const internal::VariadicOperatorMatcherFunc<
2463 extern const internal::VariadicDynCastAllOfMatcher<Stmt,
2476 internal::Matcher<QualType>, InnerMatcher) {
2477 const QualType ArgumentType =
Node.getTypeOfArgument();
2478 return InnerMatcher.matches(ArgumentType, Finder, Builder);
2497 const internal::Matcher<UnaryExprOrTypeTraitExpr> &InnerMatcher) {
2506 const internal::Matcher<UnaryExprOrTypeTraitExpr> &InnerMatcher) {
2526 inline internal::Matcher<NamedDecl>
hasName(
const std::string &Name) {
2527 return internal::Matcher<NamedDecl>(
new internal::HasNameMatcher({Name}));
2540 extern const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
2561 assert(!RegExp.empty());
2562 std::string FullNameString =
"::" +
Node.getQualifiedNameAsString();
2563 llvm::Regex RE(RegExp);
2564 return RE.match(FullNameString);
2586 inline internal::PolymorphicMatcherWithParam1<
2587 internal::HasOverloadedOperatorNameMatcher, StringRef,
2590 return internal::PolymorphicMatcherWithParam1<
2591 internal::HasOverloadedOperatorNameMatcher, StringRef,
2617 internal::Matcher<NamedDecl>,
Base) {
2618 return Finder->classIsDerivedFrom(&
Node,
Base, Builder);
2623 assert(!BaseName.empty());
2624 return isDerivedFrom(
hasName(BaseName)).matches(
Node, Finder, Builder);
2630 internal::Matcher<NamedDecl>,
Base, 0) {
2631 return Matcher<CXXRecordDecl>(
anyOf(
Base, isDerivedFrom(
Base)))
2639 assert(!BaseName.empty());
2640 return isSameOrDerivedFrom(
hasName(BaseName)).matches(
Node, Finder, Builder);
2656 return matchesFirstInPointerRange(InnerMatcher,
Node.method_begin(),
2657 Node.method_end(), Finder, Builder);
2670 return Node.isLambda();
2691 extern const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher>
has;
2707 extern const internal::ArgumentAdaptingMatcherFunc<
2708 internal::HasDescendantMatcher>
2729 extern const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher>
2759 extern const internal::ArgumentAdaptingMatcherFunc<
2760 internal::ForEachDescendantMatcher>
2779 template <
typename T>
2780 internal::Matcher<T>
findAll(
const internal::Matcher<T> &Matcher) {
2794 extern const internal::ArgumentAdaptingMatcherFunc<
2795 internal::HasParentMatcher,
2796 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
2797 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
2811 extern const internal::ArgumentAdaptingMatcherFunc<
2812 internal::HasAncestorMatcher,
2813 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
2814 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
2826 extern const internal::VariadicOperatorMatcherFunc<1, 1>
unless;
2862 inline internal::PolymorphicMatcherWithParam1<
2863 internal::HasDeclarationMatcher, internal::Matcher<Decl>,
2864 void(internal::HasDeclarationSupportedTypes)>
2866 return internal::PolymorphicMatcherWithParam1<
2867 internal::HasDeclarationMatcher, internal::Matcher<Decl>,
2868 void(internal::HasDeclarationSupportedTypes)>(InnerMatcher);
2886 return UnderlyingDecl !=
nullptr &&
2887 InnerMatcher.matches(*UnderlyingDecl, Finder, Builder);
2902 const Expr *ExprNode =
Node.getImplicitObjectArgument()
2903 ->IgnoreParenImpCasts();
2904 return (ExprNode !=
nullptr &&
2905 InnerMatcher.matches(*ExprNode, Finder, Builder));
2922 return InnerMatcher.matches(TypeDecl, Finder, Builder);
2939 return Node.isInstanceMessage();
2954 const Expr *ReceiverNode =
Node.getInstanceReceiver();
2955 return (ReceiverNode !=
nullptr &&
2983 extern const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>,
2997 assert(!RegExp.empty());
2998 std::string SelectorString =
Node.getSelector().getAsString();
2999 llvm::Regex RE(RegExp);
3000 return RE.match(SelectorString);
3008 return Node.getSelector().isNull();
3020 return Node.getSelector().isUnarySelector();
3036 return Node.getSelector().isKeywordSelector();
3051 return Node.getSelector().getNumArgs() == N;
3072 const Expr *ExprNode =
Node.getCallee();
3073 return (ExprNode !=
nullptr &&
3074 InnerMatcher.matches(*ExprNode, Finder, Builder));
3108 internal::Matcher<QualType>, InnerMatcher, 0) {
3111 return InnerMatcher.matches(QT, Finder, Builder);
3136 internal::Matcher<Decl>, InnerMatcher, 1) {
3153 if (!
Node.getTypeSourceInfo())
3156 return Inner.matches(
Node.getTypeSourceInfo()->getTypeLoc(), Finder, Builder);
3169 return Name ==
Node.getAsString();
3183 QualType, pointsTo, internal::Matcher<QualType>,
3185 return (!
Node.isNull() &&
Node->isAnyPointerType() &&
3186 InnerMatcher.matches(
Node->getPointeeType(), Finder, Builder));
3193 .matches(
Node, Finder, Builder);
3208 return InnerMatcher.matches(*
Node.getUnqualifiedDesugaredType(), Finder,
3227 return (!
Node.isNull() &&
Node->isReferenceType() &&
3228 InnerMatcher.matches(
Node->getPointeeType(), Finder, Builder));
3247 return InnerMatcher.matches(
Node.getCanonicalType(), Finder, Builder);
3254 .matches(
Node, Finder, Builder);
3258 internal::Matcher<Expr>, InnerMatcher) {
3259 const Expr *ExprNode =
Node.getImplicitObjectArgument();
3260 return (ExprNode !=
nullptr &&
3261 InnerMatcher.matches(*ExprNode, Finder, Builder));
3267 internal::Matcher<QualType>, InnerMatcher, 0) {
3268 return onImplicitObjectArgument(
3269 anyOf(hasType(InnerMatcher), hasType(pointsTo(InnerMatcher))))
3270 .matches(
Node, Finder, Builder);
3275 internal::Matcher<Decl>, InnerMatcher, 1) {
3276 return onImplicitObjectArgument(
3277 anyOf(hasType(InnerMatcher), hasType(pointsTo(InnerMatcher))))
3278 .matches(
Node, Finder, Builder);
3292 const Decl *DeclNode =
Node.getDecl();
3293 return (DeclNode !=
nullptr &&
3294 InnerMatcher.matches(*DeclNode, Finder, Builder));
3312 internal::Matcher<UsingShadowDecl>, InnerMatcher) {
3315 return InnerMatcher.matches(*
UsingDecl, Finder, Builder);
3336 return matchesFirstInPointerRange(InnerMatcher,
Node.decls_begin(),
3337 Node.decls_end(), Finder, Builder);
3350 if (
Node.isSingleDecl()) {
3351 const Decl *FoundDecl =
Node.getSingleDecl();
3352 return InnerMatcher.matches(*FoundDecl, Finder, Builder);
3366 VarDecl, hasInitializer, internal::Matcher<Expr>,
3368 const Expr *Initializer =
Node.getAnyInitializer();
3369 return (Initializer !=
nullptr &&
3370 InnerMatcher.matches(*Initializer, Finder, Builder));
3384 return Node.isStaticLocal();
3399 return Node.hasLocalStorage();
3413 return Node.hasGlobalStorage();
3480 return Node.isExceptionVariable();
3496 return Node.getNumArgs() == N;
3511 unsigned, N, internal::Matcher<Expr>, InnerMatcher) {
3512 return (N <
Node.getNumArgs() &&
3513 InnerMatcher.matches(
3514 *
Node.getArg(N)->IgnoreParenImpCasts(), Finder, Builder));
3525 ast_matchers::internal::Matcher<Expr>, InnerMatcher) {
3526 return N <
Node.getNumInits() &&
3527 InnerMatcher.matches(*
Node.getInit(N), Finder, Builder);
3565 internal::Matcher<Decl>, InnerMatcher) {
3570 std::advance(Iterator, N);
3571 return InnerMatcher.matches(**Iterator, Finder, Builder);
3588 return Node.getExceptionDecl() ==
nullptr;
3605 internal::Matcher<CXXCtorInitializer>, InnerMatcher) {
3606 return matchesFirstInPointerRange(InnerMatcher,
Node.init_begin(),
3607 Node.init_end(), Finder, Builder);
3624 internal::Matcher<FieldDecl>, InnerMatcher) {
3626 return (NodeAsDecl !=
nullptr &&
3627 InnerMatcher.matches(*NodeAsDecl, Finder, Builder));
3644 internal::Matcher<Expr>, InnerMatcher) {
3645 const Expr* NodeAsExpr =
Node.getInit();
3646 return (NodeAsExpr !=
nullptr &&
3647 InnerMatcher.matches(*NodeAsExpr, Finder, Builder));
3664 return Node.isWritten();
3684 return Node.isBaseInitializer();
3704 return Node.isMemberInitializer();
3730 internal::Matcher<Expr>, InnerMatcher) {
3731 for (
const Expr *Arg :
Node.arguments()) {
3732 BoundNodesTreeBuilder Result(*Builder);
3733 if (InnerMatcher.matches(*Arg, Finder, &Result)) {
3734 *Builder = std::move(Result);
3743 return Node.isListInitialization();
3759 return Node.requiresZeroInitialization();
3786 unsigned, N, internal::Matcher<ParmVarDecl>,
3788 return (N <
Node.parameters().size()
3789 && InnerMatcher.matches(*
Node.parameters()[N], Finder, Builder));
3813 internal::Matcher<Expr>, ArgMatcher,
3814 internal::Matcher<ParmVarDecl>, ParamMatcher) {
3815 BoundNodesTreeBuilder Result;
3819 BoundNodesTreeBuilder Matches;
3821 .matches(
Node, Finder, &Matches)
3825 bool Matched =
false;
3826 for (; ArgIndex <
Node.getNumArgs(); ++ArgIndex) {
3827 BoundNodesTreeBuilder ArgMatches(*Builder);
3828 if (ArgMatcher.matches(*(
Node.getArg(ArgIndex)->IgnoreParenCasts()),
3829 Finder, &ArgMatches)) {
3830 BoundNodesTreeBuilder ParamMatches(ArgMatches);
3832 hasParameter(ParamIndex, ParamMatcher)))),
3834 hasParameter(ParamIndex, ParamMatcher))))))
3836 Result.addMatch(ParamMatches);
3842 *Builder = std::move(Result);
3881 internal::Matcher<ParmVarDecl>,
3883 return matchesFirstInPointerRange(InnerMatcher,
Node.param_begin(),
3884 Node.param_end(), Finder, Builder);
3908 return Node.getNumParams() == N;
3936 internal::Matcher<QualType>, InnerMatcher) {
3937 return InnerMatcher.matches(
Node.getReturnType(), Finder, Builder);
3957 return Node.isExternC();
3990 return Node.isDeleted();
4003 return Node.isDefaulted();
4025 return FnTy->hasDynamicExceptionSpec();
4078 return Node.isConstexpr();
4092 internal::Matcher<Expr>, InnerMatcher) {
4093 const Expr *
const Condition =
Node.getCond();
4094 return (Condition !=
nullptr &&
4095 InnerMatcher.matches(*Condition, Finder, Builder));
4106 const Stmt *
const Then =
Node.getThen();
4107 return (Then !=
nullptr && InnerMatcher.matches(*Then, Finder, Builder));
4118 const Stmt *
const Else =
Node.getElse();
4119 return (Else !=
nullptr && InnerMatcher.matches(*Else, Finder, Builder));
4153 internal::NotEqualsBoundNodePredicate Predicate;
4156 return Builder->removeBindings(Predicate);
4168 internal::Matcher<DeclStmt>, InnerMatcher) {
4169 const DeclStmt*
const DeclarationStatement =
4170 Node.getConditionVariableDeclStmt();
4171 return DeclarationStatement !=
nullptr &&
4172 InnerMatcher.matches(*DeclarationStatement, Finder, Builder);
4185 internal::Matcher<Expr>, InnerMatcher) {
4186 if (
const Expr* Expression =
Node.getIdx())
4187 return InnerMatcher.matches(*Expression, Finder, Builder);
4202 internal::Matcher<Expr>, InnerMatcher) {
4203 if (
const Expr* Expression =
Node.getBase())
4204 return InnerMatcher.matches(*Expression, Finder, Builder);
4224 internal::Matcher<Stmt>, InnerMatcher) {
4225 const Stmt *
const Statement = internal::GetBodyMatcher<NodeType>::get(
Node);
4226 return (Statement !=
nullptr &&
4227 InnerMatcher.matches(*Statement, Finder, Builder));
4244 internal::Matcher<Stmt>, InnerMatcher) {
4246 return CS && matchesFirstInPointerRange(InnerMatcher, CS->
body_begin(),
4261 return Node.size() == N;
4289 template <
typename ValueT>
4290 internal::PolymorphicMatcherWithParam1<internal::ValueEqualsMatcher, ValueT>
4292 return internal::PolymorphicMatcherWithParam1<
4293 internal::ValueEqualsMatcher,
4302 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
4310 unsigned,
Value, 1) {
4311 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
4321 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
4335 std::string, Name) {
4336 return Name ==
Node.getOpcodeStr(
Node.getOpcode());
4356 return Node.isAssignmentOp();
4368 internal::Matcher<Expr>, InnerMatcher) {
4369 const Expr *LeftHandSide =
Node.getLHS();
4370 return (LeftHandSide !=
nullptr &&
4371 InnerMatcher.matches(*LeftHandSide, Finder, Builder));
4383 internal::Matcher<Expr>, InnerMatcher) {
4384 const Expr *RightHandSide =
Node.getRHS();
4385 return (RightHandSide !=
nullptr &&
4386 InnerMatcher.matches(*RightHandSide, Finder, Builder));
4392 const internal::Matcher<Expr> &InnerMatcher) {
4393 return anyOf(hasLHS(InnerMatcher), hasRHS(InnerMatcher));
4404 internal::Matcher<Expr>, InnerMatcher) {
4405 const Expr *
const Operand =
Node.getSubExpr();
4406 return (Operand !=
nullptr &&
4407 InnerMatcher.matches(*Operand, Finder, Builder));
4428 internal::Matcher<Expr>, InnerMatcher) {
4429 const Expr *
const SubExpression =
4430 internal::GetSourceExpressionMatcher<NodeType>::get(
Node);
4431 return (SubExpression !=
nullptr &&
4432 InnerMatcher.matches(*SubExpression, Finder, Builder));
4451 internal::Matcher<QualType>, InnerMatcher) {
4453 return InnerMatcher.matches(NodeType, Finder, Builder);
4461 internal::Matcher<QualType>, InnerMatcher) {
4462 return InnerMatcher.matches(
Node.getType(), Finder, Builder);
4474 return Node.isStruct();
4486 return Node.isUnion();
4498 return Node.isClass();
4513 internal::Matcher<Expr>, InnerMatcher) {
4514 const Expr *Expression =
Node.getTrueExpr();
4515 return (Expression !=
nullptr &&
4516 InnerMatcher.matches(*Expression, Finder, Builder));
4528 internal::Matcher<Expr>, InnerMatcher) {
4529 const Expr *Expression =
Node.getFalseExpr();
4530 return (Expression !=
nullptr &&
4531 InnerMatcher.matches(*Expression, Finder, Builder));
4558 return Node.isThisDeclarationADefinition();
4572 return Node.isVariadic();
4593 internal::Matcher<CXXRecordDecl>, InnerMatcher) {
4595 return (Parent !=
nullptr &&
4596 InnerMatcher.matches(*Parent, Finder, Builder));
4624 internal::Matcher<CXXMethodDecl>, InnerMatcher) {
4625 BoundNodesTreeBuilder Result;
4626 bool Matched =
false;
4627 for (
const auto *Overridden :
Node.overridden_methods()) {
4628 BoundNodesTreeBuilder OverriddenBuilder(*Builder);
4629 const bool OverriddenMatched =
4630 InnerMatcher.matches(*Overridden, Finder, &OverriddenBuilder);
4631 if (OverriddenMatched) {
4633 Result.addMatch(OverriddenBuilder);
4636 *Builder = std::move(Result);
4651 return Node.isVirtual();
4669 return Node.isVirtualAsWritten();
4690 return Node.template hasAttr<FinalAttr>();
4704 return Node.isPure();
4719 return Node.isConst();
4736 return Node.isCopyAssignmentOperator();
4753 return Node.isMoveAssignmentOperator();
4771 return Node.size_overridden_methods() > 0 ||
Node.hasAttr<OverrideAttr>();
4786 return Node.isUserProvided();
4816 return Node.isArrow();
4830 return Node->isIntegerType();
4844 return Node->isUnsignedIntegerType();
4858 return Node->isSignedIntegerType();
4872 return Node->isAnyCharacterType();
4892 return Node->isAnyPointerType();
4911 return Node.isConstQualified();
4930 return Node.isVolatileQualified();
4947 return Node.hasLocalQualifiers();
4963 internal::Matcher<ValueDecl>, InnerMatcher) {
4964 return InnerMatcher.matches(*
Node.getMemberDecl(), Finder, Builder);
4980 hasObjectExpression,
4983 internal::Matcher<Expr>, InnerMatcher) {
4984 if (
const auto *E = dyn_cast<UnresolvedMemberExpr>(&
Node))
4985 if (E->isImplicitAccess())
4987 if (
const auto *E = dyn_cast<CXXDependentScopeMemberExpr>(&
Node))
4988 if (E->isImplicitAccess())
4990 return InnerMatcher.matches(*
Node.getBase(), Finder, Builder);
5003 internal::Matcher<UsingShadowDecl>, InnerMatcher) {
5004 return matchesFirstInPointerRange(InnerMatcher,
Node.shadow_begin(),
5005 Node.shadow_end(), Finder, Builder);
5021 internal::Matcher<NamedDecl>, InnerMatcher) {
5022 return InnerMatcher.matches(*
Node.getTargetDecl(), Finder, Builder);
5056 Node.getTemplateSpecializationKind() ==
5058 Node.getTemplateSpecializationKind() ==
5120 internal::Matcher<QualType>, InnerMatcher, 0) {
5121 return internal::BindableMatcher<TypeLoc>(
5122 new internal::TypeLocTypeMatcher(InnerMatcher));
5134 return Node.isBooleanType();
5146 return Node.isVoidType();
5149 template <
typename NodeType>
5198 return Node.isRealFloatingType();
5251 return internal::HasSizeMatcher<NodeType>::hasSize(
Node, N);
5307 internal::Matcher<Expr>, InnerMatcher) {
5308 return InnerMatcher.matches(*
Node.getSizeExpr(), Finder, Builder);
5553 pointee, getPointee,
5674 internal::Matcher<NestedNameSpecifier>, InnerMatcher) {
5676 return InnerMatcher.matches(*Qualifier, Finder, Builder);
5698 return InnerMatcher.matches(
Node.getNamedType(), Finder, Builder);
5729 hasReplacementType, getReplacementType,
5768 return InnerType.matches(
Node.getDecayedType(), Finder, Builder);
5787 if (!DC)
return false;
5804 extern const internal::VariadicAllOfMatcher<NestedNameSpecifier>
5808 extern const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
5814 internal::BindableMatcher<NestedNameSpecifierLoc>, loc,
5815 internal::Matcher<NestedNameSpecifier>, InnerMatcher, 1) {
5816 return internal::BindableMatcher<NestedNameSpecifierLoc>(
5817 new internal::LocMatcher<NestedNameSpecifierLoc, NestedNameSpecifier>(
5834 internal::Matcher<QualType>, InnerMatcher) {
5835 if (!
Node.getAsType())
5837 return InnerMatcher.matches(
QualType(
Node.getAsType(), 0), Finder, Builder);
5852 internal::Matcher<TypeLoc>, InnerMatcher) {
5853 return Node &&
Node.getNestedNameSpecifier()->getAsType() &&
5854 InnerMatcher.matches(
Node.getTypeLoc(), Finder, Builder);
5867 internal::Matcher<NestedNameSpecifier>, InnerMatcher,
5872 return InnerMatcher.matches(*NextNode, Finder, Builder);
5885 internal::Matcher<NestedNameSpecifierLoc>, InnerMatcher,
5890 return InnerMatcher.matches(NextNode, Finder, Builder);
5904 internal::Matcher<NamespaceDecl>, InnerMatcher) {
5905 if (!
Node.getAsNamespace())
5907 return InnerMatcher.matches(*
Node.getAsNamespace(), Finder, Builder);
5918 return &
Node == Other;
5924 return &
Node == Other;
5930 return &
Node == Other;
5948 BoundNodesTreeBuilder Result;
5953 bool Matched =
false;
5955 SC = SC->getNextSwitchCase()) {
5956 BoundNodesTreeBuilder CaseBuilder(*Builder);
5957 bool CaseMatched = InnerMatcher.matches(*SC, Finder, &CaseBuilder);
5960 Result.addMatch(CaseBuilder);
5963 *Builder = std::move(Result);
5978 internal::Matcher<CXXCtorInitializer>, InnerMatcher) {
5979 BoundNodesTreeBuilder Result;
5980 bool Matched =
false;
5981 for (
const auto *I :
Node.inits()) {
5982 BoundNodesTreeBuilder InitBuilder(*Builder);
5983 if (InnerMatcher.matches(*I, Finder, &InitBuilder)) {
5985 Result.addMatch(InitBuilder);
5988 *Builder = std::move(Result);
6004 return Node.isCopyConstructor();
6019 return Node.isMoveConstructor();
6034 return Node.isDefaultConstructor();
6051 return Node.isDelegatingConstructor();
6071 return Node.isExplicit();
6092 if (
const auto *FD = dyn_cast<FunctionDecl>(&
Node))
6093 return FD->isInlineSpecified();
6094 else if (
const auto *NSD = dyn_cast<NamespaceDecl>(&
Node))
6095 return NSD->isInline();
6096 llvm_unreachable(
"Not a valid polymorphic type");
6109 return Node.isAnonymousNamespace();
6126 return InnerMatcher.matches(*
Node.getLHS(), Finder, Builder);
6139 for (
const auto *
Attr :
Node.attrs()) {
6158 if (
const auto *RetValue =
Node.getRetValue())
6159 return InnerMatcher.matches(*RetValue, Finder, Builder);
6169 extern const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
6207 const auto &Parents = Finder->getASTContext().getParents(
Node);
6211 while(!Stack.empty()) {
6212 const auto &CurNode = Stack.back();
6214 if(
const auto *FuncDeclNode = CurNode.get<
FunctionDecl>()) {
6215 if(InnerMatcher.matches(*FuncDeclNode, Finder, Builder)) {
6218 }
else if(
const auto *LambdaExprNode = CurNode.get<
LambdaExpr>()) {
6219 if(InnerMatcher.matches(*LambdaExprNode->getCallOperator(),
6224 for(
const auto &
Parent: Finder->getASTContext().getParents(CurNode))
6252 return Node.hasExternalFormalLinkage();
6263 return Node.hasDefaultArg();
6275 return Node.isArray();
6287 return Node.isArray() &&
6288 InnerMatcher.matches(*
Node.getArraySize(), Finder, Builder);
6299 return Node.hasDefinition();
6310 return Node.isScoped();
6322 return F->hasTrailingReturn();
6329 #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::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.
bool isAssignmentOperator(OverloadedOperatorKind OK)
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.
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.
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< 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.
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.
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, 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.
Pepresents 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.
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 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++ 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.
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.
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...
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.
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
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
IgnoreParenImpCasts - Ignore parentheses and implicit casts.
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.
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.
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]).
__DEVICE__ int max(int __a, int __b)
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.