NativeEnumModules.cpp 1.4 KB

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