|
33 | 33 | #include "llvm/Linker/Linker.h"
|
34 | 34 | #include "llvm/MC/SubtargetFeature.h"
|
35 | 35 | #include "llvm/Object/IRObjectFile.h"
|
36 |
| -#include "llvm/Object/ModuleSummaryIndexObjectFile.h" |
37 | 36 | #include "llvm/Support/CachePruning.h"
|
38 | 37 | #include "llvm/Support/Debug.h"
|
39 | 38 | #include "llvm/Support/Error.h"
|
@@ -569,21 +568,19 @@ std::unique_ptr<ModuleSummaryIndex> ThinLTOCodeGenerator::linkCombinedIndex() {
|
569 | 568 | std::unique_ptr<ModuleSummaryIndex> CombinedIndex;
|
570 | 569 | uint64_t NextModuleId = 0;
|
571 | 570 | for (auto &ModuleBuffer : Modules) {
|
572 |
| - Expected<std::unique_ptr<object::ModuleSummaryIndexObjectFile>> ObjOrErr = |
573 |
| - object::ModuleSummaryIndexObjectFile::create( |
574 |
| - ModuleBuffer.getMemBuffer()); |
575 |
| - if (!ObjOrErr) { |
| 571 | + Expected<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr = |
| 572 | + getModuleSummaryIndex(ModuleBuffer.getMemBuffer()); |
| 573 | + if (!IndexOrErr) { |
576 | 574 | // FIXME diagnose
|
577 | 575 | logAllUnhandledErrors(
|
578 |
| - ObjOrErr.takeError(), errs(), |
579 |
| - "error: can't create ModuleSummaryIndexObjectFile for buffer: "); |
| 576 | + IndexOrErr.takeError(), errs(), |
| 577 | + "error: can't create module summary index for buffer: "); |
580 | 578 | return nullptr;
|
581 | 579 | }
|
582 |
| - auto Index = (*ObjOrErr)->takeIndex(); |
583 | 580 | if (CombinedIndex) {
|
584 |
| - CombinedIndex->mergeFrom(std::move(Index), ++NextModuleId); |
| 581 | + CombinedIndex->mergeFrom(std::move(*IndexOrErr), ++NextModuleId); |
585 | 582 | } else {
|
586 |
| - CombinedIndex = std::move(Index); |
| 583 | + CombinedIndex = std::move(*IndexOrErr); |
587 | 584 | }
|
588 | 585 | }
|
589 | 586 | return CombinedIndex;
|
|
0 commit comments