[llvm] r263577 - Add missing error handling in llvm-lto

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 13:17:56 PDT 2016


Author: mehdi_amini
Date: Tue Mar 15 15:17:55 2016
New Revision: 263577

URL: http://llvm.org/viewvc/llvm-project?rev=263577&view=rev
Log:
Add missing error handling in llvm-lto

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 at apple.com>

Modified:
    llvm/trunk/tools/llvm-lto/llvm-lto.cpp

Modified: llvm/trunk/tools/llvm-lto/llvm-lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-lto/llvm-lto.cpp?rev=263577&r1=263576&r2=263577&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-lto/llvm-lto.cpp (original)
+++ llvm/trunk/tools/llvm-lto/llvm-lto.cpp Tue Mar 15 15:17:55 2016
@@ -258,6 +258,7 @@ static void createCombinedModuleSummaryI
     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.




More information about the llvm-commits mailing list