OSDN Git Service

Add missing error handling in llvm-lto
authorMehdi Amini <mehdi.amini@apple.com>
Tue, 15 Mar 2016 20:17:55 +0000 (20:17 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Tue, 15 Mar 2016 20:17:55 +0000 (20:17 +0000)
Annoyingly, ErrorOr allows to *not check* the error when things go
well. It will crash badly when there is an error though. It should
runtime assert when it is used without being checked!

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263577 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-lto/llvm-lto.cpp

index 8aadc40..d6f3d8a 100644 (file)
@@ -258,6 +258,7 @@ static void createCombinedModuleSummaryIndex() {
     CurrentActivity = "loading file '" + Filename + "'";
     ErrorOr<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr =
         llvm::getModuleSummaryIndexForFile(Filename, diagnosticHandler);
+    error(IndexOrErr, "error: " + CurrentActivity);
     std::unique_ptr<ModuleSummaryIndex> Index = std::move(IndexOrErr.get());
     CurrentActivity = "";
     // Skip files without a module summary.