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