diff --git a/src/indexer.cc b/src/indexer.cc index a16fd12c..e74843e3 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -1270,14 +1270,21 @@ Index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, std::unique_ptr Action = createIndexingAction( DataConsumer, IndexOpts, std::make_unique(param)); - + std::string reason; { llvm::CrashRecoveryContext CRC; auto parse = [&]() { if (!Action->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])) return; +#if LLVM_VERSION_MAJOR >= 9 // rL364464 + if (llvm::Error E = Action->Execute()) { + reason = llvm::toString(std::move(E)); + return; + } +#else if (!Action->Execute()) return; +#endif Action->EndSourceFile(); ok = true; }; @@ -1287,7 +1294,8 @@ Index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, } } if (!ok) { - LOG_S(ERROR) << "failed to index " << main; + LOG_S(ERROR) << "failed to index " << main + << (reason.empty() ? "" : ": " + reason); return {}; } for (auto &Buf : Bufs) diff --git a/src/sema_manager.cc b/src/sema_manager.cc index 8ebdca0a..0eaf44ca 100644 --- a/src/sema_manager.cc +++ b/src/sema_manager.cc @@ -324,8 +324,15 @@ bool Parse(CompilerInstance &Clang) { SyntaxOnlyAction Action; if (!Action.BeginSourceFile(Clang, Clang.getFrontendOpts().Inputs[0])) 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()) return false; +#endif Action.EndSourceFile(); return true; }