summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/PDB')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp28
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp31
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/GSI.cpp12
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/GSI.h16
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp2
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/HashTable.cpp8
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp2
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp4
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/ModInfo.cpp9
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/ModStream.cpp6
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp13
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp12
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp6
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp2
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/StringTable.cpp7
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp4
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp2
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp4
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp10
19 files changed, 87 insertions, 91 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
index d8169434143..06c34325a57 100644
--- a/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
@@ -34,7 +34,7 @@ using namespace llvm::support;
template <typename ContribType>
static Error loadSectionContribs(FixedStreamArray<ContribType> &Output,
- StreamReader &Reader) {
+ BinaryStreamReader &Reader) {
if (Reader.bytesRemaining() % sizeof(ContribType) != 0)
return make_error<RawError>(
raw_error_code::corrupt_file,
@@ -52,7 +52,7 @@ DbiStream::DbiStream(PDBFile &File, std::unique_ptr<MappedBlockStream> Stream)
DbiStream::~DbiStream() = default;
Error DbiStream::reload() {
- StreamReader Reader(*Stream);
+ BinaryStreamReader Reader(*Stream);
if (Stream->getLength() < sizeof(DbiStreamHeader))
return make_error<RawError>(raw_error_code::corrupt_file,
@@ -145,7 +145,7 @@ Error DbiStream::reload() {
"Found unexpected bytes in DBI Stream.");
if (ECSubstream.getLength() > 0) {
- StreamReader ECReader(ECSubstream);
+ BinaryStreamReader ECReader(ECSubstream);
if (auto EC = ECNames.load(ECReader))
return EC;
}
@@ -207,16 +207,16 @@ PDB_Machine DbiStream::getMachineType() const {
return static_cast<PDB_Machine>(Machine);
}
-msf::FixedStreamArray<object::coff_section> DbiStream::getSectionHeaders() {
+FixedStreamArray<object::coff_section> DbiStream::getSectionHeaders() {
return SectionHeaders;
}
-msf::FixedStreamArray<object::FpoData> DbiStream::getFpoRecords() {
+FixedStreamArray<object::FpoData> DbiStream::getFpoRecords() {
return FpoRecords;
}
ArrayRef<ModuleInfoEx> DbiStream::modules() const { return ModuleInfos; }
-msf::FixedStreamArray<SecMapEntry> DbiStream::getSectionMap() const {
+FixedStreamArray<SecMapEntry> DbiStream::getSectionMap() const {
return SectionMap;
}
@@ -235,7 +235,7 @@ Error DbiStream::initializeSectionContributionData() {
if (SecContrSubstream.getLength() == 0)
return Error::success();
- StreamReader SCReader(SecContrSubstream);
+ BinaryStreamReader SCReader(SecContrSubstream);
if (auto EC = SCReader.readEnum(SectionContribVersion, llvm::support::little))
return EC;
@@ -254,7 +254,7 @@ Error DbiStream::initializeModInfoArray() {
// Since each ModInfo in the stream is a variable length, we have to iterate
// them to know how many there actually are.
- StreamReader Reader(ModInfoSubstream);
+ BinaryStreamReader Reader(ModInfoSubstream);
VarStreamArray<ModInfo> ModInfoArray;
if (auto EC = Reader.readArray(ModInfoArray, ModInfoSubstream.getLength()))
@@ -284,7 +284,7 @@ Error DbiStream::initializeSectionHeadersData() {
"Corrupted section header stream.");
size_t NumSections = StreamLen / sizeof(object::coff_section);
- msf::StreamReader Reader(*SHS);
+ BinaryStreamReader Reader(*SHS);
if (auto EC = Reader.readArray(SectionHeaders, NumSections))
return make_error<RawError>(raw_error_code::corrupt_file,
"Could not read a bitmap.");
@@ -316,7 +316,7 @@ Error DbiStream::initializeFpoRecords() {
"Corrupted New FPO stream.");
size_t NumRecords = StreamLen / sizeof(object::FpoData);
- msf::StreamReader Reader(*FS);
+ BinaryStreamReader Reader(*FS);
if (auto EC = Reader.readArray(FpoRecords, NumRecords))
return make_error<RawError>(raw_error_code::corrupt_file,
"Corrupted New FPO stream.");
@@ -328,7 +328,7 @@ Error DbiStream::initializeSectionMapData() {
if (SecMapSubstream.getLength() == 0)
return Error::success();
- StreamReader SMReader(SecMapSubstream);
+ BinaryStreamReader SMReader(SecMapSubstream);
const SecMapHeader *Header;
if (auto EC = SMReader.readObject(Header))
return EC;
@@ -342,7 +342,7 @@ Error DbiStream::initializeFileInfo() {
return Error::success();
const FileInfoSubstreamHeader *FH;
- StreamReader FISR(FileInfoSubstream);
+ BinaryStreamReader FISR(FileInfoSubstream);
if (auto EC = FISR.readObject(FH))
return EC;
@@ -411,14 +411,14 @@ uint32_t DbiStream::getDebugStreamIndex(DbgHeaderType Type) const {
}
Expected<StringRef> DbiStream::getFileNameForIndex(uint32_t Index) const {
- StreamReader Names(NamesBuffer);
+ BinaryStreamReader Names(NamesBuffer);
if (Index >= FileNameOffsets.size())
return make_error<RawError>(raw_error_code::index_out_of_bounds);
uint32_t FileOffset = FileNameOffsets[Index];
Names.setOffset(FileOffset);
StringRef Name;
- if (auto EC = Names.readZeroString(Name))
+ if (auto EC = Names.readCString(Name))
return std::move(EC);
return Name;
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
index 60687ac23b0..f8d44320889 100644
--- a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
@@ -153,18 +153,18 @@ Error DbiStreamBuilder::generateModiSubstream() {
uint32_t Size = calculateModiSubstreamSize();
auto Data = Allocator.Allocate<uint8_t>(Size);
- ModInfoBuffer = MutableByteStream(MutableArrayRef<uint8_t>(Data, Size));
+ ModInfoBuffer = MutableBinaryByteStream(MutableArrayRef<uint8_t>(Data, Size));
- StreamWriter ModiWriter(ModInfoBuffer);
+ BinaryStreamWriter ModiWriter(ModInfoBuffer);
for (const auto &M : ModuleInfoList) {
ModuleInfoHeader Layout = {};
Layout.ModDiStream = kInvalidStreamIndex;
Layout.NumFiles = M->SourceFiles.size();
if (auto EC = ModiWriter.writeObject(Layout))
return EC;
- if (auto EC = ModiWriter.writeZeroString(M->Mod))
+ if (auto EC = ModiWriter.writeCString(M->Mod))
return EC;
- if (auto EC = ModiWriter.writeZeroString(M->Obj))
+ if (auto EC = ModiWriter.writeCString(M->Obj))
return EC;
}
if (ModiWriter.bytesRemaining() > sizeof(uint32_t))
@@ -179,11 +179,12 @@ Error DbiStreamBuilder::generateFileInfoSubstream() {
auto Data = Allocator.Allocate<uint8_t>(Size);
uint32_t NamesOffset = Size - NameSize;
- FileInfoBuffer = MutableByteStream(MutableArrayRef<uint8_t>(Data, Size));
+ FileInfoBuffer =
+ MutableBinaryByteStream(MutableArrayRef<uint8_t>(Data, Size));
- WritableStreamRef MetadataBuffer =
- WritableStreamRef(FileInfoBuffer).keep_front(NamesOffset);
- StreamWriter MetadataWriter(MetadataBuffer);
+ WritableBinaryStreamRef MetadataBuffer =
+ WritableBinaryStreamRef(FileInfoBuffer).keep_front(NamesOffset);
+ BinaryStreamWriter MetadataWriter(MetadataBuffer);
uint16_t ModiCount = std::min<uint32_t>(UINT16_MAX, ModuleInfos.size());
uint16_t FileCount = std::min<uint32_t>(UINT16_MAX, SourceFileNames.size());
@@ -209,11 +210,11 @@ Error DbiStreamBuilder::generateFileInfoSubstream() {
// A side effect of this is that this will actually compute the various
// file name offsets, so we can then go back and write the FileNameOffsets
// array to the other substream.
- NamesBuffer = WritableStreamRef(FileInfoBuffer).drop_front(NamesOffset);
- StreamWriter NameBufferWriter(NamesBuffer);
+ NamesBuffer = WritableBinaryStreamRef(FileInfoBuffer).drop_front(NamesOffset);
+ BinaryStreamWriter NameBufferWriter(NamesBuffer);
for (auto &Name : SourceFileNames) {
Name.second = NameBufferWriter.getOffset();
- if (auto EC = NameBufferWriter.writeZeroString(Name.getKey()))
+ if (auto EC = NameBufferWriter.writeCString(Name.getKey()))
return EC;
}
@@ -363,14 +364,14 @@ std::vector<SecMapEntry> DbiStreamBuilder::createSectionMap(
}
Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
- const msf::WritableStream &Buffer) {
+ WritableBinaryStreamRef Buffer) {
if (auto EC = finalize())
return EC;
auto InfoS =
WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StreamDBI);
- StreamWriter Writer(*InfoS);
+ BinaryStreamWriter Writer(*InfoS);
if (auto EC = Writer.writeObject(*Header))
return EC;
@@ -404,9 +405,9 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
for (auto &Stream : DbgStreams) {
if (Stream.StreamNumber == kInvalidStreamIndex)
continue;
- auto WritableStream = WritableMappedBlockStream::createIndexedStream(
+ auto WritableBinaryStream = WritableMappedBlockStream::createIndexedStream(
Layout, Buffer, Stream.StreamNumber);
- StreamWriter DbgStreamWriter(*WritableStream);
+ BinaryStreamWriter DbgStreamWriter(*WritableBinaryStream);
if (auto EC = DbgStreamWriter.writeArray(Stream.Data))
return EC;
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/GSI.cpp b/llvm/lib/DebugInfo/PDB/Native/GSI.cpp
index 5a727910e20..3a7e1e1529f 100644
--- a/llvm/lib/DebugInfo/PDB/Native/GSI.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/GSI.cpp
@@ -28,9 +28,9 @@ static Error checkHashHdrVersion(const GSIHashHeader *HashHdr) {
return Error::success();
}
-Error readGSIHashBuckets(
- msf::FixedStreamArray<support::ulittle32_t> &HashBuckets,
- const GSIHashHeader *HashHdr, msf::StreamReader &Reader) {
+Error readGSIHashBuckets(FixedStreamArray<support::ulittle32_t> &HashBuckets,
+ const GSIHashHeader *HashHdr,
+ BinaryStreamReader &Reader) {
if (auto EC = checkHashHdrVersion(HashHdr))
return EC;
@@ -57,7 +57,7 @@ Error readGSIHashBuckets(
}
Error readGSIHashHeader(const GSIHashHeader *&HashHdr,
- msf::StreamReader &Reader) {
+ BinaryStreamReader &Reader) {
if (Reader.readObject(HashHdr))
return make_error<RawError>(raw_error_code::corrupt_file,
"Stream does not contain a GSIHashHeader.");
@@ -70,9 +70,9 @@ Error readGSIHashHeader(const GSIHashHeader *&HashHdr,
return Error::success();
}
-Error readGSIHashRecords(msf::FixedStreamArray<PSHashRecord> &HashRecords,
+Error readGSIHashRecords(FixedStreamArray<PSHashRecord> &HashRecords,
const GSIHashHeader *HashHdr,
- msf::StreamReader &Reader) {
+ BinaryStreamReader &Reader) {
if (auto EC = checkHashHdrVersion(HashHdr))
return EC;
diff --git a/llvm/lib/DebugInfo/PDB/Native/GSI.h b/llvm/lib/DebugInfo/PDB/Native/GSI.h
index 5c5596c0484..f47321a2f14 100644
--- a/llvm/lib/DebugInfo/PDB/Native/GSI.h
+++ b/llvm/lib/DebugInfo/PDB/Native/GSI.h
@@ -33,9 +33,7 @@
namespace llvm {
-namespace msf {
-class StreamReader;
-}
+class BinaryStreamReader;
namespace pdb {
@@ -56,14 +54,14 @@ struct GSIHashHeader {
support::ulittle32_t NumBuckets;
};
-Error readGSIHashBuckets(
- msf::FixedStreamArray<support::ulittle32_t> &HashBuckets,
- const GSIHashHeader *HashHdr, msf::StreamReader &Reader);
+Error readGSIHashBuckets(FixedStreamArray<support::ulittle32_t> &HashBuckets,
+ const GSIHashHeader *HashHdr,
+ BinaryStreamReader &Reader);
Error readGSIHashHeader(const GSIHashHeader *&HashHdr,
- msf::StreamReader &Reader);
-Error readGSIHashRecords(msf::FixedStreamArray<PSHashRecord> &HashRecords,
+ BinaryStreamReader &Reader);
+Error readGSIHashRecords(FixedStreamArray<PSHashRecord> &HashRecords,
const GSIHashHeader *HashHdr,
- msf::StreamReader &Reader);
+ BinaryStreamReader &Reader);
}
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp b/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
index d5c80ba42b5..7d6d39d43d2 100644
--- a/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
@@ -23,7 +23,7 @@ GlobalsStream::GlobalsStream(std::unique_ptr<MappedBlockStream> Stream)
GlobalsStream::~GlobalsStream() = default;
Error GlobalsStream::reload() {
- StreamReader Reader(*Stream);
+ BinaryStreamReader Reader(*Stream);
const GSIHashHeader *HashHdr;
if (auto EC = readGSIHashHeader(HashHdr, Reader))
diff --git a/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp b/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
index dd95c078d7e..535799706c8 100644
--- a/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
@@ -22,7 +22,7 @@ HashTable::HashTable() : HashTable(8) {}
HashTable::HashTable(uint32_t Capacity) { Buckets.resize(Capacity); }
-Error HashTable::load(msf::StreamReader &Stream) {
+Error HashTable::load(BinaryStreamReader &Stream) {
const Header *H;
if (auto EC = Stream.readObject(H))
return EC;
@@ -77,7 +77,7 @@ uint32_t HashTable::calculateSerializedLength() const {
return Size;
}
-Error HashTable::commit(msf::StreamWriter &Writer) const {
+Error HashTable::commit(BinaryStreamWriter &Writer) const {
Header H;
H.Size = size();
H.Capacity = capacity();
@@ -209,7 +209,7 @@ void HashTable::grow() {
assert(size() == S);
}
-Error HashTable::readSparseBitVector(msf::StreamReader &Stream,
+Error HashTable::readSparseBitVector(BinaryStreamReader &Stream,
SparseBitVector<> &V) {
uint32_t NumWords;
if (auto EC = Stream.readInteger(NumWords, llvm::support::little))
@@ -231,7 +231,7 @@ Error HashTable::readSparseBitVector(msf::StreamReader &Stream,
return Error::success();
}
-Error HashTable::writeSparseBitVector(msf::StreamWriter &Writer,
+Error HashTable::writeSparseBitVector(BinaryStreamWriter &Writer,
SparseBitVector<> &Vec) {
int ReqBits = Vec.find_last() + 1;
uint32_t NumWords = alignTo(ReqBits, sizeof(uint32_t)) / sizeof(uint32_t);
diff --git a/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp b/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp
index 692099256d8..9c4fca7aa5e 100644
--- a/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/InfoStream.cpp
@@ -26,7 +26,7 @@ InfoStream::InfoStream(std::unique_ptr<MappedBlockStream> Stream)
: Stream(std::move(Stream)) {}
Error InfoStream::reload() {
- StreamReader Reader(*Stream);
+ BinaryStreamReader Reader(*Stream);
const InfoStreamHeader *H;
if (auto EC = Reader.readObject(H))
diff --git a/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
index 0b6a563b5a9..a6d9066cf1d 100644
--- a/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
@@ -44,10 +44,10 @@ Error InfoStreamBuilder::finalizeMsfLayout() {
}
Error InfoStreamBuilder::commit(const msf::MSFLayout &Layout,
- const msf::WritableStream &Buffer) const {
+ WritableBinaryStreamRef Buffer) const {
auto InfoS =
WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StreamPDB);
- StreamWriter Writer(*InfoS);
+ BinaryStreamWriter Writer(*InfoS);
InfoStreamHeader H;
H.Age = Age;
diff --git a/llvm/lib/DebugInfo/PDB/Native/ModInfo.cpp b/llvm/lib/DebugInfo/PDB/Native/ModInfo.cpp
index 501188e96f6..5e229663844 100644
--- a/llvm/lib/DebugInfo/PDB/Native/ModInfo.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/ModInfo.cpp
@@ -16,7 +16,6 @@
#include <cstdint>
using namespace llvm;
-using namespace llvm::msf;
using namespace llvm::pdb;
using namespace llvm::support;
@@ -26,15 +25,15 @@ ModInfo::ModInfo(const ModInfo &Info) = default;
ModInfo::~ModInfo() = default;
-Error ModInfo::initialize(ReadableStreamRef Stream, ModInfo &Info) {
- StreamReader Reader(Stream);
+Error ModInfo::initialize(BinaryStreamRef Stream, ModInfo &Info) {
+ BinaryStreamReader Reader(Stream);
if (auto EC = Reader.readObject(Info.Layout))
return EC;
- if (auto EC = Reader.readZeroString(Info.ModuleName))
+ if (auto EC = Reader.readCString(Info.ModuleName))
return EC;
- if (auto EC = Reader.readZeroString(Info.ObjFileName))
+ if (auto EC = Reader.readCString(Info.ObjFileName))
return EC;
return Error::success();
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp b/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp
index 9f035cf3e94..0c2d2c32c6e 100644
--- a/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp
@@ -31,7 +31,7 @@ ModStream::ModStream(const ModInfo &Module,
ModStream::~ModStream() = default;
Error ModStream::reload() {
- StreamReader Reader(*Stream);
+ BinaryStreamReader Reader(*Stream);
uint32_t SymbolSize = Mod.getSymbolDebugInfoByteSize();
uint32_t C11Size = Mod.getLineInfoByteSize();
@@ -41,7 +41,7 @@ Error ModStream::reload() {
return make_error<RawError>(raw_error_code::corrupt_file,
"Module has both C11 and C13 line info");
- ReadableStreamRef S;
+ BinaryStreamRef S;
if (auto EC = Reader.readInteger(Signature, llvm::support::little))
return EC;
@@ -53,7 +53,7 @@ Error ModStream::reload() {
if (auto EC = Reader.readStreamRef(C13LinesSubstream, C13Size))
return EC;
- StreamReader LineReader(C13LinesSubstream);
+ BinaryStreamReader LineReader(C13LinesSubstream);
if (auto EC = LineReader.readArray(LineInfo, LineReader.bytesRemaining()))
return EC;
diff --git a/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp b/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
index ceeca10c5c5..91cbf4bca07 100644
--- a/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
@@ -21,12 +21,11 @@
#include <cstdint>
using namespace llvm;
-using namespace llvm::msf;
using namespace llvm::pdb;
NamedStreamMap::NamedStreamMap() = default;
-Error NamedStreamMap::load(StreamReader &Stream) {
+Error NamedStreamMap::load(BinaryStreamReader &Stream) {
Mapping.clear();
FinalizedHashTable.clear();
FinalizedInfo.reset();
@@ -37,7 +36,7 @@ Error NamedStreamMap::load(StreamReader &Stream) {
make_error<RawError>(raw_error_code::corrupt_file,
"Expected string buffer size"));
- msf::ReadableStreamRef StringsBuffer;
+ BinaryStreamRef StringsBuffer;
if (auto EC = Stream.readStreamRef(StringsBuffer, StringBufferSize))
return EC;
@@ -51,11 +50,11 @@ Error NamedStreamMap::load(StreamReader &Stream) {
std::tie(NameOffset, NameIndex) = Entry;
// Compute the offset of the start of the string relative to the stream.
- msf::StreamReader NameReader(StringsBuffer);
+ BinaryStreamReader NameReader(StringsBuffer);
NameReader.setOffset(NameOffset);
// Pump out our c-string from the stream.
StringRef Str;
- if (auto EC = NameReader.readZeroString(Str))
+ if (auto EC = NameReader.readCString(Str))
return joinErrors(std::move(EC),
make_error<RawError>(raw_error_code::corrupt_file,
"Expected name map name"));
@@ -67,7 +66,7 @@ Error NamedStreamMap::load(StreamReader &Stream) {
return Error::success();
}
-Error NamedStreamMap::commit(msf::StreamWriter &Writer) const {
+Error NamedStreamMap::commit(BinaryStreamWriter &Writer) const {
assert(FinalizedInfo.hasValue());
// The first field is the number of bytes of string data.
@@ -77,7 +76,7 @@ Error NamedStreamMap::commit(msf::StreamWriter &Writer) const {
// Now all of the string data itself.
for (const auto &Item : Mapping) {
- if (auto EC = Writer.writeZeroString(Item.getKey()))
+ if (auto EC = Writer.writeCString(Item.getKey()))
return EC;
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
index e1cf9102773..a08ecd0487e 100644
--- a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
@@ -39,7 +39,7 @@ namespace {
typedef FixedStreamArray<support::ulittle32_t> ulittle_array;
} // end anonymous namespace
-PDBFile::PDBFile(StringRef Path, std::unique_ptr<ReadableStream> PdbFileBuffer,
+PDBFile::PDBFile(StringRef Path, std::unique_ptr<BinaryStream> PdbFileBuffer,
BumpPtrAllocator &Allocator)
: FilePath(Path), Allocator(Allocator), Buffer(std::move(PdbFileBuffer)) {}
@@ -113,7 +113,7 @@ Error PDBFile::setBlockData(uint32_t BlockIndex, uint32_t Offset,
}
Error PDBFile::parseFileHeaders() {
- StreamReader Reader(*Buffer);
+ BinaryStreamReader Reader(*Buffer);
// Initialize SB.
const msf::SuperBlock *SB = nullptr;
@@ -147,7 +147,7 @@ Error PDBFile::parseFileHeaders() {
// See the function fpmPn() for more information:
// https://github.com/Microsoft/microsoft-pdb/blob/master/PDB/msf/msf.cpp#L489
auto FpmStream = MappedBlockStream::createFpmStream(ContainerLayout, *Buffer);
- StreamReader FpmReader(*FpmStream);
+ BinaryStreamReader FpmReader(*FpmStream);
ArrayRef<uint8_t> FpmBytes;
if (auto EC = FpmReader.readBytes(FpmBytes,
msf::getFullFpmByteSize(ContainerLayout)))
@@ -185,7 +185,7 @@ Error PDBFile::parseStreamData() {
// subclass of IPDBStreamData which only accesses the fields that have already
// been parsed, we can avoid this and reuse MappedBlockStream.
auto DS = MappedBlockStream::createDirectoryStream(ContainerLayout, *Buffer);
- StreamReader Reader(*DS);
+ BinaryStreamReader Reader(*DS);
if (auto EC = Reader.readInteger(NumStreams, llvm::support::little))
return EC;
@@ -350,7 +350,7 @@ Expected<StringTable &> PDBFile::getStringTable() {
if (!NS)
return NS.takeError();
- StreamReader Reader(**NS);
+ BinaryStreamReader Reader(**NS);
auto N = llvm::make_unique<StringTable>();
if (auto EC = N->load(Reader))
return std::move(EC);
@@ -403,7 +403,7 @@ bool PDBFile::hasStringTable() {
/// contain the stream returned by createIndexedStream().
Expected<std::unique_ptr<MappedBlockStream>>
PDBFile::safelyCreateIndexedStream(const MSFLayout &Layout,
- const ReadableStream &MsfData,
+ BinaryStreamRef MsfData,
uint32_t StreamIndex) const {
if (StreamIndex >= getNumStreams())
return make_error<RawError>(raw_error_code::no_stream);
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
index fde61ddc650..104867d169b 100644
--- a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
@@ -119,7 +119,7 @@ Error PDBFileBuilder::commit(StringRef Filename) {
return llvm::make_error<pdb::GenericError>(generic_error_code::invalid_path,
Filename);
FileBufferByteStream Buffer(std::move(*OutFileOrError));
- StreamWriter Writer(Buffer);
+ BinaryStreamWriter Writer(Buffer);
if (auto EC = Writer.writeObject(*Layout.SB))
return EC;
@@ -131,7 +131,7 @@ Error PDBFileBuilder::commit(StringRef Filename) {
auto DirStream =
WritableMappedBlockStream::createDirectoryStream(Layout, Buffer);
- StreamWriter DW(*DirStream);
+ BinaryStreamWriter DW(*DirStream);
if (auto EC = DW.writeInteger<uint32_t>(Layout.StreamSizes.size(),
llvm::support::little))
return EC;
@@ -150,7 +150,7 @@ Error PDBFileBuilder::commit(StringRef Filename) {
auto NS = WritableMappedBlockStream::createIndexedStream(Layout, Buffer,
StringTableStreamNo);
- StreamWriter NSWriter(*NS);
+ BinaryStreamWriter NSWriter(*NS);
if (auto EC = Strings.commit(NSWriter))
return EC;
diff --git a/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp b/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp
index 57b77b8254d..921eeeed414 100644
--- a/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp
@@ -69,7 +69,7 @@ uint32_t PublicsStream::getAddrMap() const { return Header->AddrMap; }
// we skip over the hash table which we believe contains information about
// public symbols.
Error PublicsStream::reload() {
- StreamReader Reader(*Stream);
+ BinaryStreamReader Reader(*Stream);
// Check stream size.
if (Reader.bytesRemaining() < sizeof(HeaderInfo) + sizeof(GSIHashHeader))
diff --git a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp
index c81bff48191..e2b9ea20812 100644
--- a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp
@@ -17,13 +17,12 @@
#include "llvm/Support/Endian.h"
using namespace llvm;
-using namespace llvm::msf;
using namespace llvm::support;
using namespace llvm::pdb;
StringTable::StringTable() : Signature(0), HashVersion(0), NameCount(0) {}
-Error StringTable::load(StreamReader &Stream) {
+Error StringTable::load(BinaryStreamReader &Stream) {
const StringTableHeader *H;
if (auto EC = Stream.readObject(H))
return EC;
@@ -68,9 +67,9 @@ StringRef StringTable::getStringForID(uint32_t ID) const {
// the starting offset of the string we're looking for. So just seek into
// the desired offset and a read a null terminated stream from that offset.
StringRef Result;
- StreamReader NameReader(NamesBuffer);
+ BinaryStreamReader NameReader(NamesBuffer);
NameReader.setOffset(ID);
- if (auto EC = NameReader.readZeroString(Result))
+ if (auto EC = NameReader.readCString(Result))
consumeError(std::move(EC));
return Result;
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp
index 8fad775ecdc..5432fe4b99e 100644
--- a/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp
@@ -52,7 +52,7 @@ uint32_t StringTableBuilder::finalize() {
return Size;
}
-Error StringTableBuilder::commit(msf::StreamWriter &Writer) const {
+Error StringTableBuilder::commit(BinaryStreamWriter &Writer) const {
// Write a header
StringTableHeader H;
H.Signature = StringTableSignature;
@@ -67,7 +67,7 @@ Error StringTableBuilder::commit(msf::StreamWriter &Writer) const {
StringRef S = Pair.first;
uint32_t Offset = Pair.second;
Writer.setOffset(StringStart + Offset);
- if (auto EC = Writer.writeZeroString(S))
+ if (auto EC = Writer.writeCString(S))
return EC;
}
Writer.setOffset(StringStart + StringSize);
diff --git a/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp b/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp
index 3f0e07a99e1..2d351b05b0b 100644
--- a/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp
@@ -30,7 +30,7 @@ SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
SymbolStream::~SymbolStream() {}
Error SymbolStream::reload() {
- StreamReader Reader(*Stream);
+ BinaryStreamReader Reader(*Stream);
if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
return EC;
diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
index 8f9dd0a793b..ee655730273 100644
--- a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
@@ -54,7 +54,7 @@ Error TpiStream::verifyHashValues() {
}
Error TpiStream::reload() {
- StreamReader Reader(*Stream);
+ BinaryStreamReader Reader(*Stream);
if (Reader.bytesRemaining() < sizeof(TpiStreamHeader))
return make_error<RawError>(raw_error_code::corrupt_file,
@@ -93,7 +93,7 @@ Error TpiStream::reload() {
auto HS = MappedBlockStream::createIndexedStream(
Pdb.getMsfLayout(), Pdb.getMsfBuffer(), Header->HashStreamIndex);
- StreamReader HSR(*HS);
+ BinaryStreamReader HSR(*HS);
uint32_t NumHashValues =
Header->HashValueBuffer.Length / sizeof(ulittle32_t);
diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
index 29c1ec00fc7..49412b1f95a 100644
--- a/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
@@ -82,7 +82,7 @@ Error TpiStreamBuilder::finalize() {
return Error::success();
}
-uint32_t TpiStreamBuilder::calculateSerializedLength() const {
+uint32_t TpiStreamBuilder::calculateSerializedLength() {
return sizeof(TpiStreamHeader) + TypeRecordStream.getLength();
}
@@ -113,19 +113,19 @@ Error TpiStreamBuilder::finalizeMsfLayout() {
}
ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(HashBuffer.data()),
HashBufferSize);
- HashValueStream = llvm::make_unique<ByteStream>(Bytes);
+ HashValueStream = llvm::make_unique<BinaryByteStream>(Bytes);
return Error::success();
}
Error TpiStreamBuilder::commit(const msf::MSFLayout &Layout,
- const msf::WritableStream &Buffer) {
+ WritableBinaryStreamRef Buffer) {
if (auto EC = finalize())
return EC;
auto InfoS =
WritableMappedBlockStream::createIndexedStream(Layout, Buffer, Idx);
- StreamWriter Writer(*InfoS);
+ BinaryStreamWriter Writer(*InfoS);
if (auto EC = Writer.writeObject(*Header))
return EC;
@@ -136,7 +136,7 @@ Error TpiStreamBuilder::commit(const msf::MSFLayout &Layout,
if (HashStreamIndex != kInvalidStreamIndex) {
auto HVS = WritableMappedBlockStream::createIndexedStream(Layout, Buffer,
HashStreamIndex);
- StreamWriter HW(*HVS);
+ BinaryStreamWriter HW(*HVS);
if (auto EC = HW.writeStreamRef(*HashValueStream))
return EC;
}
OpenPOWER on IntegriCloud