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 125915e254
commit aa4d2d1b43

View File

@ -159,6 +159,9 @@ buildCompilerInvocation(const std::string &main, std::vector<const char *> args,
auto &isec = ci->getFrontendOpts().Inputs; auto &isec = ci->getFrontendOpts().Inputs;
if (isec.size()) if (isec.size())
isec[0] = FrontendInputFile(main, isec[0].getKind(), isec[0].isSystem()); 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 // clangSerialization has an unstable format. Disable PCH reading/writing
// to work around PCH mismatch problems. // to work around PCH mismatch problems.
ci->getPreprocessorOpts().ImplicitPCHInclude.clear(); ci->getPreprocessorOpts().ImplicitPCHInclude.clear();