LLVM  14.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 
15 #include "llvm/Support/Endian.h"
16 
17 using namespace llvm;
18 using namespace llvm::msf;
19 using namespace llvm::support;
20 using namespace llvm::pdb;
21 
22 SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
23  : Stream(std::move(Stream)) {}
24 
26 
28  BinaryStreamReader Reader(*Stream);
29 
30  if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
31  return EC;
32 
33  return Error::success();
34 }
35 
37 SymbolStream::getSymbols(bool *HadError) const {
38  return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
39 }
40 
42 
44  return *SymbolRecords.at(Offset);
45 }
BinaryStreamReader.h
llvm::pdb::SymbolStream::readRecord
codeview::CVSymbol readRecord(uint32_t Offset) const
Definition: SymbolStream.cpp:43
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::pdb::SymbolStream::commit
Error commit()
Definition: SymbolStream.cpp:41
SymbolRecord.h
llvm::pdb::SymbolStream::~SymbolStream
~SymbolStream()
Definition: SymbolStream.cpp:25
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:331
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::VarStreamArray::end
Iterator end() const
Definition: BinaryStreamArray.h:115
llvm::msf
Definition: IMSFFile.h:18
llvm::pdb::SymbolStream::reload
Error reload()
Definition: SymbolStream.cpp:27
CodeView.h
llvm::pdb
Definition: ConcreteSymbolEnumerator.h:20
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition: BinaryStreamReader.h:31
MappedBlockStream.h
llvm::move
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:1609
llvm::codeview::CVRecord
CVRecord is a fat pointer (base + size pair) to a symbol or type record.
Definition: CVRecord.h:29
uint32_t
llvm::pdb::SymbolStream::getSymbols
iterator_range< codeview::CVSymbolArray::Iterator > getSymbols(bool *HadError) const
Definition: SymbolStream.cpp:37
llvm::VarStreamArray::begin
Iterator begin(bool *HadError=nullptr) const
Definition: BinaryStreamArray.h:108
std
Definition: BitVector.h:838
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::support
Definition: Endian.h:25
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::VarStreamArray::at
Iterator at(uint32_t Offset) const
given an offset into the array's underlying stream, return an iterator to the record at that offset.
Definition: BinaryStreamArray.h:132
SymbolStream.h
Endian.h
llvm::BinaryStreamReader::readArray
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 ...
Definition: BinaryStreamReader.h:187