Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp
35293 views
//==- NativeEnumSymbols.cpp - Native Symbol Enumerator impl ------*- C++ -*-==//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h"910#include "llvm/DebugInfo/CodeView/CodeView.h"11#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"12#include "llvm/DebugInfo/PDB/Native/NativeSession.h"13#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"14#include "llvm/DebugInfo/PDB/PDBSymbol.h"1516using namespace llvm;17using namespace llvm::codeview;18using namespace llvm::pdb;1920NativeEnumSymbols::NativeEnumSymbols(NativeSession &PDBSession,21std::vector<SymIndexId> Symbols)22: Symbols(std::move(Symbols)), Index(0), Session(PDBSession) {}2324uint32_t NativeEnumSymbols::getChildCount() const {25return static_cast<uint32_t>(Symbols.size());26}2728std::unique_ptr<PDBSymbol>29NativeEnumSymbols::getChildAtIndex(uint32_t N) const {30if (N < Symbols.size()) {31return Session.getSymbolCache().getSymbolById(Symbols[N]);32}33return nullptr;34}3536std::unique_ptr<PDBSymbol> NativeEnumSymbols::getNext() {37return getChildAtIndex(Index++);38}3940void NativeEnumSymbols::reset() { Index = 0; }414243