NativeEnumLineNumbers.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //==- NativeEnumLineNumbers.cpp - Native Type 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/NativeEnumLineNumbers.h"
  9. #include "llvm/ADT/STLExtras.h"
  10. #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
  11. #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
  12. #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
  13. #include "llvm/DebugInfo/PDB/Native/NativeLineNumber.h"
  14. #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
  15. #include "llvm/DebugInfo/PDB/Native/NativeSourceFile.h"
  16. using namespace llvm;
  17. using namespace llvm::codeview;
  18. using namespace llvm::pdb;
  19. NativeEnumLineNumbers::NativeEnumLineNumbers(
  20. std::vector<NativeLineNumber> LineNums)
  21. : Lines(std::move(LineNums)), Index(0) {}
  22. uint32_t NativeEnumLineNumbers::getChildCount() const {
  23. return static_cast<uint32_t>(Lines.size());
  24. }
  25. std::unique_ptr<IPDBLineNumber>
  26. NativeEnumLineNumbers::getChildAtIndex(uint32_t N) const {
  27. if (N >= getChildCount())
  28. return nullptr;
  29. return std::make_unique<NativeLineNumber>(Lines[N]);
  30. }
  31. std::unique_ptr<IPDBLineNumber> NativeEnumLineNumbers::getNext() {
  32. return getChildAtIndex(Index++);
  33. }
  34. void NativeEnumLineNumbers::reset() { Index = 0; }