r363074 - Fix for r42230, MSVC test failure in DependencyDirectivesSourceMinimizerTest.cpp

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 11 07:58:26 PDT 2019


Author: erichkeane
Date: Tue Jun 11 07:58:26 2019
New Revision: 363074

URL: http://llvm.org/viewvc/llvm-project?rev=363074&view=rev
Log:
Fix for r42230, MSVC test failure in DependencyDirectivesSourceMinimizerTest.cpp

r362459 introduced DependencyDirectivesSourceMinimizerTest.cpp, which
hits an MSVC bug:
developercommunity.visualstudio.com/content/problem/67300/stringifying-raw-string-literal.html

This only happens when the parameter to a macro is stringified in the
macro.  This patch removes the string from the assert so that the
warning no longer happens.

Modified:
    cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp

Modified: cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp?rev=363074&r1=363073&r2=363074&view=diff
==============================================================================
--- cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp (original)
+++ cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp Tue Jun 11 07:58:26 2019
@@ -405,25 +405,27 @@ TEST(MinimizeSourceToDependencyDirective
                "#endif\n",
                Out.data());
 
-  ASSERT_FALSE(minimizeSourceToDependencyDirectives(
+  bool RawStringLiteralResult = minimizeSourceToDependencyDirectives(
       "#ifndef GUARD\n"
       "#define GUARD\n"
       R"raw(static constexpr char bytes[] = R"(-?:\,[]{}#&*!|>'"%@`)";)raw"
       "\n"
       "#endif\n",
-      Out));
+      Out);
+  ASSERT_FALSE(RawStringLiteralResult);
   EXPECT_STREQ("#ifndef GUARD\n"
                "#define GUARD\n"
                "#endif\n",
                Out.data());
 
-  ASSERT_FALSE(minimizeSourceToDependencyDirectives(
+  bool RawStringLiteralResult2 = minimizeSourceToDependencyDirectives(
       "#ifndef GUARD\n"
       "#define GUARD\n"
       R"raw(static constexpr char bytes[] = R"abc(-?:\,[]{}#&*!|>'"%@`)abc";)raw"
       "\n"
       "#endif\n",
-      Out));
+      Out);
+  ASSERT_FALSE(RawStringLiteralResult2);
   EXPECT_STREQ("#ifndef GUARD\n"
                "#define GUARD\n"
                "#endif\n",




More information about the cfe-commits mailing list