summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-02-18 01:35:33 +0000
committerZachary Turner <zturner@google.com>2017-02-18 01:35:33 +0000
commit181fe17b6f0f434d39b32b90b12844f7a9b55a3b (patch)
treea9c68cad05c7c6c643e75369b57019c314dce048 /llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
parent0aef305f352235fe66d44e8f253b3b09d27a1b10 (diff)
downloadbcm5719-llvm-181fe17b6f0f434d39b32b90b12844f7a9b55a3b.tar.gz
bcm5719-llvm-181fe17b6f0f434d39b32b90b12844f7a9b55a3b.zip
Don't assume little endian in StreamReader / StreamWriter.
In an effort to generalize this so it can be used by more than just PDB code, we shouldn't assume little endian. llvm-svn: 295525
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/HashTable.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/HashTable.cpp16
1 files changed, 8 insertions, 8 deletions
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"));
OpenPOWER on IntegriCloud