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