brintos

brintos / llvm-project-archived public Read only

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