forked from OSchip/llvm-project
[clangd] Don't crash on `#pragma clang __debug parser_crash`
Currently, clangd crashes when opening a file with `#pragma clang __debug parser_crash` (e.g. clang/test/Modules/Inputs/crash.h). This patch disables these crashes. Reviewed By: kadircet Differential Revision: https://reviews.llvm.org/D86279
This commit is contained in:
parent
707138d677
commit
4457398265
|
@ -78,6 +78,8 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
|
|||
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) {
|
||||
|
|
|
@ -51,6 +51,11 @@ TEST(BuildCompilerInvocation, DropsPCH) {
|
|||
IsEmpty());
|
||||
}
|
||||
|
||||
TEST(BuildCompilerInvocation, PragmaDebugCrash) {
|
||||
TestTU TU = TestTU::withCode("#pragma clang __debug parser_crash");
|
||||
TU.build(); // no-crash
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace clangd
|
||||
} // namespace clang
|
||||
|
|
Loading…
Reference in New Issue