Index: cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp =================================================================== --- cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp +++ cfe/trunk/lib/Lex/DependencyDirectivesSourceMinimizer.cpp @@ -262,7 +262,14 @@ if (Start == Cur) return false; // The previous character must be a valid PP number character. - if (!isPreprocessingNumberBody(*(Cur - 1))) + // Make sure that the L, u, U, u8 prefixes don't get marked as a + // separator though. + char Prev = *(Cur - 1); + if (Prev == 'L' || Prev == 'U' || Prev == 'u') + return false; + if (Prev == '8' && (Cur - 1 != Start) && *(Cur - 2) == 'u') + return false; + if (!isPreprocessingNumberBody(Prev)) return false; // The next character should be a valid identifier body character. return (Cur + 1) < End && isIdentifierBody(*(Cur + 1)); Index: cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp =================================================================== --- cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp +++ cfe/trunk/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp @@ -507,4 +507,41 @@ EXPECT_STREQ("#include \n#include \n", Out.data()); } +TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixL) { + SmallVector Out; + + StringRef Source = R"(L'P' +#if DEBUG +// ' +#endif +#include +)"; + ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out)); + EXPECT_STREQ("#include \n", Out.data()); +} + +TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixU) { + SmallVector Out; + + StringRef Source = R"(int x = U'P'; +#include +// ' +)"; + ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out)); + EXPECT_STREQ("#include \n", Out.data()); +} + +TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixu) { + SmallVector Out; + + StringRef Source = R"(int x = u'b'; +int y = u8'a'; +int z = 128'78; +#include +// ' +)"; + ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out)); + EXPECT_STREQ("#include \n", Out.data()); +} + } // end anonymous namespace