[llvm] b7438c2 - [PDB] Move stream index tracking to GSIStreamBuilder
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon May 4 20:56:21 PDT 2020
Author: Reid Kleckner
Date: 2020-05-04T20:51:09-07:00
New Revision: b7438c25eace5ecdb5ec87a23dd2a587d8ae7572
URL: https://github.com/llvm/llvm-project/commit/b7438c25eace5ecdb5ec87a23dd2a587d8ae7572
DIFF: https://github.com/llvm/llvm-project/commit/b7438c25eace5ecdb5ec87a23dd2a587d8ae7572.diff
LOG: [PDB] Move stream index tracking to GSIStreamBuilder
The GSIHashStreamBuilder doesn't need to know the stream index.
Standardize the naming (Idx -> Index in public APIs).
Added:
Modified:
llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h
llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h b/llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h
index a49795600028..c4d35438541a 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<GSIHashStreamBuilder> PSH;
std::unique_ptr<GSIHashStreamBuilder> GSH;
diff --git a/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
index 88eab574d0f7..d35c656e7172 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<CVSymbol> Records;
- uint32_t StreamIndex;
llvm::DenseSet<CVSymbol, SymbolDenseMapInfo> SymbolHashes;
std::vector<PSHashRecord> HashRecords;
std::array<support::ulittle32_t, (IPHR_HASH + 32) / 32> HashBitmap;
@@ -213,11 +212,12 @@ Error GSIStreamBuilder::finalizeMsfLayout() {
Expected<uint32_t> 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<ulittle32_t> computeAddrMap(ArrayRef<CVSymbol> 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 d6f7e28b839e..d6a187ebb9f6 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) {
More information about the llvm-commits
mailing list