• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
SymbolStream(std::unique_ptr<MappedBlockStream> Stream)23 SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
24     : Stream(std::move(Stream)) {}
25 
~SymbolStream()26 SymbolStream::~SymbolStream() {}
27 
reload()28 Error SymbolStream::reload() {
29   BinaryStreamReader Reader(*Stream);
30 
31   if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
32     return EC;
33 
34   return Error::success();
35 }
36 
37 iterator_range<codeview::CVSymbolArray::Iterator>
getSymbols(bool * HadError) const38 SymbolStream::getSymbols(bool *HadError) const {
39   return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
40 }
41 
commit()42 Error SymbolStream::commit() { return Error::success(); }
43 
readRecord(uint32_t Offset) const44 codeview::CVSymbol SymbolStream::readRecord(uint32_t Offset) const {
45   return *SymbolRecords.at(Offset);
46 }
47