Rui Ueyama | 0fcd826 | 2016-05-20 19:55:17 +0000 | [diff] [blame] | 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 | |
Adrian McCarthy | 6b6b8c4 | 2017-01-25 22:38:55 +0000 | [diff] [blame] | 10 | #include "llvm/DebugInfo/PDB/Native/SymbolStream.h" |
Rui Ueyama | 0fcd826 | 2016-05-20 19:55:17 +0000 | [diff] [blame] | 11 | |
| 12 | #include "llvm/DebugInfo/CodeView/CodeView.h" |
| 13 | #include "llvm/DebugInfo/CodeView/TypeRecord.h" |
Zachary Turner | d2684b7 | 2017-02-25 00:33:34 +0000 | [diff] [blame] | 14 | #include "llvm/DebugInfo/MSF/BinaryStreamReader.h" |
Zachary Turner | a3225b0 | 2016-07-29 20:56:36 +0000 | [diff] [blame] | 15 | #include "llvm/DebugInfo/MSF/MappedBlockStream.h" |
Adrian McCarthy | 6b6b8c4 | 2017-01-25 22:38:55 +0000 | [diff] [blame] | 16 | #include "llvm/DebugInfo/PDB/Native/PDBFile.h" |
| 17 | #include "llvm/DebugInfo/PDB/Native/RawConstants.h" |
| 18 | #include "llvm/DebugInfo/PDB/Native/RawError.h" |
Rui Ueyama | 0fcd826 | 2016-05-20 19:55:17 +0000 | [diff] [blame] | 19 | |
| 20 | #include "llvm/Support/Endian.h" |
| 21 | |
| 22 | using namespace llvm; |
Zachary Turner | bac69d3 | 2016-07-22 19:56:05 +0000 | [diff] [blame] | 23 | using namespace llvm::msf; |
Rui Ueyama | 0fcd826 | 2016-05-20 19:55:17 +0000 | [diff] [blame] | 24 | using namespace llvm::support; |
| 25 | using namespace llvm::pdb; |
| 26 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 27 | SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream) |
| 28 | : Stream(std::move(Stream)) {} |
Rui Ueyama | 0fcd826 | 2016-05-20 19:55:17 +0000 | [diff] [blame] | 29 | |
| 30 | SymbolStream::~SymbolStream() {} |
| 31 | |
Zachary Turner | 9e33e6f | 2016-05-24 18:55:14 +0000 | [diff] [blame] | 32 | Error SymbolStream::reload() { |
Zachary Turner | bac69d3 | 2016-07-22 19:56:05 +0000 | [diff] [blame] | 33 | StreamReader Reader(*Stream); |
Rui Ueyama | 0fcd826 | 2016-05-20 19:55:17 +0000 | [diff] [blame] | 34 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 35 | if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength())) |
Zachary Turner | 0d43c1c | 2016-05-28 05:21:57 +0000 | [diff] [blame] | 36 | return EC; |
Rui Ueyama | 0fcd826 | 2016-05-20 19:55:17 +0000 | [diff] [blame] | 37 | |
Rui Ueyama | 0fcd826 | 2016-05-20 19:55:17 +0000 | [diff] [blame] | 38 | return Error::success(); |
| 39 | } |
Zachary Turner | 9e33e6f | 2016-05-24 18:55:14 +0000 | [diff] [blame] | 40 | |
Zachary Turner | 0d43c1c | 2016-05-28 05:21:57 +0000 | [diff] [blame] | 41 | iterator_range<codeview::CVSymbolArray::Iterator> |
| 42 | SymbolStream::getSymbols(bool *HadError) const { |
| 43 | return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end()); |
Zachary Turner | 9e33e6f | 2016-05-24 18:55:14 +0000 | [diff] [blame] | 44 | } |
Zachary Turner | 8848a7a | 2016-07-06 18:05:57 +0000 | [diff] [blame] | 45 | |
| 46 | Error SymbolStream::commit() { return Error::success(); } |