blob: 6e4d56443a07280c58efda27563a56fc7c23270a [file] [log] [blame]
Adrian McCarthy65d26882017-03-15 20:17:58 +00001//==- 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 Turner7999b4f2018-09-05 23:30:38 +000014#include "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h"
Adrian McCarthy65d26882017-03-15 20:17:58 +000015#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
16#include "llvm/DebugInfo/PDB/PDBSymbol.h"
17#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
Zachary Turner7999b4f2018-09-05 23:30:38 +000018#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
Adrian McCarthy65d26882017-03-15 20:17:58 +000019
20namespace llvm {
21namespace pdb {
22
Zachary Turner7999b4f2018-09-05 23:30:38 +000023NativeEnumModules::NativeEnumModules(NativeSession &PDBSession, uint32_t Index)
24 : Session(PDBSession), Index(Index) {}
Adrian McCarthy65d26882017-03-15 20:17:58 +000025
26uint32_t NativeEnumModules::getChildCount() const {
Zachary Turner8ab7dd602018-09-07 00:12:34 +000027 return Session.getSymbolCache().getNumCompilands();
Adrian McCarthy65d26882017-03-15 20:17:58 +000028}
29
30std::unique_ptr<PDBSymbol>
Zachary Turner7999b4f2018-09-05 23:30:38 +000031NativeEnumModules::getChildAtIndex(uint32_t N) const {
Zachary Turner8ab7dd602018-09-07 00:12:34 +000032 return Session.getSymbolCache().getOrCreateCompiland(N);
Adrian McCarthy65d26882017-03-15 20:17:58 +000033}
34
35std::unique_ptr<PDBSymbol> NativeEnumModules::getNext() {
Zachary Turner7999b4f2018-09-05 23:30:38 +000036 if (Index >= getChildCount())
Adrian McCarthy65d26882017-03-15 20:17:58 +000037 return nullptr;
38 return getChildAtIndex(Index++);
39}
40
41void NativeEnumModules::reset() { Index = 0; }
42
Adrian McCarthy65d26882017-03-15 20:17:58 +000043}
44}