44#ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H
45#define LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H
82#include "llvm/ADT/ArrayRef.h"
83#include "llvm/ADT/SmallVector.h"
84#include "llvm/ADT/StringExtras.h"
85#include "llvm/ADT/StringRef.h"
86#include "llvm/Support/Casting.h"
87#include "llvm/Support/Compiler.h"
88#include "llvm/Support/ErrorHandling.h"
89#include "llvm/Support/Regex.h"
100namespace ast_matchers {
115 template <
typename T>
117 return MyBoundNodes.getNodeAs<
T>(
ID);
127 return MyBoundNodes.getMap();
134 BoundNodes(internal::BoundNodesMap &MyBoundNodes)
135 : MyBoundNodes(MyBoundNodes) {}
137 internal::BoundNodesMap MyBoundNodes;
171inline internal::TrueMatcher
anything() {
return internal::TrueMatcher(); }
184extern const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
196extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl>
208extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
220extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl>
230extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
249 auto &
SourceManager = Finder->getASTContext().getSourceManager();
270 auto &
SourceManager = Finder->getASTContext().getSourceManager();
272 if (ExpansionLoc.isInvalid()) {
297 auto &
SourceManager = Finder->getASTContext().getSourceManager();
299 if (ExpansionLoc.isInvalid()) {
318 std::string, MacroName) {
321 auto& Context = Finder->getASTContext();
322 std::optional<SourceLocation> B =
324 if (!B)
return false;
325 std::optional<SourceLocation>
E =
327 if (!
E)
return false;
340extern const internal::VariadicAllOfMatcher<Decl>
decl;
352extern const internal::VariadicDynCastAllOfMatcher<Decl, DecompositionDecl>
362extern const internal::VariadicDynCastAllOfMatcher<Decl, BindingDecl>
373extern const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
387extern const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl>
namedDecl;
398extern const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl>
labelDecl;
409extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl>
421extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
433extern const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl>
recordDecl;
442extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl>
451extern const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
464extern const internal::VariadicDynCastAllOfMatcher<
483extern const internal::VariadicDynCastAllOfMatcher<
496extern const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
507extern const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl>
521extern const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
531extern const internal::VariadicAllOfMatcher<CXXBaseSpecifier>
cxxBaseSpecifier;
542extern const internal::VariadicAllOfMatcher<CXXCtorInitializer>
554extern const internal::VariadicAllOfMatcher<TemplateArgument>
templateArgument;
565extern const internal::VariadicAllOfMatcher<TemplateArgumentLoc>
577extern const internal::VariadicAllOfMatcher<TemplateName>
templateName;
587extern const internal::VariadicDynCastAllOfMatcher<
Decl,
599extern const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
610extern const internal::VariadicDynCastAllOfMatcher<
Decl,
694 return Node.isBitField();
711 return Node.isBitField() &&
712 Node.getBitWidthValue(Finder->getASTContext()) == Width;
733 InnerMatcher.matches(*
Initializer, Finder, Builder));
739 return Node.isMain();
753 internal::Matcher<ClassTemplateDecl>, InnerMatcher) {
755 return (
Decl !=
nullptr &&
756 InnerMatcher.matches(*
Decl, Finder, Builder));
764 return Node.isImplicit();
789 hasAnyTemplateArgument,
793 internal::Matcher<TemplateArgument>, InnerMatcher) {
795 internal::getTemplateSpecializationArgs(
Node);
796 return matchesFirstInRange(InnerMatcher, List.begin(), List.end(), Finder,
797 Builder) != List.end();
818 const internal::Matcher<T> &InnerMatcher) {
819 return internal::DynTypedMatcher::constructRestrictedWrapper(
820 new internal::TraversalMatcher<T>(TK, InnerMatcher),
821 InnerMatcher.getID().first)
822 .template unconditionalConvertTo<T>();
826internal::BindableMatcher<T>
828 return internal::BindableMatcher<T>(
829 internal::DynTypedMatcher::constructRestrictedWrapper(
830 new internal::TraversalMatcher<T>(TK, InnerMatcher),
831 InnerMatcher.getID().first)
832 .template unconditionalConvertTo<T>());
835template <
typename...
T>
836internal::TraversalWrapper<internal::VariadicOperatorMatcher<
T...>>
838 const internal::VariadicOperatorMatcher<T...> &InnerMatcher) {
839 return internal::TraversalWrapper<internal::VariadicOperatorMatcher<
T...>>(
843template <
template <
typename ToArg,
typename FromArg>
class ArgumentAdapterT,
844 typename T,
typename ToTypes>
845internal::TraversalWrapper<
846 internal::ArgumentAdaptingMatcherFuncAdaptor<ArgumentAdapterT, T, ToTypes>>
848 ArgumentAdapterT,
T, ToTypes> &InnerMatcher) {
849 return internal::TraversalWrapper<
850 internal::ArgumentAdaptingMatcherFuncAdaptor<ArgumentAdapterT,
T,
851 ToTypes>>(TK, InnerMatcher);
854template <
template <
typename T,
typename...
P>
class MatcherT, typename...
P,
855 typename ReturnTypesF>
856internal::TraversalWrapper<
857 internal::PolymorphicMatcher<MatcherT, ReturnTypesF, P...>>
859 const internal::PolymorphicMatcher<MatcherT, ReturnTypesF, P...>
861 return internal::TraversalWrapper<
862 internal::PolymorphicMatcher<MatcherT, ReturnTypesF,
P...>>(TK,
866template <
typename...
T>
867internal::Matcher<
typename internal::GetClade<
T...>::Type>
869 return traverse(TK, InnerMatcher.with());
895 return InnerMatcher.matches(*
Node.IgnoreImplicit(), Finder, Builder);
924 internal::Matcher<Expr>, InnerMatcher) {
925 return InnerMatcher.matches(*
Node.IgnoreImpCasts(), Finder, Builder);
946 return InnerMatcher.matches(*
Node.IgnoreParenCasts(), Finder, Builder);
971 internal::Matcher<Expr>, InnerMatcher) {
972 return InnerMatcher.matches(*
Node.IgnoreParenImpCasts(), Finder, Builder);
988 return InnerMatcher.matches(
Node.IgnoreParens(), Finder, Builder);
1005 return InnerMatcher.matches(*
E, Finder, Builder);
1022 return Node.isInstantiationDependent();
1070 hasTemplateArgument,
1074 unsigned, N, internal::Matcher<TemplateArgument>, InnerMatcher) {
1076 internal::getTemplateSpecializationArgs(
Node);
1077 if (List.size() <= N)
1079 return InnerMatcher.matches(List[N], Finder, Builder);
1092 templateArgumentCountIs,
1096 return internal::getTemplateSpecializationArgs(
Node).size() == N;
1111 internal::Matcher<QualType>, InnerMatcher) {
1114 return InnerMatcher.matches(
Node.getAsType(), Finder, Builder);
1129 internal::Matcher<TemplateName>, InnerMatcher) {
1132 return InnerMatcher.matches(
Node.getAsTemplate(), Finder, Builder);
1149 internal::Matcher<Decl>, InnerMatcher) {
1151 return InnerMatcher.matches(*
Node.getAsDecl(), Finder, Builder);
1169 return InnerMatcher.matches(*
Node.getAsExpr(), Finder, Builder);
1199 internal::Matcher<QualType>, InnerMatcher) {
1202 return InnerMatcher.matches(
Node.getIntegralType(), Finder, Builder);
1220 std::string,
Value) {
1236extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1248extern const internal::VariadicDynCastAllOfMatcher<Decl, ExportDecl>
exportDecl;
1257extern const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl>
valueDecl;
1270extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
1282extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
1293extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl>
enumDecl;
1303extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
1318extern const internal::VariadicDynCastAllOfMatcher<Decl, TagDecl>
tagDecl;
1326extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl>
1335extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
1346extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
1356extern const internal::VariadicDynCastAllOfMatcher<Decl, ConceptDecl>
1368extern const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl>
varDecl;
1378extern const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl>
fieldDecl;
1388extern const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
1397extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl>
1406extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
1417extern const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl>
friendDecl;
1427extern const internal::VariadicAllOfMatcher<Stmt>
stmt;
1437extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt>
declStmt;
1450extern const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr>
memberExpr;
1464extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
1476extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1488extern const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr>
callExpr;
1518extern const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr>
lambdaExpr;
1527extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
1539extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
1548extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCStringLiteral>
1558extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
1568extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
1578extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
1588extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
1598extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
1613extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
1626extern const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
1638extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl>
1649extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
1658extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
1668extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt>
1678extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
1688extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
1698extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
1711extern const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr>
1717 internal::Matcher<Expr>, InnerMatcher) {
1718 const Expr *SyntForm =
Node.getSyntacticForm();
1719 return (SyntForm !=
nullptr &&
1720 InnerMatcher.matches(*SyntForm, Finder, Builder));
1734extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1746extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
1764extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr>
1777extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1790extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl>
usingDecl;
1801extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingEnumDecl>
1813extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
1830extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
1844extern const internal::VariadicDynCastAllOfMatcher<
Decl,
1863extern const internal::VariadicDynCastAllOfMatcher<
Decl,
1876extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr>
1886extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr>
parenExpr;
1898extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
1909extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1923extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr>
1934extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
1955extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1967extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr>
cxxNewExpr;
1977extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr>
1993extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNoexceptExpr>
2013extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitLoopExpr>
2032extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitIndexExpr>
2043extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
2055extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
2074extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
2086extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFoldExpr>
2106extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
2116extern const internal::VariadicDynCastAllOfMatcher<Stmt, Expr>
expr;
2125extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
2139extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr>
2148extern const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr>
blockExpr;
2156extern const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt>
ifStmt;
2165extern const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt>
forStmt;
2177 const Stmt *
const Increment =
Node.getInc();
2178 return (Increment !=
nullptr &&
2179 InnerMatcher.matches(*Increment, Finder, Builder));
2193 return (
Init !=
nullptr && InnerMatcher.matches(*
Init, Finder, Builder));
2203extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
2216 const VarDecl *
const Var =
Node.getLoopVariable();
2217 return (Var !=
nullptr && InnerMatcher.matches(*Var, Finder, Builder));
2231 return (
Init !=
nullptr && InnerMatcher.matches(*
Init, Finder, Builder));
2242extern const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt>
whileStmt;
2252extern const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt>
doStmt;
2262extern const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt>
breakStmt;
2272extern const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt>
2283extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoreturnStmt>
2294extern const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt>
returnStmt;
2305extern const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt>
gotoStmt;
2316extern const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt>
labelStmt;
2328extern const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr>
2339extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt>
switchStmt;
2349extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase>
switchCase;
2359extern const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt>
caseStmt;
2369extern const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt>
2378extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt>
2388extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt>
2398extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt>
cxxTryStmt;
2407extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr>
2417extern const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt>
nullStmt;
2427extern const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt>
asmStmt;
2435extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
2445extern const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral>
2458extern const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
2465extern const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
2475extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
2480extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
2484extern const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
2490extern const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
2500extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
2511extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoawaitExpr>
2514extern const internal::VariadicDynCastAllOfMatcher<Stmt, DependentCoawaitExpr>
2524extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoyieldExpr>
2535extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoroutineBodyStmt>
2539extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
2543extern const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr>
2547extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConvertVectorExpr>
2551extern const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr>
2555extern const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr>
2563extern const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr>
atomicExpr;
2571extern const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr>
stmtExpr;
2580extern const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
2589extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator>
2598extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
2607extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
2619extern const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
2635extern const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
2648extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
2664extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
2679extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
2690extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
2699extern const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
2723extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
2730extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
2746extern const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr>
castExpr;
2756extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
2765extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
2774extern const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
2783extern const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
2798 return Node.size() == N;
2802extern const internal::VariadicAllOfMatcher<QualType>
qualType;
2805extern const internal::VariadicAllOfMatcher<Type>
type;
2808extern const internal::VariadicAllOfMatcher<TypeLoc>
typeLoc;
2829extern const internal::VariadicOperatorMatcherFunc<
2830 2, std::numeric_limits<unsigned>::max()>
2836extern const internal::VariadicOperatorMatcherFunc<
2837 2, std::numeric_limits<unsigned>::max()>
2843extern const internal::VariadicOperatorMatcherFunc<
2844 2, std::numeric_limits<unsigned>::max()>
2871extern const internal::VariadicOperatorMatcherFunc<1, 1>
optionally;
2882extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
2911template <
typename T,
typename...
U>
2912auto mapAnyOf(internal::VariadicDynCastAllOfMatcher<T, U>
const &...) {
2913 return internal::MapAnyOfHelper<
U...>();
3026extern const internal::MapAnyOfMatcher<CallExpr, CXXConstructExpr>
invocation;
3037 internal::Matcher<QualType>, InnerMatcher) {
3038 const QualType ArgumentType =
Node.getTypeOfArgument();
3039 return InnerMatcher.matches(ArgumentType, Finder, Builder);
3061 const internal::Matcher<UnaryExprOrTypeTraitExpr> &InnerMatcher) {
3063 allOf(
anyOf(ofKind(UETT_AlignOf), ofKind(UETT_PreferredAlignOf)),
3070 const internal::Matcher<UnaryExprOrTypeTraitExpr> &InnerMatcher) {
3072 allOf(ofKind(UETT_SizeOf), InnerMatcher)));
3090inline internal::Matcher<NamedDecl>
hasName(StringRef Name) {
3091 return internal::Matcher<NamedDecl>(
3092 new internal::HasNameMatcher({std::string(Name)}));
3105extern const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
3126 std::string FullNameString =
"::" +
Node.getQualifiedNameAsString();
3127 return RegExp->match(FullNameString);
3149inline internal::PolymorphicMatcher<
3150 internal::HasOverloadedOperatorNameMatcher,
3152 std::vector<std::string>>
3154 return internal::PolymorphicMatcher<
3155 internal::HasOverloadedOperatorNameMatcher,
3157 std::vector<std::string>>({std::string(Name)});
3168extern const internal::VariadicFunction<
3169 internal::PolymorphicMatcher<internal::HasOverloadedOperatorNameMatcher,
3172 std::vector<std::string>>,
3197 return Node.getMember().getAsString() == N;
3235 std::string, BindingID) {
3236 auto MemberName =
Node.getMember().getAsString();
3238 return Builder->removeBindings(
3239 [
this, MemberName](
const BoundNodesMap &
Nodes) {
3242 if (!isa<FieldDecl, CXXMethodDecl, VarDecl>(ND))
3244 return ND->getName() != MemberName;
3283 internal::Matcher<NamedDecl>,
Base) {
3285 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3286 return Finder->classIsDerivedFrom(RD,
Base, Builder,
false);
3289 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3290 return Finder->objcClassIsDerivedFrom(InterfaceDecl,
Base, Builder,
3298 std::string, BaseName, 1) {
3299 if (BaseName.empty())
3302 const auto M = isDerivedFrom(
hasName(BaseName));
3304 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3305 return Matcher<CXXRecordDecl>(M).matches(*RD, Finder, Builder);
3307 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3308 return Matcher<ObjCInterfaceDecl>(M).matches(*InterfaceDecl, Finder, Builder);
3345 return Node.hasDefinition() &&
3347 return BaseSpecMatcher.matches(Base, Finder, Builder);
3354 isSameOrDerivedFrom,
3356 internal::Matcher<NamedDecl>,
Base, 0) {
3359 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3360 return Matcher<CXXRecordDecl>(M).matches(*RD, Finder, Builder);
3362 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3363 return Matcher<ObjCInterfaceDecl>(M).matches(*InterfaceDecl, Finder, Builder);
3369 isSameOrDerivedFrom,
3371 std::string, BaseName, 1) {
3372 if (BaseName.empty())
3375 const auto M = isSameOrDerivedFrom(
hasName(BaseName));
3377 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3378 return Matcher<CXXRecordDecl>(M).matches(*RD, Finder, Builder);
3380 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3381 return Matcher<ObjCInterfaceDecl>(M).matches(*InterfaceDecl, Finder, Builder);
3406 isDirectlyDerivedFrom,
3408 internal::Matcher<NamedDecl>,
Base, 0) {
3410 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3411 return Finder->classIsDerivedFrom(RD,
Base, Builder,
true);
3414 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3415 return Finder->objcClassIsDerivedFrom(InterfaceDecl,
Base, Builder,
3421 isDirectlyDerivedFrom,
3423 std::string, BaseName, 1) {
3424 if (BaseName.empty())
3426 const auto M = isDirectlyDerivedFrom(
hasName(BaseName));
3428 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3429 return Matcher<CXXRecordDecl>(M).matches(*RD, Finder, Builder);
3431 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3432 return Matcher<ObjCInterfaceDecl>(M).matches(*InterfaceDecl, Finder, Builder);
3447 BoundNodesTreeBuilder
Result(*Builder);
3448 auto MatchIt = matchesFirstInPointerRange(InnerMatcher,
Node.method_begin(),
3450 if (MatchIt ==
Node.method_end())
3453 if (Finder->isTraversalIgnoringImplicitNodes() && (*MatchIt)->isImplicit())
3455 *Builder = std::move(
Result);
3469 return Node.isLambda();
3490extern const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher>
has;
3506extern const internal::ArgumentAdaptingMatcherFunc<
3507 internal::HasDescendantMatcher>
3528extern const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher>
3558extern const internal::ArgumentAdaptingMatcherFunc<
3559 internal::ForEachDescendantMatcher>
3578template <
typename T>
3579internal::Matcher<T>
findAll(
const internal::Matcher<T> &Matcher) {
3593extern const internal::ArgumentAdaptingMatcherFunc<
3594 internal::HasParentMatcher,
3595 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
3596 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
3610extern const internal::ArgumentAdaptingMatcherFunc<
3611 internal::HasAncestorMatcher,
3612 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
3613 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
3625extern const internal::VariadicOperatorMatcherFunc<1, 1>
unless;
3661inline internal::PolymorphicMatcher<
3662 internal::HasDeclarationMatcher,
3663 void(internal::HasDeclarationSupportedTypes), internal::Matcher<Decl>>
3665 return internal::PolymorphicMatcher<
3666 internal::HasDeclarationMatcher,
3667 void(internal::HasDeclarationSupportedTypes), internal::Matcher<Decl>>(
3686 return UnderlyingDecl !=
nullptr &&
3687 InnerMatcher.matches(*UnderlyingDecl, Finder, Builder);
3710 const Expr *ExprNode =
Node.getImplicitObjectArgument()
3711 ->IgnoreParenImpCasts();
3712 return (ExprNode !=
nullptr &&
3713 InnerMatcher.matches(*ExprNode, Finder, Builder));
3730 return InnerMatcher.matches(
TypeDecl, Finder, Builder);
3746 return Node.isClassMethod();
3762 return Node.isInstanceMethod();
3779 return Node.isClassMessage();
3796 return Node.isInstanceMessage();
3811 const Expr *ReceiverNode =
Node.getInstanceReceiver();
3812 return (ReceiverNode !=
nullptr &&
3839extern const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>,
3853 std::string SelectorString =
Node.getSelector().getAsString();
3854 return RegExp->match(SelectorString);
3862 return Node.getSelector().isNull();
3874 return Node.getSelector().isUnarySelector();
3890 return Node.getSelector().isKeywordSelector();
3905 return Node.getSelector().getNumArgs() == N;
3944 internal::Matcher<Stmt>, InnerMatcher, 0) {
3945 const auto *ExprNode =
Node.getCallee();
3946 return (ExprNode !=
nullptr &&
3947 InnerMatcher.matches(*ExprNode, Finder, Builder));
3973 internal::Matcher<Decl>, InnerMatcher, 1) {
3974 if (isa<CallExpr>(&
Node))
3976 .matches(
Node, Finder, Builder);
3980 const auto *MsgNode = cast<ObjCMessageExpr>(&
Node);
3981 const Decl *DeclNode = MsgNode->getMethodDecl();
3982 return (DeclNode !=
nullptr &&
3983 InnerMatcher.matches(*DeclNode, Finder, Builder));
4007 internal::Matcher<QualType>, InnerMatcher, 0) {
4010 return InnerMatcher.matches(QT, Finder, Builder);
4048 internal::Matcher<Decl>, InnerMatcher, 1) {
4092 internal::Matcher<TypeLoc>, Inner) {
4094 if (source ==
nullptr) {
4098 return Inner.matches(source->
getTypeLoc(), Finder, Builder);
4111 return Name ==
Node.getAsString();
4125 QualType, pointsTo, internal::Matcher<QualType>,
4127 return (!
Node.isNull() &&
Node->isAnyPointerType() &&
4128 InnerMatcher.matches(
Node->getPointeeType(), Finder, Builder));
4135 .matches(
Node, Finder, Builder);
4150 return InnerMatcher.matches(*
Node.getUnqualifiedDesugaredType(), Finder,
4169 return (!
Node.isNull() &&
Node->isReferenceType() &&
4170 InnerMatcher.matches(
Node->getPointeeType(), Finder, Builder));
4189 return InnerMatcher.matches(
Node.getCanonicalType(), Finder, Builder);
4196 .matches(
Node, Finder, Builder);
4217 internal::Matcher<Expr>, InnerMatcher) {
4218 const Expr *ExprNode =
Node.getImplicitObjectArgument();
4219 return (ExprNode !=
nullptr &&
4220 InnerMatcher.matches(*ExprNode, Finder, Builder));
4240 internal::Matcher<QualType>, InnerMatcher, 0) {
4241 return onImplicitObjectArgument(
4242 anyOf(hasType(InnerMatcher), hasType(pointsTo(InnerMatcher))))
4243 .matches(
Node, Finder, Builder);
4248 internal::Matcher<Decl>, InnerMatcher, 1) {
4249 return onImplicitObjectArgument(
4250 anyOf(hasType(InnerMatcher), hasType(pointsTo(InnerMatcher))))
4251 .matches(
Node, Finder, Builder);
4265 const Decl *DeclNode =
Node.getDecl();
4266 return (DeclNode !=
nullptr &&
4267 InnerMatcher.matches(*DeclNode, Finder, Builder));
4294 internal::Matcher<UsingShadowDecl>, Inner) {
4297 return Inner.matches(*
UsingDecl, Finder, Builder);
4318 return matchesFirstInPointerRange(InnerMatcher,
Node.decls_begin(),
4319 Node.decls_end(), Finder,
4320 Builder) !=
Node.decls_end();
4333 if (
Node.isSingleDecl()) {
4334 const Decl *FoundDecl =
Node.getSingleDecl();
4335 return InnerMatcher.matches(*FoundDecl, Finder, Builder);
4349 VarDecl, hasInitializer, internal::Matcher<Expr>,
4353 InnerMatcher.matches(*
Initializer, Finder, Builder));
4379 internal::Matcher<LambdaCapture>, InnerMatcher) {
4380 BoundNodesTreeBuilder
Result;
4381 bool Matched =
false;
4383 if (Finder->isTraversalIgnoringImplicitNodes() &&
Capture.isImplicit())
4385 BoundNodesTreeBuilder CaptureBuilder(*Builder);
4386 if (InnerMatcher.matches(
Capture, Finder, &CaptureBuilder)) {
4388 Result.addMatch(CaptureBuilder);
4391 *Builder = std::move(
Result);
4406 return Node.isStaticLocal();
4421 return Node.hasLocalStorage();
4435 return Node.hasGlobalStorage();
4502 return Node.isExceptionVariable();
4518 unsigned NumArgs =
Node.getNumArgs();
4519 if (!Finder->isTraversalIgnoringImplicitNodes())
4520 return NumArgs == N;
4522 if (!isa<CXXDefaultArgExpr>(
Node.getArg(NumArgs - 1)))
4526 return NumArgs == N;
4545 unsigned NumArgs =
Node.getNumArgs();
4546 if (!Finder->isTraversalIgnoringImplicitNodes())
4547 return NumArgs >= N;
4549 if (!isa<CXXDefaultArgExpr>(
Node.getArg(NumArgs - 1)))
4553 return NumArgs >= N;
4568 unsigned, N, internal::Matcher<Expr>, InnerMatcher) {
4569 if (N >=
Node.getNumArgs())
4572 if (Finder->isTraversalIgnoringImplicitNodes() && isa<CXXDefaultArgExpr>(Arg))
4595 const auto *
const Init =
Node.getInit();
4596 return Init && InnerMacher.matches(*
Init, Finder, Builder);
4617 const Expr *
const Pattern =
Node.getPattern();
4618 return Pattern && InnerMacher.matches(*Pattern, Finder, Builder);
4699 return N <
Node.getNumInits() &&
4700 InnerMatcher.matches(*
Node.getInit(N), Finder, Builder);
4738 internal::Matcher<Decl>, InnerMatcher) {
4739 const unsigned NumDecls = std::distance(
Node.decl_begin(),
Node.decl_end());
4743 std::advance(Iterator, N);
4744 return InnerMatcher.matches(**Iterator, Finder, Builder);
4761 return Node.getExceptionDecl() ==
nullptr;
4778 internal::Matcher<CXXCtorInitializer>, InnerMatcher) {
4779 auto MatchIt = matchesFirstInPointerRange(InnerMatcher,
Node.init_begin(),
4780 Node.init_end(), Finder, Builder);
4781 if (MatchIt ==
Node.init_end())
4783 return (*MatchIt)->isWritten() || !Finder->isTraversalIgnoringImplicitNodes();
4800 internal::Matcher<FieldDecl>, InnerMatcher) {
4802 return (NodeAsDecl !=
nullptr &&
4803 InnerMatcher.matches(*NodeAsDecl, Finder, Builder));
4820 internal::Matcher<Expr>, InnerMatcher) {
4821 const Expr* NodeAsExpr =
Node.getInit();
4822 return (NodeAsExpr !=
nullptr &&
4823 InnerMatcher.matches(*NodeAsExpr, Finder, Builder));
4840 return Node.isWritten();
4860 return Node.isBaseInitializer();
4880 return Node.isMemberInitializer();
4906 internal::Matcher<Expr>, InnerMatcher) {
4907 for (
const Expr *Arg :
Node.arguments()) {
4908 if (Finder->isTraversalIgnoringImplicitNodes() &&
4909 isa<CXXDefaultArgExpr>(Arg))
4911 BoundNodesTreeBuilder
Result(*Builder);
4912 if (InnerMatcher.matches(*Arg, Finder, &
Result)) {
4913 *Builder = std::move(
Result);
4932extern const internal::VariadicAllOfMatcher<LambdaCapture>
lambdaCapture;
4949 clang::ast_matchers::internal::BoundNodesTreeBuilder
Result(*Builder);
4951 *Builder = std::move(
Result);
4975 if (!
Node.capturesVariable())
4977 auto *capturedVar =
Node.getCapturedVar();
4978 return capturedVar && InnerMatcher.matches(*capturedVar, Finder, Builder);
4999 return Node.isListInitialization();
5015 return Node.requiresZeroInitialization();
5042 unsigned, N, internal::Matcher<ParmVarDecl>,
5044 return (N <
Node.parameters().size()
5045 && InnerMatcher.matches(*
Node.parameters()[N], Finder, Builder));
5064 return Node.isExplicitObjectMemberFunction();
5088 internal::Matcher<Expr>, ArgMatcher,
5089 internal::Matcher<ParmVarDecl>, ParamMatcher) {
5090 BoundNodesTreeBuilder
Result;
5094 BoundNodesTreeBuilder Matches;
5098 .matches(
Node, Finder, &Matches)
5102 bool Matched =
false;
5103 for (; ArgIndex <
Node.getNumArgs(); ++ArgIndex) {
5104 BoundNodesTreeBuilder ArgMatches(*Builder);
5105 if (ArgMatcher.matches(*(
Node.getArg(ArgIndex)->IgnoreParenCasts()),
5106 Finder, &ArgMatches)) {
5107 BoundNodesTreeBuilder ParamMatches(ArgMatches);
5109 hasParameter(ParamIndex, ParamMatcher)))),
5111 hasParameter(ParamIndex, ParamMatcher))))))
5112 .matches(
Node, Finder, &ParamMatches)) {
5113 Result.addMatch(ParamMatches);
5119 *Builder = std::move(
Result);
5151 internal::Matcher<Expr>, ArgMatcher,
5152 internal::Matcher<QualType>, ParamMatcher) {
5153 BoundNodesTreeBuilder
Result;
5157 BoundNodesTreeBuilder Matches;
5161 .matches(
Node, Finder, &Matches)
5166 if (
const auto *
Call = dyn_cast<CallExpr>(&
Node)) {
5167 if (
const auto *
Value =
5168 dyn_cast_or_null<ValueDecl>(
Call->getCalleeDecl())) {
5178 assert(MP &&
"Must be member-pointer if its a memberfunctionpointer");
5181 "The call must have happened through a member function "
5187 unsigned ParamIndex = 0;
5188 bool Matched =
false;
5189 unsigned NumArgs =
Node.getNumArgs();
5193 for (; ArgIndex < NumArgs; ++ArgIndex, ++ParamIndex) {
5194 BoundNodesTreeBuilder ArgMatches(*Builder);
5195 if (ArgMatcher.matches(*(
Node.getArg(ArgIndex)->IgnoreParenCasts()), Finder,
5197 BoundNodesTreeBuilder ParamMatches(ArgMatches);
5203 if (ParamMatcher.matches(ParamType, Finder, &ParamMatches)) {
5204 Result.addMatch(ParamMatches);
5210 hasParameter(ParamIndex, hasType(ParamMatcher))))),
5212 hasParameter(ParamIndex, hasType(ParamMatcher)))))))
5213 .matches(
Node, Finder, &ParamMatches)) {
5214 Result.addMatch(ParamMatches);
5220 *Builder = std::move(
Result);
5242 if (
const auto *
Decl = dyn_cast_or_null<FunctionDecl>(Context))
5243 return N <
Decl->param_size() &&
Decl->getParamDecl(N) == &
Node;
5244 if (
const auto *
Decl = dyn_cast_or_null<BlockDecl>(Context))
5245 return N <
Decl->param_size() &&
Decl->getParamDecl(N) == &
Node;
5246 if (
const auto *
Decl = dyn_cast_or_null<ObjCMethodDecl>(Context))
5247 return N <
Decl->param_size() &&
Decl->getParamDecl(N) == &
Node;
5287 internal::Matcher<ParmVarDecl>,
5289 return matchesFirstInPointerRange(InnerMatcher,
Node.param_begin(),
5290 Node.param_end(), Finder,
5291 Builder) !=
Node.param_end();
5315 return Node.getNumParams() == N;
5343 forEachTemplateArgument,
5347 internal::Matcher<TemplateArgument>, InnerMatcher) {
5349 clang::ast_matchers::internal::getTemplateSpecializationArgs(
Node);
5350 clang::ast_matchers::internal::BoundNodesTreeBuilder
Result;
5351 bool Matched =
false;
5352 for (
const auto &Arg : TemplateArgs) {
5353 clang::ast_matchers::internal::BoundNodesTreeBuilder ArgBuilder(*Builder);
5354 if (InnerMatcher.matches(Arg, Finder, &ArgBuilder)) {
5356 Result.addMatch(ArgBuilder);
5359 *Builder = std::move(
Result);
5388 internal::Matcher<QualType>, InnerMatcher) {
5389 return InnerMatcher.matches(
Node.getReturnType(), Finder, Builder);
5409 return Node.isExternC();
5442 return Node.isDeleted();
5455 return Node.isDefaulted();
5488 return FnTy->hasDynamicExceptionSpec();
5538 return Node.isConsteval();
5560 return Node.isConstexpr();
5575 if (
const auto *CIA =
Node.getAttr<ConstInitAttr>())
5576 return CIA->isConstinit();
5604 internal::Matcher<Stmt>, InnerMatcher) {
5606 return Init !=
nullptr && InnerMatcher.matches(*
Init, Finder, Builder);
5620 internal::Matcher<Expr>, InnerMatcher) {
5623 InnerMatcher.matches(*
Condition, Finder, Builder));
5634 const Stmt *
const Then =
Node.getThen();
5635 return (Then !=
nullptr && InnerMatcher.matches(*Then, Finder, Builder));
5646 const Stmt *
const Else =
Node.getElse();
5647 return (Else !=
nullptr && InnerMatcher.matches(*Else, Finder, Builder));
5681 internal::NotEqualsBoundNodePredicate Predicate;
5684 return Builder->removeBindings(Predicate);
5696 internal::Matcher<DeclStmt>, InnerMatcher) {
5697 const DeclStmt*
const DeclarationStatement =
5698 Node.getConditionVariableDeclStmt();
5699 return DeclarationStatement !=
nullptr &&
5700 InnerMatcher.matches(*DeclarationStatement, Finder, Builder);
5713 internal::Matcher<Expr>, InnerMatcher) {
5715 return InnerMatcher.matches(*
Expression, Finder, Builder);
5730 internal::Matcher<Expr>, InnerMatcher) {
5732 return InnerMatcher.matches(*
Expression, Finder, Builder);
5764 internal::Matcher<Stmt>, InnerMatcher) {
5765 if (Finder->isTraversalIgnoringImplicitNodes() && isDefaultedHelper(&
Node))
5767 const Stmt *
const Statement = internal::GetBodyMatcher<NodeType>::get(
Node);
5768 return (Statement !=
nullptr &&
5769 InnerMatcher.matches(*Statement, Finder, Builder));
5789 internal::Matcher<Stmt>, InnerMatcher) {
5790 const Stmt *
const Statement =
Node.getBody();
5791 return (Statement !=
nullptr &&
5792 InnerMatcher.matches(*Statement, Finder, Builder));
5810 internal::Matcher<Stmt>, InnerMatcher) {
5812 return CS && matchesFirstInPointerRange(InnerMatcher, CS->
body_begin(),
5828 return Node.size() == N;
5856template <
typename ValueT>
5857internal::PolymorphicMatcher<internal::ValueEqualsMatcher,
5858 void(internal::AllNodeBaseTypes), ValueT>
5860 return internal::PolymorphicMatcher<internal::ValueEqualsMatcher,
5861 void(internal::AllNodeBaseTypes), ValueT>(
5870 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
5878 unsigned,
Value, 1) {
5879 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
5889 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
5914 std::string, Name) {
5915 if (std::optional<StringRef> OpName = internal::getOpName(
Node))
5916 return *OpName == Name;
5926extern const internal::VariadicFunction<
5927 internal::PolymorphicMatcher<internal::HasAnyOperatorNameMatcher,
5931 std::vector<std::string>>,
5950 isAssignmentOperator,
5953 return Node.isAssignmentOp();
5971 isComparisonOperator,
5974 return Node.isComparisonOp();
5988 internal::Matcher<Expr>, InnerMatcher) {
5989 const Expr *LeftHandSide = internal::getLHS(
Node);
5990 return (LeftHandSide !=
nullptr &&
5991 InnerMatcher.matches(*LeftHandSide, Finder, Builder));
6005 internal::Matcher<Expr>, InnerMatcher) {
6006 const Expr *RightHandSide = internal::getRHS(
Node);
6007 return (RightHandSide !=
nullptr &&
6008 InnerMatcher.matches(*RightHandSide, Finder, Builder));
6017 internal::Matcher<Expr>, InnerMatcher) {
6018 return internal::VariadicDynCastAllOfMatcher<Stmt, NodeType>()(
6019 anyOf(hasLHS(InnerMatcher), hasRHS(InnerMatcher)))
6020 .matches(
Node, Finder, Builder);
6038 internal::Matcher<Expr>, Matcher1, internal::Matcher<Expr>, Matcher2) {
6039 return internal::VariadicDynCastAllOfMatcher<Stmt, NodeType>()(
6040 anyOf(
allOf(hasLHS(Matcher1), hasRHS(Matcher2)),
6041 allOf(hasRHS(Matcher1), hasLHS(Matcher2))))
6042 .matches(
Node, Finder, Builder);
6055 internal::Matcher<Expr>, InnerMatcher) {
6056 const Expr *
const Operand = internal::getSubExpr(
Node);
6057 return (Operand !=
nullptr &&
6058 InnerMatcher.matches(*Operand, Finder, Builder));
6079 internal::Matcher<Expr>, InnerMatcher) {
6080 const Expr *
const SubExpression =
6081 internal::GetSourceExpressionMatcher<NodeType>::get(
Node);
6082 return (SubExpression !=
nullptr &&
6083 InnerMatcher.matches(*SubExpression, Finder, Builder));
6105 internal::Matcher<QualType>, InnerMatcher) {
6107 return InnerMatcher.matches(NodeType, Finder, Builder);
6113 internal::Matcher<QualType>, InnerMatcher) {
6114 return InnerMatcher.matches(
Node.getType(), Finder, Builder);
6127 return Node.isStruct();
6140 return Node.isUnion();
6153 return Node.isClass();
6166 return Node.isEnum();
6181 internal::Matcher<Expr>, InnerMatcher) {
6184 InnerMatcher.matches(*
Expression, Finder, Builder));
6196 internal::Matcher<Expr>, InnerMatcher) {
6199 InnerMatcher.matches(*
Expression, Finder, Builder));
6226 return Node.isThisDeclarationADefinition();
6240 return Node.isVariadic();
6261 internal::Matcher<CXXRecordDecl>, InnerMatcher) {
6263 ASTChildrenNotSpelledInSourceScope RAII(Finder,
false);
6266 return (
Parent !=
nullptr &&
6267 InnerMatcher.matches(*
Parent, Finder, Builder));
6295 internal::Matcher<CXXMethodDecl>, InnerMatcher) {
6296 BoundNodesTreeBuilder
Result;
6297 bool Matched =
false;
6298 for (
const auto *Overridden :
Node.overridden_methods()) {
6299 BoundNodesTreeBuilder OverriddenBuilder(*Builder);
6300 const bool OverriddenMatched =
6301 InnerMatcher.matches(*Overridden, Finder, &OverriddenBuilder);
6302 if (OverriddenMatched) {
6304 Result.addMatch(OverriddenBuilder);
6307 *Builder = std::move(
Result);
6333 return Node.isVirtual();
6351 return Node.isVirtualAsWritten();
6355 return Node.isInheritingConstructor();
6376 return Node.template hasAttr<FinalAttr>();
6403 return Node.isConst();
6420 return Node.isCopyAssignmentOperator();
6437 return Node.isMoveAssignmentOperator();
6455 return Node.size_overridden_methods() > 0 ||
Node.hasAttr<OverrideAttr>();
6470 return Node.isUserProvided();
6500 return Node.isArrow();
6514 return Node->isIntegerType();
6528 return Node->isUnsignedIntegerType();
6542 return Node->isSignedIntegerType();
6556 return Node->isAnyCharacterType();
6576 return Node->isAnyPointerType();
6595 return Node.isConstQualified();
6614 return Node.isVolatileQualified();
6631 return Node.hasLocalQualifiers();
6647 internal::Matcher<ValueDecl>, InnerMatcher) {
6648 return InnerMatcher.matches(*
Node.getMemberDecl(), Finder, Builder);
6668 hasObjectExpression,
6671 internal::Matcher<Expr>, InnerMatcher) {
6672 if (
const auto *
E = dyn_cast<UnresolvedMemberExpr>(&
Node))
6673 if (
E->isImplicitAccess())
6675 if (
const auto *
E = dyn_cast<CXXDependentScopeMemberExpr>(&
Node))
6676 if (
E->isImplicitAccess())
6678 return InnerMatcher.matches(*
Node.getBase(), Finder, Builder);
6691 internal::Matcher<UsingShadowDecl>, InnerMatcher) {
6692 return matchesFirstInPointerRange(InnerMatcher,
Node.shadow_begin(),
6693 Node.shadow_end(), Finder,
6694 Builder) !=
Node.shadow_end();
6710 internal::Matcher<NamedDecl>, InnerMatcher) {
6711 return InnerMatcher.matches(*
Node.getTargetDecl(), Finder, Builder);
6745 Node.getTemplateSpecializationKind() ==
6747 Node.getTemplateSpecializationKind() ==
6810 internal::Matcher<QualType>, InnerMatcher, 0) {
6811 return internal::BindableMatcher<TypeLoc>(
6812 new internal::TypeLocTypeMatcher(InnerMatcher));
6823extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, QualifiedTypeLoc>
6838 return InnerMatcher.matches(
Node.getUnqualifiedLoc(), Finder, Builder);
6852 auto Loc =
Node.getFunctionTypeLoc();
6853 return Loc && ReturnMatcher.matches(
Loc.getReturnLoc(), Finder, Builder);
6864extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, PointerTypeLoc>
6878 return PointeeMatcher.matches(
Node.getPointeeLoc(), Finder, Builder);
6891extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, ReferenceTypeLoc>
6906 return ReferentMatcher.matches(
Node.getPointeeLoc(), Finder, Builder);
6918extern const internal::VariadicDynCastAllOfMatcher<
6936 hasAnyTemplateArgumentLoc,
6940 internal::Matcher<TemplateArgumentLoc>, InnerMatcher) {
6941 auto Args = internal::getTemplateArgsWritten(
Node);
6942 return matchesFirstInRange(InnerMatcher, Args.begin(), Args.end(), Finder,
6943 Builder) != Args.end();
6961 hasTemplateArgumentLoc,
6965 unsigned, Index, internal::Matcher<TemplateArgumentLoc>, InnerMatcher) {
6966 auto Args = internal::getTemplateArgsWritten(
Node);
6967 return Index < Args.size() &&
6968 InnerMatcher.matches(Args[Index], Finder, Builder);
6980extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, ElaboratedTypeLoc>
6999 return InnerMatcher.matches(
Node.getNamedTypeLoc(), Finder, Builder);
7011 return Node.isBooleanType();
7023 return Node.isVoidType();
7026template <
typename NodeType>
7075 return Node.isRealFloatingType();
7128 return internal::HasSizeMatcher<NodeType>::hasSize(
Node, N);
7199 internal::Matcher<Expr>, InnerMatcher) {
7200 return InnerMatcher.matches(*
Node.getSizeExpr(), Finder, Builder);
7446 pointee, getPointee,
7595 internal::Matcher<NestedNameSpecifier>, InnerMatcher) {
7597 return InnerMatcher.matches(*Qualifier, Finder, Builder);
7619 return InnerMatcher.matches(
Node.getNamedType(), Finder, Builder);
7662 hasReplacementType, getReplacementType,
7701 return InnerType.matches(
Node.getDecayedType(), Finder, Builder);
7720 if (!DC)
return false;
7737extern const internal::VariadicAllOfMatcher<NestedNameSpecifier>
7741extern const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
7747 internal::BindableMatcher<NestedNameSpecifierLoc>, loc,
7748 internal::Matcher<NestedNameSpecifier>, InnerMatcher, 1) {
7749 return internal::BindableMatcher<NestedNameSpecifierLoc>(
7750 new internal::LocMatcher<NestedNameSpecifierLoc, NestedNameSpecifier>(
7767 internal::Matcher<QualType>, InnerMatcher) {
7768 if (!
Node.getAsType())
7770 return InnerMatcher.matches(
QualType(
Node.getAsType(), 0), Finder, Builder);
7785 internal::Matcher<TypeLoc>, InnerMatcher) {
7786 return Node &&
Node.getNestedNameSpecifier()->getAsType() &&
7787 InnerMatcher.matches(
Node.getTypeLoc(), Finder, Builder);
7800 internal::Matcher<NestedNameSpecifier>, InnerMatcher,
7805 return InnerMatcher.matches(*NextNode, Finder, Builder);
7818 internal::Matcher<NestedNameSpecifierLoc>, InnerMatcher,
7823 return InnerMatcher.matches(NextNode, Finder, Builder);
7837 internal::Matcher<NamespaceDecl>, InnerMatcher) {
7838 if (!
Node.getAsNamespace())
7840 return InnerMatcher.matches(*
Node.getAsNamespace(), Finder, Builder);
7859extern const internal::VariadicAllOfMatcher<Attr>
attr;
7899 BoundNodesTreeBuilder
Result;
7904 bool Matched =
false;
7906 SC = SC->getNextSwitchCase()) {
7907 BoundNodesTreeBuilder CaseBuilder(*Builder);
7908 bool CaseMatched = InnerMatcher.matches(*SC, Finder, &CaseBuilder);
7911 Result.addMatch(CaseBuilder);
7914 *Builder = std::move(
Result);
7929 internal::Matcher<CXXCtorInitializer>, InnerMatcher) {
7930 BoundNodesTreeBuilder
Result;
7931 bool Matched =
false;
7932 for (
const auto *I :
Node.inits()) {
7933 if (Finder->isTraversalIgnoringImplicitNodes() && !I->isWritten())
7935 BoundNodesTreeBuilder InitBuilder(*Builder);
7936 if (InnerMatcher.matches(*I, Finder, &InitBuilder)) {
7938 Result.addMatch(InitBuilder);
7941 *Builder = std::move(
Result);
7957 return Node.isCopyConstructor();
7972 return Node.isMoveConstructor();
7987 return Node.isDefaultConstructor();
8004 return Node.isDelegatingConstructor();
8032 return Node.isExplicit();
8062 ASTChildrenNotSpelledInSourceScope RAII(Finder,
false);
8064 return InnerMatcher.matches(*ES.
getExpr(), Finder, Builder);
8087 if (
const auto *FD = dyn_cast<FunctionDecl>(&
Node))
8088 return FD->isInlineSpecified();
8089 if (
const auto *NSD = dyn_cast<NamespaceDecl>(&
Node))
8090 return NSD->isInline();
8091 if (
const auto *VD = dyn_cast<VarDecl>(&
Node))
8092 return VD->isInline();
8093 llvm_unreachable(
"Not a valid polymorphic type");
8106 return Node.isAnonymousNamespace();
8153 return Node.isInAnonymousNamespace();
8170 return InnerMatcher.matches(*
Node.getLHS(), Finder, Builder);
8183 for (
const auto *
Attr :
Node.attrs()) {
8203 return InnerMatcher.matches(*
RetValue, Finder, Builder);
8213extern const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
8258 return InnerMatcher.matches(*VD, Finder, Builder);
8281 internal::Matcher<BindingDecl>, InnerMatcher) {
8282 if (
Node.bindings().size() <= N)
8284 return InnerMatcher.matches(*
Node.bindings()[N], Finder, Builder);
8306 return llvm::any_of(
Node.bindings(), [&](
const auto *Binding) {
8307 return InnerMatcher.matches(*Binding, Finder, Builder);
8330 const auto &Parents = Finder->getASTContext().getParents(
Node);
8333 while (!Stack.empty()) {
8334 const auto &CurNode = Stack.back();
8336 if (
const auto *FuncDeclNode = CurNode.get<
FunctionDecl>()) {
8337 if (InnerMatcher.matches(*FuncDeclNode, Finder, Builder)) {
8340 }
else if (
const auto *LambdaExprNode = CurNode.get<
LambdaExpr>()) {
8341 if (InnerMatcher.matches(*LambdaExprNode->getCallOperator(), Finder,
8346 llvm::append_range(Stack, Finder->getASTContext().getParents(CurNode));
8380 const auto &Parents = Finder->getASTContext().getParents(
Node);
8383 while (!Stack.empty()) {
8384 const auto &CurNode = Stack.back();
8386 if (
const auto *FuncDeclNode = CurNode.get<
FunctionDecl>()) {
8387 BoundNodesTreeBuilder B = *Builder;
8388 if (InnerMatcher.matches(*FuncDeclNode, Finder, &B)) {
8389 *Builder = std::move(B);
8392 }
else if (
const auto *LambdaExprNode = CurNode.get<
LambdaExpr>()) {
8393 BoundNodesTreeBuilder B = *Builder;
8394 if (InnerMatcher.matches(*LambdaExprNode->getCallOperator(), Finder,
8396 *Builder = std::move(B);
8399 }
else if (
const auto *ObjCMethodDeclNode = CurNode.get<
ObjCMethodDecl>()) {
8400 BoundNodesTreeBuilder B = *Builder;
8401 if (InnerMatcher.matches(*ObjCMethodDeclNode, Finder, &B)) {
8402 *Builder = std::move(B);
8405 }
else if (
const auto *BlockDeclNode = CurNode.get<
BlockDecl>()) {
8406 BoundNodesTreeBuilder B = *Builder;
8407 if (InnerMatcher.matches(*BlockDeclNode, Finder, &B)) {
8408 *Builder = std::move(B);
8412 llvm::append_range(Stack, Finder->getASTContext().getParents(CurNode));
8439 return Node.hasExternalFormalLinkage();
8464 return Node.hasDefaultArg();
8476 return Node.isArray();
8488 internal::Matcher<Expr>, InnerMatcher) {
8489 return Node.getNumPlacementArgs() > Index &&
8490 InnerMatcher.matches(*
Node.getPlacementArg(Index), Finder, Builder);
8503 return llvm::any_of(
Node.placement_arguments(), [&](
const Expr *Arg) {
8504 return InnerMatcher.matches(*Arg, Finder, Builder);
8517 return Node.isArray() && *
Node.getArraySize() &&
8518 InnerMatcher.matches(**
Node.getArraySize(), Finder, Builder);
8529 return Node.hasDefinition();
8540 return Node.isScoped();
8552 return F->hasTrailingReturn();
8588 if (
const auto *CleanupsExpr = dyn_cast<ExprWithCleanups>(&
Node))
8589 E = CleanupsExpr->getSubExpr();
8590 if (
const auto *CtorExpr = dyn_cast<CXXConstructExpr>(
E)) {
8591 if (CtorExpr->isElidable()) {
8592 if (
const auto *MaterializeTemp =
8593 dyn_cast<MaterializeTemporaryExpr>(CtorExpr->getArg(0))) {
8594 return InnerMatcher.matches(*MaterializeTemp->getSubExpr(), Finder,
8599 return InnerMatcher.matches(
Node, Finder, Builder);
8618extern const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
8635 return Node.isStandaloneDirective();
8654 internal::Matcher<Stmt>, InnerMatcher) {
8655 if (
Node.isStandaloneDirective())
8657 return InnerMatcher.matches(*
Node.getStructuredBlock(), Finder, Builder);
8672 internal::Matcher<OMPClause>, InnerMatcher) {
8674 return matchesFirstInPointerRange(InnerMatcher, Clauses.begin(),
8675 Clauses.end(), Finder,
8676 Builder) != Clauses.end();
8693extern const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
8710 return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_none;
8727 return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_shared;
8746 return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_private;
8765 return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_firstprivate;
8787 return llvm::omp::isAllowedClauseForDirective(
8788 Node.getDirectiveKind(), CKind,
8789 Finder->getASTContext().getLangOpts().OpenMP);
Defines the clang::ASTContext interface.
BoundNodesTreeBuilder BoundNodes
BoundNodesTreeBuilder Nodes
#define AST_POLYMORPHIC_MATCHER_P(DefineMatcher, ReturnTypesF, ParamType, Param)
AST_POLYMORPHIC_MATCHER_P(DefineMatcher, ParamType, Param) { ... } defines a single-parameter functio...
#define AST_POLYMORPHIC_MATCHER_P2(DefineMatcher, ReturnTypesF, ParamType1, Param1, ParamType2, Param2)
AST_POLYMORPHIC_MATCHER_P2( DefineMatcher, ParamType1, Param1, ParamType2, Param2) { ....
#define AST_POLYMORPHIC_MATCHER(DefineMatcher, ReturnTypesF)
AST_POLYMORPHIC_MATCHER(DefineMatcher) { ... } defines a single-parameter function named DefineMatche...
#define AST_MATCHER_FUNCTION_P_OVERLOAD(ReturnType, DefineMatcher, ParamType, Param, OverloadId)
#define AST_POLYMORPHIC_MATCHER_P_OVERLOAD(DefineMatcher, ReturnTypesF, ParamType, Param, OverloadId)
#define AST_POLYMORPHIC_SUPPORTED_TYPES(...)
Construct a type-list to be passed to the AST_POLYMORPHIC_MATCHER* macros.
#define AST_MATCHER_P_OVERLOAD(Type, DefineMatcher, ParamType, Param, OverloadId)
#define AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName, ReturnTypesF)
AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName) defines the matcher MatcherName that can be used...
#define AST_POLYMORPHIC_MATCHER_REGEX(DefineMatcher, ReturnTypesF, Param)
AST_POLYMORPHIC_MATCHER_REGEX(DefineMatcher, ReturnTypesF, Param) { ... } defines a function named De...
#define AST_MATCHER(Type, DefineMatcher)
AST_MATCHER(Type, DefineMatcher) { ... } defines a zero parameter function named DefineMatcher() that...
#define AST_TYPELOC_TRAVERSE_MATCHER_DECL(MatcherName, FunctionName, ReturnTypesF)
#define AST_MATCHER_P2(Type, DefineMatcher, ParamType1, Param1, ParamType2, Param2)
AST_MATCHER_P2( Type, DefineMatcher, ParamType1, Param1, ParamType2, Param2) { ....
#define AST_MATCHER_REGEX(Type, DefineMatcher, Param)
AST_MATCHER_REGEX(Type, DefineMatcher, Param) { ... } defines a function named DefineMatcher() that t...
#define AST_MATCHER_FUNCTION(ReturnType, DefineMatcher)
AST_MATCHER_FUNCTION(ReturnType, DefineMatcher) { ... } defines a zero parameter function named Defin...
#define AST_MATCHER_P(Type, DefineMatcher, ParamType, Param)
AST_MATCHER_P(Type, DefineMatcher, ParamType, Param) { ... } defines a single-parameter function name...
Defines the clang::attr::Kind enum.
enum clang::sema::@1712::IndirectLocalPathEntry::EntryKind Kind
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::FileManager interface and associated types.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static bool RetValue(InterpState &S, CodePtr &Pt)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
static bool isExternC(const NamedDecl *ND)
This file defines OpenMP AST classes for clauses.
static QualType getUnderlyingType(const SubRegion *R)
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
static bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
Defines the Objective-C statement AST node classes.
This file defines OpenMP AST classes for executable directives and clauses.
Defines the clang::TypeLoc interface and its subclasses.
Defines enumerations for the type traits support.
C Language Family Type Representation.
__PTRDIFF_TYPE__ ptrdiff_t
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Attr - This represents one attribute.
attr::Kind getKind() const
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Represents a C++ declaration that introduces decls from somewhere else.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
A binding in a decomposition declaration.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represents a base class of a C++ class.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
Represents a C++ conversion function within a class.
Represents a C++ base or member initializer.
Represents a C++ deduction guide declaration.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
A call to an overloaded operator written using operator syntax.
Represents a C++ struct/union/class.
A rewritten comparison expression that was originally written using operator syntax.
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CaseStmt - Represent a case statement.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Complex values, per C99 6.2.5p11.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
body_iterator body_begin()
Represents the canonical version of C arrays with a specified constant size.
Represents the body of a coroutine.
Represents a pointer type decayed from an array or function type.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
DeclGroupRef::const_iterator const_decl_iterator
Decl - This represents one declaration (or definition), e.g.
static Decl * castFromDeclContext(const DeclContext *)
Represents a ValueDecl that came out of a declarator.
Represents the type decltype(expr) (C++11).
A decomposition declaration.
Represents a C99 designated initializer expression.
DoStmt - This represents a 'do/while' stmt.
A dynamically typed AST node container.
const T * get() const
Retrieve the stored node as type T.
static DynTypedNode create(const T &Node)
Creates a DynTypedNode from Node.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
ExplicitCastExpr - An explicit cast written in the source code.
Store information needed for an explicit specifier.
const Expr * getExpr() const
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
This represents one expression.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Represents a member of a struct/union/class.
Cached information about one file (either on disk or in the virtual file system).
ForStmt - This represents a 'for (init;cond;inc)' stmt.
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Represents a function declaration or definition.
Represents a prototype with parameter type info, e.g.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
unsigned getNumParams() const
QualType getParamType(unsigned i) const
bool isVariadic() const
Whether this function prototype is variadic.
bool isNothrow(bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
IfStmt - This represents an if/then/else.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Describes an C or C++ initializer list.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
A pointer to member type per C++ 8.3.3 - Pointers to members.
This represents a decl that may have a name.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
This represents 'default' clause in the '#pragma omp ...' directive.
This is a basic class for representing single OpenMP executable directive.
Represents Objective-C's @autoreleasepool Statement.
Represents an ObjC class declaration.
An expression that sends a message to the given Objective-C object or class.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents a pointer to an Objective C object.
Represents one property declaration in an Objective-C interface.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Sugar for parentheses used when specifying types.
Represents a parameter to a function.
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getCanonicalType() const
Wrapper of type source information for a type with non-trivial direct qualifiers.
Base for LValueReferenceType and RValueReferenceType.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Smart pointer class that efficiently represents Objective-C method names.
std::string getAsString() const
Derive the full selector name (e.g.
This class handles loading and caching of source files into memory.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
bool isInMainFile(SourceLocation Loc) const
Returns whether the PresumedLoc for a given SourceLocation is in the main file.
OptionalFileEntryRef getFileEntryRefForID(FileID FID) const
Returns the FileEntryRef for the provided FileID.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
StringLiteral - This represents a string literal expression, e.g.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents the result of substituting a type for a template type parameter.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
Location wrapper for a TemplateArgument.
Represents a template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ Type
The template argument is a type.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
Represents a type template specialization; the template must be a class template, a type alias templa...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Represents a declaration of a type.
Base wrapper for a particular "section" of type source info.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
The base class of the type hierarchy.
bool isFunctionPointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isMemberFunctionPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Represents a dependent using declaration which was marked with typename.
Represents a dependent using declaration which was not marked with typename.
Represents a C++ using-declaration.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents a C array with a specified size that is not an integer-constant-expression.
WhileStmt - This represents a 'while' stmt.
Maps string IDs to AST nodes matched by parts of a matcher.
internal::BoundNodesMap::IDToNodeMap IDToNodeMap
Type of mapping from binding identifiers to bound nodes.
const IDToNodeMap & getMap() const
Retrieve mapping from binding identifiers to bound nodes.
friend class internal::BoundNodesTreeBuilder
const T * getNodeAs(StringRef ID) const
Returns the AST node bound to ID.
HasOverloadOpNameMatcher hasAnyOverloadedOperatorNameFunc(ArrayRef< const StringRef * > NameRefs)
Matcher< ObjCMessageExpr > hasAnySelectorFunc(ArrayRef< const StringRef * > NameRefs)
Matcher< NamedDecl > hasAnyNameFunc(ArrayRef< const StringRef * > NameRefs)
HasOpNameMatcher hasAnyOperatorNameFunc(ArrayRef< const StringRef * > NameRefs)
std::optional< SourceLocation > getExpansionLocOfMacro(StringRef MacroName, SourceLocation Loc, const ASTContext &Context)
bool matchesAnyBase(const CXXRecordDecl &Node, const Matcher< CXXBaseSpecifier > &BaseSpecMatcher, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder)
const internal::VariadicDynCastAllOfMatcher< Stmt, FixedPointLiteral > fixedPointLiteral
Matches fixed point literals.
const internal::VariadicDynCastAllOfMatcher< Stmt, CStyleCastExpr > cStyleCastExpr
Matches a C-style cast expression.
const internal::VariadicDynCastAllOfMatcher< Decl, TagDecl > tagDecl
Matches tag declarations.
internal::Matcher< QualType > TypeMatcher
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXReinterpretCastExpr > cxxReinterpretCastExpr
Matches a reinterpret_cast expression.
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
const internal::VariadicDynCastAllOfMatcher< TypeLoc, ElaboratedTypeLoc > elaboratedTypeLoc
Matches C or C++ elaborated TypeLocs.
const internal::VariadicDynCastAllOfMatcher< Stmt, StmtExpr > stmtExpr
Matches statement expression (GNU extension).
const internal::VariadicDynCastAllOfMatcher< Stmt, ExprWithCleanups > exprWithCleanups
Matches expressions that introduce cleanups to be run at the end of the sub-expression's evaluation.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > declRefExpr
Matches expressions that refer to declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefNameDecl > typedefNameDecl
Matches typedef name declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCIvarDecl > objcIvarDecl
Matches Objective-C instance variable declarations.
const AstTypeMatcher< EnumType > enumType
Matches enum types.
const AstTypeMatcher< FunctionProtoType > functionProtoType
Matches FunctionProtoType nodes.
const AstTypeMatcher< ElaboratedType > elaboratedType
Matches types specified with an elaborated type keyword or with a qualified name.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasDecl > typeAliasDecl
Matches type alias declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingEnumDecl > usingEnumDecl
Matches using-enum declarations.
const AstTypeMatcher< ObjCObjectPointerType > objcObjectPointerType
Matches an Objective-C object pointer type, which is different from a pointer type,...
const internal::VariadicDynCastAllOfMatcher< Stmt, ConstantExpr > constantExpr
Matches a constant expression wrapper.
const internal::VariadicDynCastAllOfMatcher< Stmt, ArrayInitLoopExpr > arrayInitLoopExpr
Matches a loop initializing the elements of an array in a number of contexts:
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCIvarRefExpr > objcIvarRefExpr
Matches a reference to an ObjCIvar.
const AstTypeMatcher< BuiltinType > builtinType
Matches builtin Types.
const internal::VariadicOperatorMatcherFunc< 1, 1 > unless
Matches if the provided matcher does not match.
const internal::VariadicDynCastAllOfMatcher< Decl, ConceptDecl > conceptDecl
Matches concept declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CoyieldExpr > coyieldExpr
Matches co_yield expressions.
const AstTypeMatcher< DependentSizedExtVectorType > dependentSizedExtVectorType
Matches C++ extended vector type where either the type or size is dependent.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDeleteExpr > cxxDeleteExpr
Matches delete expressions.
const internal::VariadicAllOfMatcher< TemplateName > templateName
Matches template name.
internal::Matcher< Decl > DeclarationMatcher
Types of matchers for the top-level classes in the AST class hierarchy.
internal::Matcher< NestedNameSpecifier > NestedNameSpecifierMatcher
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCProtocolDecl > objcProtocolDecl
Matches Objective-C protocol declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitCastExpr > implicitCastExpr
Matches the implicit cast nodes of Clang's AST.
const internal::VariadicOperatorMatcherFunc< 1, 1 > optionally
Matches any node regardless of the submatcher.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDecl > usingDecl
Matches using declarations.
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > hasDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCPropertyDecl > objcPropertyDecl
Matches Objective-C property declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, StringLiteral > stringLiteral
Matches string literals (also matches wide string literals).
const internal::VariadicAllOfMatcher< CXXCtorInitializer > cxxCtorInitializer
Matches constructor initializers.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtFinallyStmt > objcFinallyStmt
Matches Objective-C @finally statements.
const AstTypeMatcher< DependentSizedArrayType > dependentSizedArrayType
Matches C++ arrays whose size is a value-dependent expression.
const AstTypeMatcher< TemplateSpecializationType > templateSpecializationType
Matches template specialization types.
const internal::VariadicDynCastAllOfMatcher< Stmt, AtomicExpr > atomicExpr
Matches atomic builtins.
const AstTypeMatcher< DeducedTemplateSpecializationType > deducedTemplateSpecializationType
Matches C++17 deduced template specialization types, e.g.
const internal::VariadicDynCastAllOfMatcher< Stmt, CoawaitExpr > coawaitExpr
Matches co_await expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, EnumDecl > enumDecl
Matches enum declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ConvertVectorExpr > convertVectorExpr
Matches builtin function __builtin_convertvector.
const internal::VariadicDynCastAllOfMatcher< Stmt, AddrLabelExpr > addrLabelExpr
Matches address of label statements (GNU extension).
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDependentScopeMemberExpr > cxxDependentScopeMemberExpr
Matches member expressions where the actual member referenced could not be resolved because the base ...
const internal::VariadicDynCastAllOfMatcher< Stmt, PredefinedExpr > predefinedExpr
Matches predefined identifier expressions [C99 6.4.2.2].
const internal::VariadicAllOfMatcher< NestedNameSpecifier > nestedNameSpecifier
Matches nested name specifiers.
const AstTypeMatcher< PointerType > pointerType
Matches pointer types, but does not match Objective-C object pointer types.
const internal::VariadicDynCastAllOfMatcher< Stmt, DependentCoawaitExpr > dependentCoawaitExpr
Matches co_await expressions where the type of the promise is dependent.
const internal::VariadicDynCastAllOfMatcher< Stmt, BreakStmt > breakStmt
Matches break statements.
const internal::VariadicDynCastAllOfMatcher< Decl, BindingDecl > bindingDecl
Matches binding declarations Example matches foo and bar (matcher = bindingDecl()
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, OMPExecutableDirective > ompExecutableDirective
Matches any #pragma omp executable directive.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCStringLiteral > objcStringLiteral
Matches ObjectiveC String literal expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCMethodDecl > objcMethodDecl
Matches Objective-C method declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > parmVarDecl
Matches parameter variable declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXRewrittenBinaryOperator > cxxRewrittenBinaryOperator
Matches rewritten binary operators.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > typedefDecl
Matches typedef declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, GenericSelectionExpr > genericSelectionExpr
Matches C11 _Generic expression.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDeductionGuideDecl > cxxDeductionGuideDecl
Matches user-defined and implicitly generated deduction guide.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBoolLiteralExpr > cxxBoolLiteral
Matches bool literals.
const internal::VariadicDynCastAllOfMatcher< Stmt, ReturnStmt > returnStmt
Matches return statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, AsmStmt > asmStmt
Matches asm statements.
internal::Matcher< NamedDecl > hasName(StringRef Name)
Matches NamedDecl nodes that have the specified name.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDynamicCastExpr > cxxDynamicCastExpr
Matches a dynamic_cast expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, CoreturnStmt > coreturnStmt
Matches co_return statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, LambdaExpr > lambdaExpr
Matches lambda expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundStmt > compoundStmt
Matches compound statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, FloatingLiteral > floatLiteral
Matches float literals of all sizes / encodings, e.g.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAutoreleasePoolStmt > autoreleasePoolStmt
Matches an Objective-C autorelease pool statement.
const internal::VariadicFunction< internal::PolymorphicMatcher< internal::HasOverloadedOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl), std::vector< std::string > >, StringRef, internal::hasAnyOverloadedOperatorNameFunc > hasAnyOverloadedOperatorName
Matches overloaded operator names.
const internal::VariadicDynCastAllOfMatcher< Decl, NonTypeTemplateParmDecl > nonTypeTemplateParmDecl
Matches non-type template parameter declarations.
const AstTypeMatcher< VariableArrayType > variableArrayType
Matches C arrays with a specified size that is not an integer-constant-expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryExprOrTypeTraitExpr > unaryExprOrTypeTraitExpr
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
const internal::VariadicDynCastAllOfMatcher< Stmt, NullStmt > nullStmt
Matches null statements.
const internal::VariadicDynCastAllOfMatcher< TypeLoc, TemplateSpecializationTypeLoc > templateSpecializationTypeLoc
Matches template specialization TypeLocs.
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachDescendantMatcher > forEachDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher.
const internal::VariadicAllOfMatcher< CXXBaseSpecifier > cxxBaseSpecifier
Matches class bases.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDefaultArgExpr > cxxDefaultArgExpr
Matches the value of a default argument at the call site.
const internal::VariadicAllOfMatcher< TemplateArgument > templateArgument
Matches template arguments.
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachMatcher > forEach
Matches AST nodes that have child AST nodes that match the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, CaseStmt > caseStmt
Matches case statements inside switch statements.
const internal::VariadicAllOfMatcher< NestedNameSpecifierLoc > nestedNameSpecifierLoc
Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
const internal::VariadicDynCastAllOfMatcher< Decl, NamedDecl > namedDecl
Matches a declaration of anything that could have a name.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingTypenameDecl > unresolvedUsingTypenameDecl
Matches unresolved using value declarations that involve the typename.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< DecltypeType > decltypeType
Matches types nodes representing C++11 decltype(<expr>) types.
const internal::VariadicAllOfMatcher< TypeLoc > typeLoc
Matches TypeLocs in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenListExpr > parenListExpr
Matches paren list expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplatePartialSpecializationDecl > classTemplatePartialSpecializationDecl
Matches C++ class template partial specializations.
const internal::VariadicDynCastAllOfMatcher< Stmt, WhileStmt > whileStmt
Matches while statements.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryDecl > objcCategoryDecl
Matches Objective-C category declarations.
internal::TrueMatcher anything()
Matches any node.
const internal::VariadicFunction< internal::Matcher< ObjCMessageExpr >, StringRef, internal::hasAnySelectorFunc > hasAnySelector
Matches when at least one of the supplied string equals to the Selector.getAsString()
const AstTypeMatcher< AutoType > autoType
Matches types nodes representing C++11 auto types.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConversionDecl > cxxConversionDecl
Matches conversion operator declarations.
const AstTypeMatcher< ParenType > parenType
Matches ParenType nodes.
const internal::VariadicDynCastAllOfMatcher< Decl, LabelDecl > labelDecl
Matches a declaration of label.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFunctionalCastExpr > cxxFunctionalCastExpr
Matches functional cast expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstCastExpr > cxxConstCastExpr
Matches a const_cast expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTemporaryObjectExpr > cxxTemporaryObjectExpr
Matches functional cast expressions having N != 1 arguments.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > unaryOperator
Matches unary operator expressions.
const internal::VariadicDynCastAllOfMatcher< TypeLoc, ReferenceTypeLoc > referenceTypeLoc
Matches reference TypeLocs.
const internal::VariadicFunction< internal::Matcher< NamedDecl >, StringRef, internal::hasAnyNameFunc > hasAnyName
Matches NamedDecl nodes that have any of the specified names.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCMessageExpr > objcMessageExpr
Matches ObjectiveC Message invocation expressions.
const internal::MapAnyOfMatcher< BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator > binaryOperation
Matches nodes which can be used with binary operators.
const internal::VariadicDynCastAllOfMatcher< Stmt, ArraySubscriptExpr > arraySubscriptExpr
Matches array subscript expressions.
const internal::VariadicDynCastAllOfMatcher< OMPClause, OMPDefaultClause > ompDefaultClause
Matches OpenMP default clause.
const internal::VariadicDynCastAllOfMatcher< Decl, AccessSpecDecl > accessSpecDecl
Matches C++ access specifier declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, LinkageSpecDecl > linkageSpecDecl
Matches a declaration of a linkage specification.
const AstTypeMatcher< InjectedClassNameType > injectedClassNameType
Matches injected class name types.
const internal::VariadicDynCastAllOfMatcher< Stmt, GNUNullExpr > gnuNullExpr
Matches GNU __null expression.
const internal::VariadicDynCastAllOfMatcher< TypeLoc, PointerTypeLoc > pointerTypeLoc
Matches pointer TypeLocs.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXForRangeStmt > cxxForRangeStmt
Matches range-based for statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > cxxMemberCallExpr
Matches member call expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConstructorDecl > cxxConstructorDecl
Matches C++ constructor declarations.
const AstTypeMatcher< BlockPointerType > blockPointerType
Matches block pointer types, i.e.
internal::BindableMatcher< Stmt > sizeOfExpr(const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher)
Same as unaryExprOrTypeTraitExpr, but only matching sizeof.
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > initListExpr
Matches init list expressions.
internal::Matcher< CXXCtorInitializer > CXXCtorInitializerMatcher
const AstTypeMatcher< AtomicType > atomicType
Matches atomic types.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasTemplateDecl > typeAliasTemplateDecl
Matches type alias template declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNoexceptExpr > cxxNoexceptExpr
Matches noexcept expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ArrayInitIndexExpr > arrayInitIndexExpr
The arrayInitIndexExpr consists of two subexpressions: a common expression (the source array) that is...
internal::VariadicDynCastAllOfMatcher< Type, NodeType > AstTypeMatcher
const AstTypeMatcher< UsingType > usingType
Matches types specified through a using declaration.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNewExpr > cxxNewExpr
Matches new expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, EnumConstantDecl > enumConstantDecl
Matches enum constants.
const internal::VariadicDynCastAllOfMatcher< Stmt, ForStmt > forStmt
Matches for statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, GotoStmt > gotoStmt
Matches goto statements.
internal::Matcher< CXXBaseSpecifier > CXXBaseSpecifierMatcher
auto mapAnyOf(internal::VariadicDynCastAllOfMatcher< T, U > const &...)
Matches any of the NodeMatchers with InnerMatchers nested within.
const internal::VariadicDynCastAllOfMatcher< Decl, DeclaratorDecl > declaratorDecl
Matches declarator declarations (field, variable, function and non-type template parameter declaratio...
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtCatchStmt > objcCatchStmt
Matches Objective-C @catch statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryOperator > binaryOperator
Matches binary operator expressions.
const internal::VariadicDynCastAllOfMatcher< TypeLoc, QualifiedTypeLoc > qualifiedTypeLoc
Matches QualifiedTypeLocs in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTypeParmDecl > templateTypeParmDecl
Matches template type parameter declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, BlockExpr > blockExpr
Matches a reference to a block.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionTemplateDecl > functionTemplateDecl
Matches C++ function template declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenExpr > parenExpr
Matches parentheses used in expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, StaticAssertDecl > staticAssertDecl
Matches a C++ static_assert declaration.
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > has
Matches AST nodes that have child AST nodes that match the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, CoroutineBodyStmt > coroutineBodyStmt
Matches coroutine body statements.
const AstTypeMatcher< MacroQualifiedType > macroQualifiedType
Matches qualified types when the qualifier is applied via a macro.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryImplDecl > objcCategoryImplDecl
Matches Objective-C category definitions.
const AstTypeMatcher< TypedefType > typedefType
Matches typedef types.
const internal::VariadicDynCastAllOfMatcher< Stmt, MaterializeTemporaryExpr > materializeTemporaryExpr
Matches nodes where temporaries are materialized.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryConditionalOperator > binaryConditionalOperator
Matches binary conditional operator expressions (GNU extension).
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtTryStmt > objcTryStmt
Matches Objective-C @try statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, ExplicitCastExpr > explicitCastExpr
Matches explicit cast expressions.
internal::PolymorphicMatcher< internal::ValueEqualsMatcher, void(internal::AllNodeBaseTypes), ValueT > equals(const ValueT &Value)
Matches literals that are equal to the given value of type ValueT.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStaticCastExpr > cxxStaticCastExpr
Matches a C++ static_cast expression.
const internal::VariadicDynCastAllOfMatcher< Decl, ValueDecl > valueDecl
Matches any value declaration.
const internal::VariadicDynCastAllOfMatcher< Decl, TranslationUnitDecl > translationUnitDecl
Matches the top declaration context.
const AstTypeMatcher< TemplateTypeParmType > templateTypeParmType
Matches template type parameter types.
const AstTypeMatcher< ConstantArrayType > constantArrayType
Matches C arrays with a specified constant size.
internal::Matcher< Stmt > StatementMatcher
internal::Matcher< TypeLoc > TypeLocMatcher
const internal::VariadicAllOfMatcher< LambdaCapture > lambdaCapture
Matches lambda captures.
internal::Matcher< TemplateArgumentLoc > TemplateArgumentLocMatcher
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> eachOf
Matches if any of the given matchers matches.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstructExpr > cxxConstructExpr
Matches constructor call expressions (including implicit ones).
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCInterfaceDecl > objcInterfaceDecl
Matches Objective-C interface declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTemplateParmDecl > templateTemplateParmDecl
Matches template template parameter declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, FieldDecl > fieldDecl
Matches field declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, UserDefinedLiteral > userDefinedLiteral
Matches user defined literal operator call.
const internal::VariadicDynCastAllOfMatcher< Stmt, ChooseExpr > chooseExpr
Matches GNU __builtin_choose_expr.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > cxxOperatorCallExpr
Matches overloaded operator calls.
internal::PolymorphicMatcher< internal::HasOverloadedOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl), std::vector< std::string > > hasOverloadedOperatorName(StringRef Name)
Matches overloaded operator names.
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceAliasDecl > namespaceAliasDecl
Matches a declaration of a namespace alias.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBindTemporaryExpr > cxxBindTemporaryExpr
Matches nodes where temporaries are created.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchCase > switchCase
Matches case and default statements inside switch statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, DefaultStmt > defaultStmt
Matches default statements inside switch statements.
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> allOf
Matches if all given matchers match.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateSpecializationDecl > classTemplateSpecializationDecl
Matches C++ class template specializations.
const internal::VariadicDynCastAllOfMatcher< Decl, DecompositionDecl > decompositionDecl
Matches decomposition-declarations.
const AstTypeMatcher< SubstTemplateTypeParmType > substTemplateTypeParmType
Matches types that represent the result of substituting a type for a template type parameter.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionDecl > functionDecl
Matches function declarations.
const AstTypeMatcher< UnaryTransformType > unaryTransformType
Matches types nodes representing unary type transformations.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedMemberExpr > unresolvedMemberExpr
Matches unresolved member expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtThrowStmt > objcThrowStmt
Matches Objective-C @throw statements.
const internal::MapAnyOfMatcher< CallExpr, CXXConstructExpr > invocation
Matches function calls and constructor calls.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThrowExpr > cxxThrowExpr
Matches throw expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchStmt > switchStmt
Matches switch statements.
const AstTypeMatcher< RecordType > recordType
Matches record types (e.g.
const internal::VariadicDynCastAllOfMatcher< Stmt, MemberExpr > memberExpr
Matches member expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > cxxRecordDecl
Matches C++ class declarations.
const internal::VariadicAllOfMatcher< TemplateArgumentLoc > templateArgumentLoc
Matches template arguments (with location info).
internal::Matcher< T > traverse(TraversalKind TK, const internal::Matcher< T > &InnerMatcher)
Causes all nested matchers to be matched with the specified traversal kind.
const AstTypeMatcher< ReferenceType > referenceType
Matches both lvalue and rvalue reference types.
const internal::VariadicDynCastAllOfMatcher< Stmt, DesignatedInitExpr > designatedInitExpr
Matches C99 designated initializer expressions [C99 6.7.8].
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDestructorDecl > cxxDestructorDecl
Matches explicit C++ destructor declarations.
internal::BindableMatcher< Stmt > alignOfExpr(const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher)
Same as unaryExprOrTypeTraitExpr, but only matching alignof.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXUnresolvedConstructExpr > cxxUnresolvedConstructExpr
Matches unresolved constructor call expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCImplementationDecl > objcImplementationDecl
Matches Objective-C implementation declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, IntegerLiteral > integerLiteral
Matches integer literals of all sizes / encodings, e.g.
const internal::VariadicDynCastAllOfMatcher< Decl, ExportDecl > exportDecl
Matches any export declaration.
internal::Matcher< T > findAll(const internal::Matcher< T > &Matcher)
Matches if the node or any descendant matches.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitValueInitExpr > implicitValueInitExpr
Matches implicit initializers of init list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, DoStmt > doStmt
Matches do statements.
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceDecl > namespaceDecl
Matches a declaration of a namespace.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNullPtrLiteralExpr > cxxNullPtrLiteralExpr
Matches nullptr literal.
internal::PolymorphicMatcher< internal::HasDeclarationMatcher, void(internal::HasDeclarationSupportedTypes), internal::Matcher< Decl > > hasDeclaration(const internal::Matcher< Decl > &InnerMatcher)
Matches a node if the declaration associated with that node matches the given matcher.
const AstTypeMatcher< DecayedType > decayedType
Matches decayed type Example matches i[] in declaration of f.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclStmt > declStmt
Matches declaration statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundLiteralExpr > compoundLiteralExpr
Matches compound (i.e.
const AstTypeMatcher< MemberPointerType > memberPointerType
Matches member pointer types.
const internal::VariadicDynCastAllOfMatcher< Stmt, LabelStmt > labelStmt
Matches label statements.
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
const internal::VariadicDynCastAllOfMatcher< Decl, FriendDecl > friendDecl
Matches friend declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
internal::Matcher< TemplateArgument > TemplateArgumentMatcher
const AstTypeMatcher< IncompleteArrayType > incompleteArrayType
Matches C arrays with unspecified size.
const internal::VariadicDynCastAllOfMatcher< Stmt, CharacterLiteral > characterLiteral
Matches character literals (also matches wchar_t).
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFoldExpr > cxxFoldExpr
Matches C++17 fold expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ConditionalOperator > conditionalOperator
Matches conditional operator expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStdInitializerListExpr > cxxStdInitializerListExpr
Matches C++ initializer list expressions.
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> anyOf
Matches if any of the given matchers matches.
internal::Matcher< Attr > AttrMatcher
const internal::VariadicFunction< internal::PolymorphicMatcher< internal::HasAnyOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator, UnaryOperator), std::vector< std::string > >, StringRef, internal::hasAnyOperatorNameFunc > hasAnyOperatorName
Matches operator expressions (binary or unary) that have any of the specified names.
const internal::VariadicDynCastAllOfMatcher< Stmt, OpaqueValueExpr > opaqueValueExpr
Matches opaque value expressions.
const AstTypeMatcher< ComplexType > complexType
Matches C99 complex types.
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > cudaKernelCallExpr
Matches CUDA kernel call expression.
const internal::VariadicDynCastAllOfMatcher< Decl, IndirectFieldDecl > indirectFieldDecl
Matches indirect field declarations.
const AstTypeMatcher< FunctionType > functionType
Matches FunctionType nodes.
const internal::VariadicDynCastAllOfMatcher< Decl, BlockDecl > blockDecl
Matches block declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > cxxMethodDecl
Matches method declarations.
internal::Matcher< LambdaCapture > LambdaCaptureMatcher
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXCatchStmt > cxxCatchStmt
Matches catch statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
internal::Matcher< NestedNameSpecifierLoc > NestedNameSpecifierLocMatcher
const internal::VariadicAllOfMatcher< QualType > qualType
Matches QualTypes in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTryStmt > cxxTryStmt
Matches try statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, SubstNonTypeTemplateParmExpr > substNonTypeTemplateParmExpr
Matches substitutions of non-type template parameters.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDirectiveDecl > usingDirectiveDecl
Matches using namespace declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingValueDecl > unresolvedUsingValueDecl
Matches unresolved using value declarations.
const internal::ArgumentAdaptingMatcherFunc< internal::HasAncestorMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > hasAncestor
Matches AST nodes that have an ancestor that matches the provided matcher.
const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > hasParent
Matches AST nodes that have a parent that matches the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, IfStmt > ifStmt
Matches if statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThisExpr > cxxThisExpr
Matches implicit and explicit this expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImaginaryLiteral > imaginaryLiteral
Matches imaginary literals, which are based on integer and floating point literals e....
const AstTypeMatcher< RValueReferenceType > rValueReferenceType
Matches rvalue reference types.
const internal::VariadicDynCastAllOfMatcher< Stmt, ContinueStmt > continueStmt
Matches continue statements.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateDecl > classTemplateDecl
Matches C++ class template declarations.
const AstTypeMatcher< LValueReferenceType > lValueReferenceType
Matches lvalue reference types.
The JSON file list parser is used to communicate input to InstallAPI.
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
bool isInstanceMethod(const Decl *D)
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
TraversalKind
Defines how we descend a level in the AST when we pass through expressions.
@ SD_Thread
Thread storage duration.
@ SD_Static
Static storage duration.
@ SD_Automatic
Automatic storage duration (most local variables).
@ Result
The result type of a method or function.
CastKind
CastKind - The kind of operation required for a conversion.
const FunctionProtoType * T
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ Other
Other implicit parameter.