aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/Raw/SymbolStream.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-05-28 05:21:57 +0000
committerZachary Turner <zturner@google.com>2016-05-28 05:21:57 +0000
commit0d43c1c339ab5532c4527e92dc852b6e0f3f1788 (patch)
tree321e2a7cb797ccc76f6d806872e8a12ee8fd475b /llvm/lib/DebugInfo/PDB/Raw/SymbolStream.cpp
parent9a9a3169e35306f396e2d690b157ad03a9521650 (diff)
downloadllvm-0d43c1c339ab5532c4527e92dc852b6e0f3f1788.zip
llvm-0d43c1c339ab5532c4527e92dc852b6e0f3f1788.tar.gz
llvm-0d43c1c339ab5532c4527e92dc852b6e0f3f1788.tar.bz2
[pdb] Finish conversion to zero copy pdb access.
This converts remaining uses of ByteStream, which was still left in the symbol stream and type stream, to using the new StreamInterface zero-copy classes. RecordIterator is finally deleted, so this is the only way left now. Additionally, more error checking is added when iterating the various streams. With this, the transition to zero copy pdb access is complete. llvm-svn: 271101
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/SymbolStream.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/SymbolStream.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/SymbolStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/SymbolStream.cpp
index ba4ea57..021e229 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/SymbolStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/SymbolStream.cpp
@@ -30,20 +30,13 @@ SymbolStream::~SymbolStream() {}
Error SymbolStream::reload() {
codeview::StreamReader Reader(MappedStream);
- if (Stream.load(Reader, MappedStream.getLength()))
- return make_error<RawError>(raw_error_code::corrupt_file,
- "Could not load symbol stream.");
+ if (auto EC = Reader.readArray(SymbolRecords, MappedStream.getLength()))
+ return EC;
return Error::success();
}
-iterator_range<codeview::SymbolIterator> SymbolStream::getSymbols() const {
- using codeview::SymbolIterator;
- ArrayRef<uint8_t> Data;
- if (auto Error = Stream.readBytes(0, Stream.getLength(), Data)) {
- consumeError(std::move(Error));
- return iterator_range<SymbolIterator>(SymbolIterator(), SymbolIterator());
- }
-
- return codeview::makeSymbolRange(Data, nullptr);
+iterator_range<codeview::CVSymbolArray::Iterator>
+SymbolStream::getSymbols(bool *HadError) const {
+ return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
}