clang_tu: set RecoveryAST & RecoveryASTType

This commit is contained in:
Fangrui Song 2020-08-30 10:21:58 -07:00
parent 55c0d5b4eb
commit 20a9f7b5f4

View File

@ -156,6 +156,10 @@ buildCompilerInvocation(const std::string &main, std::vector<const char *> args,
// Enable IndexFrontendAction::shouldSkipFunctionBody. // Enable IndexFrontendAction::shouldSkipFunctionBody.
ci->getFrontendOpts().SkipFunctionBodies = true; ci->getFrontendOpts().SkipFunctionBodies = true;
ci->getLangOpts()->SpellChecking = false; ci->getLangOpts()->SpellChecking = false;
#if LLVM_VERSION_MAJOR >= 11
ci->getLangOpts()->RecoveryAST = true;
ci->getLangOpts()->RecoveryASTType = true;
#endif
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());