diff options
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp index 51a868f8770..d8169434143 100644 --- a/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp @@ -10,8 +10,6 @@ #include "llvm/DebugInfo/PDB/Native/DbiStream.h" #include "llvm/ADT/StringRef.h" #include "llvm/DebugInfo/MSF/BinaryStreamArray.h" -#include "llvm/DebugInfo/MSF/BinaryStreamArray.h" -#include "llvm/DebugInfo/MSF/BinaryStreamReader.h" #include "llvm/DebugInfo/MSF/BinaryStreamReader.h" #include "llvm/DebugInfo/MSF/MappedBlockStream.h" #include "llvm/DebugInfo/PDB/Native/ISectionContribVisitor.h" @@ -36,7 +34,7 @@ using namespace llvm::support; template <typename ContribType> static Error loadSectionContribs(FixedStreamArray<ContribType> &Output, - BinaryStreamReader &Reader) { + StreamReader &Reader) { if (Reader.bytesRemaining() % sizeof(ContribType) != 0) return make_error<RawError>( raw_error_code::corrupt_file, @@ -54,7 +52,7 @@ DbiStream::DbiStream(PDBFile &File, std::unique_ptr<MappedBlockStream> Stream) DbiStream::~DbiStream() = default; Error DbiStream::reload() { - BinaryStreamReader Reader(*Stream); + StreamReader Reader(*Stream); if (Stream->getLength() < sizeof(DbiStreamHeader)) return make_error<RawError>(raw_error_code::corrupt_file, @@ -147,7 +145,7 @@ Error DbiStream::reload() { "Found unexpected bytes in DBI Stream."); if (ECSubstream.getLength() > 0) { - BinaryStreamReader ECReader(ECSubstream); + StreamReader ECReader(ECSubstream); if (auto EC = ECNames.load(ECReader)) return EC; } @@ -209,16 +207,16 @@ PDB_Machine DbiStream::getMachineType() const { return static_cast<PDB_Machine>(Machine); } -FixedStreamArray<object::coff_section> DbiStream::getSectionHeaders() { +msf::FixedStreamArray<object::coff_section> DbiStream::getSectionHeaders() { return SectionHeaders; } -FixedStreamArray<object::FpoData> DbiStream::getFpoRecords() { +msf::FixedStreamArray<object::FpoData> DbiStream::getFpoRecords() { return FpoRecords; } ArrayRef<ModuleInfoEx> DbiStream::modules() const { return ModuleInfos; } -FixedStreamArray<SecMapEntry> DbiStream::getSectionMap() const { +msf::FixedStreamArray<SecMapEntry> DbiStream::getSectionMap() const { return SectionMap; } @@ -237,8 +235,8 @@ Error DbiStream::initializeSectionContributionData() { if (SecContrSubstream.getLength() == 0) return Error::success(); - BinaryStreamReader SCReader(SecContrSubstream); - if (auto EC = SCReader.readEnum(SectionContribVersion)) + StreamReader SCReader(SecContrSubstream); + if (auto EC = SCReader.readEnum(SectionContribVersion, llvm::support::little)) return EC; if (SectionContribVersion == DbiSecContribVer60) @@ -256,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. - BinaryStreamReader Reader(ModInfoSubstream); + StreamReader Reader(ModInfoSubstream); VarStreamArray<ModInfo> ModInfoArray; if (auto EC = Reader.readArray(ModInfoArray, ModInfoSubstream.getLength())) @@ -286,7 +284,7 @@ Error DbiStream::initializeSectionHeadersData() { "Corrupted section header stream."); size_t NumSections = StreamLen / sizeof(object::coff_section); - BinaryStreamReader Reader(*SHS); + msf::StreamReader Reader(*SHS); if (auto EC = Reader.readArray(SectionHeaders, NumSections)) return make_error<RawError>(raw_error_code::corrupt_file, "Could not read a bitmap."); @@ -318,7 +316,7 @@ Error DbiStream::initializeFpoRecords() { "Corrupted New FPO stream."); size_t NumRecords = StreamLen / sizeof(object::FpoData); - BinaryStreamReader Reader(*FS); + msf::StreamReader Reader(*FS); if (auto EC = Reader.readArray(FpoRecords, NumRecords)) return make_error<RawError>(raw_error_code::corrupt_file, "Corrupted New FPO stream."); @@ -330,7 +328,7 @@ Error DbiStream::initializeSectionMapData() { if (SecMapSubstream.getLength() == 0) return Error::success(); - BinaryStreamReader SMReader(SecMapSubstream); + StreamReader SMReader(SecMapSubstream); const SecMapHeader *Header; if (auto EC = SMReader.readObject(Header)) return EC; @@ -344,7 +342,7 @@ Error DbiStream::initializeFileInfo() { return Error::success(); const FileInfoSubstreamHeader *FH; - BinaryStreamReader FISR(FileInfoSubstream); + StreamReader FISR(FileInfoSubstream); if (auto EC = FISR.readObject(FH)) return EC; @@ -413,14 +411,14 @@ uint32_t DbiStream::getDebugStreamIndex(DbgHeaderType Type) const { } Expected<StringRef> DbiStream::getFileNameForIndex(uint32_t Index) const { - BinaryStreamReader Names(NamesBuffer); + StreamReader 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.readCString(Name)) + if (auto EC = Names.readZeroString(Name)) return std::move(EC); return Name; } |