diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2019-06-19 13:56:36 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2019-06-19 13:56:36 +0000 |
commit | 26c066d66d7a3f605a612718ceff67e8f86049f2 (patch) | |
tree | cddbc81c1511af19b42b92c847265cc9e3c4165b /clang/unittests/Tooling/Syntax/TokensTest.cpp | |
parent | 102b1efd5325de188b06b0725a673c902f351dad (diff) | |
download | bcm5719-llvm-26c066d66d7a3f605a612718ceff67e8f86049f2.tar.gz bcm5719-llvm-26c066d66d7a3f605a612718ceff67e8f86049f2.zip |
[Syntax] Fix a crash when dumping empty token buffer
llvm-svn: 363801
Diffstat (limited to 'clang/unittests/Tooling/Syntax/TokensTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/Syntax/TokensTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/Syntax/TokensTest.cpp b/clang/unittests/Tooling/Syntax/TokensTest.cpp index 34c80fce2a3..a812b844c85 100644 --- a/clang/unittests/Tooling/Syntax/TokensTest.cpp +++ b/clang/unittests/Tooling/Syntax/TokensTest.cpp @@ -290,6 +290,14 @@ file './input.cpp' # pragma GCC visibility push ( public ) # pragma GCC visibility pop mappings: ['#'_0, '<eof>'_13) => ['<eof>'_0, '<eof>'_0) +)"}, + // Empty files should not crash. + {R"cpp()cpp", R"(expanded tokens: + <empty> +file './input.cpp' + spelled tokens: + <empty> + no mappings. )"}}; for (auto &Test : TestCases) EXPECT_EQ(collectAndDump(Test.first), Test.second) |