If clang >= 10, don't crash on #pragma clang __debug

This commit is contained in:
Fangrui Song 2020-08-22 10:29:39 -07:00
parent 4cf16a7e5a
commit 0b5372ddf2

View File

@ -155,6 +155,9 @@ buildCompilerInvocation(const std::string &main, std::vector<const char *> args,
auto &isec = ci->getFrontendOpts().Inputs;
if (isec.size())
isec[0] = FrontendInputFile(main, isec[0].getKind(), isec[0].isSystem());
#if LLVM_VERSION_MAJOR >= 10 // llvmorg-11-init-2414-g75f09b54429
ci->getPreprocessorOpts().DisablePragmaDebugCrash = true;
#endif
// clangSerialization has an unstable format. Disable PCH reading/writing
// to work around PCH mismatch problems.
ci->getPreprocessorOpts().ImplicitPCHInclude.clear();