diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h b/llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h index a497956000283..c4d35438541a4 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h @@ -51,9 +51,9 @@ class GSIStreamBuilder { Error commit(const msf::MSFLayout &Layout, WritableBinaryStreamRef Buffer); - uint32_t getPublicsStreamIndex() const; - uint32_t getGlobalsStreamIndex() const; - uint32_t getRecordStreamIdx() const { return RecordStreamIdx; } + uint32_t getPublicsStreamIndex() const { return PublicsStreamIndex; } + uint32_t getGlobalsStreamIndex() const { return GlobalsStreamIndex; } + uint32_t getRecordStreamIndex() const { return RecordStreamIndex; } void addPublicSymbol(const codeview::PublicSym32 &Pub); @@ -69,7 +69,9 @@ class GSIStreamBuilder { Error commitPublicsHashStream(WritableBinaryStreamRef Stream); Error commitGlobalsHashStream(WritableBinaryStreamRef Stream); - uint32_t RecordStreamIdx = kInvalidStreamIndex; + uint32_t PublicsStreamIndex = kInvalidStreamIndex; + uint32_t GlobalsStreamIndex = kInvalidStreamIndex; + uint32_t RecordStreamIndex = kInvalidStreamIndex; msf::MSFBuilder &Msf; std::unique_ptr PSH; std::unique_ptr GSH; diff --git a/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp index 88eab574d0f77..d35c656e71724 100644 --- a/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp @@ -49,7 +49,6 @@ struct llvm::pdb::GSIHashStreamBuilder { }; std::vector Records; - uint32_t StreamIndex; llvm::DenseSet SymbolHashes; std::vector HashRecords; std::array HashBitmap; @@ -213,11 +212,12 @@ Error GSIStreamBuilder::finalizeMsfLayout() { Expected Idx = Msf.addStream(calculateGlobalsHashStreamSize()); if (!Idx) return Idx.takeError(); - GSH->StreamIndex = *Idx; + GlobalsStreamIndex = *Idx; + Idx = Msf.addStream(calculatePublicsHashStreamSize()); if (!Idx) return Idx.takeError(); - PSH->StreamIndex = *Idx; + PublicsStreamIndex = *Idx; uint32_t RecordBytes = GSH->calculateRecordByteSize() + PSH->calculateRecordByteSize(); @@ -225,7 +225,7 @@ Error GSIStreamBuilder::finalizeMsfLayout() { Idx = Msf.addStream(RecordBytes); if (!Idx) return Idx.takeError(); - RecordStreamIdx = *Idx; + RecordStreamIndex = *Idx; return Error::success(); } @@ -286,14 +286,6 @@ static std::vector computeAddrMap(ArrayRef Records) { return AddrMap; } -uint32_t GSIStreamBuilder::getPublicsStreamIndex() const { - return PSH->StreamIndex; -} - -uint32_t GSIStreamBuilder::getGlobalsStreamIndex() const { - return GSH->StreamIndex; -} - void GSIStreamBuilder::addPublicSymbol(const PublicSym32 &Pub) { PSH->addSymbol(Pub, Msf); } @@ -377,7 +369,7 @@ Error GSIStreamBuilder::commit(const msf::MSFLayout &Layout, auto PS = WritableMappedBlockStream::createIndexedStream( Layout, Buffer, getPublicsStreamIndex(), Msf.getAllocator()); auto PRS = WritableMappedBlockStream::createIndexedStream( - Layout, Buffer, getRecordStreamIdx(), Msf.getAllocator()); + Layout, Buffer, getRecordStreamIndex(), Msf.getAllocator()); if (auto EC = commitSymbolRecordStream(*PRS)) return EC; diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp index d6f7e28b839ef..d6a187ebb9f6a 100644 --- a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp @@ -144,7 +144,7 @@ Error PDBFileBuilder::finalizeMsfLayout() { if (Dbi) { Dbi->setPublicsStreamIndex(Gsi->getPublicsStreamIndex()); Dbi->setGlobalsStreamIndex(Gsi->getGlobalsStreamIndex()); - Dbi->setSymbolRecordStreamIndex(Gsi->getRecordStreamIdx()); + Dbi->setSymbolRecordStreamIndex(Gsi->getRecordStreamIndex()); } } if (Tpi) {