• 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/Raw/SymbolStream.h"
11 
12 #include "llvm/DebugInfo/CodeView/CodeView.h"
13 #include "llvm/DebugInfo/CodeView/StreamReader.h"
14 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
15 #include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
16 #include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
17 #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
18 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
19 #include "llvm/DebugInfo/PDB/Raw/RawError.h"
20 
21 #include "llvm/Support/Endian.h"
22 
23 using namespace llvm;
24 using namespace llvm::support;
25 using namespace llvm::pdb;
26 
SymbolStream(std::unique_ptr<MappedBlockStream> Stream)27 SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
28     : Stream(std::move(Stream)) {}
29 
~SymbolStream()30 SymbolStream::~SymbolStream() {}
31 
reload()32 Error SymbolStream::reload() {
33   codeview::StreamReader Reader(*Stream);
34 
35   if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
36     return EC;
37 
38   return Error::success();
39 }
40 
41 iterator_range<codeview::CVSymbolArray::Iterator>
getSymbols(bool * HadError) const42 SymbolStream::getSymbols(bool *HadError) const {
43   return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
44 }
45 
commit()46 Error SymbolStream::commit() { return Error::success(); }
47