[PATCH] D86279: [clangd] Don't crash on `#pragma clang __debug parser_crash`
Aleksandr Platonov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 20 05:54:01 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG445739826567: [clangd] Don't crash on `#pragma clang __debug parser_crash` (authored by ArcsinX).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86279/new/
https://reviews.llvm.org/D86279
Files:
clang-tools-extra/clangd/Compiler.cpp
clang-tools-extra/clangd/unittests/CompilerTests.cpp
Index: clang-tools-extra/clangd/unittests/CompilerTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/CompilerTests.cpp
+++ clang-tools-extra/clangd/unittests/CompilerTests.cpp
@@ -51,6 +51,11 @@
IsEmpty());
}
+TEST(BuildCompilerInvocation, PragmaDebugCrash) {
+ TestTU TU = TestTU::withCode("#pragma clang __debug parser_crash");
+ TU.build(); // no-crash
+}
+
} // namespace
} // namespace clangd
} // namespace clang
Index: clang-tools-extra/clangd/Compiler.cpp
===================================================================
--- clang-tools-extra/clangd/Compiler.cpp
+++ clang-tools-extra/clangd/Compiler.cpp
@@ -78,6 +78,8 @@
CI->getPreprocessorOpts().PCHThroughHeader.clear();
CI->getPreprocessorOpts().PCHWithHdrStop = false;
CI->getPreprocessorOpts().PCHWithHdrStopCreate = false;
+ // Don't crash on `#pragma clang __debug parser_crash`
+ CI->getPreprocessorOpts().DisablePragmaDebugCrash = true;
// Recovery expression currently only works for C++.
if (CI->getLangOpts()->CPlusPlus) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86279.286797.patch
Type: text/x-patch
Size: 1106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200820/f9a138ae/attachment.bin>
More information about the cfe-commits
mailing list