NativeEnumModules.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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/Native/NativeSession.h"
  10. #include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
  11. #include "llvm/DebugInfo/PDB/PDBSymbol.h"
  12. #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
  13. namespace llvm {
  14. namespace pdb {
  15. NativeEnumModules::NativeEnumModules(NativeSession &PDBSession, uint32_t Index)
  16. : Session(PDBSession), Index(Index) {}
  17. uint32_t NativeEnumModules::getChildCount() const {
  18. return Session.getSymbolCache().getNumCompilands();
  19. }
  20. std::unique_ptr<PDBSymbol>
  21. NativeEnumModules::getChildAtIndex(uint32_t N) const {
  22. return Session.getSymbolCache().getOrCreateCompiland(N);
  23. }
  24. std::unique_ptr<PDBSymbol> NativeEnumModules::getNext() {
  25. if (Index >= getChildCount())
  26. return nullptr;
  27. return getChildAtIndex(Index++);
  28. }
  29. void NativeEnumModules::reset() { Index = 0; }
  30. }
  31. }