diff options
author | Zachary Turner <zturner@google.com> | 2017-05-02 23:36:17 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-05-02 23:36:17 +0000 |
commit | 7dba20bd2b0767ff6be93d7d68a3045d060a7e22 (patch) | |
tree | 4012baf0139582f0dd109c3bd3a359dc3201bb12 /llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp | |
parent | c7180204cab2407328fcbfc044e7526b9fcc7b7c (diff) | |
download | bcm5719-llvm-7dba20bd2b0767ff6be93d7d68a3045d060a7e22.tar.gz bcm5719-llvm-7dba20bd2b0767ff6be93d7d68a3045d060a7e22.zip |
Make codeview::StringTable.
Previously we had knowledge of how to serialize and deserialize
a string table inside of DebugInfo/PDB, but the string table
that it serializes contains a piece that is actually considered
CodeView and can appear outside of a PDB. We already have logic
in llvm-readobj and MCCodeView to read and write this format,
so it doesn't make sense to duplicate the logic in DebugInfoPDB
as well.
This patch makes codeview::StringTable (for writing) and
codeview::StringTableRef (for reading), updates DebugInfoPDB
to use these classes for its own writing, and updates llvm-readobj
to additionally use StringTableRef for reading.
It's a bit more difficult to get MCCodeView to use this for
writing, but it's a logical next step.
llvm-svn: 301986
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp index f158c5c5386..859295d2c7d 100644 --- a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp @@ -338,7 +338,7 @@ Expected<SymbolStream &> PDBFile::getPDBSymbolStream() { } Expected<PDBStringTable &> PDBFile::getStringTable() { - if (!Strings || !PDBStringTableStream) { + if (!Strings) { auto IS = getPDBInfoStream(); if (!IS) return IS.takeError(); @@ -350,12 +350,13 @@ Expected<PDBStringTable &> PDBFile::getStringTable() { if (!NS) return NS.takeError(); - BinaryStreamReader Reader(**NS); auto N = llvm::make_unique<PDBStringTable>(); - if (auto EC = N->load(Reader)) + BinaryStreamReader Reader(**NS); + if (auto EC = N->reload(Reader)) return std::move(EC); + assert(Reader.bytesRemaining() == 0); + StringTableStream = std::move(*NS); Strings = std::move(N); - PDBStringTableStream = std::move(*NS); } return *Strings; } |