diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2019-09-26 19:28:51 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2019-09-26 19:28:51 +0000 |
| commit | 15d5f5dd350e9ba811171968e647a80f84776888 (patch) | |
| tree | 25d38b5546e2a988932f2a356fbcb0c32b3dbddc /clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp | |
| parent | f1a5a93157b4658c7961b57960e407001dae6965 (diff) | |
| download | bcm5719-llvm-15d5f5dd350e9ba811171968e647a80f84776888.tar.gz bcm5719-llvm-15d5f5dd350e9ba811171968e647a80f84776888.zip | |
[clang-scan-deps] Allow continuation line backslashes followed by whitespace
in the dependency source minimizer
Clang allows continuations that have whitespace between the backslash and the newline.
This patch ensures that the dependency source minimizer can handle the whitespace between
the backslash and the newline when looking for a line continuation.
Differential Revision: https://reviews.llvm.org/D68052
llvm-svn: 373007
Diffstat (limited to 'clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp')
| -rw-r--r-- | clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp b/clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp index c00c160977e..5eb7d256a36 100644 --- a/clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp +++ b/clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp @@ -157,19 +157,19 @@ TEST(MinimizeSourceToDependencyDirectivesTest, DefineHorizontalWhitespace) { ASSERT_FALSE(minimizeSourceToDependencyDirectives( "#define MACRO(\t)\tcon \t tent\t", Out)); - EXPECT_STREQ("#define MACRO() con \t tent\t\n", Out.data()); + EXPECT_STREQ("#define MACRO() con \t tent\n", Out.data()); ASSERT_FALSE(minimizeSourceToDependencyDirectives( "#define MACRO(\f)\fcon \f tent\f", Out)); - EXPECT_STREQ("#define MACRO() con \f tent\f\n", Out.data()); + EXPECT_STREQ("#define MACRO() con \f tent\n", Out.data()); ASSERT_FALSE(minimizeSourceToDependencyDirectives( "#define MACRO(\v)\vcon \v tent\v", Out)); - EXPECT_STREQ("#define MACRO() con \v tent\v\n", Out.data()); + EXPECT_STREQ("#define MACRO() con \v tent\n", Out.data()); ASSERT_FALSE(minimizeSourceToDependencyDirectives( "#define MACRO \t\v\f\v\t con\f\t\vtent\v\f \v", Out)); - EXPECT_STREQ("#define MACRO con\f\t\vtent\v\n", Out.data()); + EXPECT_STREQ("#define MACRO con\f\t\vtent\n", Out.data()); } TEST(MinimizeSourceToDependencyDirectivesTest, DefineMultilineArgs) { @@ -476,6 +476,17 @@ TEST(MinimizeSourceToDependencyDirectivesTest, SplitIdentifier) { EXPECT_STREQ("#define GUA RD\n", Out.data()); } +TEST(MinimizeSourceToDependencyDirectivesTest, + WhitespaceAfterLineContinuationSlash) { + SmallVector<char, 128> Out; + + ASSERT_FALSE(minimizeSourceToDependencyDirectives("#define A 1 + \\ \n" + "2 + \\\t\n" + "3\n", + Out)); + EXPECT_STREQ("#define A 1 + 2 + 3\n", Out.data()); +} + TEST(MinimizeSourceToDependencyDirectivesTest, PoundWarningAndError) { SmallVector<char, 128> Out; |

