Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/PDB/DIA/DIAEnumTables.cpp
35294 views
//===- DIAEnumTables.cpp - DIA Table 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/DIA/DIAEnumTables.h"9#include "llvm/DebugInfo/PDB/DIA/DIATable.h"1011using namespace llvm;12using namespace llvm::pdb;1314DIAEnumTables::DIAEnumTables(CComPtr<IDiaEnumTables> DiaEnumerator)15: Enumerator(DiaEnumerator) {}1617uint32_t DIAEnumTables::getChildCount() const {18LONG Count = 0;19return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;20}2122std::unique_ptr<IPDBTable>23DIAEnumTables::getChildAtIndex(uint32_t Index) const {24CComPtr<IDiaTable> Item;25VARIANT Var;26Var.vt = VT_UINT;27Var.uintVal = Index;28if (S_OK != Enumerator->Item(Var, &Item))29return nullptr;3031return std::unique_ptr<IPDBTable>(new DIATable(Item));32}3334std::unique_ptr<IPDBTable> DIAEnumTables::getNext() {35CComPtr<IDiaTable> Item;36ULONG CeltFetched = 0;37if (S_OK != Enumerator->Next(1, &Item, &CeltFetched))38return nullptr;3940return std::unique_ptr<IPDBTable>(new DIATable(Item));41}4243void DIAEnumTables::reset() { Enumerator->Reset(); }444546