summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Lex
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2019-07-10 22:00:59 +0000
committerAlex Lorenz <arphaman@gmail.com>2019-07-10 22:00:59 +0000
commit9a6c17b5b8628f2f9b23eaf4dfdb95862521bf99 (patch)
tree3eb83967bb56a54ec82ad0e744515f2153bb3386 /clang/unittests/Lex
parentd7aae33a9513d29400157867cdc1f11c2e4a0c40 (diff)
downloadbcm5719-llvm-9a6c17b5b8628f2f9b23eaf4dfdb95862521bf99.tar.gz
bcm5719-llvm-9a6c17b5b8628f2f9b23eaf4dfdb95862521bf99.zip
[clang-scan-deps] Dependency directives source minimizer:
single quotes are not digit separators after a valid character literal prefix The single quote character can act as a c++ digit separator. However, the minimizer shouldn't treat it as such when it's actually following a valid character literal prefix, like L, U, u, or u8. Differential Revision: https://reviews.llvm.org/D64525 llvm-svn: 365700
Diffstat (limited to 'clang/unittests/Lex')
-rw-r--r--clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp b/clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
index d13723bdd1c..cfa3ec91e03 100644
--- a/clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
+++ b/clang/unittests/Lex/DependencyDirectivesSourceMinimizerTest.cpp
@@ -507,4 +507,41 @@ int c = 12 ' ';
EXPECT_STREQ("#include <bob>\n#include <foo>\n", Out.data());
}
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixL) {
+ SmallVector<char, 128> Out;
+
+ StringRef Source = R"(L'P'
+#if DEBUG
+// '
+#endif
+#include <test.h>
+)";
+ ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+ EXPECT_STREQ("#include <test.h>\n", Out.data());
+}
+
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixU) {
+ SmallVector<char, 128> Out;
+
+ StringRef Source = R"(int x = U'P';
+#include <test.h>
+// '
+)";
+ ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+ EXPECT_STREQ("#include <test.h>\n", Out.data());
+}
+
+TEST(MinimizeSourceToDependencyDirectivesTest, CharacterLiteralPrefixu) {
+ SmallVector<char, 128> Out;
+
+ StringRef Source = R"(int x = u'b';
+int y = u8'a';
+int z = 128'78;
+#include <test.h>
+// '
+)";
+ ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out));
+ EXPECT_STREQ("#include <test.h>\n", Out.data());
+}
+
} // end anonymous namespace
OpenPOWER on IntegriCloud