diff options
author | Zachary Turner <zturner@google.com> | 2017-03-15 22:19:30 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-03-15 22:19:30 +0000 |
commit | f1220084f6af8430ffccbd7b5f83c165ed8213c7 (patch) | |
tree | 7d16f15fd61888f808786f115de25a27f8093d56 /llvm/lib/DebugInfo | |
parent | ea4e60754e0556b0f28be36220354831ae532816 (diff) | |
download | bcm5719-llvm-f1220084f6af8430ffccbd7b5f83c165ed8213c7.tar.gz bcm5719-llvm-f1220084f6af8430ffccbd7b5f83c165ed8213c7.zip |
[llvm-pdbdump] Add support for diffing the String Table.
llvm-svn: 297901
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/StringTable.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp index 2b13d96f08e..7e28389b838 100644 --- a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp @@ -20,9 +20,11 @@ using namespace llvm; using namespace llvm::support; using namespace llvm::pdb; -StringTable::StringTable() : Signature(0), HashVersion(0), NameCount(0) {} +StringTable::StringTable() {} Error StringTable::load(BinaryStreamReader &Stream) { + ByteSize = Stream.getLength(); + const StringTableHeader *H; if (auto EC = Stream.readObject(H)) return EC; @@ -56,9 +58,18 @@ Error StringTable::load(BinaryStreamReader &Stream) { if (auto EC = Stream.readInteger(NameCount)) return EC; + + if (Stream.bytesRemaining() > 0) + return make_error<RawError>(raw_error_code::stream_too_long, + "Unexpected bytes found in string table"); + return Error::success(); } +uint32_t StringTable::getByteSize() const { + return ByteSize; +} + StringRef StringTable::getStringForID(uint32_t ID) const { if (ID == IDs[0]) return StringRef(); |