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