LLVM  6.0.0svn
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 
19 #include "llvm/Support/Endian.h"
20 
21 using namespace llvm;
22 using namespace llvm::msf;
23 using namespace llvm::support;
24 using namespace llvm::pdb;
25 
26 SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
27  : Stream(std::move(Stream)) {}
28 
30 
32  BinaryStreamReader Reader(*Stream);
33 
34  if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
35  return EC;
36 
37  return Error::success();
38 }
39 
41 SymbolStream::getSymbols(bool *HadError) const {
42  return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
43 }
44 
46 
48  return *SymbolRecords.at(Offset);
49 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Iterator end() const
Definition: BitVector.h:920
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:313
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:156
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 ...