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