LLVM  5.0.0
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 
Iterator end() 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:311
A range adaptor for a pair of iterators.
iterator_range< codeview::CVSymbolArray::Iterator > getSymbols(bool *HadError) const
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
Iterator begin(bool *HadError=nullptr) const
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 ...