1 //===- SymbolStream.cpp - PDB Symbol Stream Access ------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "llvm/DebugInfo/PDB/Native/SymbolStream.h" 10 11 #include "llvm/DebugInfo/MSF/MappedBlockStream.h" 12 13 using namespace llvm; 14 using namespace llvm::msf; 15 using namespace llvm::support; 16 using namespace llvm::pdb; 17 18 SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream) 19 : Stream(std::move(Stream)) {} 20 21 SymbolStream::~SymbolStream() = default; 22 23 Error SymbolStream::reload() { 24 BinaryStreamReader Reader(*Stream); 25 26 if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength())) 27 return EC; 28 29 return Error::success(); 30 } 31 32 iterator_range<codeview::CVSymbolArray::Iterator> 33 SymbolStream::getSymbols(bool *HadError) const { 34 return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end()); 35 } 36 37 Error SymbolStream::commit() { return Error::success(); } 38 39 codeview::CVSymbol SymbolStream::readRecord(uint32_t Offset) const { 40 return *SymbolRecords.at(Offset); 41 } 42