45 #ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H
46 #define LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H
54 #include "llvm/ADT/Twine.h"
55 #include "llvm/Support/Regex.h"
59 namespace ast_matchers {
76 return MyBoundNodes.getNodeAs<T>(
ID);
83 return getNodeAs<T>(
ID);
87 return getNodeAs<T>(
ID);
98 return MyBoundNodes.getMap();
103 BoundNodes(internal::BoundNodesMap &MyBoundNodes)
104 : MyBoundNodes(MyBoundNodes) {}
106 internal::BoundNodesMap MyBoundNodes;
114 template <
typename T>
115 internal::Matcher<T>
id(StringRef
ID,
117 return InnerMatcher.bind(ID);
145 inline internal::TrueMatcher
anything() {
return internal::TrueMatcher(); }
158 const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
170 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl>
typedefDecl;
181 const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
193 const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl>
typeAliasDecl;
234 if (ExpansionLoc.isInvalid()) {
257 std::string, RegExp) {
260 if (ExpansionLoc.isInvalid()) {
270 llvm::Regex RE(RegExp);
283 const internal::VariadicAllOfMatcher<Decl>
decl;
293 const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
307 const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl>
namedDecl;
318 const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl>
labelDecl;
329 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl>
namespaceDecl;
340 const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
352 const internal::VariadicDynCastAllOfMatcher<
363 const internal::VariadicDynCastAllOfMatcher<
373 const internal::VariadicDynCastAllOfMatcher<
387 const internal::VariadicDynCastAllOfMatcher<
400 const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
411 const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl>
parmVarDecl;
424 const internal::VariadicDynCastAllOfMatcher<
458 const internal::VariadicDynCastAllOfMatcher<
470 const internal::VariadicDynCastAllOfMatcher<
534 return Node.isBitField();
550 return Node.isBitField() &&
551 Node.getBitWidthValue(
Finder->getASTContext()) == Width;
557 return Node.isImplicit();
573 hasAnyTemplateArgument,
578 internal::getTemplateSpecializationArgs(
Node);
718 unsigned, N, internal::Matcher<TemplateArgument>,
InnerMatcher) {
720 internal::getTemplateSpecializationArgs(
Node);
721 if (List.size() <= N)
736 templateArgumentCountIs,
740 return internal::getTemplateSpecializationArgs(
Node).size() == N;
846 std::string,
Value) {
849 return Node.getAsIntegral().toString(10) ==
Value;
859 const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl>
valueDecl;
872 const internal::VariadicDynCastAllOfMatcher<
885 const internal::VariadicDynCastAllOfMatcher<
897 const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl>
enumDecl;
907 const internal::VariadicDynCastAllOfMatcher<
917 const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl>
cxxMethodDecl;
925 const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
937 const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl>
varDecl;
947 const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl>
fieldDecl;
955 const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl>
functionDecl;
963 const internal::VariadicDynCastAllOfMatcher<
975 const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl>
friendDecl;
985 const internal::VariadicAllOfMatcher<Stmt>
stmt;
995 const internal::VariadicDynCastAllOfMatcher<
1010 const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr>
memberExpr;
1020 const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr>
callExpr;
1028 const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr>
lambdaExpr;
1037 const internal::VariadicDynCastAllOfMatcher<
1050 const internal::VariadicDynCastAllOfMatcher<
1061 const internal::VariadicDynCastAllOfMatcher<
1072 const internal::VariadicDynCastAllOfMatcher<
1086 const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr>
initListExpr;
1092 const Expr *SyntForm =
Node.getSyntacticForm();
1093 return (SyntForm !=
nullptr &&
1105 const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
1135 const internal::VariadicDynCastAllOfMatcher<
1148 const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl>
usingDecl;
1159 const internal::VariadicDynCastAllOfMatcher<
1177 const internal::VariadicDynCastAllOfMatcher<
1192 const internal::VariadicDynCastAllOfMatcher<
1211 const internal::VariadicDynCastAllOfMatcher<
1222 const internal::VariadicDynCastAllOfMatcher<
1236 const internal::VariadicDynCastAllOfMatcher<
1248 const internal::VariadicDynCastAllOfMatcher<
1262 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr>
cxxThisExpr;
1272 const internal::VariadicDynCastAllOfMatcher<
1294 const internal::VariadicDynCastAllOfMatcher<
1306 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr>
cxxNewExpr;
1326 const internal::VariadicDynCastAllOfMatcher<
1339 const internal::VariadicDynCastAllOfMatcher<
1357 const internal::VariadicDynCastAllOfMatcher<
1367 const internal::VariadicDynCastAllOfMatcher<Stmt, Expr>
expr;
1376 const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
declRefExpr;
1384 const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt>
ifStmt;
1393 const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt>
forStmt;
1405 const Stmt *
const Increment =
Node.getInc();
1406 return (Increment !=
nullptr &&
1420 const Stmt *
const Init =
Node.getInit();
1431 const internal::VariadicDynCastAllOfMatcher<
1445 const VarDecl *
const Var =
Node.getLoopVariable();
1459 const Expr *
const Init =
Node.getRangeInit();
1471 const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt>
whileStmt;
1481 const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt>
doStmt;
1491 const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt>
breakStmt;
1501 const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt>
continueStmt;
1511 const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt>
returnStmt;
1522 const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt>
gotoStmt;
1533 const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt>
labelStmt;
1555 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt>
switchStmt;
1565 const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase>
switchCase;
1575 const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt>
caseStmt;
1585 const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt>
defaultStmt;
1593 const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt>
compoundStmt;
1602 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt>
cxxCatchStmt;
1611 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt>
cxxTryStmt;
1620 const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr>
cxxThrowExpr;
1629 const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt>
nullStmt;
1639 const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt>
asmStmt;
1647 const internal::VariadicDynCastAllOfMatcher<
1658 const internal::VariadicDynCastAllOfMatcher<
1672 const internal::VariadicDynCastAllOfMatcher<
1680 const internal::VariadicDynCastAllOfMatcher<
1691 const internal::VariadicDynCastAllOfMatcher<
1698 const internal::VariadicDynCastAllOfMatcher<
1709 const internal::VariadicDynCastAllOfMatcher<
1714 const internal::VariadicDynCastAllOfMatcher<
1719 const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr>
gnuNullExpr;
1726 const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr>
atomicExpr;
1734 const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr>
stmtExpr;
1742 const internal::VariadicDynCastAllOfMatcher<
1752 const internal::VariadicDynCastAllOfMatcher<
1762 const internal::VariadicDynCastAllOfMatcher<
1772 const internal::VariadicDynCastAllOfMatcher<
1784 const internal::VariadicDynCastAllOfMatcher<
1801 const internal::VariadicDynCastAllOfMatcher<
1815 const internal::VariadicDynCastAllOfMatcher<
1832 const internal::VariadicDynCastAllOfMatcher<
1848 const internal::VariadicDynCastAllOfMatcher<
1860 const internal::VariadicDynCastAllOfMatcher<
1870 const internal::VariadicDynCastAllOfMatcher<
1895 const internal::VariadicDynCastAllOfMatcher<
1903 const internal::VariadicDynCastAllOfMatcher<
1920 const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr>
castExpr;
1930 const internal::VariadicDynCastAllOfMatcher<
1940 const internal::VariadicDynCastAllOfMatcher<
1950 const internal::VariadicDynCastAllOfMatcher<
1960 const internal::VariadicDynCastAllOfMatcher<
1976 return Node.size() == N;
1980 const internal::VariadicAllOfMatcher<QualType>
qualType;
1983 const internal::VariadicAllOfMatcher<Type>
type;
1986 const internal::VariadicAllOfMatcher<TypeLoc>
typeLoc;
2007 const internal::VariadicOperatorMatcherFunc<2, UINT_MAX>
eachOf = {
2008 internal::DynTypedMatcher::VO_EachOf
2014 const internal::VariadicOperatorMatcherFunc<2, UINT_MAX>
anyOf = {
2015 internal::DynTypedMatcher::VO_AnyOf
2021 const internal::VariadicOperatorMatcherFunc<2, UINT_MAX>
allOf = {
2022 internal::DynTypedMatcher::VO_AllOf
2034 const internal::VariadicDynCastAllOfMatcher<
2048 const QualType ArgumentType =
Node.getTypeOfArgument();
2068 const internal::Matcher<UnaryExprOrTypeTraitExpr> &
InnerMatcher) {
2076 const internal::Matcher<UnaryExprOrTypeTraitExpr> &
InnerMatcher) {
2096 inline internal::Matcher<NamedDecl>
hasName(
const std::string &
Name) {
2097 std::vector<std::string>
Names;
2098 Names.push_back(Name);
2099 return internal::Matcher<NamedDecl>(
new internal::HasNameMatcher(Names));
2112 const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
2133 assert(!RegExp.empty());
2134 std::string FullNameString =
"::" +
Node.getQualifiedNameAsString();
2135 llvm::Regex RE(RegExp);
2136 return RE.match(FullNameString);
2158 inline internal::PolymorphicMatcherWithParam1<
2159 internal::HasOverloadedOperatorNameMatcher, StringRef,
2162 return internal::PolymorphicMatcherWithParam1<
2163 internal::HasOverloadedOperatorNameMatcher, StringRef,
2189 internal::Matcher<NamedDecl>,
Base) {
2195 assert(!BaseName.empty());
2202 internal::Matcher<NamedDecl>,
Base, 0) {
2203 return Matcher<CXXRecordDecl>(
anyOf(
Base, isDerivedFrom(
Base)))
2211 assert(!BaseName.empty());
2242 return Node.isLambda();
2263 const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher>
2264 LLVM_ATTRIBUTE_UNUSED
has = {};
2280 const internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher>
2300 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher>
2329 const internal::ArgumentAdaptingMatcherFunc<internal::ForEachDescendantMatcher>
2348 template <
typename T>
2363 const internal::ArgumentAdaptingMatcherFunc<
2364 internal::HasParentMatcher,
2365 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
2366 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
2380 const internal::ArgumentAdaptingMatcherFunc<
2381 internal::HasAncestorMatcher,
2382 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>,
2383 internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc>>
2395 const internal::VariadicOperatorMatcherFunc<1, 1>
unless = {
2396 internal::DynTypedMatcher::VO_UnaryNot
2417 inline internal::PolymorphicMatcherWithParam1<
2418 internal::HasDeclarationMatcher, internal::Matcher<Decl>,
2419 void(internal::HasDeclarationSupportedTypes)>
2421 return internal::PolymorphicMatcherWithParam1<
2422 internal::HasDeclarationMatcher, internal::Matcher<Decl>,
2423 void(internal::HasDeclarationSupportedTypes)>(
InnerMatcher);
2438 const Expr *ExprNode =
Node.getImplicitObjectArgument()
2439 ->IgnoreParenImpCasts();
2440 return (ExprNode !=
nullptr &&
2484 assert(!RegExp.empty());
2485 std::string SelectorString =
Node.getSelector().getAsString();
2486 llvm::Regex RE(RegExp);
2487 return RE.match(SelectorString);
2495 return Node.getSelector().isNull();
2507 return Node.getSelector().isUnarySelector();
2523 return Node.getSelector().isKeywordSelector();
2538 return Node.getSelector().getNumArgs() == N;
2559 const Expr *ExprNode =
Node.getCallee();
2560 return (ExprNode !=
nullptr &&
2631 if (!
Node.getTypeSourceInfo())
2661 QualType, pointsTo, internal::Matcher<QualType>,
2663 return (!
Node.isNull() &&
Node->isAnyPointerType() &&
2689 return (!
Node.isNull() &&
Node->isReferenceType() &&
2721 const Expr *ExprNode =
Node.getImplicitObjectArgument();
2722 return (ExprNode !=
nullptr &&
2730 return onImplicitObjectArgument(
2738 return onImplicitObjectArgument(
2754 const Decl *DeclNode =
Node.getDecl();
2755 return (DeclNode !=
nullptr &&
2791 if (
Node.isSingleDecl()) {
2792 const Decl *FoundDecl =
Node.getSingleDecl();
2807 VarDecl, hasInitializer, internal::Matcher<Expr>,
2809 const Expr *Initializer =
Node.getAnyInitializer();
2810 return (Initializer !=
nullptr &&
2826 return Node.hasLocalStorage();
2840 return Node.hasGlobalStorage();
2903 return Node.isExceptionVariable();
2919 return Node.getNumArgs() == N;
2935 return (N <
Node.getNumArgs() &&
2980 std::advance(Iterator, N);
2998 return Node.getExceptionDecl() ==
nullptr;
3036 return (NodeAsDecl !=
nullptr &&
3055 const Expr* NodeAsExpr =
Node.getInit();
3056 return (NodeAsExpr !=
nullptr &&
3074 return Node.isWritten();
3094 return Node.isBaseInitializer();
3114 return Node.isMemberInitializer();
3132 for (
const Expr *Arg :
Node.arguments()) {
3144 return Node.isListInitialization();
3160 return Node.requiresZeroInitialization();
3174 unsigned, N, internal::Matcher<ParmVarDecl>,
3176 return (N <
Node.getNumParams() &&
3202 internal::Matcher<Expr>, ArgMatcher,
3203 internal::Matcher<ParmVarDecl>, ParamMatcher) {
3204 BoundNodesTreeBuilder
Result;
3208 BoundNodesTreeBuilder
Matches;
3214 bool Matched =
false;
3215 for (; ArgIndex <
Node.getNumArgs(); ++ArgIndex) {
3216 BoundNodesTreeBuilder ArgMatches(*
Builder);
3217 if (ArgMatcher.matches(*(
Node.getArg(ArgIndex)->IgnoreParenCasts()),
3219 BoundNodesTreeBuilder ParamMatches(ArgMatches);
3221 hasParameter(ParamIndex, ParamMatcher)))),
3223 hasParameter(ParamIndex, ParamMatcher))))))
3225 Result.addMatch(ParamMatches);
3274 return Node.getNumParams() == N;
3301 return Node.isExternC();
3314 return Node.isDeleted();
3327 return Node.isDefaulted();
3349 return FnTy->hasDynamicExceptionSpec();
3397 return Node.isConstexpr();
3412 const Expr *
const Condition =
Node.getCond();
3413 return (Condition !=
nullptr &&
3425 const Stmt *
const Then =
Node.getThen();
3437 const Stmt *
const Else =
Node.getElse();
3472 internal::NotEqualsBoundNodePredicate Predicate;
3475 return Builder->removeBindings(Predicate);
3488 const DeclStmt*
const DeclarationStatement =
3489 Node.getConditionVariableDeclStmt();
3490 return DeclarationStatement !=
nullptr &&
3505 if (
const Expr* Expression =
Node.getIdx())
3522 if (
const Expr* Expression =
Node.getBase())
3544 const Stmt *
const Statement = internal::GetBodyMatcher<NodeType>::get(
Node);
3545 return (Statement !=
nullptr &&
3580 return Node.size() == N;
3592 template <
typename ValueT>
3593 internal::PolymorphicMatcherWithParam1<internal::ValueEqualsMatcher, ValueT>
3595 return internal::PolymorphicMatcherWithParam1<
3596 internal::ValueEqualsMatcher,
3610 std::string,
Name) {
3624 const Expr *LeftHandSide =
Node.getLHS();
3625 return (LeftHandSide !=
nullptr &&
3639 const Expr *RightHandSide =
Node.getRHS();
3640 return (RightHandSide !=
nullptr &&
3648 return anyOf(hasLHS(InnerMatcher), hasRHS(InnerMatcher));
3660 const Expr *
const Operand =
Node.getSubExpr();
3661 return (Operand !=
nullptr &&
3685 const Expr *
const SubExpression =
3686 internal::GetSourceExpressionMatcher<NodeType>::get(
Node);
3687 return (SubExpression !=
nullptr &&
3730 return Node.isStruct();
3742 return Node.isUnion();
3754 return Node.isClass();
3770 const Expr *Expression =
Node.getTrueExpr();
3771 return (Expression !=
nullptr &&
3785 const Expr *Expression =
Node.getFalseExpr();
3786 return (Expression !=
nullptr &&
3806 return Node.isThisDeclarationADefinition();
3820 return Node.isVariadic();
3843 return (Parent !=
nullptr &&
3873 BoundNodesTreeBuilder
Result;
3874 bool Matched =
false;
3875 for (
const auto *Overridden :
Node.overridden_methods()) {
3876 BoundNodesTreeBuilder OverriddenBuilder(*
Builder);
3877 const bool OverriddenMatched =
3879 if (OverriddenMatched) {
3881 Result.addMatch(OverriddenBuilder);
3899 return Node.isVirtual();
3917 return Node.isVirtualAsWritten();
3938 return Node.template hasAttr<FinalAttr>();
3952 return Node.isPure();
3967 return Node.isConst();
3984 return Node.isCopyAssignmentOperator();
4001 return Node.isMoveAssignmentOperator();
4019 return Node.size_overridden_methods() > 0 ||
Node.hasAttr<OverrideAttr>();
4034 return Node.isUserProvided();
4053 return Node.isArrow();
4067 return Node->isIntegerType();
4081 return Node->isUnsignedIntegerType();
4095 return Node->isSignedIntegerType();
4109 return Node->isAnyCharacterType();
4129 return Node->isAnyPointerType();
4148 return Node.isConstQualified();
4167 return Node.isVolatileQualified();
4184 return Node.hasLocalQualifiers();
4280 Node.getTemplateSpecializationKind() ==
4343 return internal::BindableMatcher<TypeLoc>(
4356 return Node.isBooleanType();
4368 return Node.isVoidType();
4417 return Node.isRealFloatingType();
4470 return internal::HasSizeMatcher<NodeType>::hasSize(
Node, N);
4852 internal::Matcher<NestedNameSpecifier>,
InnerMatcher) {
4948 if (!DC)
return false;
4968 const internal::VariadicAllOfMatcher<
4974 internal::BindableMatcher<NestedNameSpecifierLoc>, loc,
4975 internal::Matcher<NestedNameSpecifier>,
InnerMatcher, 1) {
4976 return internal::BindableMatcher<NestedNameSpecifierLoc>(
4977 new internal::LocMatcher<NestedNameSpecifierLoc, NestedNameSpecifier>(
4995 if (!
Node.getAsType())
5044 internal::Matcher<NestedNameSpecifierLoc>,
InnerMatcher,
5064 if (!
Node.getAsNamespace())
5077 return &
Node == Other;
5083 return &
Node == Other;
5089 return &
Node == Other;
5107 BoundNodesTreeBuilder
Result;
5112 bool Matched =
false;
5114 SC = SC->getNextSwitchCase()) {
5115 BoundNodesTreeBuilder CaseBuilder(*
Builder);
5119 Result.addMatch(CaseBuilder);
5138 BoundNodesTreeBuilder
Result;
5139 bool Matched =
false;
5140 for (
const auto *
I :
Node.inits()) {
5141 BoundNodesTreeBuilder InitBuilder(*
Builder);
5144 Result.addMatch(InitBuilder);
5163 return Node.isCopyConstructor();
5178 return Node.isMoveConstructor();
5193 return Node.isDefaultConstructor();
5210 return Node.isDelegatingConstructor();
5230 return Node.isExplicit();
5251 if (
const auto *FD = dyn_cast<FunctionDecl>(&
Node))
5252 return FD->isInlineSpecified();
5253 else if (
const auto *NSD = dyn_cast<NamespaceDecl>(&
Node))
5254 return NSD->isInline();
5255 llvm_unreachable(
"Not a valid polymorphic type");
5268 return Node.isAnonymousNamespace();
5298 for (
const auto *
Attr :
Node.attrs()) {
5317 if (
const auto *RetValue =
Node.getRetValue())
5329 const internal::VariadicDynCastAllOfMatcher<
5369 const auto &Parents =
Finder->getASTContext().getParents(
Node);
5373 while(!
Stack.empty()) {
5374 const auto &CurNode =
Stack.back();
5376 if(
const auto *FuncDeclNode = CurNode.get<
FunctionDecl>()) {
5380 }
else if(
const auto *LambdaExprNode = CurNode.get<
LambdaExpr>()) {
5381 if(
InnerMatcher.matches(*LambdaExprNode->getCallOperator(),
5386 for(
const auto &Parent:
Finder->getASTContext().getParents(CurNode))
5387 Stack.push_back(Parent);
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...
const T * getStmtAs(StringRef ID) const
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.
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > LLVM_ATTRIBUTE_UNUSED hasDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher. ...
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.
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.
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.
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasDecl > typeAliasDecl
Matches type alias declarations.
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].
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)
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.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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.
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 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, 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.
The result type of a method or function.
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< 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.
bool isNothrow(const ASTContext &Ctx, bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
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 T * getDeclAs(StringRef ID) const
Deprecated.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingValueDecl > unresolvedUsingValueDecl
Matches unresolved using value declarations.
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 char * getName() const
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.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionDecl > functionDecl
Matches function declarations.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
AST_POLYMORPHIC_MATCHER_P2(hasTemplateArgument, AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, TemplateSpecializationType), unsigned, N, internal::Matcher< TemplateArgument >, InnerMatcher)
Matches classTemplateSpecializations where the n'th TemplateArgument matches the given InnerMatcher...
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.
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.
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.
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< 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
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]).
WhileStmt - This represents a 'while' stmt.
internal::Matcher< NamedDecl > hasName(const std::string &Name)
Matches NamedDecl nodes that have the specified name.
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.
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...
TemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon, QualType Aliased)
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.