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) {
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) {
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits