uint32_t ContributionOffsets[8] = {};
+ SmallVector<OwningBinary<object::ObjectFile>, 128> Objects;
+ Objects.reserve(Inputs.size());
for (const auto &Input : Inputs) {
auto ErrOrObj = object::ObjectFile::createObjectFile(Input);
if (!ErrOrObj)
return ErrOrObj.getError();
+ Objects.push_back(std::move(*ErrOrObj));
+
+ auto &Obj = *Objects.back().getBinary();
+
UnitIndexEntry CurEntry = {};
StringRef CurStrSection;
SmallVector<SmallString<32>, 4> UncompressedSections;
- for (const auto &Section : ErrOrObj->getBinary()->sections()) {
+ for (const auto &Section : Obj.sections()) {
if (Section.isBSS())
continue;
if (Section.isVirtual())
if (!CurCUIndexSection.empty()) {
DWARFUnitIndex CUIndex(DW_SECT_INFO);
- DataExtractor CUIndexData(CurCUIndexSection,
- ErrOrObj->getBinary()->isLittleEndian(), 0);
+ DataExtractor CUIndexData(CurCUIndexSection, Obj.isLittleEndian(), 0);
if (!CUIndex.parse(CUIndexData))
return make_error_code(std::errc::invalid_argument);
if (CurTUIndexSection.empty())
return make_error_code(std::errc::invalid_argument);
DWARFUnitIndex TUIndex(DW_SECT_TYPES);
- DataExtractor TUIndexData(CurTUIndexSection,
- ErrOrObj->getBinary()->isLittleEndian(), 0);
+ DataExtractor TUIndexData(CurTUIndexSection, Obj.isLittleEndian(), 0);
if (!TUIndex.parse(TUIndexData))
return make_error_code(std::errc::invalid_argument);
addAllTypesFromDWP(Out, TypeIndexEntries, TUIndex, TypesSection,
writeIndex(Out, MCOFI.getDwarfCUIndexSection(), ContributionOffsets,
IndexEntries);
-
+ Out.Finish();
return std::error_code();
}
if (auto Err = write(*MS, InputFiles))
return error(Err.message(), "Writing DWP file");
-
- MS->Finish();
}