45 #ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H
46 #define LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H
54 #include "llvm/Support/Regex.h"
58 namespace ast_matchers {
75 return MyBoundNodes.getNodeAs<T>(
ID);
85 return MyBoundNodes.getMap();
90 BoundNodes(internal::BoundNodesMap &MyBoundNodes)
91 : MyBoundNodes(MyBoundNodes) {}
93 internal::BoundNodesMap MyBoundNodes;
101 template <
typename T>
102 internal::Matcher<T>
id(StringRef
ID,
104 return InnerMatcher.bind(ID);
133 inline internal::TrueMatcher
anything() {
return internal::TrueMatcher(); }
146 const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
158 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl>
typedefDecl;
169 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
181 const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl>
typeAliasDecl;
190 const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
232 if (ExpansionLoc.isInvalid()) {
255 std::string, RegExp) {
258 if (ExpansionLoc.isInvalid()) {
268 llvm::Regex RE(RegExp);
281 const internal::VariadicAllOfMatcher<Decl>
decl;
291 const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
305 const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl>
namedDecl;
316 const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl>
labelDecl;
327 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl>
namespaceDecl;
338 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
350 const internal::VariadicDynCastAllOfMatcher<
361 const internal::VariadicDynCastAllOfMatcher<
371 const internal::VariadicDynCastAllOfMatcher<
385 const internal::VariadicDynCastAllOfMatcher<
398 const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
409 const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl>
parmVarDecl;
422 const internal::VariadicDynCastAllOfMatcher<
467 const internal::VariadicDynCastAllOfMatcher<
479 const internal::VariadicDynCastAllOfMatcher<
543 return Node.isBitField();
560 return Node.isBitField() &&
561 Node.getBitWidthValue(
Finder->getASTContext()) == Width;
580 const Expr *Initializer =
Node.getInClassInitializer();
581 return (Initializer !=
nullptr &&
588 return Node.isImplicit();
613 hasAnyTemplateArgument,
619 internal::getTemplateSpecializationArgs(
Node);
766 unsigned, N, internal::Matcher<TemplateArgument>,
InnerMatcher) {
768 internal::getTemplateSpecializationArgs(
Node);
769 if (List.size() <= N)
784 templateArgumentCountIs,
788 return internal::getTemplateSpecializationArgs(
Node).size() == N;
912 std::string,
Value) {
915 return Node.getAsIntegral().toString(10) ==
Value;
925 const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl>
valueDecl;
938 const internal::VariadicDynCastAllOfMatcher<
951 const internal::VariadicDynCastAllOfMatcher<
963 const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl>
enumDecl;
973 const internal::VariadicDynCastAllOfMatcher<
983 const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl>
cxxMethodDecl;
991 const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
1003 const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl>
varDecl;
1013 const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl>
fieldDecl;
1021 const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl>
functionDecl;
1029 const internal::VariadicDynCastAllOfMatcher<
1041 const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl>
friendDecl;
1051 const internal::VariadicAllOfMatcher<Stmt>
stmt;
1061 const internal::VariadicDynCastAllOfMatcher<
1076 const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr>
memberExpr;
1086 const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr>
callExpr;
1094 const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr>
lambdaExpr;
1103 const internal::VariadicDynCastAllOfMatcher<
1116 const internal::VariadicDynCastAllOfMatcher<
1127 const internal::VariadicDynCastAllOfMatcher<
1138 const internal::VariadicDynCastAllOfMatcher<
1149 const internal::VariadicDynCastAllOfMatcher<
1165 const internal::VariadicDynCastAllOfMatcher<
1178 const internal::VariadicDynCastAllOfMatcher<
1190 const internal::VariadicDynCastAllOfMatcher<
1201 const internal::VariadicDynCastAllOfMatcher<
1215 const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr>
initListExpr;
1221 const Expr *SyntForm =
Node.getSyntacticForm();
1222 return (SyntForm !=
nullptr &&
1237 const internal::VariadicDynCastAllOfMatcher<
Stmt,
1248 const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
1278 const internal::VariadicDynCastAllOfMatcher<
1291 const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl>
usingDecl;
1302 const internal::VariadicDynCastAllOfMatcher<
1320 const internal::VariadicDynCastAllOfMatcher<
1335 const internal::VariadicDynCastAllOfMatcher<
1354 const internal::VariadicDynCastAllOfMatcher<
1365 const internal::VariadicDynCastAllOfMatcher<
1379 const internal::VariadicDynCastAllOfMatcher<
1391 const internal::VariadicDynCastAllOfMatcher<
1405 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr>
cxxThisExpr;
1415 const internal::VariadicDynCastAllOfMatcher<
1437 const internal::VariadicDynCastAllOfMatcher<
1449 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr>
cxxNewExpr;
1469 const internal::VariadicDynCastAllOfMatcher<
1482 const internal::VariadicDynCastAllOfMatcher<
1500 const internal::VariadicDynCastAllOfMatcher<
1510 const internal::VariadicDynCastAllOfMatcher<Stmt, Expr>
expr;
1519 const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
declRefExpr;
1527 const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt>
ifStmt;
1536 const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt>
forStmt;
1548 const Stmt *
const Increment =
Node.getInc();
1549 return (Increment !=
nullptr &&
1563 const Stmt *
const Init =
Node.getInit();
1574 const internal::VariadicDynCastAllOfMatcher<
1588 const VarDecl *
const Var =
Node.getLoopVariable();
1602 const Expr *
const Init =
Node.getRangeInit();
1614 const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt>
whileStmt;
1624 const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt>
doStmt;
1634 const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt>
breakStmt;
1644 const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt>
continueStmt;
1654 const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt>
returnStmt;
1665 const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt>
gotoStmt;
1676 const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt>
labelStmt;
1698 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt>
switchStmt;
1708 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase>
switchCase;
1718 const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt>
caseStmt;
1728 const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt>
defaultStmt;
1736 const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt>
compoundStmt;
1745 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt>
cxxCatchStmt;
1754 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt>
cxxTryStmt;
1763 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr>
cxxThrowExpr;
1772 const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt>
nullStmt;
1782 const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt>
asmStmt;
1790 const internal::VariadicDynCastAllOfMatcher<
1801 const internal::VariadicDynCastAllOfMatcher<
1815 const internal::VariadicDynCastAllOfMatcher<
1823 const internal::VariadicDynCastAllOfMatcher<
1834 const internal::VariadicDynCastAllOfMatcher<
1841 const internal::VariadicDynCastAllOfMatcher<
1852 const internal::VariadicDynCastAllOfMatcher<
1857 const internal::VariadicDynCastAllOfMatcher<
1862 const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr>
gnuNullExpr;
1869 const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr>
atomicExpr;
1877 const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr>
stmtExpr;
1885 const internal::VariadicDynCastAllOfMatcher<
1895 const internal::VariadicDynCastAllOfMatcher<
1905 const internal::VariadicDynCastAllOfMatcher<
1915 const internal::VariadicDynCastAllOfMatcher<
1927 const internal::VariadicDynCastAllOfMatcher<
1944 const internal::VariadicDynCastAllOfMatcher<
1958 const internal::VariadicDynCastAllOfMatcher<
1975 const internal::VariadicDynCastAllOfMatcher<
1991 const internal::VariadicDynCastAllOfMatcher<
2003 const internal::VariadicDynCastAllOfMatcher<
2013 const internal::VariadicDynCastAllOfMatcher<
2038 const internal::VariadicDynCastAllOfMatcher<
2046 const internal::VariadicDynCastAllOfMatcher<
2063 const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr>
castExpr;
2073 const internal::VariadicDynCastAllOfMatcher<
2083 const internal::VariadicDynCastAllOfMatcher<
2093 const internal::VariadicDynCastAllOfMatcher<
2103 const internal::VariadicDynCastAllOfMatcher<
2119 return Node.size() == N;
2123 const internal::VariadicAllOfMatcher<QualType>
qualType;
2126 const internal::VariadicAllOfMatcher<Type>
type;
2129 const internal::VariadicAllOfMatcher<TypeLoc>
typeLoc;
2150 const internal::VariadicOperatorMatcherFunc<2, UINT_MAX>
eachOf = {
2151 internal::DynTypedMatcher::VO_EachOf
2157 const internal::VariadicOperatorMatcherFunc<2, UINT_MAX>
anyOf = {
2158 internal::DynTypedMatcher::VO_AnyOf
2164 const internal::VariadicOperatorMatcherFunc<2, UINT_MAX>
allOf = {
2165 internal::DynTypedMatcher::VO_AllOf
2177 const internal::VariadicDynCastAllOfMatcher<
2191 const QualType ArgumentType =
Node.getTypeOfArgument();
2211 const internal::Matcher<UnaryExprOrTypeTraitExpr> &
InnerMatcher) {
2219 const internal::Matcher<UnaryExprOrTypeTraitExpr> &
InnerMatcher) {
2239 inline internal::Matcher<NamedDecl>
hasName(
const std::string &
Name) {
2240 std::vector<std::string>
Names;
2241 Names.push_back(Name);
2242 return internal::Matcher<NamedDecl>(
new internal::HasNameMatcher(Names));
2255 const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
2276 assert(!RegExp.empty());
2277 std::string FullNameString =
"::" +
Node.getQualifiedNameAsString();
2278 llvm::Regex RE(RegExp);
2279 return RE.match(FullNameString);
2301 inline internal::PolymorphicMatcherWithParam1<
2302 internal::HasOverloadedOperatorNameMatcher, StringRef,
2305 return internal::PolymorphicMatcherWithParam1<
2306 internal::HasOverloadedOperatorNameMatcher, StringRef,
2332 internal::Matcher<NamedDecl>,
Base) {
2338 assert(!BaseName.empty());
2345 internal::Matcher<NamedDecl>,
Base, 0) {
2346 return Matcher<CXXRecordDecl>(
anyOf(
Base, isDerivedFrom(
Base)))
2354 assert(!BaseName.empty());
2385 return Node.isLambda();
2406 const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher>
2407 LLVM_ATTRIBUTE_UNUSED
has = {};
2423 const internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher>
2443 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher>
2472 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachDescendantMatcher>
2491 template <
typename T>
2506 const internal::ArgumentAdaptingMatcherFunc<
2507 internal::HasParentMatcher,
2508 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
2509 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
2523 const internal::ArgumentAdaptingMatcherFunc<
2524 internal::HasAncestorMatcher,
2525 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
2526 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
2538 const internal::VariadicOperatorMatcherFunc<1, 1>
unless = {
2539 internal::DynTypedMatcher::VO_UnaryNot
2562 inline internal::PolymorphicMatcherWithParam1<
2563 internal::HasDeclarationMatcher, internal::Matcher<Decl>,
2564 void(internal::HasDeclarationSupportedTypes)>
2566 return internal::PolymorphicMatcherWithParam1<
2567 internal::HasDeclarationMatcher, internal::Matcher<Decl>,
2568 void(internal::HasDeclarationSupportedTypes)>(
InnerMatcher);
2586 return UnderlyingDecl !=
nullptr &&
2602 const Expr *ExprNode =
Node.getImplicitObjectArgument()
2603 ->IgnoreParenImpCasts();
2604 return (ExprNode !=
nullptr &&
2648 assert(!RegExp.empty());
2649 std::string SelectorString =
Node.getSelector().getAsString();
2650 llvm::Regex RE(RegExp);
2651 return RE.match(SelectorString);
2659 return Node.getSelector().isNull();
2671 return Node.getSelector().isUnarySelector();
2687 return Node.getSelector().isKeywordSelector();
2702 return Node.getSelector().getNumArgs() == N;
2723 const Expr *ExprNode =
Node.getCallee();
2724 return (ExprNode !=
nullptr &&
2795 if (!
Node.getTypeSourceInfo())
2825 QualType, pointsTo, internal::Matcher<QualType>,
2827 return (!
Node.isNull() &&
Node->isAnyPointerType() &&
2869 return (!
Node.isNull() &&
Node->isReferenceType() &&
2901 const Expr *ExprNode =
Node.getImplicitObjectArgument();
2902 return (ExprNode !=
nullptr &&
2910 return onImplicitObjectArgument(
2918 return onImplicitObjectArgument(
2934 const Decl *DeclNode =
Node.getDecl();
2935 return (DeclNode !=
nullptr &&
2992 if (
Node.isSingleDecl()) {
3008 VarDecl, hasInitializer, internal::Matcher<Expr>,
3010 const Expr *Initializer =
Node.getAnyInitializer();
3011 return (Initializer !=
nullptr &&
3027 return Node.hasLocalStorage();
3041 return Node.hasGlobalStorage();
3108 return Node.isExceptionVariable();
3124 return Node.getNumArgs() == N;
3140 return (N <
Node.getNumArgs() &&
3185 std::advance(Iterator, N);
3203 return Node.getExceptionDecl() ==
nullptr;
3241 return (NodeAsDecl !=
nullptr &&
3260 const Expr* NodeAsExpr =
Node.getInit();
3261 return (NodeAsExpr !=
nullptr &&
3279 return Node.isWritten();
3299 return Node.isBaseInitializer();
3319 return Node.isMemberInitializer();
3337 for (
const Expr *Arg :
Node.arguments()) {
3349 return Node.isListInitialization();
3365 return Node.requiresZeroInitialization();
3379 unsigned, N, internal::Matcher<ParmVarDecl>,
3381 return (N <
Node.getNumParams() &&
3407 internal::Matcher<Expr>, ArgMatcher,
3408 internal::Matcher<ParmVarDecl>, ParamMatcher) {
3409 BoundNodesTreeBuilder
Result;
3413 BoundNodesTreeBuilder
Matches;
3419 bool Matched =
false;
3420 for (; ArgIndex <
Node.getNumArgs(); ++ArgIndex) {
3421 BoundNodesTreeBuilder ArgMatches(*
Builder);
3422 if (ArgMatcher.matches(*(
Node.getArg(ArgIndex)->IgnoreParenCasts()),
3424 BoundNodesTreeBuilder ParamMatches(ArgMatches);
3426 hasParameter(ParamIndex, ParamMatcher)))),
3428 hasParameter(ParamIndex, ParamMatcher))))))
3430 Result.addMatch(ParamMatches);
3479 return Node.getNumParams() == N;
3507 return Node.isExternC();
3540 return Node.isDeleted();
3553 return Node.isDefaulted();
3575 return FnTy->hasDynamicExceptionSpec();
3623 return Node.isConstexpr();
3638 const Expr *
const Condition =
Node.getCond();
3639 return (Condition !=
nullptr &&
3651 const Stmt *
const Then =
Node.getThen();
3663 const Stmt *
const Else =
Node.getElse();
3698 internal::NotEqualsBoundNodePredicate Predicate;
3701 return Builder->removeBindings(Predicate);
3714 const DeclStmt*
const DeclarationStatement =
3715 Node.getConditionVariableDeclStmt();
3716 return DeclarationStatement !=
nullptr &&
3731 if (
const Expr* Expression =
Node.getIdx())
3748 if (
const Expr* Expression =
Node.getBase())
3770 const Stmt *
const Statement = internal::GetBodyMatcher<NodeType>::get(
Node);
3771 return (Statement !=
nullptr &&
3806 return Node.size() == N;
3834 template <
typename ValueT>
3835 internal::PolymorphicMatcherWithParam1<internal::ValueEqualsMatcher, ValueT>
3837 return internal::PolymorphicMatcherWithParam1<
3838 internal::ValueEqualsMatcher,
3847 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
3855 unsigned,
Value, 1) {
3856 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
3866 return internal::ValueEqualsMatcher<NodeType, ParamT>(
Value)
3880 std::string,
Name) {
3894 const Expr *LeftHandSide =
Node.getLHS();
3895 return (LeftHandSide !=
nullptr &&
3909 const Expr *RightHandSide =
Node.getRHS();
3910 return (RightHandSide !=
nullptr &&
3918 return anyOf(hasLHS(InnerMatcher), hasRHS(InnerMatcher));
3930 const Expr *
const Operand =
Node.getSubExpr();
3931 return (Operand !=
nullptr &&
3955 const Expr *
const SubExpression =
3956 internal::GetSourceExpressionMatcher<NodeType>::get(
Node);
3957 return (SubExpression !=
nullptr &&
4000 return Node.isStruct();
4012 return Node.isUnion();
4024 return Node.isClass();
4040 const Expr *Expression =
Node.getTrueExpr();
4041 return (Expression !=
nullptr &&
4055 const Expr *Expression =
Node.getFalseExpr();
4056 return (Expression !=
nullptr &&
4076 return Node.isThisDeclarationADefinition();
4090 return Node.isVariadic();
4113 return (Parent !=
nullptr &&
4143 BoundNodesTreeBuilder
Result;
4144 bool Matched =
false;
4145 for (
const auto *Overridden :
Node.overridden_methods()) {
4146 BoundNodesTreeBuilder OverriddenBuilder(*
Builder);
4147 const bool OverriddenMatched =
4149 if (OverriddenMatched) {
4151 Result.addMatch(OverriddenBuilder);
4169 return Node.isVirtual();
4187 return Node.isVirtualAsWritten();
4208 return Node.template hasAttr<FinalAttr>();
4222 return Node.isPure();
4237 return Node.isConst();
4254 return Node.isCopyAssignmentOperator();
4271 return Node.isMoveAssignmentOperator();
4289 return Node.size_overridden_methods() > 0 ||
Node.hasAttr<OverrideAttr>();
4304 return Node.isUserProvided();
4323 return Node.isArrow();
4337 return Node->isIntegerType();
4351 return Node->isUnsignedIntegerType();
4365 return Node->isSignedIntegerType();
4379 return Node->isAnyCharacterType();
4399 return Node->isAnyPointerType();
4418 return Node.isConstQualified();
4437 return Node.isVolatileQualified();
4454 return Node.hasLocalQualifiers();
4550 Node.getTemplateSpecializationKind() ==
4613 return internal::BindableMatcher<TypeLoc>(
4626 return Node.isBooleanType();
4638 return Node.isVoidType();
4687 return Node.isRealFloatingType();
4740 return internal::HasSizeMatcher<NodeType>::hasSize(
Node, N);
5122 internal::Matcher<NestedNameSpecifier>,
InnerMatcher) {
5176 hasReplacementType, getReplacementType,
5234 if (!DC)
return false;
5254 const internal::VariadicAllOfMatcher<
5260 internal::BindableMatcher<NestedNameSpecifierLoc>, loc,
5261 internal::Matcher<NestedNameSpecifier>,
InnerMatcher, 1) {
5262 return internal::BindableMatcher<NestedNameSpecifierLoc>(
5263 new internal::LocMatcher<NestedNameSpecifierLoc, NestedNameSpecifier>(
5281 if (!
Node.getAsType())
5330 internal::Matcher<NestedNameSpecifierLoc>,
InnerMatcher,
5350 if (!
Node.getAsNamespace())
5363 return &
Node == Other;
5369 return &
Node == Other;
5375 return &
Node == Other;
5393 BoundNodesTreeBuilder
Result;
5398 bool Matched =
false;
5400 SC = SC->getNextSwitchCase()) {
5401 BoundNodesTreeBuilder CaseBuilder(*
Builder);
5405 Result.addMatch(CaseBuilder);
5424 BoundNodesTreeBuilder
Result;
5425 bool Matched =
false;
5426 for (
const auto *
I :
Node.inits()) {
5427 BoundNodesTreeBuilder InitBuilder(*
Builder);
5430 Result.addMatch(InitBuilder);
5449 return Node.isCopyConstructor();
5464 return Node.isMoveConstructor();
5479 return Node.isDefaultConstructor();
5496 return Node.isDelegatingConstructor();
5516 return Node.isExplicit();
5537 if (
const auto *FD = dyn_cast<FunctionDecl>(&
Node))
5538 return FD->isInlineSpecified();
5539 else if (
const auto *NSD = dyn_cast<NamespaceDecl>(&
Node))
5540 return NSD->isInline();
5541 llvm_unreachable(
"Not a valid polymorphic type");
5554 return Node.isAnonymousNamespace();
5584 for (
const auto *
Attr :
Node.attrs()) {
5603 if (
const auto *RetValue =
Node.getRetValue())
5615 const internal::VariadicDynCastAllOfMatcher<
5655 const auto &Parents =
Finder->getASTContext().getParents(
Node);
5659 while(!
Stack.empty()) {
5660 const auto &CurNode =
Stack.back();
5662 if(
const auto *FuncDeclNode = CurNode.get<
FunctionDecl>()) {
5666 }
else if(
const auto *LambdaExprNode = CurNode.get<
LambdaExpr>()) {
5667 if(
InnerMatcher.matches(*LambdaExprNode->getCallOperator(),
5672 for(
const auto &Parent:
Finder->getASTContext().getParents(CurNode))
5673 Stack.push_back(Parent);
5700 return Node.hasExternalFormalLinkage();
A call to an overloaded operator written using operator syntax.
internal::TrueMatcher anything()
Matches any node.
Defines the clang::ASTContext interface.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
The null pointer literal (C++11 [lex.nullptr])
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc > > LLVM_ATTRIBUTE_UNUSED hasParent
Matches AST nodes that have a parent that matches the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const internal::ArgumentAdaptingMatcherFunc< internal::HasAncestorMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc > > LLVM_ATTRIBUTE_UNUSED hasAncestor
Matches AST nodes that have an ancestor that matches the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, BreakStmt > breakStmt
Matches break statements.
Smart pointer class that efficiently represents Objective-C method names.
const internal::VariadicDynCastAllOfMatcher< Stmt, DoStmt > doStmt
Matches do statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, AddrLabelExpr > addrLabelExpr
Matches address of label statements (GNU extension).
PointerType - C99 6.7.5.1 - Pointer Declarators.
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryConditionalOperator > binaryConditionalOperator
Matches binary conditional operator expressions (GNU extension).
A (possibly-)qualified type.
const internal::VariadicDynCastAllOfMatcher< Stmt, StmtExpr > stmtExpr
Matches statement expression (GNU extension).
AST_MATCHER_P(FieldDecl, hasBitWidth, unsigned, Width)
Matches non-static data members that are bit-fields of the specified bit width.
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > LLVM_ATTRIBUTE_UNUSED hasDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher. ...
static Decl * castFromDeclContext(const DeclContext *)
const internal::VariadicAllOfMatcher< TemplateName > templateName
Matches template name.
Stmt - This represents one statement.
FunctionType - C99 6.7.5.3 - Function Declarators.
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
IfStmt - This represents an if/then/else.
const internal::VariadicDynCastAllOfMatcher< Stmt, OpaqueValueExpr > opaqueValueExpr
Matches opaque value expressions.
internal::PolymorphicMatcherWithParam1< internal::HasDeclarationMatcher, internal::Matcher< Decl >, void(internal::HasDeclarationSupportedTypes)> hasDeclaration(const internal::Matcher< Decl > &InnerMatcher)
Matches a node if the declaration associated with that node matches the given matcher.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > cxxMethodDecl
Matches method declarations.
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
The template argument is an expression, and we've not resolved it to one of the other forms yet...
const internal::VariadicDynCastAllOfMatcher< Decl, LinkageSpecDecl > linkageSpecDecl
Matches a declaration of a linkage specification.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNullPtrLiteralExpr > cxxNullPtrLiteralExpr
Matches nullptr literal.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDynamicCastExpr > cxxDynamicCastExpr
Matches a dynamic_cast expression.
Decl - This represents one declaration (or definition), e.g.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++14 decltype(auto) type.
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachMatcher > LLVM_ATTRIBUTE_UNUSED forEach
Matches AST nodes that have child AST nodes that match the provided matcher.
ParenExpr - This represents a parethesized expression, e.g.
const internal::VariadicDynCastAllOfMatcher< Stmt, LabelStmt > labelStmt
Matches label statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThisExpr > cxxThisExpr
Matches implicit and explicit this expressions.
internal::Matcher< Decl > DeclarationMatcher
Types of matchers for the top-level classes in the AST class hierarchy.
The base class of the type hierarchy.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
NamespaceDecl - Represent a C++ namespace.
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
float __ovld __cnfn distance(float p0, float p1)
Returns the distance between p0 and p1.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDecl > usingDecl
Matches using declarations.
internal::Matcher< CXXCtorInitializer > CXXCtorInitializerMatcher
const internal::VariadicDynCastAllOfMatcher< Decl, ValueDecl > valueDecl
Matches any value declaration.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateDecl > classTemplateDecl
Matches C++ class template declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, EnumConstantDecl > enumConstantDecl
Matches enum constants.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
const DynTypedMatcher *const Matcher
CompoundLiteralExpr - [C99 6.5.2.5].
AST_MATCHER(Decl, isPublic)
Matches public C++ declarations.
internal::PolymorphicMatcherWithParam1< internal::ValueEqualsMatcher, ValueT > equals(const ValueT &Value)
Matches literals that are equal to the given value of type ValueT.
ObjCMethodDecl - Represents an instance or class method declaration.
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasDecl > typeAliasDecl
Matches type alias declarations.
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Represents the result of substituting a type for a template type parameter.
const internal::VariadicDynCastAllOfMatcher< Stmt, AsmStmt > asmStmt
Matches asm statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, DesignatedInitExpr > designatedInitExpr
Matches C99 designated initializer expressions [C99 6.7.8].
AST_POLYMORPHIC_MATCHER_P2(hasTemplateArgument, AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, TemplateSpecializationType, FunctionDecl), unsigned, N, internal::Matcher< TemplateArgument >, InnerMatcher)
Matches classTemplateSpecializations, templateSpecializationType and functionDecl where the n'th Temp...
A C++ static_cast expression (C++ [expr.static.cast]).
Base wrapper for a particular "section" of type source info.
RecordDecl - Represents a struct/union/class.
Represents a C99 designated initializer expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, ConditionalOperator > conditionalOperator
Matches conditional operator expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryExprOrTypeTraitExpr > unaryExprOrTypeTraitExpr
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasTemplateDecl > typeAliasTemplateDecl
Matches type alias template declarations.
Represents a class template specialization, which refers to a class template with a given set of temp...
const internal::VariadicAllOfMatcher< QualType > qualType
Matches QualTypes in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, CaseStmt > caseStmt
Matches case statements inside switch statements.
A C++ nested-name-specifier augmented with source location information.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCMessageExpr > objcMessageExpr
Matches ObjectiveC Message invocation expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDestructorDecl > cxxDestructorDecl
Matches explicit C++ destructor declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, WhileStmt > whileStmt
Matches while statements.
Represents an access specifier followed by colon ':'.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTryStmt > cxxTryStmt
Matches try statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundLiteralExpr > compoundLiteralExpr
Matches compound (i.e.
Describes an C or C++ initializer list.
Represents a C++ using-declaration.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXReinterpretCastExpr > cxxReinterpretCastExpr
Matches a reinterpret_cast expression.
An rvalue reference type, per C++11 [dcl.ref].
const internal::VariadicDynCastAllOfMatcher< Stmt, NullStmt > nullStmt
Matches null statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNewExpr > cxxNewExpr
Matches new expressions.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
const internal::VariadicDynCastAllOfMatcher< Decl, NamedDecl > namedDecl
Matches a declaration of anything that could have a name.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > typedefDecl
Matches typedef declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > cxxMemberCallExpr
Matches member call expressions.
const internal::VariadicOperatorMatcherFunc< 2, UINT_MAX > eachOf
Matches if any of the given matchers matches.
AST_MATCHER_FUNCTION(internal::Matcher< Decl >, isInstantiated)
Matches declarations that are template instantiations or are inside template instantiations.
const internal::VariadicDynCastAllOfMatcher< Stmt, DefaultStmt > defaultStmt
Matches default statements inside switch statements.
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, CompoundStmt > compoundStmt
Matches compound statements.
TypeDecl - Represents a declaration of a type.
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > parmVarDecl
Matches parameter variable declarations.
A builtin binary operation expression such as "x + y" or "x <= y".
const IntrusiveRefCntPtr< DynMatcherInterface > InnerMatcher
const internal::VariadicDynCastAllOfMatcher< Stmt, ReturnStmt > returnStmt
Matches return statements.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
const internal::VariadicDynCastAllOfMatcher< Decl, TranslationUnitDecl > translationUnitDecl
Matches the top declaration context.
const internal::VariadicDynCastAllOfMatcher< Decl, FriendDecl > friendDecl
Matches friend declarations.
StringRef getName() const
internal::Matcher< Stmt > sizeOfExpr(const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher)
Same as unaryExprOrTypeTraitExpr, but only matching sizeof.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
const internal::VariadicDynCastAllOfMatcher< Decl, StaticAssertDecl > staticAssertDecl
Matches a C++ static_assert declaration.
Represents an Objective-C protocol declaration.
Represents binding an expression to a temporary.
const internal::VariadicDynCastAllOfMatcher< Decl, LabelDecl > labelDecl
Matches a declaration of label.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclStmt > declStmt
Matches declaration statements.
internal::PolymorphicMatcherWithParam1< internal::HasOverloadedOperatorNameMatcher, StringRef, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl)> hasOverloadedOperatorName(StringRef Name)
Matches overloaded operator names.
Represents an ObjC class declaration.
internal::Matcher< T > findAll(const internal::Matcher< T > &Matcher)
Matches if the node or any descendant matches.
internal::Matcher< Stmt > StatementMatcher
detail::InMemoryDirectory::const_iterator I
A default argument (C++ [dcl.fct.default]).
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > unaryOperator
Matches unary operator expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStdInitializerListExpr > cxxStdInitializerListExpr
Matches C++ initializer list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, MemberExpr > memberExpr
Matches member expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > initListExpr
Matches init list expressions.
ConditionalOperator - The ?: ternary operator.
const internal::VariadicOperatorMatcherFunc< 2, UINT_MAX > allOf
Matches if all given matchers match.
CompoundStmt - This represents a group of statements like { stmt stmt }.
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
Represents a prototype with parameter type info, e.g.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFunctionalCastExpr > cxxFunctionalCastExpr
Matches functional cast expressions.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
Represents a ValueDecl that came out of a declarator.
CastKind
CastKind - The kind of operation required for a conversion.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
const internal::VariadicDynCastAllOfMatcher< Stmt, ArraySubscriptExpr > arraySubscriptExpr
Matches array subscript expressions.
std::vector< bool > & Stack
internal::Matcher< NestedNameSpecifierLoc > NestedNameSpecifierLocMatcher
const internal::VariadicDynCastAllOfMatcher< Stmt, LambdaExpr > lambdaExpr
Matches lambda expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryOperator > binaryOperator
Matches binary operator expressions.
Represents an array type in C++ whose size is a value-dependent expression.
const internal::VariadicAllOfMatcher< NestedNameSpecifier > nestedNameSpecifier
Matches nested name specifiers.
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachDescendantMatcher > LLVM_ATTRIBUTE_UNUSED forEachDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher. ...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, IntegerLiteral > integerLiteral
Matches integer literals of all sizes / encodings, e.g.
const internal::VariadicDynCastAllOfMatcher< Stmt, ForStmt > forStmt
Matches for statements.
Declaration of a template type parameter.
const internal::VariadicOperatorMatcherFunc< 1, 1 > unless
Matches if the provided matcher does not match.
Represents a C++ functional cast expression that builds a temporary object.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a C++ destructor within a class.
Matcher< NamedDecl > hasAnyNameFunc(ArrayRef< const StringRef * > NameRefs)
const internal::VariadicAllOfMatcher< NestedNameSpecifierLoc > nestedNameSpecifierLoc
Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
const internal::VariadicDynCastAllOfMatcher< Stmt, GotoStmt > gotoStmt
Matches goto statements.
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
internal::Matcher< T > id(StringRef ID, const internal::BindableMatcher< T > &InnerMatcher)
If the provided matcher matches a node, binds the node to ID.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
static SVal getValue(SVal val, SValBuilder &svalBuilder)
internal::BoundNodesMap::IDToNodeMap IDToNodeMap
Type of mapping from binding identifiers to bound nodes.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTemporaryObjectExpr > cxxTemporaryObjectExpr
Matches functional cast expressions having N != 1 arguments.
const internal::VariadicDynCastAllOfMatcher< Stmt, PredefinedExpr > predefinedExpr
Matches predefined identifier expressions [C99 6.4.2.2].
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
const internal::VariadicDynCastAllOfMatcher< Stmt, MaterializeTemporaryExpr > materializeTemporaryExpr
Matches nodes where temporaries are materialized.
An expression that sends a message to the given Objective-C object or class.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
AST_TYPE_TRAVERSE_MATCHER(hasDeducedType, getDeducedType, AST_POLYMORPHIC_SUPPORTED_TYPES(AutoType))
Matches AutoType nodes where the deduced type is a specific type.
An lvalue reference type, per C++11 [dcl.ref].
Represents a reference to a non-type template parameter that has been substituted with a template arg...
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXForRangeStmt > cxxForRangeStmt
Matches range-based for statements.
const internal::VariadicFunction< internal::Matcher< NamedDecl >, StringRef, internal::hasAnyNameFunc > hasAnyName
Matches NamedDecl nodes that have any of the specified names.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStaticCastExpr > cxxStaticCastExpr
Matches a C++ static_cast expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, AtomicExpr > atomicExpr
Matches atomic builtins.
Represents a C++ conversion function within a class.
This template specialization was implicitly instantiated from a template.
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCProtocolDecl > objcProtocolDecl
Matches Objective-C protocol declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDeleteExpr > cxxDeleteExpr
Matches delete expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchCase > switchCase
Matches case and default statements inside switch statements.
AST_POLYMORPHIC_MATCHER_P_OVERLOAD(hasType, AST_POLYMORPHIC_SUPPORTED_TYPES(Expr, TypedefNameDecl, ValueDecl), internal::Matcher< QualType >, InnerMatcher, 0)
Matches if the expression's or declaration's type matches a type matcher.
DoStmt - This represents a 'do/while' stmt.
AST_MATCHER_P2(DeclStmt, containsDeclaration, unsigned, N, internal::Matcher< Decl >, InnerMatcher)
Matches the n'th declaration of a declaration statement.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCInterfaceDecl > objcInterfaceDecl
Matches Objective-C interface declarations.
const internal::VariadicAllOfMatcher< TypeLoc > typeLoc
Matches TypeLocs in the clang AST.
bool isInMainFile(SourceLocation Loc) const
Returns whether the PresumedLoc for a given SourceLocation is in the main file.
Maps string IDs to AST nodes matched by parts of a matcher.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
ASTMatchFinder *const Finder
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBindTemporaryExpr > cxxBindTemporaryExpr
Matches nodes where temporaries are created.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
friend class internal::BoundNodesTreeBuilder
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingValueDecl > unresolvedUsingValueDecl
Matches unresolved using value declarations.
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
AST_MATCHER_FUNCTION_P_OVERLOAD(internal::BindableMatcher< TypeLoc >, loc, internal::Matcher< QualType >, InnerMatcher, 0)
Matches TypeLocs for which the given inner QualType-matcher matches.
const internal::VariadicDynCastAllOfMatcher< Stmt, CharacterLiteral > characterLiteral
Matches character literals (also matches wchar_t).
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > declRefExpr
Matches expressions that refer to declarations.
const internal::VariadicAllOfMatcher< CXXCtorInitializer > cxxCtorInitializer
Matches constructor initializers.
Sugar for parentheses used when specifying types.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThrowExpr > cxxThrowExpr
Matches throw expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitCastExpr > implicitCastExpr
Matches the implicit cast nodes of Clang's AST.
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > LLVM_ATTRIBUTE_UNUSED has
Matches AST nodes that have child AST nodes that match the provided matcher.
TagDecl - Represents the declaration of a struct/union/class/enum.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > cxxOperatorCallExpr
Matches overloaded operator calls.
Represents a call to a member function that may be written either with member call syntax (e...
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
static QualType getUnderlyingType(const SubRegion *R)
Represents a dependent using declaration which was not marked with typename.
Cached information about one file (either on disk or in the virtual file system). ...
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateSpecializationDecl > classTemplateSpecializationDecl
Matches C++ class template specializations.
AST_POLYMORPHIC_MATCHER_P(isExpansionInFileMatching, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc), std::string, RegExp)
Matches AST nodes that were expanded within files whose name is partially matching a given regex...
Represents a static or instance method of a struct/union/class.
internal::Matcher< Stmt > alignOfExpr(const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher)
Same as unaryExprOrTypeTraitExpr, but only matching alignof.
static bool hasAttr(const FunctionDecl *D, bool IgnoreImplicitAttr)
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionDecl > functionDecl
Matches function declarations.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool isNothrow(const ASTContext &Ctx, bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
ObjCCategoryDecl - Represents a category declaration.
internal::Matcher< TypeLoc > TypeLocMatcher
const IDToNodeMap & getMap() const
Retrieve mapping from binding identifiers to bound nodes.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConstructorDecl > cxxConstructorDecl
Matches C++ constructor declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, AccessSpecDecl > accessSpecDecl
Matches C++ access specifier declarations.
std::string getAsString() const
Derive the full selector name (e.g.
Represents one property declaration in an Objective-C interface.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
#define AST_POLYMORPHIC_SUPPORTED_TYPES(...)
Construct a type-list to be passed to the AST_POLYMORPHIC_MATCHER* macros.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCPropertyDecl > objcPropertyDecl
Matches Objective-C property declarations.
This template specialization was instantiated from a template due to an explicit instantiation defini...
Represents a C++11 static_assert declaration.
const internal::VariadicDynCastAllOfMatcher< Stmt, ExplicitCastExpr > explicitCastExpr
Matches explicit cast expressions.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
static DynTypedNode create(const T &Node)
Creates a DynTypedNode from Node.
const internal::VariadicDynCastAllOfMatcher< Stmt, SubstNonTypeTemplateParmExpr > substNonTypeTemplateParmExpr
Matches substitutions of non-type template parameters.
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
Represents a pointer type decayed from an array or function type.
The injected class name of a C++ class template or class template partial specialization.
const internal::VariadicDynCastAllOfMatcher< Stmt, StringLiteral > stringLiteral
Matches string literals (also matches wide string literals).
AST_TYPELOC_TRAVERSE_MATCHER(hasElementType, getElement, AST_POLYMORPHIC_SUPPORTED_TYPES(ArrayType, ComplexType))
Matches arrays and C99 complex types that have a specific element type.
attr::Kind getKind() const
Base class for declarations which introduce a typedef-name.
ast_type_traits::DynTypedNode Node
Represents a template argument.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDefaultArgExpr > cxxDefaultArgExpr
Matches the value of a default argument at the call site.
internal::Matcher< NestedNameSpecifier > NestedNameSpecifierMatcher
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstCastExpr > cxxConstCastExpr
Matches a const_cast expression.
const T * getNodeAs(StringRef ID) const
Returns the AST node bound to ID.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionTemplateDecl > functionTemplateDecl
Matches C++ function template declarations.
[C99 6.4.2.2] - A predefined identifier such as func.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
const internal::VariadicDynCastAllOfMatcher< Decl, EnumDecl > enumDecl
Matches enum declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenExpr > parenExpr
Matches parentheses used in expressions.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTypeParmDecl > templateTypeParmDecl
Matches template type parameter declarations.
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Represents a dependent using declaration which was marked with typename.
A pointer to member type per C++ 8.3.3 - Pointers to members.
ExplicitCastExpr - An explicit cast written in the source code.
body_iterator body_begin()
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > cudaKernelCallExpr
Matches CUDA kernel call expression.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCIvarDecl > objcIvarDecl
Matches Objective-C instance variable declarations.
Represents a pointer to an Objective C object.
SwitchStmt - This represents a 'switch' stmt.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXUnresolvedConstructExpr > cxxUnresolvedConstructExpr
Matches unresolved constructor call expressions.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDirectiveDecl > usingDirectiveDecl
Matches using namespace declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CStyleCastExpr > cStyleCastExpr
Matches a C-style cast expression.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingTypenameDecl > unresolvedUsingTypenameDecl
Matches unresolved using value declarations that involve the typename.
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
Represents a C++ base or member initializer.
This template specialization was declared or defined by an explicit specialization (C++ [temp...
AST_MATCHER_P_OVERLOAD(CXXRecordDecl, isDerivedFrom, std::string, BaseName, 1)
Overloaded method as shortcut for isDerivedFrom(hasName(...)).
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstructExpr > cxxConstructExpr
Matches constructor call expressions (including implicit ones).
Represents a call to a CUDA kernel function.
const internal::VariadicDynCastAllOfMatcher< Stmt, FloatingLiteral > floatLiteral
Matches float literals of all sizes / encodings, e.g.
DeclGroupRef::const_iterator const_decl_iterator
const internal::VariadicDynCastAllOfMatcher< Stmt, IfStmt > ifStmt
Matches if statements.
Base for LValueReferenceType and RValueReferenceType.
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
The template argument is a type.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryDecl > objcCategoryDecl
Matches Objective-C category declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXCatchStmt > cxxCatchStmt
Matches catch statements.
AST_POLYMORPHIC_MATCHER(isExpansionInMainFile, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc))
Matches AST nodes that were expanded within the main-file.
internal::Matcher< QualType > TypeMatcher
internal::Matcher< BinaryOperator > hasEitherOperand(const internal::Matcher< Expr > &InnerMatcher)
Matches if either the left hand side or the right hand side of a binary operator matches.
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
const internal::VariadicOperatorMatcherFunc< 2, UINT_MAX > anyOf
Matches if any of the given matchers matches.
const internal::VariadicDynCastAllOfMatcher< Stmt, ContinueStmt > continueStmt
Matches continue statements.
const internal::VariadicAllOfMatcher< TemplateArgument > templateArgument
Matches template arguments.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
const internal::VariadicDynCastAllOfMatcher< Decl, NonTypeTemplateParmDecl > nonTypeTemplateParmDecl
Matches non-type template parameter declarations.
Represents a C++ struct/union/class.
BoundNodesTreeBuilder *const Builder
The template argument is a template name that was provided for a template template parameter...
Represents a C array with an unspecified size.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
CXXCatchStmt - This represents a C++ catch block.
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
ObjCIvarDecl - Represents an ObjC instance variable.
WhileStmt - This represents a 'while' stmt.
internal::Matcher< NamedDecl > hasName(const std::string &Name)
Matches NamedDecl nodes that have the specified name.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCMethodDecl > objcMethodDecl
Matches Objective-C method declarations.
Declaration of a class template.
This class is used for builtin types like 'int'.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefNameDecl > typedefNameDecl
Matches typedef name declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenListExpr > parenListExpr
Matches paren list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitValueInitExpr > implicitValueInitExpr
Matches implicit initializers of init list expressions.
StringLiteral - This represents a string literal expression, e.g.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConversionDecl > cxxConversionDecl
Matches conversion operator declarations.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceDecl > namespaceDecl
Matches a declaration of a namespace.
const internal::VariadicDynCastAllOfMatcher< Stmt, UserDefinedLiteral > userDefinedLiteral
Matches user defined literal operator call.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchStmt > switchStmt
Matches switch statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBoolLiteralExpr > cxxBoolLiteral
Matches bool literals.
const internal::VariadicDynCastAllOfMatcher< Decl, FieldDecl > fieldDecl
Matches field declarations.
A reference to a declared variable, function, enum, etc.
Represents a type template specialization; the template must be a class template, a type alias templa...
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< Decl, NamespaceAliasDecl > namespaceAliasDecl
Matches a declaration of a namespace alias.
bool matches(const til::SExpr *E1, const til::SExpr *E2)
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > cxxRecordDecl
Matches C++ class declarations.
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
NamedDecl - This represents a decl with a name.
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a C array with a specified size that is not an integer-constant-expression.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
Automatic storage duration (most local variables).
Represents C++ using-directive.
const internal::VariadicDynCastAllOfMatcher< Decl, DeclaratorDecl > declaratorDecl
Matches declarator declarations (field, variable, function and non-type template parameter declaratio...
Represents the canonical version of C arrays with a specified constant size.
This class handles loading and caching of source files into memory.
Declaration of a template function.
Attr - This represents one attribute.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
AST_TYPE_MATCHER(BuiltinType, builtinType)
Matches builtin Types.
static bool isExternC(const NamedDecl *ND)
const internal::VariadicDynCastAllOfMatcher< Stmt, GNUNullExpr > gnuNullExpr
Matches GNU __null expression.