From af299ea5d456aa2fc19d7fdb041a0452d209fd4c Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Sat, 25 Feb 2017 00:44:30 +0000 Subject: [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 --- llvm/lib/DebugInfo/PDB/Native/StringTable.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'llvm/lib/DebugInfo/PDB/Native/StringTable.cpp') diff --git a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp index c81bff48191..79a78c92598 100644 --- a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp @@ -17,13 +17,12 @@ #include "llvm/Support/Endian.h" using namespace llvm; -using namespace llvm::msf; using namespace llvm::support; using namespace llvm::pdb; StringTable::StringTable() : Signature(0), HashVersion(0), NameCount(0) {} -Error StringTable::load(StreamReader &Stream) { +Error StringTable::load(BinaryStreamReader &Stream) { const StringTableHeader *H; if (auto EC = Stream.readObject(H)) return EC; @@ -55,7 +54,7 @@ Error StringTable::load(StreamReader &Stream) { return make_error(raw_error_code::corrupt_file, "Missing name count"); - if (auto EC = Stream.readInteger(NameCount, llvm::support::little)) + if (auto EC = Stream.readInteger(NameCount)) return EC; return Error::success(); } @@ -68,9 +67,9 @@ StringRef StringTable::getStringForID(uint32_t ID) const { // the starting offset of the string we're looking for. So just seek into // the desired offset and a read a null terminated stream from that offset. StringRef Result; - StreamReader NameReader(NamesBuffer); + BinaryStreamReader NameReader(NamesBuffer); NameReader.setOffset(ID); - if (auto EC = NameReader.readZeroString(Result)) + if (auto EC = NameReader.readCString(Result)) consumeError(std::move(EC)); return Result; } -- cgit v1.2.3