From 1de89c2e6c54760f5a313affe6ef1a7ccf265879 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sun, 8 Jan 2017 00:30:27 +0000 Subject: [PATCH] [ThinLTO] Expected<> return values need to be handled to avoid an assertion git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291377 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/LTO/ThinLTOCodeGenerator.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/LTO/ThinLTOCodeGenerator.cpp b/lib/LTO/ThinLTOCodeGenerator.cpp index 66ffe6db29d..928f69a17de 100644 --- a/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/lib/LTO/ThinLTOCodeGenerator.cpp @@ -196,8 +196,15 @@ crossImportIntoModule(Module &TheModule, const ModuleSummaryIndex &Index, }; FunctionImporter Importer(Index, Loader); - if (!Importer.importFunctions(TheModule, ImportList)) + Expected 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, -- 2.49.0