aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-05-27 18:20:20 +0000
committerZachary Turner <zturner@google.com>2016-05-27 18:20:20 +0000
commit3a9a23ae62be9959ea1d98ed22fea561efd9cf03 (patch)
tree3435915d18500427ef98a5802876703929f0fd16 /llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
parent346b98011c33cec0b4ab1354ae29b294e1765faa (diff)
downloadllvm-3a9a23ae62be9959ea1d98ed22fea561efd9cf03.zip
llvm-3a9a23ae62be9959ea1d98ed22fea561efd9cf03.tar.gz
llvm-3a9a23ae62be9959ea1d98ed22fea561efd9cf03.tar.bz2
[pdb] Allow zero-copy read support for symbol streams.
This reduces the amount of memory used by llvm-pdbdump by roughly 1/3 of the size of the PDB file. Differential Revision: http://reviews.llvm.org/D20724 Reviewed By: ruiu llvm-svn: 271025
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
index 38d3f2f..404208a 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
@@ -9,6 +9,7 @@
#include "llvm/DebugInfo/PDB/Raw/ModStream.h"
+#include "llvm/DebugInfo/CodeView/RecordIterator.h"
#include "llvm/DebugInfo/CodeView/StreamReader.h"
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
@@ -32,8 +33,14 @@ Error ModStream::reload() {
return llvm::make_error<RawError>(raw_error_code::corrupt_file,
"Module has both C11 and C13 line info");
- if (auto EC = SymbolsSubstream.load(Reader, SymbolSize))
+ codeview::StreamRef S;
+
+ uint32_t SymbolSubstreamSig = 0;
+ if (auto EC = Reader.readInteger(SymbolSubstreamSig))
+ return EC;
+ if (auto EC = Reader.readArray(SymbolsSubstream, SymbolSize - 4))
return EC;
+
if (auto EC = Reader.readStreamRef(LinesSubstream, C11Size))
return EC;
if (auto EC = Reader.readStreamRef(C13LinesSubstream, C13Size))
@@ -51,6 +58,6 @@ Error ModStream::reload() {
return Error::success();
}
-iterator_range<codeview::SymbolIterator> ModStream::symbols() const {
- return codeview::makeSymbolRange(SymbolsSubstream.data().slice(4), nullptr);
+iterator_range<codeview::CVSymbolArray::Iterator> ModStream::symbols() const {
+ return llvm::make_range(SymbolsSubstream.begin(), SymbolsSubstream.end());
}