13#include "llvm/ADT/STLExtras.h"
16using namespace ast_matchers;
26 const auto IgnoreDerivedToBase = [](
const Expr *
E,
auto Matcher) {
29 if (
const auto *Cast = dyn_cast<ImplicitCastExpr>(
E)) {
30 if ((Cast->getCastKind() == CK_DerivedToBase ||
31 Cast->getCastKind() == CK_UncheckedDerivedToBase) &&
32 Matcher(Cast->getSubExpr()))
38 const auto EvalCommaExpr = [](
const Expr *
E,
auto Matcher) {
40 while (
const auto *BOComma =
41 dyn_cast_or_null<BinaryOperator>(
Result->IgnoreParens())) {
42 if (!BOComma->isCommaOp())
44 Result = BOComma->getRHS();
57 const auto ConditionalOperatorM = [
Target](
const Expr *
E) {
58 if (
const auto *OP = dyn_cast<ConditionalOperator>(
E)) {
59 if (
const auto *TE = OP->getTrueExpr()->IgnoreParens())
62 if (
const auto *FE = OP->getFalseExpr()->IgnoreParens())
69 const auto ElvisOperator = [
Target](
const Expr *
E) {
70 if (
const auto *OP = dyn_cast<BinaryConditionalOperator>(
E)) {
71 if (
const auto *TE = OP->getTrueExpr()->IgnoreParens())
74 if (
const auto *FE = OP->getFalseExpr()->IgnoreParens())
82 return IgnoreDerivedToBase(SourceExprP,
84 return E ==
Target || ConditionalOperatorM(
E) ||
87 EvalCommaExpr(SourceExprP, [&](
const Expr *
E) {
88 return IgnoreDerivedToBase(
96 return llvm::is_contained(
Node.capture_inits(),
E);
100 ast_matchers::internal::Matcher<DeclStmt>, InnerMatcher) {
101 const DeclStmt *
const Range =
Node.getRangeStmt();
102 return InnerMatcher.matches(*
Range, Finder, Builder);
106 auto *Exp = dyn_cast<Expr>(&
Node);
109 auto *
Target = dyn_cast<Expr>(Inner);
117AST_MATCHER_P(InitListExpr, hasAnyInit, ast_matchers::internal::Matcher<Expr>,
119 for (
const Expr *Arg :
Node.inits()) {
120 ast_matchers::internal::BoundNodesTreeBuilder
Result(*Builder);
121 if (InnerMatcher.matches(*Arg, Finder, &
Result)) {
122 *Builder = std::move(
Result);
129const ast_matchers::internal::VariadicDynCastAllOfMatcher<Stmt, CXXTypeidExpr>
132AST_MATCHER(CXXTypeidExpr, isPotentiallyEvaluated) {
133 return Node.isPotentiallyEvaluated();
137 const Decl *CalleeDecl =
Node.getCalleeDecl();
138 const auto *VD = dyn_cast_or_null<ValueDecl>(CalleeDecl);
141 const QualType
T = VD->getType().getCanonicalType();
142 const auto *MPT = dyn_cast<MemberPointerType>(
T);
143 const auto *FPT = MPT ? cast<FunctionProtoType>(MPT->getPointeeType())
144 : dyn_cast<FunctionProtoType>(
T);
147 return FPT->isConst();
151 ast_matchers::internal::Matcher<Expr>, InnerMatcher) {
152 if (
Node.isTypePredicate())
154 return InnerMatcher.matches(*
Node.getControllingExpr(), Finder, Builder);
158ast_matchers::internal::Matcher<T>
159findFirst(
const ast_matchers::internal::Matcher<T> &Matcher) {
163const auto nonConstReferenceType = [] {
164 return hasUnqualifiedDesugaredType(
168const auto nonConstPointerType = [] {
169 return hasUnqualifiedDesugaredType(
173const auto isMoveOnly = [] {
183template <
class T>
struct NodeID;
184template <>
struct NodeID<Expr> {
static constexpr StringRef value =
"expr"; };
185template <>
struct NodeID<
Decl> {
static constexpr StringRef value =
"decl"; };
186constexpr StringRef NodeID<Expr>::value;
187constexpr StringRef NodeID<Decl>::value;
190 class F =
const Stmt *(ExprMutationAnalyzer::Analyzer::*)(
const T *)>
191const Stmt *tryEachMatch(ArrayRef<ast_matchers::BoundNodes> Matches,
192 ExprMutationAnalyzer::Analyzer *Analyzer, F Finder) {
193 const StringRef
ID = NodeID<T>::value;
194 for (
const auto &
Nodes : Matches) {
195 if (
const Stmt *S = (Analyzer->*Finder)(
Nodes.getNodeAs<
T>(
ID)))
204 return findMutationMemoized(
206 {&ExprMutationAnalyzer::Analyzer::findDirectMutation,
207 &ExprMutationAnalyzer::Analyzer::findMemberMutation,
208 &ExprMutationAnalyzer::Analyzer::findArrayElementMutation,
209 &ExprMutationAnalyzer::Analyzer::findCastMutation,
210 &ExprMutationAnalyzer::Analyzer::findRangeLoopMutation,
211 &ExprMutationAnalyzer::Analyzer::findReferenceMutation,
212 &ExprMutationAnalyzer::Analyzer::findFunctionArgMutation},
227 return tryEachDeclRef(Dec,
231const Stmt *ExprMutationAnalyzer::Analyzer::findMutationMemoized(
234 const auto Memoized = MemoizedResults.find(Exp);
235 if (
Memoized != MemoizedResults.end())
239 MemoizedResults[Exp] =
nullptr;
243 for (
const auto &Finder : Finders) {
244 if (
const Stmt *S = (this->*Finder)(Exp))
245 return MemoizedResults[Exp] = S;
252ExprMutationAnalyzer::Analyzer::tryEachDeclRef(
const Decl *Dec,
253 MutationFinder Finder) {
254 const auto Refs =
match(
258 anyOf(equalsNode(Dec),
262 .bind(NodeID<Expr>::value)),
264 for (
const auto &RefNodes : Refs) {
265 const auto *
E = RefNodes.getNodeAs<Expr>(NodeID<Expr>::value);
266 if ((this->*Finder)(
E))
275 return selectFirst<Stmt>(
279 stmt(canResolveToExpr(Exp),
295 unless(isPotentiallyEvaluated())),
301 .bind(NodeID<Expr>::value)),
302 Stm, Context)) !=
nullptr;
311 return tryEachMatch<Expr>(Matches,
this,
316ExprMutationAnalyzer::Analyzer::findDeclMutation(ArrayRef<BoundNodes> Matches) {
317 return tryEachMatch<Decl>(Matches,
this,
321const Stmt *ExprMutationAnalyzer::Analyzer::findExprPointeeMutation(
322 ArrayRef<ast_matchers::BoundNodes> Matches) {
323 return tryEachMatch<Expr>(
327const Stmt *ExprMutationAnalyzer::Analyzer::findDeclPointeeMutation(
328 ArrayRef<ast_matchers::BoundNodes> Matches) {
329 return tryEachMatch<Decl>(
334ExprMutationAnalyzer::Analyzer::findDirectMutation(
const Expr *Exp) {
336 const auto AsAssignmentLhs =
337 binaryOperator(isAssignmentOperator(), hasLHS(canResolveToExpr(Exp)));
340 const auto AsIncDecOperand =
342 hasUnaryOperand(canResolveToExpr(Exp)));
351 hasArgument(0, canResolveToExpr(Exp))),
357 hasEitherOperand(ignoringImpCasts(canResolveToExpr(Exp)))),
361 cxxFoldExpr(hasFoldInit(ignoringImpCasts(canResolveToExpr(Exp)))),
368 hasObjectExpression(canResolveToExpr(Exp))))))),
374 hasObjectExpression(canResolveToExpr(Exp))))))));
380 const auto AsAmpersandOperand =
384 hasUnaryOperand(canResolveToExpr(Exp)));
385 const auto AsPointerFromArrayDecay =
castExpr(
386 hasCastKind(CK_ArrayToPointerDecay),
394 cxxMethodDecl(ofClass(isMoveOnly()), returns(nonConstPointerType()))),
395 argumentCountIs(1), hasArgument(0, canResolveToExpr(Exp)));
402 const auto NonConstRefParam = forEachArgumentWithParamType(
403 anyOf(canResolveToExpr(Exp),
404 memberExpr(hasObjectExpression(canResolveToExpr(Exp)))),
405 nonConstReferenceType());
408 const auto AsNonConstRefArg =
414 callExpr(isTypeDependent(), hasAnyArgument(canResolveToExpr(Exp))),
430 const auto AsLambdaRefCaptureInit =
lambdaExpr(hasCaptureInit(Exp));
437 const auto AsNonConstRefReturn =
438 returnStmt(hasReturnValue(canResolveToExpr(Exp)));
442 allOf(canResolveToExpr(Exp), hasType(nonConstReferenceType())))));
444 const auto Matches =
match(
447 findFirst(
stmt(
anyOf(AsAssignmentLhs, AsIncDecOperand, AsNonConstThis,
448 AsAmpersandOperand, AsPointerFromArrayDecay,
449 AsOperatorArrowThis, AsNonConstRefArg,
450 AsLambdaRefCaptureInit, AsNonConstRefReturn,
451 AsNonConstRefRangeInit))
454 return selectFirst<Stmt>(
"stmt", Matches);
458ExprMutationAnalyzer::Analyzer::findMemberMutation(
const Expr *Exp) {
460 const auto MemberExprs =
match(
463 hasObjectExpression(canResolveToExpr(Exp))),
465 hasLHS(equalsNode(Exp)))))
466 .bind(NodeID<Expr>::value)),
468 return findExprMutation(MemberExprs);
472ExprMutationAnalyzer::Analyzer::findArrayElementMutation(
const Expr *Exp) {
474 const auto SubscriptExprs =
match(
476 anyOf(hasBase(canResolveToExpr(Exp)),
478 hasCastKind(CK_ArrayToPointerDecay),
479 hasSourceExpression(canResolveToExpr(Exp)))))))
480 .bind(NodeID<Expr>::value)),
482 return findExprMutation(SubscriptExprs);
485const Stmt *ExprMutationAnalyzer::Analyzer::findCastMutation(
const Expr *Exp) {
488 const auto ExplicitCast =
491 nonConstReferenceType()))))
495 if (
const auto *CastStmt = selectFirst<Stmt>(
"stmt", ExplicitCast))
499 const auto Casts =
match(
502 nonConstReferenceType())),
504 nonConstReferenceType())))))
505 .bind(NodeID<Expr>::value)),
508 if (
const Stmt *S = findExprMutation(Casts))
513 hasAnyName(
"::std::move",
"::std::forward"))),
514 hasArgument(0, canResolveToExpr(Exp)))
517 return findExprMutation(Calls);
521ExprMutationAnalyzer::Analyzer::findRangeLoopMutation(
const Expr *Exp) {
528 const auto DeclStmtToNonRefToArray =
declStmt(hasSingleDecl(
varDecl(hasType(
530 const auto RefToArrayRefToElements =
match(
534 hasType(nonConstPointerType())))
535 .bind(NodeID<Decl>::value)),
536 hasRangeStmt(DeclStmtToNonRefToArray),
537 hasRangeInit(canResolveToExpr(Exp))))
541 if (
const auto *BadRangeInitFromArray =
542 selectFirst<Stmt>(
"stmt", RefToArrayRefToElements))
543 return BadRangeInitFromArray;
552 const auto HasAnyNonConstIterator =
558 const auto DeclStmtToNonConstIteratorContainer =
declStmt(
562 const auto RefToContainerBadIterators =
match(
564 hasRangeStmt(DeclStmtToNonConstIteratorContainer),
565 hasRangeInit(canResolveToExpr(Exp)))))
569 if (
const auto *BadIteratorsContainer =
570 selectFirst<Stmt>(
"stmt", RefToContainerBadIterators))
571 return BadIteratorsContainer;
575 const auto LoopVars =
577 hasLoopVariable(
varDecl(hasType(nonConstReferenceType()))
578 .bind(NodeID<Decl>::value)),
579 hasRangeInit(canResolveToExpr(Exp)))),
581 return findDeclMutation(LoopVars);
585ExprMutationAnalyzer::Analyzer::findReferenceMutation(
const Expr *Exp) {
589 const auto Ref =
match(
593 returns(nonConstReferenceType()))),
594 argumentCountIs(1), hasArgument(0, canResolveToExpr(Exp)))
595 .bind(NodeID<Expr>::value)),
597 if (
const Stmt *S = findExprMutation(Ref))
601 const auto Refs =
match(
603 varDecl(hasType(nonConstReferenceType()),
604 hasInitializer(
anyOf(
605 canResolveToExpr(Exp),
606 memberExpr(hasObjectExpression(canResolveToExpr(Exp))))),
611 hasRangeStmt(equalsBoundNode(
"stmt"))))))))
612 .bind(NodeID<Decl>::value))),
614 return findDeclMutation(Refs);
618ExprMutationAnalyzer::Analyzer::findFunctionArgMutation(
const Expr *Exp) {
619 const auto NonConstRefParam = forEachArgumentWithParam(
620 canResolveToExpr(Exp),
621 parmVarDecl(hasType(nonConstReferenceType())).bind(
"parm"));
624 const auto Matches =
match(
630 "::std::move",
"::std::forward"))))),
633 .bind(NodeID<Expr>::value))),
635 for (
const auto &
Nodes : Matches) {
636 const auto *Exp =
Nodes.getNodeAs<Expr>(NodeID<Expr>::value);
637 const auto *
Func =
Nodes.getNodeAs<FunctionDecl>(
"func");
638 if (!
Func->getBody() || !
Func->getPrimaryTemplate())
641 const auto *Parm =
Nodes.getNodeAs<ParmVarDecl>(
"parm");
642 const ArrayRef<ParmVarDecl *> AllParams =
643 Func->getPrimaryTemplate()->getTemplatedDecl()->parameters();
645 AllParams[std::min<size_t>(Parm->getFunctionScopeIndex(),
646 AllParams.size() - 1)]
648 if (
const auto *
T = ParmType->
getAs<PackExpansionType>())
649 ParmType =
T->getPattern();
653 if (
const auto *RefType = ParmType->getAs<RValueReferenceType>()) {
654 if (!RefType->getPointeeType().getQualifiers() &&
655 RefType->getPointeeType()->getAs<TemplateTypeParmType>()) {
658 *
Func, Context, Memorized);
659 if (Analyzer->findMutation(Parm))
670FunctionParmMutationAnalyzer::FunctionParmMutationAnalyzer(
671 const FunctionDecl &
Func, ASTContext &Context,
672 ExprMutationAnalyzer::Memoized &Memorized)
673 : BodyAnalyzer(*
Func.getBody(), Context, Memorized) {
674 if (
const auto *Ctor = dyn_cast<CXXConstructorDecl>(&
Func)) {
677 for (
const CXXCtorInitializer *
Init : Ctor->inits()) {
678 ExprMutationAnalyzer::Analyzer InitAnalyzer(*
Init->getInit(), Context,
680 for (
const ParmVarDecl *Parm : Ctor->parameters()) {
681 if (Results.contains(Parm))
683 if (
const Stmt *S = InitAnalyzer.findMutation(Parm))
692 const auto Memoized = Results.find(Parm);
693 if (Memoized != Results.end())
694 return Memoized->second;
699 Results[Parm] =
nullptr;
700 if (
const Stmt *S = BodyAnalyzer.findMutation(Parm))
701 return Results[Parm] = S;
702 return Results[Parm];
BoundNodesTreeBuilder Nodes
#define AST_MATCHER(Type, DefineMatcher)
AST_MATCHER(Type, DefineMatcher) { ... } defines a zero parameter function named DefineMatcher() that...
#define AST_MATCHER_P(Type, DefineMatcher, ParamType, Param)
AST_MATCHER_P(Type, DefineMatcher, ParamType, Param) { ... } defines a single-parameter function name...
llvm::MachO::Target Target
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Decl - This represents one declaration (or definition), e.g.
friend class FunctionParmMutationAnalyzer
static bool isUnevaluated(const Stmt *Smt, const Stmt &Stm, ASTContext &Context)
This represents one expression.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
static FunctionParmMutationAnalyzer * getFunctionParmMutationAnalyzer(const FunctionDecl &Func, ASTContext &Context, ExprMutationAnalyzer::Memoized &Memorized)
const Stmt * findMutation(const ParmVarDecl *Parm)
Represents a parameter to a function.
Stmt - This represents one statement.
const T * getAs() const
Member-template getAs<specific type>'.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > declRefExpr
Matches expressions that refer to declarations.
const internal::VariadicOperatorMatcherFunc< 1, 1 > unless
Matches if the provided matcher does not match.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitCastExpr > implicitCastExpr
Matches the implicit cast nodes of Clang's AST.
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > hasDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDependentScopeMemberExpr > cxxDependentScopeMemberExpr
Matches member expressions where the actual member referenced could not be resolved because the base ...
const AstTypeMatcher< PointerType > pointerType
Matches pointer types, but does not match Objective-C object pointer types.
const internal::VariadicDynCastAllOfMatcher< Decl, BindingDecl > bindingDecl
Matches binding declarations Example matches foo and bar (matcher = bindingDecl()
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > parmVarDecl
Matches parameter variable declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, GenericSelectionExpr > genericSelectionExpr
Matches C11 _Generic expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, ReturnStmt > returnStmt
Matches return statements.
internal::Matcher< NamedDecl > hasName(StringRef Name)
Matches NamedDecl nodes that have the specified name.
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, LambdaExpr > lambdaExpr
Matches lambda expressions.
const AstTypeMatcher< VariableArrayType > variableArrayType
Matches C arrays with a specified size that is not an integer-constant-expression.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryExprOrTypeTraitExpr > unaryExprOrTypeTraitExpr
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachDescendantMatcher > forEachDescendant
Matches AST nodes that have descendant AST nodes that match the provided matcher.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
const internal::VariadicDynCastAllOfMatcher< Decl, NamedDecl > namedDecl
Matches a declaration of anything that could have a name.
const internal::VariadicAllOfMatcher< TypeLoc > typeLoc
Matches TypeLocs in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenListExpr > parenListExpr
Matches paren list expressions.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > unaryOperator
Matches unary operator expressions.
const internal::VariadicFunction< internal::Matcher< NamedDecl >, StringRef, internal::hasAnyNameFunc > hasAnyName
Matches NamedDecl nodes that have any of the specified names.
const internal::VariadicDynCastAllOfMatcher< Stmt, ArraySubscriptExpr > arraySubscriptExpr
Matches array subscript expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXForRangeStmt > cxxForRangeStmt
Matches range-based for statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > cxxMemberCallExpr
Matches member call expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConstructorDecl > cxxConstructorDecl
Matches C++ constructor declarations.
internal::BindableMatcher< Stmt > sizeOfExpr(const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher)
Same as unaryExprOrTypeTraitExpr, but only matching sizeof.
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > initListExpr
Matches init list expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNoexceptExpr > cxxNoexceptExpr
Matches noexcept expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryOperator > binaryOperator
Matches binary operator expressions.
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > has
Matches AST nodes that have child AST nodes that match the provided matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, ExplicitCastExpr > explicitCastExpr
Matches explicit cast expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstructExpr > cxxConstructExpr
Matches constructor call expressions (including implicit ones).
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > cxxOperatorCallExpr
Matches overloaded operator calls.
internal::PolymorphicMatcher< internal::HasOverloadedOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl), std::vector< std::string > > hasOverloadedOperatorName(StringRef Name)
Matches overloaded operator names.
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> allOf
Matches if all given matchers match.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionDecl > functionDecl
Matches function declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedMemberExpr > unresolvedMemberExpr
Matches unresolved member expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, MemberExpr > memberExpr
Matches member expressions.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > cxxRecordDecl
Matches C++ class declarations.
internal::Matcher< T > traverse(TraversalKind TK, const internal::Matcher< T > &InnerMatcher)
Causes all nested matchers to be matched with the specified traversal kind.
const AstTypeMatcher< ReferenceType > referenceType
Matches both lvalue and rvalue reference types.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXUnresolvedConstructExpr > cxxUnresolvedConstructExpr
Matches unresolved constructor call expressions.
internal::Matcher< T > findAll(const internal::Matcher< T > &Matcher)
Matches if the node or any descendant matches.
internal::PolymorphicMatcher< internal::HasDeclarationMatcher, void(internal::HasDeclarationSupportedTypes), internal::Matcher< Decl > > hasDeclaration(const internal::Matcher< Decl > &InnerMatcher)
Matches a node if the declaration associated with that node matches the given matcher.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclStmt > declStmt
Matches declaration statements.
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFoldExpr > cxxFoldExpr
Matches C++17 fold expressions.
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> anyOf
Matches if any of the given matchers matches.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > cxxMethodDecl
Matches method declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
const internal::ArgumentAdaptingMatcherFunc< internal::HasAncestorMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > hasAncestor
Matches AST nodes that have an ancestor that matches the provided matcher.
const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > hasParent
Matches AST nodes that have a parent that matches the provided matcher.
The JSON file list parser is used to communicate input to InstallAPI.
@ TK_AsIs
Will traverse all child nodes.
@ Result
The result type of a method or function.
const FunctionProtoType * T
static bool canExprResolveTo(const Expr *Source, const Expr *Target)
static bool isUnevaluated(const Stmt *Smt, const Stmt &Stm, ASTContext &Context)
const Stmt * findPointeeMutation(const Expr *Exp)
const Stmt * findMutation(const Expr *Exp)
llvm::DenseMap< const Expr *, const Stmt * > ResultMap