1*7330f729Sjoerg //==- NativeEnumModules.cpp - Native Symbol Enumerator impl ------*- C++ -*-==// 2*7330f729Sjoerg // 3*7330f729Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*7330f729Sjoerg // See https://llvm.org/LICENSE.txt for license information. 5*7330f729Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*7330f729Sjoerg // 7*7330f729Sjoerg //===----------------------------------------------------------------------===// 8*7330f729Sjoerg 9*7330f729Sjoerg #include "llvm/DebugInfo/PDB/Native/NativeEnumModules.h" 10*7330f729Sjoerg 11*7330f729Sjoerg #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" 12*7330f729Sjoerg #include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h" 13*7330f729Sjoerg #include "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h" 14*7330f729Sjoerg #include "llvm/DebugInfo/PDB/Native/NativeSession.h" 15*7330f729Sjoerg #include "llvm/DebugInfo/PDB/PDBSymbol.h" 16*7330f729Sjoerg #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h" 17*7330f729Sjoerg #include "llvm/DebugInfo/PDB/PDBSymbolExe.h" 18*7330f729Sjoerg 19*7330f729Sjoerg namespace llvm { 20*7330f729Sjoerg namespace pdb { 21*7330f729Sjoerg NativeEnumModules(NativeSession & PDBSession,uint32_t Index)22*7330f729SjoergNativeEnumModules::NativeEnumModules(NativeSession &PDBSession, uint32_t Index) 23*7330f729Sjoerg : Session(PDBSession), Index(Index) {} 24*7330f729Sjoerg getChildCount() const25*7330f729Sjoerguint32_t NativeEnumModules::getChildCount() const { 26*7330f729Sjoerg return Session.getSymbolCache().getNumCompilands(); 27*7330f729Sjoerg } 28*7330f729Sjoerg 29*7330f729Sjoerg std::unique_ptr<PDBSymbol> getChildAtIndex(uint32_t N) const30*7330f729SjoergNativeEnumModules::getChildAtIndex(uint32_t N) const { 31*7330f729Sjoerg return Session.getSymbolCache().getOrCreateCompiland(N); 32*7330f729Sjoerg } 33*7330f729Sjoerg getNext()34*7330f729Sjoergstd::unique_ptr<PDBSymbol> NativeEnumModules::getNext() { 35*7330f729Sjoerg if (Index >= getChildCount()) 36*7330f729Sjoerg return nullptr; 37*7330f729Sjoerg return getChildAtIndex(Index++); 38*7330f729Sjoerg } 39*7330f729Sjoerg reset()40*7330f729Sjoergvoid NativeEnumModules::reset() { Index = 0; } 41*7330f729Sjoerg 42*7330f729Sjoerg } 43*7330f729Sjoerg } 44