mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 02:51:57 +00:00
Adapt rL364464: clang::FrontendAction::Execute returns llvm::Error instead of bool
This commit is contained in:
parent
aab9dd6642
commit
a858567686
@ -1270,14 +1270,21 @@ Index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
|
|||||||
|
|
||||||
std::unique_ptr<FrontendAction> Action = createIndexingAction(
|
std::unique_ptr<FrontendAction> Action = createIndexingAction(
|
||||||
DataConsumer, IndexOpts, std::make_unique<IndexFrontendAction>(param));
|
DataConsumer, IndexOpts, std::make_unique<IndexFrontendAction>(param));
|
||||||
|
std::string reason;
|
||||||
{
|
{
|
||||||
llvm::CrashRecoveryContext CRC;
|
llvm::CrashRecoveryContext CRC;
|
||||||
auto parse = [&]() {
|
auto parse = [&]() {
|
||||||
if (!Action->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
|
if (!Action->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
|
||||||
return;
|
return;
|
||||||
|
#if LLVM_VERSION_MAJOR >= 9 // rL364464
|
||||||
|
if (llvm::Error E = Action->Execute()) {
|
||||||
|
reason = llvm::toString(std::move(E));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (!Action->Execute())
|
if (!Action->Execute())
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
Action->EndSourceFile();
|
Action->EndSourceFile();
|
||||||
ok = true;
|
ok = true;
|
||||||
};
|
};
|
||||||
@ -1287,7 +1294,8 @@ Index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
LOG_S(ERROR) << "failed to index " << main;
|
LOG_S(ERROR) << "failed to index " << main
|
||||||
|
<< (reason.empty() ? "" : ": " + reason);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
for (auto &Buf : Bufs)
|
for (auto &Buf : Bufs)
|
||||||
|
@ -324,8 +324,15 @@ bool Parse(CompilerInstance &Clang) {
|
|||||||
SyntaxOnlyAction Action;
|
SyntaxOnlyAction Action;
|
||||||
if (!Action.BeginSourceFile(Clang, Clang.getFrontendOpts().Inputs[0]))
|
if (!Action.BeginSourceFile(Clang, Clang.getFrontendOpts().Inputs[0]))
|
||||||
return false;
|
return false;
|
||||||
|
#if LLVM_VERSION_MAJOR >= 9 // rL364464
|
||||||
|
if (llvm::Error E = Action.Execute()) {
|
||||||
|
llvm::consumeError(std::move(E));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (!Action.Execute())
|
if (!Action.Execute())
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
Action.EndSourceFile();
|
Action.EndSourceFile();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user