1 //===- SymbolStream.cpp - PDB Symbol Stream Access ------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
12 #include "llvm/DebugInfo/CodeView/CodeView.h"
13 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
14 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
15 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
16 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
17 #include "llvm/DebugInfo/PDB/Native/RawError.h"
18 #include "llvm/Support/BinaryStreamReader.h"
19 #include "llvm/Support/Endian.h"
22 using namespace llvm::msf;
23 using namespace llvm::support;
24 using namespace llvm::pdb;
26 SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
27 : Stream(std::move(Stream)) {}
29 SymbolStream::~SymbolStream() {}
31 Error SymbolStream::reload() {
32 BinaryStreamReader Reader(*Stream);
34 if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
37 return Error::success();
40 iterator_range<codeview::CVSymbolArray::Iterator>
41 SymbolStream::getSymbols(bool *HadError) const {
42 return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
45 Error SymbolStream::commit() { return Error::success(); }