From: Mehdi Amini Date: Sun, 8 Jan 2017 00:30:27 +0000 (+0000) Subject: [ThinLTO] Expected<> return values need to be handled to avoid an assertion X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1de89c2e6c54760f5a313affe6ef1a7ccf265879;p=llvm [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 --- 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,