1 //==- NativeEnumModules.cpp - Native Symbol Enumerator impl ------*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/DebugInfo/PDB/Native/NativeEnumModules.h"
12 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
13 #include "llvm/DebugInfo/PDB/Native/DbiModuleList.h"
14 #include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
15 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
16 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
17 #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
22 NativeEnumModules::NativeEnumModules(NativeSession &PDBSession,
23 const DbiModuleList &Modules,
25 : Session(PDBSession), Modules(Modules), Index(Index) {}
27 uint32_t NativeEnumModules::getChildCount() const {
28 return static_cast<uint32_t>(Modules.getModuleCount());
31 std::unique_ptr<PDBSymbol>
32 NativeEnumModules::getChildAtIndex(uint32_t Index) const {
33 if (Index >= Modules.getModuleCount())
35 return Session.createCompilandSymbol(Modules.getModuleDescriptor(Index));
38 std::unique_ptr<PDBSymbol> NativeEnumModules::getNext() {
39 if (Index >= Modules.getModuleCount())
41 return getChildAtIndex(Index++);
44 void NativeEnumModules::reset() { Index = 0; }
46 NativeEnumModules *NativeEnumModules::clone() const {
47 return new NativeEnumModules(Session, Modules, Index);