[llvm-pdbdump] Add support for diffing the String Table.

llvm-svn: 297901
diff --git a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp
index 2b13d96..7e28389 100644
--- a/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/StringTable.cpp
@@ -20,9 +20,11 @@
 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 @@
 
   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();