[clang] ed2baaa - Revert "Add utility for testing if we're matching nodes AsIs"

Stephen Kelly via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 14:30:19 PST 2020


Author: Stephen Kelly
Date: 2020-11-10T22:29:58Z
New Revision: ed2baaac56c45cef4742cab79434a2e6c95e8fda

URL: https://github.com/llvm/llvm-project/commit/ed2baaac56c45cef4742cab79434a2e6c95e8fda
DIFF: https://github.com/llvm/llvm-project/commit/ed2baaac56c45cef4742cab79434a2e6c95e8fda.diff

LOG: Revert "Add utility for testing if we're matching nodes AsIs"

This reverts commit e73296d3b92fc231f3f913815e477d55b66595bd.

This may have caused build bot failure.

Added: 
    

Modified: 
    clang/include/clang/ASTMatchers/ASTMatchersInternal.h
    clang/lib/ASTMatchers/ASTMatchFinder.cpp
    clang/lib/ASTMatchers/ASTMatchersInternal.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index 2c2e67ace157..f5563977cb7e 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -1062,8 +1062,6 @@ class ASTMatchFinder {
 
   virtual bool IsMatchingInTemplateInstantiationNotSpelledInSource() const = 0;
 
-  bool isTraversalAsIs() const;
-
 protected:
   virtual bool matchesChildOf(const DynTypedNode &Node, ASTContext &Ctx,
                               const DynTypedMatcher &Matcher,

diff  --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
index f86e0648ecc6..67de0e14d18c 100644
--- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -153,7 +153,9 @@ class MatchChildASTVisitor
     Stmt *StmtToTraverse = StmtNode;
     if (auto *ExprNode = dyn_cast_or_null<Expr>(StmtNode)) {
       auto *LambdaNode = dyn_cast_or_null<LambdaExpr>(StmtNode);
-      if (LambdaNode && !Finder->isTraversalAsIs())
+      if (LambdaNode &&
+          Finder->getASTContext().getParentMapContext().getTraversalKind() ==
+              TK_IgnoreUnlessSpelledInSource)
         StmtToTraverse = LambdaNode;
       else
         StmtToTraverse =
@@ -230,7 +232,8 @@ class MatchChildASTVisitor
     return traverse(TAL);
   }
   bool TraverseLambdaExpr(LambdaExpr *Node) {
-    if (!Finder->isTraversalAsIs())
+    if (Finder->getASTContext().getParentMapContext().getTraversalKind() !=
+        TK_IgnoreUnlessSpelledInSource)
       return VisitorBase::TraverseLambdaExpr(Node);
     if (!Node)
       return true;

diff  --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
index 0eea41bdc4e5..2e14ef28ecdb 100644
--- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -191,10 +191,6 @@ class DynTraversalMatcherImpl : public DynMatcherInterface {
 
 static llvm::ManagedStatic<TrueMatcherImpl> TrueMatcherInstance;
 
-bool ASTMatchFinder::isTraversalAsIs() const {
-  return getASTContext().getParentMapContext().getTraversalKind() == TK_AsIs;
-}
-
 DynTypedMatcher
 DynTypedMatcher::constructVariadic(DynTypedMatcher::VariadicOperator Op,
                                    ASTNodeKind SupportedKind,
@@ -288,7 +284,8 @@ bool DynTypedMatcher::matches(const DynTypedNode &DynNode,
   TraversalKindScope RAII(Finder->getASTContext(),
                           Implementation->TraversalKind());
 
-  if (!Finder->isTraversalAsIs() &&
+  if (Finder->getASTContext().getParentMapContext().getTraversalKind() ==
+          TK_IgnoreUnlessSpelledInSource &&
       Finder->IsMatchingInTemplateInstantiationNotSpelledInSource())
     return false;
 
@@ -312,7 +309,8 @@ bool DynTypedMatcher::matchesNoKindCheck(const DynTypedNode &DynNode,
   TraversalKindScope raii(Finder->getASTContext(),
                           Implementation->TraversalKind());
 
-  if (!Finder->isTraversalAsIs() &&
+  if (Finder->getASTContext().getParentMapContext().getTraversalKind() ==
+          TK_IgnoreUnlessSpelledInSource &&
       Finder->IsMatchingInTemplateInstantiationNotSpelledInSource())
     return false;
 


        


More information about the cfe-commits mailing list