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
13using namespace llvm;
14using namespace llvm::msf;
15using namespace llvm::support;
16using namespace llvm::pdb;
17
18SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
19 : Stream(std::move(Stream)) {}
20
21SymbolStream::~SymbolStream() = default;
22
23Error SymbolStream::reload() {
24 BinaryStreamReader Reader(*Stream);
25
26 if (auto EC = Reader.readArray(Array&: SymbolRecords, Size: Stream->getLength()))
27 return EC;
28
29 return Error::success();
30}
31
32iterator_range<codeview::CVSymbolArray::Iterator>
33SymbolStream::getSymbols(bool *HadError) const {
34 return llvm::make_range(x: SymbolRecords.begin(HadError), y: SymbolRecords.end());
35}
36
37Error SymbolStream::commit() { return Error::success(); }
38
39codeview::CVSymbol SymbolStream::readRecord(uint32_t Offset) const {
40 return *SymbolRecords.at(Offset);
41}
42

source code of llvm/lib/DebugInfo/PDB/Native/SymbolStream.cpp