[clang] 55d7b22 - [ASTMatchers] Make test more clear about what it is verifying

Stephen Kelly via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 11:47:33 PST 2020


Author: Stephen Kelly
Date: 2020-01-10T19:47:12Z
New Revision: 55d7b22277e1c5e710bac7d4d4dc09db3a22dad8

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

LOG: [ASTMatchers] Make test more clear about what it is verifying

Added: 
    

Modified: 
    clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index 6ca54df06571..ee7b3bfd5b1b 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -1639,9 +1639,12 @@ void foo()
   EXPECT_TRUE(matches(VarDeclCode, varDecl(traverse(ast_type_traits::TK_AsIs,
                                                     has(implicitCastExpr())))));
 
-  EXPECT_TRUE(notMatches(
+  EXPECT_TRUE(matches(
       VarDeclCode,
-      varDecl(has(traverse(ast_type_traits::TK_AsIs, floatLiteral())))));
+      traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource,
+        // The has() below strips away the ImplicitCastExpr before the
+        // traverse(AsIs) gets to process it.
+        varDecl(has(traverse(ast_type_traits::TK_AsIs, floatLiteral()))))));
 
   EXPECT_TRUE(matches(
       VarDeclCode,


        


More information about the cfe-commits mailing list