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,
1246extern const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl>
valueDecl;
1259extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
1271extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
1282extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl>
enumDecl;
1292extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
1307extern const internal::VariadicDynCastAllOfMatcher<Decl, TagDecl>
tagDecl;
1315extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl>
1324extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
1335extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
1345extern const internal::VariadicDynCastAllOfMatcher<Decl, ConceptDecl>
1357extern const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl>
varDecl;
1367extern const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl>
fieldDecl;
1377extern const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
1386extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl>
1395extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
1406extern const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl>
friendDecl;
1416extern const internal::VariadicAllOfMatcher<Stmt>
stmt;
1426extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt>
declStmt;
1439extern const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr>
memberExpr;
1453extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
1465extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1477extern const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr>
callExpr;
1507extern const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr>
lambdaExpr;
1516extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
1528extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
1537extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCStringLiteral>
1547extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
1557extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
1567extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
1577extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
1587extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
1602extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
1615extern const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
1627extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl>
1638extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
1647extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
1657extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt>
1667extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
1677extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
1687extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
1700extern const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr>
1706 internal::Matcher<Expr>, InnerMatcher) {
1707 const Expr *SyntForm =
Node.getSyntacticForm();
1708 return (SyntForm !=
nullptr &&
1709 InnerMatcher.matches(*SyntForm, Finder, Builder));
1723extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1735extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
1753extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr>
1766extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1779extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl>
usingDecl;
1790extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingEnumDecl>
1802extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
1819extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
1833extern const internal::VariadicDynCastAllOfMatcher<
Decl,
1852extern const internal::VariadicDynCastAllOfMatcher<
Decl,
1865extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr>
1875extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr>
parenExpr;
1887extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
1898extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1912extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr>
1923extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
1944extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
1956extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr>
cxxNewExpr;
1966extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr>
1982extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNoexceptExpr>
2002extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitLoopExpr>
2021extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitIndexExpr>
2032extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
2044extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
2063extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
2075extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFoldExpr>
2095extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
2105extern const internal::VariadicDynCastAllOfMatcher<Stmt, Expr>
expr;
2114extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
2128extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr>
2137extern const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr>
blockExpr;
2145extern const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt>
ifStmt;
2154extern const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt>
forStmt;
2166 const Stmt *
const Increment =
Node.getInc();
2167 return (Increment !=
nullptr &&
2168 InnerMatcher.matches(*Increment, Finder, Builder));
2182 return (
Init !=
nullptr && InnerMatcher.matches(*
Init, Finder, Builder));
2192extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
2205 const VarDecl *
const Var =
Node.getLoopVariable();
2206 return (Var !=
nullptr && InnerMatcher.matches(*Var, Finder, Builder));
2220 return (
Init !=
nullptr && InnerMatcher.matches(*
Init, Finder, Builder));
2231extern const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt>
whileStmt;
2241extern const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt>
doStmt;
2251extern const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt>
breakStmt;
2261extern const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt>
2272extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoreturnStmt>
2283extern const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt>
returnStmt;
2294extern const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt>
gotoStmt;
2305extern const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt>
labelStmt;
2317extern const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr>
2328extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt>
switchStmt;
2338extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase>
switchCase;
2348extern const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt>
caseStmt;
2358extern const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt>
2367extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt>
2377extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt>
2387extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt>
cxxTryStmt;
2396extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr>
2406extern const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt>
nullStmt;
2416extern const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt>
asmStmt;
2424extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
2434extern const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral>
2447extern const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
2454extern const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
2464extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
2469extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
2473extern const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
2479extern const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
2489extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
2500extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoawaitExpr>
2503extern const internal::VariadicDynCastAllOfMatcher<Stmt, DependentCoawaitExpr>
2513extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoyieldExpr>
2524extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoroutineBodyStmt>
2528extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
2532extern const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr>
2536extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConvertVectorExpr>
2540extern const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr>
2544extern const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr>
2552extern const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr>
atomicExpr;
2560extern const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr>
stmtExpr;
2569extern const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
2578extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator>
2587extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
2596extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
2608extern const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
2624extern const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
2637extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
2653extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
2668extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
2679extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
2688extern const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
2712extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
2719extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
2735extern const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr>
castExpr;
2745extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
2754extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
2763extern const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
2772extern const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
2787 return Node.size() == N;
2791extern const internal::VariadicAllOfMatcher<QualType>
qualType;
2794extern const internal::VariadicAllOfMatcher<Type>
type;
2797extern const internal::VariadicAllOfMatcher<TypeLoc>
typeLoc;
2818extern const internal::VariadicOperatorMatcherFunc<
2819 2, std::numeric_limits<unsigned>::max()>
2825extern const internal::VariadicOperatorMatcherFunc<
2826 2, std::numeric_limits<unsigned>::max()>
2832extern const internal::VariadicOperatorMatcherFunc<
2833 2, std::numeric_limits<unsigned>::max()>
2860extern const internal::VariadicOperatorMatcherFunc<1, 1>
optionally;
2871extern const internal::VariadicDynCastAllOfMatcher<
Stmt,
2900template <
typename T,
typename...
U>
2901auto mapAnyOf(internal::VariadicDynCastAllOfMatcher<T, U>
const &...) {
2902 return internal::MapAnyOfHelper<
U...>();
3015extern const internal::MapAnyOfMatcher<CallExpr, CXXConstructExpr>
invocation;
3026 internal::Matcher<QualType>, InnerMatcher) {
3027 const QualType ArgumentType =
Node.getTypeOfArgument();
3028 return InnerMatcher.matches(ArgumentType, Finder, Builder);
3050 const internal::Matcher<UnaryExprOrTypeTraitExpr> &InnerMatcher) {
3052 allOf(
anyOf(ofKind(UETT_AlignOf), ofKind(UETT_PreferredAlignOf)),
3059 const internal::Matcher<UnaryExprOrTypeTraitExpr> &InnerMatcher) {
3061 allOf(ofKind(UETT_SizeOf), InnerMatcher)));
3079inline internal::Matcher<NamedDecl>
hasName(StringRef Name) {
3080 return internal::Matcher<NamedDecl>(
3081 new internal::HasNameMatcher({std::string(Name)}));
3094extern const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
3115 std::string FullNameString =
"::" +
Node.getQualifiedNameAsString();
3116 return RegExp->match(FullNameString);
3138inline internal::PolymorphicMatcher<
3139 internal::HasOverloadedOperatorNameMatcher,
3141 std::vector<std::string>>
3143 return internal::PolymorphicMatcher<
3144 internal::HasOverloadedOperatorNameMatcher,
3146 std::vector<std::string>>({std::string(Name)});
3157extern const internal::VariadicFunction<
3158 internal::PolymorphicMatcher<internal::HasOverloadedOperatorNameMatcher,
3161 std::vector<std::string>>,
3186 return Node.getMember().getAsString() == N;
3224 std::string, BindingID) {
3225 auto MemberName =
Node.getMember().getAsString();
3227 return Builder->removeBindings(
3228 [
this, MemberName](
const BoundNodesMap &
Nodes) {
3229 const auto &BN =
Nodes.getNode(this->BindingID);
3230 if (
const auto *ND = BN.get<
NamedDecl>()) {
3231 if (!isa<FieldDecl, CXXMethodDecl, VarDecl>(ND))
3233 return ND->getName() != MemberName;
3272 internal::Matcher<NamedDecl>,
Base) {
3274 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3275 return Finder->classIsDerivedFrom(RD,
Base, Builder,
false);
3278 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3279 return Finder->objcClassIsDerivedFrom(InterfaceDecl,
Base, Builder,
3287 std::string, BaseName, 1) {
3288 if (BaseName.empty())
3291 const auto M = isDerivedFrom(
hasName(BaseName));
3293 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3294 return Matcher<CXXRecordDecl>(M).matches(*RD, Finder, Builder);
3296 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3297 return Matcher<ObjCInterfaceDecl>(M).matches(*InterfaceDecl, Finder, Builder);
3334 return Node.hasDefinition() &&
3336 return BaseSpecMatcher.matches(Base, Finder, Builder);
3343 isSameOrDerivedFrom,
3345 internal::Matcher<NamedDecl>,
Base, 0) {
3348 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3349 return Matcher<CXXRecordDecl>(M).matches(*RD, Finder, Builder);
3351 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3352 return Matcher<ObjCInterfaceDecl>(M).matches(*InterfaceDecl, Finder, Builder);
3358 isSameOrDerivedFrom,
3360 std::string, BaseName, 1) {
3361 if (BaseName.empty())
3364 const auto M = isSameOrDerivedFrom(
hasName(BaseName));
3366 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3367 return Matcher<CXXRecordDecl>(M).matches(*RD, Finder, Builder);
3369 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3370 return Matcher<ObjCInterfaceDecl>(M).matches(*InterfaceDecl, Finder, Builder);
3395 isDirectlyDerivedFrom,
3397 internal::Matcher<NamedDecl>,
Base, 0) {
3399 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3400 return Finder->classIsDerivedFrom(RD,
Base, Builder,
true);
3403 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3404 return Finder->objcClassIsDerivedFrom(InterfaceDecl,
Base, Builder,
3410 isDirectlyDerivedFrom,
3412 std::string, BaseName, 1) {
3413 if (BaseName.empty())
3415 const auto M = isDirectlyDerivedFrom(
hasName(BaseName));
3417 if (
const auto *RD = dyn_cast<CXXRecordDecl>(&
Node))
3418 return Matcher<CXXRecordDecl>(M).matches(*RD, Finder, Builder);
3420 const auto *InterfaceDecl = cast<ObjCInterfaceDecl>(&
Node);
3421 return Matcher<ObjCInterfaceDecl>(M).matches(*InterfaceDecl, Finder, Builder);
3436 BoundNodesTreeBuilder
Result(*Builder);
3437 auto MatchIt = matchesFirstInPointerRange(InnerMatcher,
Node.method_begin(),
3439 if (MatchIt ==
Node.method_end())
3442 if (Finder->isTraversalIgnoringImplicitNodes() && (*MatchIt)->isImplicit())
3444 *Builder = std::move(
Result);
3458 return Node.isLambda();
3479extern const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher>
has;
3495extern const internal::ArgumentAdaptingMatcherFunc<
3496 internal::HasDescendantMatcher>
3517extern const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher>
3547extern const internal::ArgumentAdaptingMatcherFunc<
3548 internal::ForEachDescendantMatcher>
3567template <
typename T>
3568internal::Matcher<T>
findAll(
const internal::Matcher<T> &Matcher) {
3582extern const internal::ArgumentAdaptingMatcherFunc<
3583 internal::HasParentMatcher,
3584 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
3585 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
3599extern const internal::ArgumentAdaptingMatcherFunc<
3600 internal::HasAncestorMatcher,
3601 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
3602 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
3614extern const internal::VariadicOperatorMatcherFunc<1, 1>
unless;
3650inline internal::PolymorphicMatcher<
3651 internal::HasDeclarationMatcher,
3652 void(internal::HasDeclarationSupportedTypes), internal::Matcher<Decl>>
3654 return internal::PolymorphicMatcher<
3655 internal::HasDeclarationMatcher,
3656 void(internal::HasDeclarationSupportedTypes), internal::Matcher<Decl>>(
3675 return UnderlyingDecl !=
nullptr &&
3676 InnerMatcher.matches(*UnderlyingDecl, Finder, Builder);
3699 const Expr *ExprNode =
Node.getImplicitObjectArgument()
3700 ->IgnoreParenImpCasts();
3701 return (ExprNode !=
nullptr &&
3702 InnerMatcher.matches(*ExprNode, Finder, Builder));
3719 return InnerMatcher.matches(
TypeDecl, Finder, Builder);
3735 return Node.isClassMethod();
3751 return Node.isInstanceMethod();
3768 return Node.isClassMessage();
3785 return Node.isInstanceMessage();
3800 const Expr *ReceiverNode =
Node.getInstanceReceiver();
3801 return (ReceiverNode !=
nullptr &&
3828extern const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>,
3842 std::string SelectorString =
Node.getSelector().getAsString();
3843 return RegExp->match(SelectorString);
3851 return Node.getSelector().isNull();
3863 return Node.getSelector().isUnarySelector();
3879 return Node.getSelector().isKeywordSelector();
3894 return Node.getSelector().getNumArgs() == N;
3933 internal::Matcher<Stmt>, InnerMatcher, 0) {
3934 const auto *ExprNode =
Node.getCallee();
3935 return (ExprNode !=
nullptr &&
3936 InnerMatcher.matches(*ExprNode, Finder, Builder));
3962 internal::Matcher<Decl>, InnerMatcher, 1) {
3963 if (isa<CallExpr>(&
Node))
3965 .matches(
Node, Finder, Builder);
3969 const auto *MsgNode = cast<ObjCMessageExpr>(&
Node);
3970 const Decl *DeclNode = MsgNode->getMethodDecl();
3971 return (DeclNode !=
nullptr &&
3972 InnerMatcher.matches(*DeclNode, Finder, Builder));
3996 internal::Matcher<QualType>, InnerMatcher, 0) {
3999 return InnerMatcher.matches(QT, Finder, Builder);
4037 internal::Matcher<Decl>, InnerMatcher, 1) {
4081 internal::Matcher<TypeLoc>, Inner) {
4083 if (source ==
nullptr) {
4087 return Inner.matches(source->
getTypeLoc(), Finder, Builder);
4100 return Name ==
Node.getAsString();
4114 QualType, pointsTo, internal::Matcher<QualType>,
4116 return (!
Node.isNull() &&
Node->isAnyPointerType() &&
4117 InnerMatcher.matches(
Node->getPointeeType(), Finder, Builder));
4124 .matches(
Node, Finder, Builder);
4139 return InnerMatcher.matches(*
Node.getUnqualifiedDesugaredType(), Finder,
4158 return (!
Node.isNull() &&
Node->isReferenceType() &&
4159 InnerMatcher.matches(
Node->getPointeeType(), Finder, Builder));
4178 return InnerMatcher.matches(
Node.getCanonicalType(), Finder, Builder);
4185 .matches(
Node, Finder, Builder);
4206 internal::Matcher<Expr>, InnerMatcher) {
4207 const Expr *ExprNode =
Node.getImplicitObjectArgument();
4208 return (ExprNode !=
nullptr &&
4209 InnerMatcher.matches(*ExprNode, Finder, Builder));
4229 internal::Matcher<QualType>, InnerMatcher, 0) {
4230 return onImplicitObjectArgument(
4231 anyOf(hasType(InnerMatcher), hasType(pointsTo(InnerMatcher))))
4232 .matches(
Node, Finder, Builder);
4237 internal::Matcher<Decl>, InnerMatcher, 1) {
4238 return onImplicitObjectArgument(
4239 anyOf(hasType(InnerMatcher), hasType(pointsTo(InnerMatcher))))
4240 .matches(
Node, Finder, Builder);
4254 const Decl *DeclNode =
Node.getDecl();
4255 return (DeclNode !=
nullptr &&
4256 InnerMatcher.matches(*DeclNode, Finder, Builder));
4283 internal::Matcher<UsingShadowDecl>, Inner) {
4286 return Inner.matches(*
UsingDecl, Finder, Builder);
4307 return matchesFirstInPointerRange(InnerMatcher,
Node.decls_begin(),
4308 Node.decls_end(), Finder,
4309 Builder) !=
Node.decls_end();
4322 if (
Node.isSingleDecl()) {
4323 const Decl *FoundDecl =
Node.getSingleDecl();
4324 return InnerMatcher.matches(*FoundDecl, Finder, Builder);
4338 VarDecl, hasInitializer, internal::Matcher<Expr>,
4342 InnerMatcher.matches(*
Initializer, Finder, Builder));
4368 internal::Matcher<LambdaCapture>, InnerMatcher) {
4369 BoundNodesTreeBuilder
Result;
4370 bool Matched =
false;
4372 if (Finder->isTraversalIgnoringImplicitNodes() &&
Capture.isImplicit())
4374 BoundNodesTreeBuilder CaptureBuilder(*Builder);
4375 if (InnerMatcher.matches(
Capture, Finder, &CaptureBuilder)) {
4377 Result.addMatch(CaptureBuilder);
4380 *Builder = std::move(
Result);
4395 return Node.isStaticLocal();
4410 return Node.hasLocalStorage();
4424 return Node.hasGlobalStorage();
4491 return Node.isExceptionVariable();
4507 unsigned NumArgs =
Node.getNumArgs();
4508 if (!Finder->isTraversalIgnoringImplicitNodes())
4509 return NumArgs == N;
4511 if (!isa<CXXDefaultArgExpr>(
Node.getArg(NumArgs - 1)))
4515 return NumArgs == N;
4534 unsigned NumArgs =
Node.getNumArgs();
4535 if (!Finder->isTraversalIgnoringImplicitNodes())
4536 return NumArgs >= N;
4538 if (!isa<CXXDefaultArgExpr>(
Node.getArg(NumArgs - 1)))
4542 return NumArgs >= N;
4557 unsigned, N, internal::Matcher<Expr>, InnerMatcher) {
4558 if (N >=
Node.getNumArgs())
4561 if (Finder->isTraversalIgnoringImplicitNodes() && isa<CXXDefaultArgExpr>(Arg))
4584 const auto *
const Init =
Node.getInit();
4585 return Init && InnerMacher.matches(*
Init, Finder, Builder);
4606 const Expr *
const Pattern =
Node.getPattern();
4607 return Pattern && InnerMacher.matches(*Pattern, Finder, Builder);
4688 return N <
Node.getNumInits() &&
4689 InnerMatcher.matches(*
Node.getInit(N), Finder, Builder);
4727 internal::Matcher<Decl>, InnerMatcher) {
4728 const unsigned NumDecls = std::distance(
Node.decl_begin(),
Node.decl_end());
4732 std::advance(Iterator, N);
4733 return InnerMatcher.matches(**Iterator, Finder, Builder);
4750 return Node.getExceptionDecl() ==
nullptr;
4767 internal::Matcher<CXXCtorInitializer>, InnerMatcher) {
4768 auto MatchIt = matchesFirstInPointerRange(InnerMatcher,
Node.init_begin(),
4769 Node.init_end(), Finder, Builder);
4770 if (MatchIt ==
Node.init_end())
4772 return (*MatchIt)->isWritten() || !Finder->isTraversalIgnoringImplicitNodes();
4789 internal::Matcher<FieldDecl>, InnerMatcher) {
4791 return (NodeAsDecl !=
nullptr &&
4792 InnerMatcher.matches(*NodeAsDecl, Finder, Builder));
4809 internal::Matcher<Expr>, InnerMatcher) {
4810 const Expr* NodeAsExpr =
Node.getInit();
4811 return (NodeAsExpr !=
nullptr &&
4812 InnerMatcher.matches(*NodeAsExpr, Finder, Builder));
4829 return Node.isWritten();
4849 return Node.isBaseInitializer();
4869 return Node.isMemberInitializer();
4895 internal::Matcher<Expr>, InnerMatcher) {
4896 for (
const Expr *Arg :
Node.arguments()) {
4897 if (Finder->isTraversalIgnoringImplicitNodes() &&
4898 isa<CXXDefaultArgExpr>(Arg))
4900 BoundNodesTreeBuilder
Result(*Builder);
4901 if (InnerMatcher.matches(*Arg, Finder, &
Result)) {
4902 *Builder = std::move(
Result);
4921extern const internal::VariadicAllOfMatcher<LambdaCapture>
lambdaCapture;
4938 clang::ast_matchers::internal::BoundNodesTreeBuilder
Result(*Builder);
4940 *Builder = std::move(
Result);
4964 if (!
Node.capturesVariable())
4966 auto *capturedVar =
Node.getCapturedVar();
4967 return capturedVar && InnerMatcher.matches(*capturedVar, Finder, Builder);
4988 return Node.isListInitialization();
5004 return Node.requiresZeroInitialization();
5031 unsigned, N, internal::Matcher<ParmVarDecl>,
5033 return (N <
Node.parameters().size()
5034 && InnerMatcher.matches(*
Node.parameters()[N], Finder, Builder));
5053 return Node.isExplicitObjectMemberFunction();
5077 internal::Matcher<Expr>, ArgMatcher,
5078 internal::Matcher<ParmVarDecl>, ParamMatcher) {
5079 BoundNodesTreeBuilder
Result;
5083 BoundNodesTreeBuilder Matches;
5087 .matches(
Node, Finder, &Matches)
5091 bool Matched =
false;
5092 for (; ArgIndex <
Node.getNumArgs(); ++ArgIndex) {
5093 BoundNodesTreeBuilder ArgMatches(*Builder);
5094 if (ArgMatcher.matches(*(
Node.getArg(ArgIndex)->IgnoreParenCasts()),
5095 Finder, &ArgMatches)) {
5096 BoundNodesTreeBuilder ParamMatches(ArgMatches);
5098 hasParameter(ParamIndex, ParamMatcher)))),
5100 hasParameter(ParamIndex, ParamMatcher))))))
5101 .matches(
Node, Finder, &ParamMatches)) {
5102 Result.addMatch(ParamMatches);
5108 *Builder = std::move(
Result);
5140 internal::Matcher<Expr>, ArgMatcher,
5141 internal::Matcher<QualType>, ParamMatcher) {
5142 BoundNodesTreeBuilder
Result;
5146 BoundNodesTreeBuilder Matches;
5150 .matches(
Node, Finder, &Matches)
5155 if (
const auto *
Call = dyn_cast<CallExpr>(&
Node)) {
5156 if (
const auto *
Value =
5157 dyn_cast_or_null<ValueDecl>(
Call->getCalleeDecl())) {
5167 assert(MP &&
"Must be member-pointer if its a memberfunctionpointer");
5170 "The call must have happened through a member function "
5176 unsigned ParamIndex = 0;
5177 bool Matched =
false;
5178 unsigned NumArgs =
Node.getNumArgs();
5182 for (; ArgIndex < NumArgs; ++ArgIndex, ++ParamIndex) {
5183 BoundNodesTreeBuilder ArgMatches(*Builder);
5184 if (ArgMatcher.matches(*(
Node.getArg(ArgIndex)->IgnoreParenCasts()), Finder,
5186 BoundNodesTreeBuilder ParamMatches(ArgMatches);
5192 if (ParamMatcher.matches(ParamType, Finder, &ParamMatches)) {
5193 Result.addMatch(ParamMatches);
5199 hasParameter(ParamIndex, hasType(ParamMatcher))))),
5201 hasParameter(ParamIndex, hasType(ParamMatcher)))))))
5202 .matches(
Node, Finder, &ParamMatches)) {
5203 Result.addMatch(ParamMatches);
5209 *Builder = std::move(
Result);
5231 if (
const auto *
Decl = dyn_cast_or_null<FunctionDecl>(Context))
5232 return N <
Decl->param_size() &&
Decl->getParamDecl(N) == &
Node;
5233 if (
const auto *
Decl = dyn_cast_or_null<BlockDecl>(Context))
5234 return N <
Decl->param_size() &&
Decl->getParamDecl(N) == &
Node;
5235 if (
const auto *
Decl = dyn_cast_or_null<ObjCMethodDecl>(Context))
5236 return N <
Decl->param_size() &&
Decl->getParamDecl(N) == &
Node;
5276 internal::Matcher<ParmVarDecl>,
5278 return matchesFirstInPointerRange(InnerMatcher,
Node.param_begin(),
5279 Node.param_end(), Finder,
5280 Builder) !=
Node.param_end();
5304 return Node.getNumParams() == N;
5332 forEachTemplateArgument,
5336 internal::Matcher<TemplateArgument>, InnerMatcher) {
5338 clang::ast_matchers::internal::getTemplateSpecializationArgs(
Node);
5339 clang::ast_matchers::internal::BoundNodesTreeBuilder
Result;
5340 bool Matched =
false;
5341 for (
const auto &Arg : TemplateArgs) {
5342 clang::ast_matchers::internal::BoundNodesTreeBuilder ArgBuilder(*Builder);
5343 if (InnerMatcher.matches(Arg, Finder, &ArgBuilder)) {
5345 Result.addMatch(ArgBuilder);
5348 *Builder = std::move(
Result);
5377 internal::Matcher<QualType>, InnerMatcher) {
5378 return InnerMatcher.matches(
Node.getReturnType(), Finder, Builder);
5398 return Node.isExternC();
5431 return Node.isDeleted();
5444 return Node.isDefaulted();
5477 return FnTy->hasDynamicExceptionSpec();
5527 return Node.isConsteval();
5549 return Node.isConstexpr();
5564 if (
const auto *CIA =
Node.getAttr<ConstInitAttr>())
5565 return CIA->isConstinit();
5593 internal::Matcher<Stmt>, InnerMatcher) {
5595 return Init !=
nullptr && InnerMatcher.matches(*
Init, Finder, Builder);
5609 internal::Matcher<Expr>, InnerMatcher) {
5612 InnerMatcher.matches(*
Condition, Finder, Builder));
5623 const Stmt *
const Then =
Node.getThen();
5624 return (Then !=
nullptr && InnerMatcher.matches(*Then, Finder, Builder));
5635 const Stmt *
const Else =
Node.getElse();
5636 return (Else !=
nullptr && InnerMatcher.matches(*Else, Finder, Builder));
5670 internal::NotEqualsBoundNodePredicate Predicate;
5673 return Builder->removeBindings(Predicate);
5685 internal::Matcher<DeclStmt>, InnerMatcher) {
5686 const DeclStmt*
const DeclarationStatement =
5687 Node.getConditionVariableDeclStmt();
5688 return DeclarationStatement !=
nullptr &&
5689 InnerMatcher.matches(*DeclarationStatement, Finder, Builder);
5702 internal::Matcher<Expr>, InnerMatcher) {
5704 return InnerMatcher.matches(*
Expression, Finder, Builder);
5719 internal::Matcher<Expr>, InnerMatcher) {
5721 return InnerMatcher.matches(*
Expression, Finder, Builder);
5753 internal::Matcher<Stmt>, InnerMatcher) {
5754 if (Finder->isTraversalIgnoringImplicitNodes() && isDefaultedHelper(&
Node))
5756 const Stmt *
const Statement = internal::GetBodyMatcher<NodeType>::get(
Node);
5757 return (Statement !=
nullptr &&
5758 InnerMatcher.matches(*Statement, Finder, Builder));
5778 internal::Matcher<Stmt>, InnerMatcher) {
5779 const Stmt *
const Statement =
Node.getBody();
5780 return (Statement !=
nullptr &&
5781 InnerMatcher.matches(*Statement, Finder, Builder));
5799 internal::Matcher<Stmt>, InnerMatcher) {
5801 return CS && matchesFirstInPointerRange(InnerMatcher, CS->
body_begin(),
5817 return Node.size() == N;
5845template <
typename ValueT>
5846internal::PolymorphicMatcher<internal::ValueEqualsMatcher,
5847 void(internal::AllNodeBaseTypes), ValueT>
5849 return internal::PolymorphicMatcher<internal::ValueEqualsMatcher,
5850 void(internal::AllNodeBaseTypes), ValueT>(
5859 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
5867 unsigned,
Value, 1) {
5868 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
5878 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
5903 std::string, Name) {
5904 if (std::optional<StringRef> OpName = internal::getOpName(
Node))
5905 return *OpName == Name;
5915extern const internal::VariadicFunction<
5916 internal::PolymorphicMatcher<internal::HasAnyOperatorNameMatcher,
5920 std::vector<std::string>>,
5939 isAssignmentOperator,
5942 return Node.isAssignmentOp();
5960 isComparisonOperator,
5963 return Node.isComparisonOp();
5977 internal::Matcher<Expr>, InnerMatcher) {
5978 const Expr *LeftHandSide = internal::getLHS(
Node);
5979 return (LeftHandSide !=
nullptr &&
5980 InnerMatcher.matches(*LeftHandSide, Finder, Builder));
5994 internal::Matcher<Expr>, InnerMatcher) {
5995 const Expr *RightHandSide = internal::getRHS(
Node);
5996 return (RightHandSide !=
nullptr &&
5997 InnerMatcher.matches(*RightHandSide, Finder, Builder));
6006 internal::Matcher<Expr>, InnerMatcher) {
6007 return internal::VariadicDynCastAllOfMatcher<Stmt, NodeType>()(
6008 anyOf(hasLHS(InnerMatcher), hasRHS(InnerMatcher)))
6009 .matches(
Node, Finder, Builder);
6027 internal::Matcher<Expr>, Matcher1, internal::Matcher<Expr>, Matcher2) {
6028 return internal::VariadicDynCastAllOfMatcher<Stmt, NodeType>()(
6029 anyOf(
allOf(hasLHS(Matcher1), hasRHS(Matcher2)),
6030 allOf(hasRHS(Matcher1), hasLHS(Matcher2))))
6031 .matches(
Node, Finder, Builder);
6044 internal::Matcher<Expr>, InnerMatcher) {
6045 const Expr *
const Operand = internal::getSubExpr(
Node);
6046 return (Operand !=
nullptr &&
6047 InnerMatcher.matches(*Operand, Finder, Builder));
6068 internal::Matcher<Expr>, InnerMatcher) {
6069 const Expr *
const SubExpression =
6070 internal::GetSourceExpressionMatcher<NodeType>::get(
Node);
6071 return (SubExpression !=
nullptr &&
6072 InnerMatcher.matches(*SubExpression, Finder, Builder));
6094 internal::Matcher<QualType>, InnerMatcher) {
6096 return InnerMatcher.matches(NodeType, Finder, Builder);
6102 internal::Matcher<QualType>, InnerMatcher) {
6103 return InnerMatcher.matches(
Node.getType(), Finder, Builder);
6116 return Node.isStruct();
6129 return Node.isUnion();
6142 return Node.isClass();
6155 return Node.isEnum();
6170 internal::Matcher<Expr>, InnerMatcher) {
6173 InnerMatcher.matches(*
Expression, Finder, Builder));
6185 internal::Matcher<Expr>, InnerMatcher) {
6188 InnerMatcher.matches(*
Expression, Finder, Builder));
6215 return Node.isThisDeclarationADefinition();
6229 return Node.isVariadic();
6250 internal::Matcher<CXXRecordDecl>, InnerMatcher) {
6252 ASTChildrenNotSpelledInSourceScope RAII(Finder,
false);
6255 return (
Parent !=
nullptr &&
6256 InnerMatcher.matches(*
Parent, Finder, Builder));
6284 internal::Matcher<CXXMethodDecl>, InnerMatcher) {
6285 BoundNodesTreeBuilder
Result;
6286 bool Matched =
false;
6287 for (
const auto *Overridden :
Node.overridden_methods()) {
6288 BoundNodesTreeBuilder OverriddenBuilder(*Builder);
6289 const bool OverriddenMatched =
6290 InnerMatcher.matches(*Overridden, Finder, &OverriddenBuilder);
6291 if (OverriddenMatched) {
6293 Result.addMatch(OverriddenBuilder);
6296 *Builder = std::move(
Result);
6322 return Node.isVirtual();
6340 return Node.isVirtualAsWritten();
6344 return Node.isInheritingConstructor();
6365 return Node.template hasAttr<FinalAttr>();
6392 return Node.isConst();
6409 return Node.isCopyAssignmentOperator();
6426 return Node.isMoveAssignmentOperator();
6444 return Node.size_overridden_methods() > 0 ||
Node.hasAttr<OverrideAttr>();
6459 return Node.isUserProvided();
6489 return Node.isArrow();
6503 return Node->isIntegerType();
6517 return Node->isUnsignedIntegerType();
6531 return Node->isSignedIntegerType();
6545 return Node->isAnyCharacterType();
6565 return Node->isAnyPointerType();
6584 return Node.isConstQualified();
6603 return Node.isVolatileQualified();
6620 return Node.hasLocalQualifiers();
6636 internal::Matcher<ValueDecl>, InnerMatcher) {
6637 return InnerMatcher.matches(*
Node.getMemberDecl(), Finder, Builder);
6657 hasObjectExpression,
6660 internal::Matcher<Expr>, InnerMatcher) {
6661 if (
const auto *
E = dyn_cast<UnresolvedMemberExpr>(&
Node))
6662 if (
E->isImplicitAccess())
6664 if (
const auto *
E = dyn_cast<CXXDependentScopeMemberExpr>(&
Node))
6665 if (
E->isImplicitAccess())
6667 return InnerMatcher.matches(*
Node.getBase(), Finder, Builder);
6680 internal::Matcher<UsingShadowDecl>, InnerMatcher) {
6681 return matchesFirstInPointerRange(InnerMatcher,
Node.shadow_begin(),
6682 Node.shadow_end(), Finder,
6683 Builder) !=
Node.shadow_end();
6699 internal::Matcher<NamedDecl>, InnerMatcher) {
6700 return InnerMatcher.matches(*
Node.getTargetDecl(), Finder, Builder);
6734 Node.getTemplateSpecializationKind() ==
6736 Node.getTemplateSpecializationKind() ==
6798 internal::Matcher<QualType>, InnerMatcher, 0) {
6799 return internal::BindableMatcher<TypeLoc>(
6800 new internal::TypeLocTypeMatcher(InnerMatcher));
6811extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, QualifiedTypeLoc>
6826 return InnerMatcher.matches(
Node.getUnqualifiedLoc(), Finder, Builder);
6840 auto Loc =
Node.getFunctionTypeLoc();
6841 return Loc && ReturnMatcher.matches(
Loc.getReturnLoc(), Finder, Builder);
6852extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, PointerTypeLoc>
6866 return PointeeMatcher.matches(
Node.getPointeeLoc(), Finder, Builder);
6879extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, ReferenceTypeLoc>
6894 return ReferentMatcher.matches(
Node.getPointeeLoc(), Finder, Builder);
6906extern const internal::VariadicDynCastAllOfMatcher<
6924 hasAnyTemplateArgumentLoc,
6928 internal::Matcher<TemplateArgumentLoc>, InnerMatcher) {
6929 auto Args = internal::getTemplateArgsWritten(
Node);
6930 return matchesFirstInRange(InnerMatcher, Args.begin(), Args.end(), Finder,
6931 Builder) != Args.end();
6949 hasTemplateArgumentLoc,
6953 unsigned, Index, internal::Matcher<TemplateArgumentLoc>, InnerMatcher) {
6954 auto Args = internal::getTemplateArgsWritten(
Node);
6955 return Index < Args.size() &&
6956 InnerMatcher.matches(Args[Index], Finder, Builder);
6968extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, ElaboratedTypeLoc>
6987 return InnerMatcher.matches(
Node.getNamedTypeLoc(), Finder, Builder);
6999 return Node.isBooleanType();
7011 return Node.isVoidType();
7014template <
typename NodeType>
7063 return Node.isRealFloatingType();
7116 return internal::HasSizeMatcher<NodeType>::hasSize(
Node, N);
7187 internal::Matcher<Expr>, InnerMatcher) {
7188 return InnerMatcher.matches(*
Node.getSizeExpr(), Finder, Builder);
7434 pointee, getPointee,
7582 internal::Matcher<NestedNameSpecifier>, InnerMatcher) {
7584 return InnerMatcher.matches(*Qualifier, Finder, Builder);
7606 return InnerMatcher.matches(
Node.getNamedType(), Finder, Builder);
7649 hasReplacementType, getReplacementType,
7688 return InnerType.matches(
Node.getDecayedType(), Finder, Builder);
7707 if (!DC)
return false;
7724extern const internal::VariadicAllOfMatcher<NestedNameSpecifier>
7728extern const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
7734 internal::BindableMatcher<NestedNameSpecifierLoc>, loc,
7735 internal::Matcher<NestedNameSpecifier>, InnerMatcher, 1) {
7736 return internal::BindableMatcher<NestedNameSpecifierLoc>(
7737 new internal::LocMatcher<NestedNameSpecifierLoc, NestedNameSpecifier>(
7754 internal::Matcher<QualType>, InnerMatcher) {
7755 if (!
Node.getAsType())
7757 return InnerMatcher.matches(
QualType(
Node.getAsType(), 0), Finder, Builder);
7772 internal::Matcher<TypeLoc>, InnerMatcher) {
7773 return Node &&
Node.getNestedNameSpecifier()->getAsType() &&
7774 InnerMatcher.matches(
Node.getTypeLoc(), Finder, Builder);
7787 internal::Matcher<NestedNameSpecifier>, InnerMatcher,
7792 return InnerMatcher.matches(*NextNode, Finder, Builder);
7805 internal::Matcher<NestedNameSpecifierLoc>, InnerMatcher,
7810 return InnerMatcher.matches(NextNode, Finder, Builder);
7824 internal::Matcher<NamespaceDecl>, InnerMatcher) {
7825 if (!
Node.getAsNamespace())
7827 return InnerMatcher.matches(*
Node.getAsNamespace(), Finder, Builder);
7846extern const internal::VariadicAllOfMatcher<Attr>
attr;
7886 BoundNodesTreeBuilder
Result;
7891 bool Matched =
false;
7893 SC = SC->getNextSwitchCase()) {
7894 BoundNodesTreeBuilder CaseBuilder(*Builder);
7895 bool CaseMatched = InnerMatcher.matches(*SC, Finder, &CaseBuilder);
7898 Result.addMatch(CaseBuilder);
7901 *Builder = std::move(
Result);
7916 internal::Matcher<CXXCtorInitializer>, InnerMatcher) {
7917 BoundNodesTreeBuilder
Result;
7918 bool Matched =
false;
7919 for (
const auto *I :
Node.inits()) {
7920 if (Finder->isTraversalIgnoringImplicitNodes() && !I->isWritten())
7922 BoundNodesTreeBuilder InitBuilder(*Builder);
7923 if (InnerMatcher.matches(*I, Finder, &InitBuilder)) {
7925 Result.addMatch(InitBuilder);
7928 *Builder = std::move(
Result);
7944 return Node.isCopyConstructor();
7959 return Node.isMoveConstructor();
7974 return Node.isDefaultConstructor();
7991 return Node.isDelegatingConstructor();
8019 return Node.isExplicit();
8049 ASTChildrenNotSpelledInSourceScope RAII(Finder,
false);
8051 return InnerMatcher.matches(*ES.
getExpr(), Finder, Builder);
8074 if (
const auto *FD = dyn_cast<FunctionDecl>(&
Node))
8075 return FD->isInlineSpecified();
8076 if (
const auto *NSD = dyn_cast<NamespaceDecl>(&
Node))
8077 return NSD->isInline();
8078 if (
const auto *VD = dyn_cast<VarDecl>(&
Node))
8079 return VD->isInline();
8080 llvm_unreachable(
"Not a valid polymorphic type");
8093 return Node.isAnonymousNamespace();
8140 return Node.isInAnonymousNamespace();
8157 return InnerMatcher.matches(*
Node.getLHS(), Finder, Builder);
8170 for (
const auto *
Attr :
Node.attrs()) {
8190 return InnerMatcher.matches(*
RetValue, Finder, Builder);
8200extern const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
8245 return InnerMatcher.matches(*VD, Finder, Builder);
8268 internal::Matcher<BindingDecl>, InnerMatcher) {
8269 if (
Node.bindings().size() <= N)
8271 return InnerMatcher.matches(*
Node.bindings()[N], Finder, Builder);
8293 return llvm::any_of(
Node.bindings(), [&](
const auto *Binding) {
8294 return InnerMatcher.matches(*Binding, Finder, Builder);
8317 const auto &Parents = Finder->getASTContext().getParents(
Node);
8320 while (!Stack.empty()) {
8321 const auto &CurNode = Stack.back();
8323 if (
const auto *FuncDeclNode = CurNode.get<
FunctionDecl>()) {
8324 if (InnerMatcher.matches(*FuncDeclNode, Finder, Builder)) {
8327 }
else if (
const auto *LambdaExprNode = CurNode.get<
LambdaExpr>()) {
8328 if (InnerMatcher.matches(*LambdaExprNode->getCallOperator(), Finder,
8333 llvm::append_range(Stack, Finder->getASTContext().getParents(CurNode));
8367 const auto &Parents = Finder->getASTContext().getParents(
Node);
8370 while (!Stack.empty()) {
8371 const auto &CurNode = Stack.back();
8373 if (
const auto *FuncDeclNode = CurNode.get<
FunctionDecl>()) {
8374 BoundNodesTreeBuilder B = *Builder;
8375 if (InnerMatcher.matches(*FuncDeclNode, Finder, &B)) {
8376 *Builder = std::move(B);
8379 }
else if (
const auto *LambdaExprNode = CurNode.get<
LambdaExpr>()) {
8380 BoundNodesTreeBuilder B = *Builder;
8381 if (InnerMatcher.matches(*LambdaExprNode->getCallOperator(), Finder,
8383 *Builder = std::move(B);
8386 }
else if (
const auto *ObjCMethodDeclNode = CurNode.get<
ObjCMethodDecl>()) {
8387 BoundNodesTreeBuilder B = *Builder;
8388 if (InnerMatcher.matches(*ObjCMethodDeclNode, Finder, &B)) {
8389 *Builder = std::move(B);
8392 }
else if (
const auto *BlockDeclNode = CurNode.get<
BlockDecl>()) {
8393 BoundNodesTreeBuilder B = *Builder;
8394 if (InnerMatcher.matches(*BlockDeclNode, Finder, &B)) {
8395 *Builder = std::move(B);
8399 llvm::append_range(Stack, Finder->getASTContext().getParents(CurNode));
8426 return Node.hasExternalFormalLinkage();
8451 return Node.hasDefaultArg();
8463 return Node.isArray();
8475 internal::Matcher<Expr>, InnerMatcher) {
8476 return Node.getNumPlacementArgs() > Index &&
8477 InnerMatcher.matches(*
Node.getPlacementArg(Index), Finder, Builder);
8490 return llvm::any_of(
Node.placement_arguments(), [&](
const Expr *Arg) {
8491 return InnerMatcher.matches(*Arg, Finder, Builder);
8504 return Node.isArray() && *
Node.getArraySize() &&
8505 InnerMatcher.matches(**
Node.getArraySize(), Finder, Builder);
8516 return Node.hasDefinition();
8527 return Node.isScoped();
8539 return F->hasTrailingReturn();
8575 if (
const auto *CleanupsExpr = dyn_cast<ExprWithCleanups>(&
Node))
8576 E = CleanupsExpr->getSubExpr();
8577 if (
const auto *CtorExpr = dyn_cast<CXXConstructExpr>(
E)) {
8578 if (CtorExpr->isElidable()) {
8579 if (
const auto *MaterializeTemp =
8580 dyn_cast<MaterializeTemporaryExpr>(CtorExpr->getArg(0))) {
8581 return InnerMatcher.matches(*MaterializeTemp->getSubExpr(), Finder,
8586 return InnerMatcher.matches(
Node, Finder, Builder);
8605extern const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
8622 return Node.isStandaloneDirective();
8641 internal::Matcher<Stmt>, InnerMatcher) {
8642 if (
Node.isStandaloneDirective())
8644 return InnerMatcher.matches(*
Node.getStructuredBlock(), Finder, Builder);
8659 internal::Matcher<OMPClause>, InnerMatcher) {
8661 return matchesFirstInPointerRange(InnerMatcher, Clauses.begin(),
8662 Clauses.end(), Finder,
8663 Builder) != Clauses.end();
8680extern const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
8697 return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_none;
8714 return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_shared;
8733 return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_private;
8752 return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_firstprivate;
8774 return llvm::omp::isAllowedClauseForDirective(
8775 Node.getDirectiveKind(), CKind,
8776 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::@1655::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, APValue &Result)
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.
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 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.
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.