diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -943,9 +943,8 @@ getSourceManager().clearIDTables(); if (Act.BeginSourceFile(*this, FIF)) { - if (llvm::Error Err = Act.Execute()) { - consumeError(std::move(Err)); // FIXME this drops errors on the floor. - } + if (llvm::Error Err = Act.Execute()) + OS << "Internal compiler error: " << toString(std::move(Err)) << "\n"; Act.EndSourceFile(); } } diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -940,15 +940,10 @@ CI.hasPreprocessor()) { StringRef Cache = CI.getPreprocessor().getHeaderSearchInfo().getModuleCachePath(); - if (!Cache.empty()) { + if (!Cache.empty()) if (llvm::Error Err = GlobalModuleIndex::writeIndex( - CI.getFileManager(), CI.getPCHContainerReader(), Cache)) { - // FIXME this drops the error on the floor, but - // Index/pch-from-libclang.c seems to rely on dropping at least some of - // the error conditions! - consumeError(std::move(Err)); - } - } + CI.getFileManager(), CI.getPCHContainerReader(), Cache)) + return Err; } return llvm::Error::success(); diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -860,7 +860,9 @@ llvm::LockFileManager Locked(IndexPath); switch (Locked) { case llvm::LockFileManager::LFS_Error: - return llvm::createStringError(std::errc::io_error, "LFS error"); + return llvm::createStringError( + std::errc::io_error, "LFS error for \"%s\": %s", IndexPath.c_str(), + Locked.getErrorMessage().c_str()); case llvm::LockFileManager::LFS_Owned: // We're responsible for building the index ourselves. Do so below. @@ -869,8 +871,10 @@ case llvm::LockFileManager::LFS_Shared: // Someone else is responsible for building the index. We don't care // when they finish, so we're done. - return llvm::createStringError(std::errc::device_or_resource_busy, - "someone else is building the index"); + return llvm::createStringError( + std::errc::device_or_resource_busy, + "someone else is building the index \"%s\": %s", IndexPath.c_str(), + Locked.getErrorMessage().c_str()); } // The module index builder.