summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/Syntax/TokensTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Tooling/Syntax/TokensTest.cpp')
-rw-r--r--clang/unittests/Tooling/Syntax/TokensTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/Syntax/TokensTest.cpp b/clang/unittests/Tooling/Syntax/TokensTest.cpp
index 24adba28a29..a1398bd5568 100644
--- a/clang/unittests/Tooling/Syntax/TokensTest.cpp
+++ b/clang/unittests/Tooling/Syntax/TokensTest.cpp
@@ -298,6 +298,21 @@ file './input.cpp'
spelled tokens:
<empty>
no mappings.
+)"},
+ // Should not crash on errors inside '#define' directives. Error is that
+ // stringification (#B) does not refer to a macro parameter.
+ {
+ R"cpp(
+a
+#define MACRO() A #B
+)cpp",
+ R"(expanded tokens:
+ a
+file './input.cpp'
+ spelled tokens:
+ a # define MACRO ( ) A # B
+ mappings:
+ ['#'_1, '<eof>'_9) => ['<eof>'_1, '<eof>'_1)
)"}};
for (auto &Test : TestCases)
EXPECT_EQ(collectAndDump(Test.first), Test.second)
OpenPOWER on IntegriCloud