r339759 - Fix ASTMatchersTraversalTest testcase compile on older compilers

David Green via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 15 03:39:43 PDT 2018


Author: dmgreen
Date: Wed Aug 15 03:39:43 2018
New Revision: 339759

URL: http://llvm.org/viewvc/llvm-project?rev=339759&view=rev
Log:
Fix ASTMatchersTraversalTest testcase compile on older compilers

Some versions of gcc, especially when invoked through ccache (-E), can have
trouble with raw string literals inside macros. This moves the string out of
the macro.

Modified:
    cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp?rev=339759&r1=339758&r2=339759&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp Wed Aug 15 03:39:43 2018
@@ -1322,7 +1322,7 @@ TEST(IgnoringImplicit, MatchesImplicit)
 }
 
 TEST(IgnoringImplicit, MatchesNestedImplicit) {
-  EXPECT_TRUE(matches(R"(
+  StringRef Code = R"(
 
 struct OtherType;
 
@@ -1348,8 +1348,8 @@ int main()
 {
     SomeType i = something();
 }
-)"
-  , varDecl(
+)";
+  EXPECT_TRUE(matches(Code, varDecl(
       hasName("i"),
       hasInitializer(exprWithCleanups(has(
         cxxConstructExpr(has(expr(ignoringImplicit(cxxConstructExpr(




More information about the cfe-commits mailing list