LLVM  4.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 
20 #include "llvm/Support/Endian.h"
21 
22 using namespace llvm;
23 using namespace llvm::msf;
24 using namespace llvm::support;
25 using namespace llvm::pdb;
26 
27 SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
28  : Stream(std::move(Stream)) {}
29 
31 
33  StreamReader Reader(*Stream);
34 
35  if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
36  return EC;
37 
38  return Error::success();
39 }
40 
42 SymbolStream::getSymbols(bool *HadError) const {
43  return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
44 }
45 
Iterator begin(bool *HadError=nullptr) const
Definition: StreamArray.h:96
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Definition: StreamReader.h:62
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Iterator end() const
Definition: StreamArray.h:100
static ErrorSuccess success()
Create a success value.
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.