From: Peter Collingbourne Date: Fri, 11 Nov 2016 19:50:39 +0000 (+0000) Subject: Bitcode: Change getModuleSummaryIndex() to return an llvm::Expected. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f4b749a024a18868c793ea44a53aa02b63c531d;p=clang Bitcode: Change getModuleSummaryIndex() to return an llvm::Expected. Differential Revision: https://reviews.llvm.org/D26539 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286624 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index d0bd22c5f1..62dc95ec9a 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -725,14 +725,12 @@ static void runThinLTOBackend(const CodeGenOptions &CGOpts, Module *M, // If we are performing a ThinLTO importing compile, load the function index // into memory and pass it into thinBackend, which will run the function // importer and invoke LTO passes. - ErrorOr> IndexOrErr = - llvm::getModuleSummaryIndexForFile( - CGOpts.ThinLTOIndexFile, - [&](const DiagnosticInfo &DI) { M->getContext().diagnose(DI); }); - if (std::error_code EC = IndexOrErr.getError()) { - std::string Error = EC.message(); - errs() << "Error loading index file '" << CGOpts.ThinLTOIndexFile - << "': " << Error << "\n"; + Expected> IndexOrErr = + llvm::getModuleSummaryIndexForFile(CGOpts.ThinLTOIndexFile); + if (!IndexOrErr) { + logAllUnhandledErrors(IndexOrErr.takeError(), errs(), + "Error loading index file '" + + CGOpts.ThinLTOIndexFile + "': "); return; } std::unique_ptr CombinedIndex = std::move(*IndexOrErr);