[llvm] r291377 - [ThinLTO] Expected<> return values need to be handled to avoid an assertion

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 7 16:30:27 PST 2017


Author: mehdi_amini
Date: Sat Jan  7 18:30:27 2017
New Revision: 291377

URL: http://llvm.org/viewvc/llvm-project?rev=291377&view=rev
Log:
[ThinLTO] Expected<> return values need to be handled to avoid an assertion

Modified:
    llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp

Modified: llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp?rev=291377&r1=291376&r2=291377&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp Sat Jan  7 18:30:27 2017
@@ -196,8 +196,15 @@ crossImportIntoModule(Module &TheModule,
   };
 
   FunctionImporter Importer(Index, Loader);
-  if (!Importer.importFunctions(TheModule, ImportList))
+  Expected<bool> Result = Importer.importFunctions(TheModule, ImportList);
+  if (!Result) {
+    handleAllErrors(Result.takeError(), [&](ErrorInfoBase &EIB) {
+      SMDiagnostic Err = SMDiagnostic(TheModule.getModuleIdentifier(),
+                                      SourceMgr::DK_Error, EIB.message());
+      Err.print("ThinLTO", errs());
+    });
     report_fatal_error("importFunctions failed");
+  }
 }
 
 static void optimizeModule(Module &TheModule, TargetMachine &TM,




More information about the llvm-commits mailing list