summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/LTO/ThinLTOCodeGenerator.cpp')
-rw-r--r--llvm/lib/LTO/ThinLTOCodeGenerator.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index d2fc892d6a9..440275c3425 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -565,23 +565,18 @@ std::unique_ptr<TargetMachine> TargetMachineBuilder::create() const {
* "thin-link".
*/
std::unique_ptr<ModuleSummaryIndex> ThinLTOCodeGenerator::linkCombinedIndex() {
- std::unique_ptr<ModuleSummaryIndex> CombinedIndex;
+ std::unique_ptr<ModuleSummaryIndex> CombinedIndex =
+ llvm::make_unique<ModuleSummaryIndex>();
uint64_t NextModuleId = 0;
for (auto &ModuleBuffer : Modules) {
- Expected<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr =
- getModuleSummaryIndex(ModuleBuffer.getMemBuffer());
- if (!IndexOrErr) {
+ if (Error Err = readModuleSummaryIndex(ModuleBuffer.getMemBuffer(),
+ *CombinedIndex, NextModuleId++)) {
// FIXME diagnose
logAllUnhandledErrors(
- IndexOrErr.takeError(), errs(),
+ std::move(Err), errs(),
"error: can't create module summary index for buffer: ");
return nullptr;
}
- if (CombinedIndex) {
- CombinedIndex->mergeFrom(std::move(*IndexOrErr), ++NextModuleId);
- } else {
- CombinedIndex = std::move(*IndexOrErr);
- }
}
return CombinedIndex;
}
OpenPOWER on IntegriCloud