LLVM 20.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
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
22
24 BinaryStreamReader Reader(*Stream);
25
26 if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
27 return EC;
28
29 return Error::success();
30}
31
33SymbolStream::getSymbols(bool *HadError) const {
34 return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
35}
36
38
40 return *SymbolRecords.at(Offset);
41}
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:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:337
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:1873
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858