LLVM  10.0.0svn
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 }
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Iterator end() const
Definition: BitVector.h:937
iterator_range< codeview::CVSymbolArray::Iterator > getSymbols(bool *HadError) const
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static ErrorSuccess success()
Create a success value.
Definition: Error.h:326
codeview::CVSymbol readRecord(uint32_t Offset) const
A range adaptor for a pair of iterators.
Iterator at(uint32_t Offset) const
given an offset into the array&#39;s underlying stream, return an iterator to the record at that offset...
Iterator begin(bool *HadError=nullptr) const
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
Provides read only access to a subclass of BinaryStream.
CVRecord is a fat pointer (base + size pair) to a symbol or type record.
Definition: CVRecord.h:30
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 ...