aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-02-25 00:44:30 +0000
committerZachary Turner <zturner@google.com>2017-02-25 00:44:30 +0000
commitaf299ea5d456aa2fc19d7fdb041a0452d209fd4c (patch)
tree2d863cba130306041941aeec5b44baa2e9c00ec1 /llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
parent42de38076517bc68a2b97c55dcbac7ea8d80b11b (diff)
downloadllvm-af299ea5d456aa2fc19d7fdb041a0452d209fd4c.zip
llvm-af299ea5d456aa2fc19d7fdb041a0452d209fd4c.tar.gz
llvm-af299ea5d456aa2fc19d7fdb041a0452d209fd4c.tar.bz2
[PDB] General improvements to Stream library.
This adds various new functionality and cleanup surrounding the use of the Stream library. Major changes include: * Renaming of all classes for more consistency / meaningfulness * Addition of some new methods for reading multiple values at once. * Full suite of unit tests for reader / writer functionality. * Full set of doxygen comments for all classes. * Streams now store their own endianness. * Fixed some bugs in a few of the classes that were discovered by the unit tests. llvm-svn: 296215
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/HashTable.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/HashTable.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp b/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
index dd95c07..ebf8c9c 100644
--- a/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/HashTable.cpp
@@ -22,7 +22,7 @@ HashTable::HashTable() : HashTable(8) {}
HashTable::HashTable(uint32_t Capacity) { Buckets.resize(Capacity); }
-Error HashTable::load(msf::StreamReader &Stream) {
+Error HashTable::load(BinaryStreamReader &Stream) {
const Header *H;
if (auto EC = Stream.readObject(H))
return EC;
@@ -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, 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;
}
@@ -77,7 +77,7 @@ uint32_t HashTable::calculateSerializedLength() const {
return Size;
}
-Error HashTable::commit(msf::StreamWriter &Writer) const {
+Error HashTable::commit(BinaryStreamWriter &Writer) const {
Header H;
H.Size = size();
H.Capacity = capacity();
@@ -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, 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();
@@ -209,10 +209,10 @@ void HashTable::grow() {
assert(size() == S);
}
-Error HashTable::readSparseBitVector(msf::StreamReader &Stream,
+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(msf::StreamReader &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"));
@@ -231,11 +231,11 @@ Error HashTable::readSparseBitVector(msf::StreamReader &Stream,
return Error::success();
}
-Error HashTable::writeSparseBitVector(msf::StreamWriter &Writer,
+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(msf::StreamWriter &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"));