virtual bool IsMatchingInTemplateInstantiationNotSpelledInSource() const = 0;
+ bool isTraversalAsIs() const;
+
protected:
virtual bool matchesChildOf(const DynTypedNode &Node, ASTContext &Ctx,
const DynTypedMatcher &Matcher,
Stmt *StmtToTraverse = StmtNode;
if (auto *ExprNode = dyn_cast_or_null<Expr>(StmtNode)) {
auto *LambdaNode = dyn_cast_or_null<LambdaExpr>(StmtNode);
- if (LambdaNode &&
- Finder->getASTContext().getParentMapContext().getTraversalKind() ==
- TK_IgnoreUnlessSpelledInSource)
+ if (LambdaNode && !Finder->isTraversalAsIs())
StmtToTraverse = LambdaNode;
else
StmtToTraverse =
return traverse(TAL);
}
bool TraverseLambdaExpr(LambdaExpr *Node) {
- if (Finder->getASTContext().getParentMapContext().getTraversalKind() !=
- TK_IgnoreUnlessSpelledInSource)
+ if (Finder->isTraversalAsIs())
return VisitorBase::TraverseLambdaExpr(Node);
if (!Node)
return true;
static llvm::ManagedStatic<TrueMatcherImpl> TrueMatcherInstance;
+bool ASTMatchFinder::isTraversalAsIs() const {
+ return getASTContext().getParentMapContext().getTraversalKind() == TK_AsIs;
+}
+
DynTypedMatcher
DynTypedMatcher::constructVariadic(DynTypedMatcher::VariadicOperator Op,
ASTNodeKind SupportedKind,
TraversalKindScope RAII(Finder->getASTContext(),
Implementation->TraversalKind());
- if (Finder->getASTContext().getParentMapContext().getTraversalKind() ==
- TK_IgnoreUnlessSpelledInSource &&
+ if (!Finder->isTraversalAsIs() &&
Finder->IsMatchingInTemplateInstantiationNotSpelledInSource())
return false;
TraversalKindScope raii(Finder->getASTContext(),
Implementation->TraversalKind());
- if (Finder->getASTContext().getParentMapContext().getTraversalKind() ==
- TK_IgnoreUnlessSpelledInSource &&
+ if (!Finder->isTraversalAsIs() &&
Finder->IsMatchingInTemplateInstantiationNotSpelledInSource())
return false;