From 05a75e40da0f83639111687799eaab2c07c00ef0 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sat, 25 Feb 2017 17:04:23 +0000 Subject: Revert r296215, "[PDB] General improvements to Stream library." and followings. r296215, "[PDB] General improvements to Stream library." r296217, "Disable BinaryStreamTest.StreamReaderObject temporarily." r296220, "Re-enable BinaryStreamTest.StreamReaderObject." r296244, "[PDB] Disable some tests that are breaking bots." r296249, "Add static_cast to silence -Wc++11-narrowing." std::errc::no_buffer_space should be used for OS-oriented errors for socket transmission. (Seek discussions around llvm/xray.) I could substitute s/no_buffer_space/others/g, but I revert whole them ATM. Could we define and use LLVM errors there? llvm-svn: 296258 --- llvm/lib/DebugInfo/PDB/Native/StringTable.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 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 79a78c92598..c81bff48191 100644 --- a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp @@ -17,12 +17,13 @@ #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(BinaryStreamReader &Stream) { +Error StringTable::load(StreamReader &Stream) { const StringTableHeader *H; if (auto EC = Stream.readObject(H)) return EC; @@ -54,7 +55,7 @@ Error StringTable::load(BinaryStreamReader &Stream) { return make_error(raw_error_code::corrupt_file, "Missing name count"); - if (auto EC = Stream.readInteger(NameCount)) + if (auto EC = Stream.readInteger(NameCount, llvm::support::little)) return EC; return Error::success(); } @@ -67,9 +68,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; - BinaryStreamReader NameReader(NamesBuffer); + StreamReader NameReader(NamesBuffer); NameReader.setOffset(ID); - if (auto EC = NameReader.readCString(Result)) + if (auto EC = NameReader.readZeroString(Result)) consumeError(std::move(EC)); return Result; } -- cgit v1.2.3