LLVM 17.0.0git
SymbolStream.cpp
Go to the documentation of this file.
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
10
12#include "llvm/Support/Endian.h"
13
14using namespace llvm;
15using namespace llvm::msf;
16using namespace llvm::support;
17using namespace llvm::pdb;
18
19SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
20 : Stream(std::move(Stream)) {}
21
23
25 BinaryStreamReader Reader(*Stream);
26
27 if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
28 return EC;
29
30 return Error::success();
31}
32
34SymbolStream::getSymbols(bool *HadError) const {
35 return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
36}
37
39
41 return *SymbolRecords.at(Offset);
42}
Provides read only access to a subclass of BinaryStream.
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
static ErrorSuccess success()
Create a success value.
Definition: Error.h:330
Iterator at(uint32_t Offset) const
given an offset into the array's underlying stream, return an iterator to the record at that offset.
Iterator end() const
Iterator begin(bool *HadError=nullptr) const
CVRecord is a fat pointer (base + size pair) to a symbol or type record.
Definition: CVRecord.h:29
A range adaptor for a pair of iterators.
SymbolStream(std::unique_ptr< msf::MappedBlockStream > Stream)
codeview::CVSymbol readRecord(uint32_t Offset) const
iterator_range< codeview::CVSymbolArray::Iterator > getSymbols(bool *HadError) const
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1909
Definition: BitVector.h:851