diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-11 19:50:39 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-11 19:50:39 +0000 |
commit | 6de481a3786b5b0409eddeee4b99a148e3f0f3f3 (patch) | |
tree | e2a11dcd251688636adc5f1a4657c15aef1d0aad /clang/lib/CodeGen | |
parent | cd513a41c17a3591e764b1ff986ae501a28cc5f5 (diff) | |
download | bcm5719-llvm-6de481a3786b5b0409eddeee4b99a148e3f0f3f3.tar.gz bcm5719-llvm-6de481a3786b5b0409eddeee4b99a148e3f0f3f3.zip |
Bitcode: Change getModuleSummaryIndex() to return an llvm::Expected.
Differential Revision: https://reviews.llvm.org/D26539
llvm-svn: 286624
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index d0bd22c5f13..62dc95ec9af 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/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<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); |