Line data Source code
1 : //===- SymbolStream.cpp - PDB Symbol Stream Access ------------------------===//
2 : //
3 : // The LLVM Compiler Infrastructure
4 : //
5 : // This file is distributed under the University of Illinois Open Source
6 : // License. See LICENSE.TXT for details.
7 : //
8 : //===----------------------------------------------------------------------===//
9 :
10 : #include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
11 :
12 : #include "llvm/DebugInfo/CodeView/CodeView.h"
13 : #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
14 : #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
15 : #include "llvm/Support/BinaryStreamReader.h"
16 : #include "llvm/Support/Endian.h"
17 :
18 : using namespace llvm;
19 : using namespace llvm::msf;
20 : using namespace llvm::support;
21 : using namespace llvm::pdb;
22 :
23 17 : SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
24 17 : : Stream(std::move(Stream)) {}
25 :
26 17 : SymbolStream::~SymbolStream() {}
27 :
28 17 : Error SymbolStream::reload() {
29 17 : BinaryStreamReader Reader(*Stream);
30 :
31 34 : if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
32 : return EC;
33 :
34 : return Error::success();
35 : }
36 :
37 : iterator_range<codeview::CVSymbolArray::Iterator>
38 0 : SymbolStream::getSymbols(bool *HadError) const {
39 0 : return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
40 : }
41 :
42 0 : Error SymbolStream::commit() { return Error::success(); }
43 :
44 324 : codeview::CVSymbol SymbolStream::readRecord(uint32_t Offset) const {
45 324 : return *SymbolRecords.at(Offset);
46 : }
|