LLVM  8.0.1
SymbolStream.cpp
Go to the documentation of this file.
1 //===- SymbolStream.cpp - PDB Symbol Stream Access ------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 
16 #include "llvm/Support/Endian.h"
17 
18 using namespace llvm;
19 using namespace llvm::msf;
20 using namespace llvm::support;
21 using namespace llvm::pdb;
22 
23 SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
24  : Stream(std::move(Stream)) {}
25 
27 
29  BinaryStreamReader Reader(*Stream);
30 
31  if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
32  return EC;
33 
34  return Error::success();
35 }
36 
38 SymbolStream::getSymbols(bool *HadError) const {
39  return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
40 }
41 
43 
45  return *SymbolRecords.at(Offset);
46 }
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Iterator end() const
Definition: BitVector.h:938
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:327
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:158
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 ...