Revert r296215, "[PDB] General improvements to Stream library." and followings.
r296215, "[PDB] General improvements to Stream library."
r296217, "Disable BinaryStreamTest.StreamReaderObject temporarily."
r296220, "Re-enable BinaryStreamTest.StreamReaderObject."
r296244, "[PDB] Disable some tests that are breaking bots."
r296249, "Add static_cast to silence -Wc++11-narrowing."
std::errc::no_buffer_space should be used for OS-oriented errors for socket transmission.
(Seek discussions around llvm/xray.)
I could substitute s/no_buffer_space/others/g, but I revert whole them ATM.
Could we define and use LLVM errors there?
llvm-svn: 296258
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
index 51a868f..d816943 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 @@
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() = 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 @@
"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 @@
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 @@
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 @@
// 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 @@
"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 @@
"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 @@
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 @@
return Error::success();
const FileInfoSubstreamHeader *FH;
- BinaryStreamReader FISR(FileInfoSubstream);
+ StreamReader FISR(FileInfoSubstream);
if (auto EC = FISR.readObject(FH))
return EC;
@@ -413,14 +411,14 @@
}
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;
}