@@ -58,10 +58,6 @@ void DbiStreamBuilder::setMachineType(COFF::MachineTypes M) {
5858 MachineType = static_cast <pdb::PDB_Machine>(static_cast <unsigned >(M));
5959}
6060
61- void DbiStreamBuilder::setSectionMap (ArrayRef<SecMapEntry> SecMap) {
62- SectionMap = SecMap;
63- }
64-
6561void DbiStreamBuilder::setGlobalsStreamIndex (uint32_t Index) {
6662 GlobalsStreamIndex = Index;
6763}
@@ -348,19 +344,18 @@ static uint16_t toSecMapFlags(uint32_t Flags) {
348344 return Ret;
349345}
350346
351- // A utility function to create a Section Map for a given list of COFF sections .
347+ // Populate the Section Map from COFF section headers .
352348//
353349// A Section Map seem to be a copy of a COFF section list in other format.
354350// I don't know why a PDB file contains both a COFF section header and
355351// a Section Map, but it seems it must be present in a PDB.
356- std::vector<SecMapEntry> DbiStreamBuilder::createSectionMap (
352+ void DbiStreamBuilder::createSectionMap (
357353 ArrayRef<llvm::object::coff_section> SecHdrs) {
358- std::vector<SecMapEntry> Ret;
359354 int Idx = 0 ;
360355
361356 auto Add = [&]() -> SecMapEntry & {
362- Ret .emplace_back ();
363- auto &Entry = Ret .back ();
357+ SectionMap .emplace_back ();
358+ auto &Entry = SectionMap .back ();
364359 memset (&Entry, 0 , sizeof (Entry));
365360
366361 Entry.Frame = Idx + 1 ;
@@ -384,8 +379,6 @@ std::vector<SecMapEntry> DbiStreamBuilder::createSectionMap(
384379 Entry.Flags = static_cast <uint16_t >(OMFSegDescFlags::AddressIs32Bit) |
385380 static_cast <uint16_t >(OMFSegDescFlags::IsAbsoluteAddress);
386381 Entry.SecByteLength = UINT32_MAX;
387-
388- return Ret;
389382}
390383
391384Error DbiStreamBuilder::commit (const msf::MSFLayout &Layout,
@@ -417,7 +410,7 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
417410 SecMapHeader SMHeader = {Size, Size};
418411 if (auto EC = Writer.writeObject (SMHeader))
419412 return EC;
420- if (auto EC = Writer.writeArray (SectionMap))
413+ if (auto EC = Writer.writeArray (makeArrayRef ( SectionMap) ))
421414 return EC;
422415 }
423416
0 commit comments