[PDB] Make streams carry their own endianness.
Before the endianness was specified on each call to read
or write of the StreamReader / StreamWriter, but in practice
it's extremely rare for streams to have data encoded in
multiple different endiannesses, so we should optimize for the
99% use case.
This makes the code cleaner and more general, but otherwise
has NFC.
llvm-svn: 296415
diff --git a/llvm/lib/DebugInfo/CodeView/CVTypeDumper.cpp b/llvm/lib/DebugInfo/CodeView/CVTypeDumper.cpp
index 5e0ff63..a945169 100644
--- a/llvm/lib/DebugInfo/CodeView/CVTypeDumper.cpp
+++ b/llvm/lib/DebugInfo/CodeView/CVTypeDumper.cpp
@@ -56,7 +56,7 @@
}
Error CVTypeDumper::dump(ArrayRef<uint8_t> Data, TypeVisitorCallbacks &Dumper) {
- BinaryByteStream Stream(Data);
+ BinaryByteStream Stream(Data, llvm::support::little);
CVTypeArray Types;
BinaryStreamReader Reader(Stream);
if (auto EC = Reader.readArray(Types, Reader.getLength()))
diff --git a/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp b/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
index fa74062..74c60c7 100644
--- a/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
+++ b/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
@@ -182,7 +182,7 @@
TypeLeafKind Leaf;
while (!Reader.empty()) {
- if (auto EC = Reader.readEnum(Leaf, llvm::support::little))
+ if (auto EC = Reader.readEnum(Leaf))
return EC;
CVMemberRecord Record;
@@ -195,7 +195,7 @@
}
Error CVTypeVisitor::visitFieldListMemberStream(ArrayRef<uint8_t> Data) {
- BinaryByteStream S(Data);
+ BinaryByteStream S(Data, llvm::support::little);
BinaryStreamReader SR(S);
return visitFieldListMemberStream(SR);
}
diff --git a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
index 3b10f8f..a204d43 100644
--- a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
+++ b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
@@ -87,14 +87,13 @@
Error CodeViewRecordIO::mapInteger(TypeIndex &TypeInd) {
if (isWriting()) {
- if (auto EC =
- Writer->writeInteger(TypeInd.getIndex(), llvm::support::little))
+ if (auto EC = Writer->writeInteger(TypeInd.getIndex()))
return EC;
return Error::success();
}
uint32_t I;
- if (auto EC = Reader->readInteger(I, llvm::support::little))
+ if (auto EC = Reader->readInteger(I))
return EC;
TypeInd.setIndex(I);
return Error::success();
@@ -177,7 +176,7 @@
if (auto EC = mapStringZ(V))
return EC;
}
- if (auto EC = Writer->writeInteger<uint8_t>(0, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint8_t>(0))
return EC;
} else {
StringRef S;
@@ -195,28 +194,24 @@
Error CodeViewRecordIO::writeEncodedSignedInteger(const int64_t &Value) {
assert(Value < 0 && "Encoded integer is not signed!");
if (Value >= std::numeric_limits<int8_t>::min()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_CHAR, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_CHAR))
return EC;
- if (auto EC = Writer->writeInteger<int8_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<int8_t>(Value))
return EC;
} else if (Value >= std::numeric_limits<int16_t>::min()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_SHORT, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_SHORT))
return EC;
- if (auto EC = Writer->writeInteger<int16_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<int16_t>(Value))
return EC;
} else if (Value >= std::numeric_limits<int32_t>::min()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_LONG, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_LONG))
return EC;
- if (auto EC = Writer->writeInteger<int32_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<int32_t>(Value))
return EC;
} else {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_QUADWORD, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_QUADWORD))
return EC;
- if (auto EC = Writer->writeInteger(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger(Value))
return EC;
}
return Error::success();
@@ -224,25 +219,22 @@
Error CodeViewRecordIO::writeEncodedUnsignedInteger(const uint64_t &Value) {
if (Value < LF_NUMERIC) {
- if (auto EC = Writer->writeInteger<uint16_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(Value))
return EC;
} else if (Value <= std::numeric_limits<uint16_t>::max()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_USHORT, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_USHORT))
return EC;
- if (auto EC = Writer->writeInteger<uint16_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(Value))
return EC;
} else if (Value <= std::numeric_limits<uint32_t>::max()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_ULONG, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_ULONG))
return EC;
- if (auto EC = Writer->writeInteger<uint32_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint32_t>(Value))
return EC;
} else {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_UQUADWORD, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_UQUADWORD))
return EC;
- if (auto EC = Writer->writeInteger(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger(Value))
return EC;
}
diff --git a/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp b/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
index d276aa0..eaa70f2 100644
--- a/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
+++ b/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
@@ -37,7 +37,7 @@
// Used to avoid overload ambiguity on APInt construtor.
bool FalseVal = false;
uint16_t Short;
- if (auto EC = Reader.readInteger(Short, llvm::support::little))
+ if (auto EC = Reader.readInteger(Short))
return EC;
if (Short < LF_NUMERIC) {
@@ -49,49 +49,49 @@
switch (Short) {
case LF_CHAR: {
int8_t N;
- if (auto EC = Reader.readInteger(N, llvm::support::little))
+ if (auto EC = Reader.readInteger(N))
return EC;
Num = APSInt(APInt(8, N, true), false);
return Error::success();
}
case LF_SHORT: {
int16_t N;
- if (auto EC = Reader.readInteger(N, llvm::support::little))
+ if (auto EC = Reader.readInteger(N))
return EC;
Num = APSInt(APInt(16, N, true), false);
return Error::success();
}
case LF_USHORT: {
uint16_t N;
- if (auto EC = Reader.readInteger(N, llvm::support::little))
+ if (auto EC = Reader.readInteger(N))
return EC;
Num = APSInt(APInt(16, N, false), true);
return Error::success();
}
case LF_LONG: {
int32_t N;
- if (auto EC = Reader.readInteger(N, llvm::support::little))
+ if (auto EC = Reader.readInteger(N))
return EC;
Num = APSInt(APInt(32, N, true), false);
return Error::success();
}
case LF_ULONG: {
uint32_t N;
- if (auto EC = Reader.readInteger(N, llvm::support::little))
+ if (auto EC = Reader.readInteger(N))
return EC;
Num = APSInt(APInt(32, N, FalseVal), true);
return Error::success();
}
case LF_QUADWORD: {
int64_t N;
- if (auto EC = Reader.readInteger(N, llvm::support::little))
+ if (auto EC = Reader.readInteger(N))
return EC;
Num = APSInt(APInt(64, N, true), false);
return Error::success();
}
case LF_UQUADWORD: {
uint64_t N;
- if (auto EC = Reader.readInteger(N, llvm::support::little))
+ if (auto EC = Reader.readInteger(N))
return EC;
Num = APSInt(APInt(64, N, false), true);
return Error::success();
@@ -103,7 +103,7 @@
Error llvm::codeview::consume(StringRef &Data, APSInt &Num) {
ArrayRef<uint8_t> Bytes(Data.bytes_begin(), Data.bytes_end());
- BinaryByteStream S(Bytes);
+ BinaryByteStream S(Bytes, llvm::support::little);
BinaryStreamReader SR(S);
auto EC = consume(SR, Num);
Data = Data.take_back(SR.bytesRemaining());
@@ -124,12 +124,12 @@
}
Error llvm::codeview::consume(BinaryStreamReader &Reader, uint32_t &Item) {
- return Reader.readInteger(Item, llvm::support::little);
+ return Reader.readInteger(Item);
}
Error llvm::codeview::consume(StringRef &Data, uint32_t &Item) {
ArrayRef<uint8_t> Bytes(Data.bytes_begin(), Data.bytes_end());
- BinaryByteStream S(Bytes);
+ BinaryByteStream S(Bytes, llvm::support::little);
BinaryStreamReader SR(S);
auto EC = consume(SR, Item);
Data = Data.take_back(SR.bytesRemaining());
@@ -137,7 +137,7 @@
}
Error llvm::codeview::consume(BinaryStreamReader &Reader, int32_t &Item) {
- return Reader.readInteger(Item, llvm::support::little);
+ return Reader.readInteger(Item);
}
Error llvm::codeview::consume(BinaryStreamReader &Reader, StringRef &Item) {
diff --git a/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp b/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp
index 9074291..4d0ce9e 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp
@@ -76,7 +76,7 @@
int N = PaddingBytes;
while (PaddingBytes > 0) {
uint8_t Pad = static_cast<uint8_t>(LF_PAD0 + PaddingBytes);
- if (auto EC = Writer.writeInteger(Pad, llvm::support::little))
+ if (auto EC = Writer.writeInteger(Pad))
return std::move(EC);
--PaddingBytes;
}
@@ -85,7 +85,8 @@
TypeSerializer::TypeSerializer(BumpPtrAllocator &Storage)
: RecordStorage(Storage), LastTypeIndex(),
- RecordBuffer(MaxRecordLength * 2), Stream(RecordBuffer), Writer(Stream),
+ RecordBuffer(MaxRecordLength * 2),
+ Stream(RecordBuffer, llvm::support::little), Writer(Stream),
Mapping(Writer) {
// RecordBuffer needs to be able to hold enough data so that if we are 1
// byte short of MaxRecordLen, and then we try to write MaxRecordLen bytes,
@@ -203,15 +204,15 @@
uint8_t *SegmentBytes = RecordStorage.Allocate<uint8_t>(LengthWithSize);
auto SavedSegment = MutableArrayRef<uint8_t>(SegmentBytes, LengthWithSize);
- MutableBinaryByteStream CS(SavedSegment);
+ MutableBinaryByteStream CS(SavedSegment, llvm::support::little);
BinaryStreamWriter CW(CS);
if (auto EC = CW.writeBytes(CopyData))
return EC;
- if (auto EC = CW.writeEnum(TypeLeafKind::LF_INDEX, llvm::support::little))
+ if (auto EC = CW.writeEnum(TypeLeafKind::LF_INDEX))
return EC;
- if (auto EC = CW.writeInteger<uint16_t>(0, llvm::support::little))
+ if (auto EC = CW.writeInteger<uint16_t>(0))
return EC;
- if (auto EC = CW.writeInteger<uint32_t>(0xB0C0B0C0, llvm::support::little))
+ if (auto EC = CW.writeInteger<uint32_t>(0xB0C0B0C0))
return EC;
FieldListSegments.push_back(SavedSegment);
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
index 06c3432..6ad0c25 100644
--- a/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp
@@ -236,7 +236,7 @@
return Error::success();
BinaryStreamReader SCReader(SecContrSubstream);
- if (auto EC = SCReader.readEnum(SectionContribVersion, llvm::support::little))
+ if (auto EC = SCReader.readEnum(SectionContribVersion))
return EC;
if (SectionContribVersion == DbiSecContribVer60)
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
index f8d4432..2dbdceb 100644
--- a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
@@ -153,7 +153,8 @@
uint32_t Size = calculateModiSubstreamSize();
auto Data = Allocator.Allocate<uint8_t>(Size);
- ModInfoBuffer = MutableBinaryByteStream(MutableArrayRef<uint8_t>(Data, Size));
+ ModInfoBuffer = MutableBinaryByteStream(MutableArrayRef<uint8_t>(Data, Size),
+ llvm::support::little);
BinaryStreamWriter ModiWriter(ModInfoBuffer);
for (const auto &M : ModuleInfoList) {
@@ -179,8 +180,8 @@
auto Data = Allocator.Allocate<uint8_t>(Size);
uint32_t NamesOffset = Size - NameSize;
- FileInfoBuffer =
- MutableBinaryByteStream(MutableArrayRef<uint8_t>(Data, Size));
+ FileInfoBuffer = MutableBinaryByteStream(MutableArrayRef<uint8_t>(Data, Size),
+ llvm::support::little);
WritableBinaryStreamRef MetadataBuffer =
WritableBinaryStreamRef(FileInfoBuffer).keep_front(NamesOffset);
@@ -188,21 +189,17 @@
uint16_t ModiCount = std::min<uint32_t>(UINT16_MAX, ModuleInfos.size());
uint16_t FileCount = std::min<uint32_t>(UINT16_MAX, SourceFileNames.size());
- if (auto EC = MetadataWriter.writeInteger(
- ModiCount, llvm::support::little)) // NumModules
+ if (auto EC = MetadataWriter.writeInteger(ModiCount)) // NumModules
return EC;
- if (auto EC = MetadataWriter.writeInteger(
- FileCount, llvm::support::little)) // NumSourceFiles
+ if (auto EC = MetadataWriter.writeInteger(FileCount)) // NumSourceFiles
return EC;
for (uint16_t I = 0; I < ModiCount; ++I) {
- if (auto EC = MetadataWriter.writeInteger(
- I, llvm::support::little)) // Mod Indices
+ if (auto EC = MetadataWriter.writeInteger(I)) // Mod Indices
return EC;
}
for (const auto MI : ModuleInfoList) {
FileCount = static_cast<uint16_t>(MI->SourceFiles.size());
- if (auto EC = MetadataWriter.writeInteger(
- FileCount, llvm::support::little)) // Mod File Counts
+ if (auto EC = MetadataWriter.writeInteger(FileCount)) // Mod File Counts
return EC;
}
@@ -224,8 +221,7 @@
if (Result == SourceFileNames.end())
return make_error<RawError>(raw_error_code::no_entry,
"The source file was not found.");
- if (auto EC = MetadataWriter.writeInteger(Result->second,
- llvm::support::little))
+ if (auto EC = MetadataWriter.writeInteger(Result->second))
return EC;
}
}
@@ -379,7 +375,7 @@
return EC;
if (!SectionContribs.empty()) {
- if (auto EC = Writer.writeEnum(DbiSecContribVer60, llvm::support::little))
+ if (auto EC = Writer.writeEnum(DbiSecContribVer60))
return EC;
if (auto EC = Writer.writeArray(SectionContribs))
return EC;
@@ -398,16 +394,15 @@
return EC;
for (auto &Stream : DbgStreams)
- if (auto EC =
- Writer.writeInteger(Stream.StreamNumber, llvm::support::little))
+ if (auto EC = Writer.writeInteger(Stream.StreamNumber))
return EC;
for (auto &Stream : DbgStreams) {
if (Stream.StreamNumber == kInvalidStreamIndex)
continue;
- auto WritableBinaryStream = WritableMappedBlockStream::createIndexedStream(
+ auto WritableStream = WritableMappedBlockStream::createIndexedStream(
Layout, Buffer, Stream.StreamNumber);
- BinaryStreamWriter DbgStreamWriter(*WritableBinaryStream);
+ BinaryStreamWriter DbgStreamWriter(*WritableStream);
if (auto EC = DbgStreamWriter.writeArray(Stream.Data))
return EC;
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp b/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
index 5357997..ebf8c9c 100644
--- a/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
@@ -48,9 +48,9 @@
"Present bit vector interesects deleted!");
for (uint32_t P : Present) {
- if (auto EC = Stream.readInteger(Buckets[P].first, llvm::support::little))
+ if (auto EC = Stream.readInteger(Buckets[P].first))
return EC;
- if (auto EC = Stream.readInteger(Buckets[P].second, llvm::support::little))
+ if (auto EC = Stream.readInteger(Buckets[P].second))
return EC;
}
@@ -91,9 +91,9 @@
return EC;
for (const auto &Entry : *this) {
- if (auto EC = Writer.writeInteger(Entry.first, llvm::support::little))
+ if (auto EC = Writer.writeInteger(Entry.first))
return EC;
- if (auto EC = Writer.writeInteger(Entry.second, llvm::support::little))
+ if (auto EC = Writer.writeInteger(Entry.second))
return EC;
}
return Error::success();
@@ -212,7 +212,7 @@
Error HashTable::readSparseBitVector(BinaryStreamReader &Stream,
SparseBitVector<> &V) {
uint32_t NumWords;
- if (auto EC = Stream.readInteger(NumWords, llvm::support::little))
+ if (auto EC = Stream.readInteger(NumWords))
return joinErrors(
std::move(EC),
make_error<RawError>(raw_error_code::corrupt_file,
@@ -220,7 +220,7 @@
for (uint32_t I = 0; I != NumWords; ++I) {
uint32_t Word;
- if (auto EC = Stream.readInteger(Word, llvm::support::little))
+ if (auto EC = Stream.readInteger(Word))
return joinErrors(std::move(EC),
make_error<RawError>(raw_error_code::corrupt_file,
"Expected hash table word"));
@@ -235,7 +235,7 @@
SparseBitVector<> &Vec) {
int ReqBits = Vec.find_last() + 1;
uint32_t NumWords = alignTo(ReqBits, sizeof(uint32_t)) / sizeof(uint32_t);
- if (auto EC = Writer.writeInteger(NumWords, llvm::support::little))
+ if (auto EC = Writer.writeInteger(NumWords))
return joinErrors(
std::move(EC),
make_error<RawError>(raw_error_code::corrupt_file,
@@ -248,7 +248,7 @@
if (Vec.test(Idx))
Word |= (1 << WordIdx);
}
- if (auto EC = Writer.writeInteger(Word, llvm::support::little))
+ if (auto EC = Writer.writeInteger(Word))
return joinErrors(std::move(EC), make_error<RawError>(
raw_error_code::corrupt_file,
"Could not write linear map word"));
diff --git a/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp b/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp
index 0c2d2c3..df9ec81 100644
--- a/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp
@@ -43,7 +43,7 @@
BinaryStreamRef S;
- if (auto EC = Reader.readInteger(Signature, llvm::support::little))
+ if (auto EC = Reader.readInteger(Signature))
return EC;
if (auto EC = Reader.readArray(SymbolsSubstream, SymbolSize - 4))
return EC;
@@ -58,7 +58,7 @@
return EC;
uint32_t GlobalRefsSize;
- if (auto EC = Reader.readInteger(GlobalRefsSize, llvm::support::little))
+ if (auto EC = Reader.readInteger(GlobalRefsSize))
return EC;
if (auto EC = Reader.readStreamRef(GlobalRefsSubstream, GlobalRefsSize))
return EC;
diff --git a/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp b/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
index 91cbf4b..1fa9bc4 100644
--- a/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp
@@ -31,7 +31,7 @@
FinalizedInfo.reset();
uint32_t StringBufferSize;
- if (auto EC = Stream.readInteger(StringBufferSize, llvm::support::little))
+ if (auto EC = Stream.readInteger(StringBufferSize))
return joinErrors(std::move(EC),
make_error<RawError>(raw_error_code::corrupt_file,
"Expected string buffer size"));
@@ -70,8 +70,7 @@
assert(FinalizedInfo.hasValue());
// The first field is the number of bytes of string data.
- if (auto EC = Writer.writeInteger(FinalizedInfo->StringDataBytes,
- llvm::support::little))
+ if (auto EC = Writer.writeInteger(FinalizedInfo->StringDataBytes))
return EC;
// Now all of the string data itself.
diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
index 4c85825..dff5334 100644
--- a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
@@ -45,7 +45,8 @@
return make_error<GenericError>(generic_error_code::invalid_path);
std::unique_ptr<MemoryBuffer> Buffer = std::move(*ErrorOrBuffer);
- auto Stream = llvm::make_unique<MemoryBufferByteStream>(std::move(Buffer));
+ auto Stream = llvm::make_unique<MemoryBufferByteStream>(
+ std::move(Buffer), llvm::support::little);
auto Allocator = llvm::make_unique<BumpPtrAllocator>();
auto File = llvm::make_unique<PDBFile>(Path, std::move(Stream), *Allocator);
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
index a08ecd0..03257c4 100644
--- a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
@@ -186,7 +186,7 @@
// been parsed, we can avoid this and reuse MappedBlockStream.
auto DS = MappedBlockStream::createDirectoryStream(ContainerLayout, *Buffer);
BinaryStreamReader Reader(*DS);
- if (auto EC = Reader.readInteger(NumStreams, llvm::support::little))
+ if (auto EC = Reader.readInteger(NumStreams))
return EC;
if (auto EC = Reader.readArray(ContainerLayout.StreamSizes, NumStreams))
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
index 104867d..18c0cdf 100644
--- a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
@@ -118,7 +118,8 @@
if (OutFileOrError.getError())
return llvm::make_error<pdb::GenericError>(generic_error_code::invalid_path,
Filename);
- FileBufferByteStream Buffer(std::move(*OutFileOrError));
+ FileBufferByteStream Buffer(std::move(*OutFileOrError),
+ llvm::support::little);
BinaryStreamWriter Writer(Buffer);
if (auto EC = Writer.writeObject(*Layout.SB))
@@ -132,8 +133,7 @@
auto DirStream =
WritableMappedBlockStream::createDirectoryStream(Layout, Buffer);
BinaryStreamWriter DW(*DirStream);
- if (auto EC = DW.writeInteger<uint32_t>(Layout.StreamSizes.size(),
- llvm::support::little))
+ if (auto EC = DW.writeInteger<uint32_t>(Layout.StreamSizes.size()))
return EC;
if (auto EC = DW.writeArray(Layout.StreamSizes))
diff --git a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp
index e2b9ea2..79a78c9 100644
--- a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp
@@ -54,7 +54,7 @@
return make_error<RawError>(raw_error_code::corrupt_file,
"Missing name count");
- if (auto EC = Stream.readInteger(NameCount, llvm::support::little))
+ if (auto EC = Stream.readInteger(NameCount))
return EC;
return Error::success();
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp
index 5432fe4..9df97c9 100644
--- a/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp
@@ -74,7 +74,7 @@
// Write a hash table.
uint32_t BucketCount = computeBucketCount(Strings.size());
- if (auto EC = Writer.writeInteger(BucketCount, llvm::support::little))
+ if (auto EC = Writer.writeInteger(BucketCount))
return EC;
std::vector<ulittle32_t> Buckets(BucketCount);
@@ -96,8 +96,7 @@
if (auto EC = Writer.writeArray(ArrayRef<ulittle32_t>(Buckets)))
return EC;
- if (auto EC = Writer.writeInteger(static_cast<uint32_t>(Strings.size()),
- llvm::support::little))
+ if (auto EC = Writer.writeInteger(static_cast<uint32_t>(Strings.size())))
return EC;
return Error::success();
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp b/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp
index 2d351b0..d38edcb 100644
--- a/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp
@@ -16,7 +16,6 @@
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
-
#include "llvm/Support/Endian.h"
using namespace llvm;
diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
index 49412b1..7d532ee 100644
--- a/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
@@ -34,7 +34,8 @@
using namespace llvm::support;
TpiStreamBuilder::TpiStreamBuilder(MSFBuilder &Msf, uint32_t StreamIdx)
- : Msf(Msf), Allocator(Msf.getAllocator()), Header(nullptr), Idx(StreamIdx) {
+ : Msf(Msf), Allocator(Msf.getAllocator()),
+ TypeRecordStream(llvm::support::little), Header(nullptr), Idx(StreamIdx) {
}
TpiStreamBuilder::~TpiStreamBuilder() = default;
@@ -113,7 +114,8 @@
}
ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(HashBuffer.data()),
HashBufferSize);
- HashValueStream = llvm::make_unique<BinaryByteStream>(Bytes);
+ HashValueStream =
+ llvm::make_unique<BinaryByteStream>(Bytes, llvm::support::little);
return Error::success();
}