Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 1 | //==- NativeEnumModules.cpp - Native Symbol Enumerator impl ------*- C++ -*-==// |
| 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 | |
| 10 | #include "llvm/DebugInfo/PDB/Native/NativeEnumModules.h" |
| 11 | |
| 12 | #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" |
| 13 | #include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h" |
Zachary Turner | 7999b4f | 2018-09-05 23:30:38 +0000 | [diff] [blame] | 14 | #include "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h" |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 15 | #include "llvm/DebugInfo/PDB/Native/NativeSession.h" |
| 16 | #include "llvm/DebugInfo/PDB/PDBSymbol.h" |
| 17 | #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h" |
Zachary Turner | 7999b4f | 2018-09-05 23:30:38 +0000 | [diff] [blame] | 18 | #include "llvm/DebugInfo/PDB/PDBSymbolExe.h" |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 19 | |
| 20 | namespace llvm { |
| 21 | namespace pdb { |
| 22 | |
Zachary Turner | 7999b4f | 2018-09-05 23:30:38 +0000 | [diff] [blame] | 23 | NativeEnumModules::NativeEnumModules(NativeSession &PDBSession, uint32_t Index) |
| 24 | : Session(PDBSession), Index(Index) {} |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 25 | |
| 26 | uint32_t NativeEnumModules::getChildCount() const { |
Zachary Turner | 8ab7dd60 | 2018-09-07 00:12:34 +0000 | [diff] [blame] | 27 | return Session.getSymbolCache().getNumCompilands(); |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | std::unique_ptr<PDBSymbol> |
Zachary Turner | 7999b4f | 2018-09-05 23:30:38 +0000 | [diff] [blame] | 31 | NativeEnumModules::getChildAtIndex(uint32_t N) const { |
Zachary Turner | 8ab7dd60 | 2018-09-07 00:12:34 +0000 | [diff] [blame] | 32 | return Session.getSymbolCache().getOrCreateCompiland(N); |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | std::unique_ptr<PDBSymbol> NativeEnumModules::getNext() { |
Zachary Turner | 7999b4f | 2018-09-05 23:30:38 +0000 | [diff] [blame] | 36 | if (Index >= getChildCount()) |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 37 | return nullptr; |
| 38 | return getChildAtIndex(Index++); |
| 39 | } |
| 40 | |
| 41 | void NativeEnumModules::reset() { Index = 0; } |
| 42 | |
Adrian McCarthy | 65d2688 | 2017-03-15 20:17:58 +0000 | [diff] [blame] | 43 | } |
| 44 | } |