]> granicus.if.org Git - llvm/commitdiff
[ThinLTO] Expected<> return values need to be handled to avoid an assertion
authorMehdi Amini <mehdi.amini@apple.com>
Sun, 8 Jan 2017 00:30:27 +0000 (00:30 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Sun, 8 Jan 2017 00:30:27 +0000 (00:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291377 91177308-0d34-0410-b5e6-96231b3b80d8

lib/LTO/ThinLTOCodeGenerator.cpp

index 66ffe6db29d61c0aeaf0914f7244fb4611fa410b..928f69a17de90b78a2aadf7666f80e69f2859743 100644 (file)
@@ -196,8 +196,15 @@ crossImportIntoModule(Module &TheModule, const ModuleSummaryIndex &Index,
   };
 
   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,