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

source code of llvm/lib/DebugInfo/PDB/Native/NativeEnumLineNumbers.cpp