diff options
author | Zachary Turner <zturner@google.com> | 2017-02-27 22:11:43 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-02-27 22:11:43 +0000 |
commit | 120faca41bddd3a5922bdefbeb7c68908fda9ab9 (patch) | |
tree | e3c36b67c61a5021ed8847241cfaf9c59b48309a /llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp | |
parent | 4a7cc16e89b68d48335e7cd19837c3e67e12afb2 (diff) | |
download | bcm5719-llvm-120faca41bddd3a5922bdefbeb7c68908fda9ab9.tar.gz bcm5719-llvm-120faca41bddd3a5922bdefbeb7c68908fda9ab9.zip |
[PDB] Partial resubmit of r296215, which improved PDB Stream Library.
This was reverted because it was breaking some builds, and
because of incorrect error code usage. Since the CL was
large and contained many different things, I'm resubmitting
it in pieces.
This portion is NFC, and consists of:
1) Renaming classes to follow a consistent naming convention.
2) Fixing the const-ness of the interface methods.
3) Adding detailed doxygen comments.
4) Fixing a few instances of passing `const BinaryStream& X`. These
are now passed as `BinaryStreamRef X`.
llvm-svn: 296394
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp b/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp index ceeca10c5c5..91cbf4bca07 100644 --- a/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp @@ -21,12 +21,11 @@ #include <cstdint> using namespace llvm; -using namespace llvm::msf; using namespace llvm::pdb; NamedStreamMap::NamedStreamMap() = default; -Error NamedStreamMap::load(StreamReader &Stream) { +Error NamedStreamMap::load(BinaryStreamReader &Stream) { Mapping.clear(); FinalizedHashTable.clear(); FinalizedInfo.reset(); @@ -37,7 +36,7 @@ Error NamedStreamMap::load(StreamReader &Stream) { make_error<RawError>(raw_error_code::corrupt_file, "Expected string buffer size")); - msf::ReadableStreamRef StringsBuffer; + BinaryStreamRef StringsBuffer; if (auto EC = Stream.readStreamRef(StringsBuffer, StringBufferSize)) return EC; @@ -51,11 +50,11 @@ Error NamedStreamMap::load(StreamReader &Stream) { std::tie(NameOffset, NameIndex) = Entry; // Compute the offset of the start of the string relative to the stream. - msf::StreamReader NameReader(StringsBuffer); + BinaryStreamReader NameReader(StringsBuffer); NameReader.setOffset(NameOffset); // Pump out our c-string from the stream. StringRef Str; - if (auto EC = NameReader.readZeroString(Str)) + if (auto EC = NameReader.readCString(Str)) return joinErrors(std::move(EC), make_error<RawError>(raw_error_code::corrupt_file, "Expected name map name")); @@ -67,7 +66,7 @@ Error NamedStreamMap::load(StreamReader &Stream) { return Error::success(); } -Error NamedStreamMap::commit(msf::StreamWriter &Writer) const { +Error NamedStreamMap::commit(BinaryStreamWriter &Writer) const { assert(FinalizedInfo.hasValue()); // The first field is the number of bytes of string data. @@ -77,7 +76,7 @@ Error NamedStreamMap::commit(msf::StreamWriter &Writer) const { // Now all of the string data itself. for (const auto &Item : Mapping) { - if (auto EC = Writer.writeZeroString(Item.getKey())) + if (auto EC = Writer.writeCString(Item.getKey())) return EC; } |