Author: pcc Date: Fri Nov 11 13:50:39 2016 New Revision: 286624 URL: http://llvm.org/viewvc/llvm-project?rev=286624&view=rev Log: Bitcode: Change getModuleSummaryIndex() to return an llvm::Expected.
Differential Revision: https://reviews.llvm.org/D26539 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=286624&r1=286623&r2=286624&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Nov 11 13:50:39 2016 @@ -725,14 +725,12 @@ static void runThinLTOBackend(const Code // 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<std::unique_ptr<ModuleSummaryIndex>> 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<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr = + llvm::getModuleSummaryIndexForFile(CGOpts.ThinLTOIndexFile); + if (!IndexOrErr) { + logAllUnhandledErrors(IndexOrErr.takeError(), errs(), + "Error loading index file '" + + CGOpts.ThinLTOIndexFile + "': "); return; } std::unique_ptr<ModuleSummaryIndex> CombinedIndex = std::move(*IndexOrErr); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits