diff options
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp | 44 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp | 20 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/MSF/StreamReader.cpp | 64 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/MSF/StreamWriter.cpp | 28 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp | 20 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/HashTable.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/ModStream.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/StringTable.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp | 5 |
15 files changed, 75 insertions, 152 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp b/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp index 48160252c6d..db5db3eeded 100644 --- a/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp +++ b/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp @@ -182,7 +182,7 @@ Error CVTypeVisitor::visitFieldListMemberStream(msf::StreamReader Reader) { TypeLeafKind Leaf; while (!Reader.empty()) { - if (auto EC = Reader.readEnum(Leaf)) + if (auto EC = Reader.readEnum(Leaf, llvm::support::little)) return EC; CVMemberRecord Record; diff --git a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp index 9bd85cf9dc6..b7e74a1f455 100644 --- a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp +++ b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp @@ -87,13 +87,14 @@ Error CodeViewRecordIO::mapByteVectorTail(std::vector<uint8_t> &Bytes) { Error CodeViewRecordIO::mapInteger(TypeIndex &TypeInd) { if (isWriting()) { - if (auto EC = Writer->writeInteger(TypeInd.getIndex())) + if (auto EC = + Writer->writeInteger(TypeInd.getIndex(), llvm::support::little)) return EC; return Error::success(); } uint32_t I; - if (auto EC = Reader->readInteger(I)) + if (auto EC = Reader->readInteger(I, llvm::support::little)) return EC; TypeInd.setIndex(I); return Error::success(); @@ -176,7 +177,7 @@ Error CodeViewRecordIO::mapStringZVectorZ(std::vector<StringRef> &Value) { if (auto EC = mapStringZ(V)) return EC; } - if (auto EC = Writer->writeInteger(uint8_t(0))) + if (auto EC = Writer->writeInteger<uint8_t>(0, llvm::support::little)) return EC; } else { StringRef S; @@ -194,24 +195,28 @@ Error CodeViewRecordIO::mapStringZVectorZ(std::vector<StringRef> &Value) { 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(static_cast<uint16_t>(LF_CHAR))) + if (auto EC = + Writer->writeInteger<uint16_t>(LF_CHAR, llvm::support::little)) return EC; - if (auto EC = Writer->writeInteger(static_cast<int8_t>(Value))) + if (auto EC = Writer->writeInteger<int8_t>(Value, llvm::support::little)) return EC; } else if (Value >= std::numeric_limits<int16_t>::min()) { - if (auto EC = Writer->writeInteger(static_cast<uint16_t>(LF_SHORT))) + if (auto EC = + Writer->writeInteger<uint16_t>(LF_SHORT, llvm::support::little)) return EC; - if (auto EC = Writer->writeInteger(static_cast<int16_t>(Value))) + if (auto EC = Writer->writeInteger<int16_t>(Value, llvm::support::little)) return EC; } else if (Value >= std::numeric_limits<int32_t>::min()) { - if (auto EC = Writer->writeInteger(static_cast<uint16_t>(LF_LONG))) + if (auto EC = + Writer->writeInteger<uint16_t>(LF_LONG, llvm::support::little)) return EC; - if (auto EC = Writer->writeInteger(static_cast<int32_t>(Value))) + if (auto EC = Writer->writeInteger<int32_t>(Value, llvm::support::little)) return EC; } else { - if (auto EC = Writer->writeInteger(static_cast<uint16_t>(LF_QUADWORD))) + if (auto EC = + Writer->writeInteger<uint16_t>(LF_QUADWORD, llvm::support::little)) return EC; - if (auto EC = Writer->writeInteger(Value)) + if (auto EC = Writer->writeInteger(Value, llvm::support::little)) return EC; } return Error::success(); @@ -219,22 +224,25 @@ Error CodeViewRecordIO::writeEncodedSignedInteger(const int64_t &Value) { Error CodeViewRecordIO::writeEncodedUnsignedInteger(const uint64_t &Value) { if (Value < LF_NUMERIC) { - if (auto EC = Writer->writeInteger(static_cast<uint16_t>(Value))) + if (auto EC = Writer->writeInteger<uint16_t>(Value, llvm::support::little)) return EC; } else if (Value <= std::numeric_limits<uint16_t>::max()) { - if (auto EC = Writer->writeInteger(static_cast<uint16_t>(LF_USHORT))) + if (auto EC = + Writer->writeInteger<uint16_t>(LF_USHORT, llvm::support::little)) return EC; - if (auto EC = Writer->writeInteger(static_cast<uint16_t>(Value))) + if (auto EC = Writer->writeInteger<uint16_t>(Value, llvm::support::little)) return EC; } else if (Value <= std::numeric_limits<uint32_t>::max()) { - if (auto EC = Writer->writeInteger(static_cast<uint16_t>(LF_ULONG))) + if (auto EC = + Writer->writeInteger<uint16_t>(LF_ULONG, llvm::support::little)) return EC; - if (auto EC = Writer->writeInteger(static_cast<uint32_t>(Value))) + if (auto EC = Writer->writeInteger<uint32_t>(Value, llvm::support::little)) return EC; } else { - if (auto EC = Writer->writeInteger(static_cast<uint16_t>(LF_UQUADWORD))) + if (auto EC = + Writer->writeInteger<uint16_t>(LF_UQUADWORD, llvm::support::little)) return EC; - if (auto EC = Writer->writeInteger(Value)) + if (auto EC = Writer->writeInteger(Value, llvm::support::little)) return EC; } diff --git a/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp b/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp index 6f29caa9bbf..6be9a059b89 100644 --- a/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp +++ b/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp @@ -37,7 +37,7 @@ Error llvm::codeview::consume(msf::StreamReader &Reader, APSInt &Num) { // Used to avoid overload ambiguity on APInt construtor. bool FalseVal = false; uint16_t Short; - if (auto EC = Reader.readInteger(Short)) + if (auto EC = Reader.readInteger(Short, llvm::support::little)) return EC; if (Short < LF_NUMERIC) { @@ -49,49 +49,49 @@ Error llvm::codeview::consume(msf::StreamReader &Reader, APSInt &Num) { switch (Short) { case LF_CHAR: { int8_t N; - if (auto EC = Reader.readInteger(N)) + if (auto EC = Reader.readInteger(N, llvm::support::little)) return EC; Num = APSInt(APInt(8, N, true), false); return Error::success(); } case LF_SHORT: { int16_t N; - if (auto EC = Reader.readInteger(N)) + if (auto EC = Reader.readInteger(N, llvm::support::little)) return EC; Num = APSInt(APInt(16, N, true), false); return Error::success(); } case LF_USHORT: { uint16_t N; - if (auto EC = Reader.readInteger(N)) + if (auto EC = Reader.readInteger(N, llvm::support::little)) return EC; Num = APSInt(APInt(16, N, false), true); return Error::success(); } case LF_LONG: { int32_t N; - if (auto EC = Reader.readInteger(N)) + if (auto EC = Reader.readInteger(N, llvm::support::little)) return EC; Num = APSInt(APInt(32, N, true), false); return Error::success(); } case LF_ULONG: { uint32_t N; - if (auto EC = Reader.readInteger(N)) + if (auto EC = Reader.readInteger(N, llvm::support::little)) return EC; Num = APSInt(APInt(32, N, FalseVal), true); return Error::success(); } case LF_QUADWORD: { int64_t N; - if (auto EC = Reader.readInteger(N)) + if (auto EC = Reader.readInteger(N, llvm::support::little)) return EC; Num = APSInt(APInt(64, N, true), false); return Error::success(); } case LF_UQUADWORD: { uint64_t N; - if (auto EC = Reader.readInteger(N)) + if (auto EC = Reader.readInteger(N, llvm::support::little)) return EC; Num = APSInt(APInt(64, N, false), true); return Error::success(); @@ -124,7 +124,7 @@ Error llvm::codeview::consume_numeric(msf::StreamReader &Reader, } Error llvm::codeview::consume(msf::StreamReader &Reader, uint32_t &Item) { - return Reader.readInteger(Item); + return Reader.readInteger(Item, llvm::support::little); } Error llvm::codeview::consume(StringRef &Data, uint32_t &Item) { @@ -137,7 +137,7 @@ Error llvm::codeview::consume(StringRef &Data, uint32_t &Item) { } Error llvm::codeview::consume(msf::StreamReader &Reader, int32_t &Item) { - return Reader.readInteger(Item); + return Reader.readInteger(Item, llvm::support::little); } Error llvm::codeview::consume(msf::StreamReader &Reader, StringRef &Item) { diff --git a/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp b/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp index f24fcff8627..299e9ad6930 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp @@ -76,7 +76,7 @@ TypeSerializer::addPadding(MutableArrayRef<uint8_t> Record) { int N = PaddingBytes; while (PaddingBytes > 0) { uint8_t Pad = static_cast<uint8_t>(LF_PAD0 + PaddingBytes); - if (auto EC = Writer.writeInteger(Pad)) + if (auto EC = Writer.writeInteger(Pad, llvm::support::little)) return std::move(EC); --PaddingBytes; } @@ -207,11 +207,11 @@ Error TypeSerializer::visitMemberEnd(CVMemberRecord &Record) { msf::StreamWriter CW(CS); if (auto EC = CW.writeBytes(CopyData)) return EC; - if (auto EC = CW.writeEnum(TypeLeafKind::LF_INDEX)) + if (auto EC = CW.writeEnum(TypeLeafKind::LF_INDEX, llvm::support::little)) return EC; - if (auto EC = CW.writeInteger(uint16_t(0))) + if (auto EC = CW.writeInteger<uint16_t>(0, llvm::support::little)) return EC; - if (auto EC = CW.writeInteger(uint32_t(0xB0C0B0C0))) + if (auto EC = CW.writeInteger<uint32_t>(0xB0C0B0C0, llvm::support::little)) return EC; FieldListSegments.push_back(SavedSegment); diff --git a/llvm/lib/DebugInfo/MSF/StreamReader.cpp b/llvm/lib/DebugInfo/MSF/StreamReader.cpp index b85fd14a3b7..d460a4eeab3 100644 --- a/llvm/lib/DebugInfo/MSF/StreamReader.cpp +++ b/llvm/lib/DebugInfo/MSF/StreamReader.cpp @@ -31,70 +31,6 @@ Error StreamReader::readBytes(ArrayRef<uint8_t> &Buffer, uint32_t Size) { return Error::success(); } -Error StreamReader::readInteger(uint8_t &Dest) { - const uint8_t *P; - if (auto EC = readObject(P)) - return EC; - Dest = *P; - return Error::success(); -} - -Error StreamReader::readInteger(uint16_t &Dest) { - const support::ulittle16_t *P; - if (auto EC = readObject(P)) - return EC; - Dest = *P; - return Error::success(); -} - -Error StreamReader::readInteger(uint32_t &Dest) { - const support::ulittle32_t *P; - if (auto EC = readObject(P)) - return EC; - Dest = *P; - return Error::success(); -} - -Error StreamReader::readInteger(uint64_t &Dest) { - const support::ulittle64_t *P; - if (auto EC = readObject(P)) - return EC; - Dest = *P; - return Error::success(); -} - -Error StreamReader::readInteger(int8_t &Dest) { - const int8_t *P; - if (auto EC = readObject(P)) - return EC; - Dest = *P; - return Error::success(); -} - -Error StreamReader::readInteger(int16_t &Dest) { - const support::little16_t *P; - if (auto EC = readObject(P)) - return EC; - Dest = *P; - return Error::success(); -} - -Error StreamReader::readInteger(int32_t &Dest) { - const support::little32_t *P; - if (auto EC = readObject(P)) - return EC; - Dest = *P; - return Error::success(); -} - -Error StreamReader::readInteger(int64_t &Dest) { - const support::little64_t *P; - if (auto EC = readObject(P)) - return EC; - Dest = *P; - return Error::success(); -} - Error StreamReader::readZeroString(StringRef &Dest) { uint32_t Length = 0; // First compute the length of the string by reading 1 byte at a time. diff --git a/llvm/lib/DebugInfo/MSF/StreamWriter.cpp b/llvm/lib/DebugInfo/MSF/StreamWriter.cpp index cdae7c5acc0..a24fb047e60 100644 --- a/llvm/lib/DebugInfo/MSF/StreamWriter.cpp +++ b/llvm/lib/DebugInfo/MSF/StreamWriter.cpp @@ -25,34 +25,6 @@ Error StreamWriter::writeBytes(ArrayRef<uint8_t> Buffer) { return Error::success(); } -Error StreamWriter::writeInteger(uint8_t Int) { return writeObject(Int); } - -Error StreamWriter::writeInteger(uint16_t Int) { - return writeObject(support::ulittle16_t(Int)); -} - -Error StreamWriter::writeInteger(uint32_t Int) { - return writeObject(support::ulittle32_t(Int)); -} - -Error StreamWriter::writeInteger(uint64_t Int) { - return writeObject(support::ulittle64_t(Int)); -} - -Error StreamWriter::writeInteger(int8_t Int) { return writeObject(Int); } - -Error StreamWriter::writeInteger(int16_t Int) { - return writeObject(support::little16_t(Int)); -} - -Error StreamWriter::writeInteger(int32_t Int) { - return writeObject(support::little32_t(Int)); -} - -Error StreamWriter::writeInteger(int64_t Int) { - return writeObject(support::little64_t(Int)); -} - Error StreamWriter::writeZeroString(StringRef Str) { if (auto EC = writeFixedString(Str)) return EC; diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp index 5d15e62d3e4..f2f25c2bfeb 100644 --- a/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/DbiStream.cpp @@ -236,7 +236,7 @@ Error DbiStream::initializeSectionContributionData() { return Error::success(); StreamReader SCReader(SecContrSubstream); - if (auto EC = SCReader.readEnum(SectionContribVersion)) + if (auto EC = SCReader.readEnum(SectionContribVersion, llvm::support::little)) return EC; if (SectionContribVersion == DbiSecContribVer60) diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp index df6e9b060df..0b56d05b468 100644 --- a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp @@ -187,17 +187,21 @@ Error DbiStreamBuilder::generateFileInfoSubstream() { 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)) // NumModules + if (auto EC = MetadataWriter.writeInteger( + ModiCount, llvm::support::little)) // NumModules return EC; - if (auto EC = MetadataWriter.writeInteger(FileCount)) // NumSourceFiles + if (auto EC = MetadataWriter.writeInteger( + FileCount, llvm::support::little)) // NumSourceFiles return EC; for (uint16_t I = 0; I < ModiCount; ++I) { - if (auto EC = MetadataWriter.writeInteger(I)) // Mod Indices + if (auto EC = MetadataWriter.writeInteger( + I, llvm::support::little)) // Mod Indices return EC; } for (const auto MI : ModuleInfoList) { FileCount = static_cast<uint16_t>(MI->SourceFiles.size()); - if (auto EC = MetadataWriter.writeInteger(FileCount)) // Mod File Counts + if (auto EC = MetadataWriter.writeInteger( + FileCount, llvm::support::little)) // Mod File Counts return EC; } @@ -219,7 +223,8 @@ Error DbiStreamBuilder::generateFileInfoSubstream() { 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)) + if (auto EC = MetadataWriter.writeInteger(Result->second, + llvm::support::little)) return EC; } } @@ -373,7 +378,7 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout, return EC; if (!SectionContribs.empty()) { - if (auto EC = Writer.writeEnum(DbiSecContribVer60)) + if (auto EC = Writer.writeEnum(DbiSecContribVer60, llvm::support::little)) return EC; if (auto EC = Writer.writeArray(SectionContribs)) return EC; @@ -392,7 +397,8 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout, return EC; for (auto &Stream : DbgStreams) - if (auto EC = Writer.writeInteger(Stream.StreamNumber)) + if (auto EC = + Writer.writeInteger(Stream.StreamNumber, llvm::support::little)) return EC; for (auto &Stream : DbgStreams) { diff --git a/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp b/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp index b3fe6fa45c5..dd95c078d7e 100644 --- a/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp @@ -48,9 +48,9 @@ Error HashTable::load(msf::StreamReader &Stream) { "Present bit vector interesects deleted!"); for (uint32_t P : Present) { - if (auto EC = Stream.readInteger(Buckets[P].first)) + if (auto EC = Stream.readInteger(Buckets[P].first, llvm::support::little)) return EC; - if (auto EC = Stream.readInteger(Buckets[P].second)) + if (auto EC = Stream.readInteger(Buckets[P].second, llvm::support::little)) return EC; } @@ -91,9 +91,9 @@ Error HashTable::commit(msf::StreamWriter &Writer) const { return EC; for (const auto &Entry : *this) { - if (auto EC = Writer.writeInteger(Entry.first)) + if (auto EC = Writer.writeInteger(Entry.first, llvm::support::little)) return EC; - if (auto EC = Writer.writeInteger(Entry.second)) + if (auto EC = Writer.writeInteger(Entry.second, llvm::support::little)) return EC; } return Error::success(); @@ -212,7 +212,7 @@ void HashTable::grow() { Error HashTable::readSparseBitVector(msf::StreamReader &Stream, SparseBitVector<> &V) { uint32_t NumWords; - if (auto EC = Stream.readInteger(NumWords)) + if (auto EC = Stream.readInteger(NumWords, llvm::support::little)) return joinErrors( std::move(EC), make_error<RawError>(raw_error_code::corrupt_file, @@ -220,7 +220,7 @@ Error HashTable::readSparseBitVector(msf::StreamReader &Stream, for (uint32_t I = 0; I != NumWords; ++I) { uint32_t Word; - if (auto EC = Stream.readInteger(Word)) + if (auto EC = Stream.readInteger(Word, llvm::support::little)) return joinErrors(std::move(EC), make_error<RawError>(raw_error_code::corrupt_file, "Expected hash table word")); @@ -235,7 +235,7 @@ Error HashTable::writeSparseBitVector(msf::StreamWriter &Writer, 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)) + if (auto EC = Writer.writeInteger(NumWords, llvm::support::little)) return joinErrors( std::move(EC), make_error<RawError>(raw_error_code::corrupt_file, @@ -248,7 +248,7 @@ Error HashTable::writeSparseBitVector(msf::StreamWriter &Writer, if (Vec.test(Idx)) Word |= (1 << WordIdx); } - if (auto EC = Writer.writeInteger(Word)) + if (auto EC = Writer.writeInteger(Word, llvm::support::little)) 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 25370f26ec3..ee8374ff120 100644 --- a/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/ModStream.cpp @@ -43,7 +43,7 @@ Error ModStream::reload() { ReadableStreamRef S; - if (auto EC = Reader.readInteger(Signature)) + if (auto EC = Reader.readInteger(Signature, llvm::support::little)) return EC; if (auto EC = Reader.readArray(SymbolsSubstream, SymbolSize - 4)) return EC; @@ -58,7 +58,7 @@ Error ModStream::reload() { return EC; uint32_t GlobalRefsSize; - if (auto EC = Reader.readInteger(GlobalRefsSize)) + if (auto EC = Reader.readInteger(GlobalRefsSize, llvm::support::little)) 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 47fd0e1ba24..8a9579ca385 100644 --- a/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp @@ -32,7 +32,7 @@ Error NamedStreamMap::load(StreamReader &Stream) { FinalizedInfo.reset(); uint32_t StringBufferSize; - if (auto EC = Stream.readInteger(StringBufferSize)) + if (auto EC = Stream.readInteger(StringBufferSize, llvm::support::little)) return joinErrors(std::move(EC), make_error<RawError>(raw_error_code::corrupt_file, "Expected string buffer size")); @@ -71,8 +71,8 @@ Error NamedStreamMap::commit(msf::StreamWriter &Writer) const { assert(FinalizedInfo.hasValue()); // The first field is the number of bytes of string data. - if (auto EC = Writer.writeInteger( - FinalizedInfo->StringDataBytes)) // Number of bytes of string data + if (auto EC = Writer.writeInteger(FinalizedInfo->StringDataBytes, + llvm::support::little)) return EC; // Now all of the string data itself. diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp index 3a3692dcac5..26d9e0ee9e9 100644 --- a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp @@ -186,7 +186,7 @@ Error PDBFile::parseStreamData() { // been parsed, we can avoid this and reuse MappedBlockStream. auto DS = MappedBlockStream::createDirectoryStream(ContainerLayout, *Buffer); StreamReader Reader(*DS); - if (auto EC = Reader.readInteger(NumStreams)) + if (auto EC = Reader.readInteger(NumStreams, llvm::support::little)) 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 57ca2ba488a..fb8e34e7e82 100644 --- a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp @@ -132,8 +132,8 @@ Error PDBFileBuilder::commit(StringRef Filename) { auto DirStream = WritableMappedBlockStream::createDirectoryStream(Layout, Buffer); StreamWriter DW(*DirStream); - if (auto EC = - DW.writeInteger(static_cast<uint32_t>(Layout.StreamSizes.size()))) + if (auto EC = DW.writeInteger<uint32_t>(Layout.StreamSizes.size(), + llvm::support::little)) 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 5b8ae9b7e9c..34f2b480260 100644 --- a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp @@ -55,7 +55,7 @@ Error StringTable::load(StreamReader &Stream) { return make_error<RawError>(raw_error_code::corrupt_file, "Missing name count"); - if (auto EC = Stream.readInteger(NameCount)) + if (auto EC = Stream.readInteger(NameCount, llvm::support::little)) return EC; return Error::success(); } diff --git a/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp index ef9caee4cd6..304f3a6ed11 100644 --- a/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/StringTableBuilder.cpp @@ -74,7 +74,7 @@ Error StringTableBuilder::commit(msf::StreamWriter &Writer) const { // Write a hash table. uint32_t BucketCount = computeBucketCount(Strings.size()); - if (auto EC = Writer.writeInteger(BucketCount)) + if (auto EC = Writer.writeInteger(BucketCount, llvm::support::little)) return EC; std::vector<ulittle32_t> Buckets(BucketCount); @@ -96,7 +96,8 @@ Error StringTableBuilder::commit(msf::StreamWriter &Writer) const { if (auto EC = Writer.writeArray(ArrayRef<ulittle32_t>(Buckets))) return EC; - if (auto EC = Writer.writeInteger(static_cast<uint32_t>(Strings.size()))) + if (auto EC = Writer.writeInteger(static_cast<uint32_t>(Strings.size()), + llvm::support::little)) return EC; return Error::success(); } |