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/NativeCompilandSymbol.h"
14 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
15 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
16 #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
21 NativeEnumModules::NativeEnumModules(NativeSession &PDBSession,
22 ArrayRef<ModuleInfoEx> Modules,
24 : Session(PDBSession), Modules(Modules), Index(Index) {}
26 uint32_t NativeEnumModules::getChildCount() const {
27 return static_cast<uint32_t>(Modules.size());
30 std::unique_ptr<PDBSymbol>
31 NativeEnumModules::getChildAtIndex(uint32_t Index) const {
32 if (Index >= Modules.size())
34 return std::unique_ptr<PDBSymbol>(new PDBSymbolCompiland(Session,
35 std::unique_ptr<IPDBRawSymbol>(
36 new NativeCompilandSymbol(Session, Modules[Index]))));
39 std::unique_ptr<PDBSymbol> NativeEnumModules::getNext() {
40 if (Index >= Modules.size())
42 return getChildAtIndex(Index++);
45 void NativeEnumModules::reset() { Index = 0; }
47 NativeEnumModules *NativeEnumModules::clone() const {
48 return new NativeEnumModules(Session, Modules, Index);