aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-02-28 00:04:07 +0000
committerZachary Turner <zturner@google.com>2017-02-28 00:04:07 +0000
commit695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4 (patch)
treecaf35bd7345bb071545ef39b636b40ffafc41504 /llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
parent59cd89332010b22e82c3110d558ff37948c4df1e (diff)
downloadllvm-695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4.zip
llvm-695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4.tar.gz
llvm-695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4.tar.bz2
[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
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 5357997..ebf8c9c 100644
--- a/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
@@ -48,9 +48,9 @@ Error HashTable::load(BinaryStreamReader &Stream) {
"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 @@ Error HashTable::commit(BinaryStreamWriter &Writer) const {
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 @@ void HashTable::grow() {
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 @@ Error HashTable::readSparseBitVector(BinaryStreamReader &Stream,
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 @@ Error HashTable::writeSparseBitVector(BinaryStreamWriter &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, 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 @@ Error HashTable::writeSparseBitVector(BinaryStreamWriter &Writer,
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"));