1 //===- DIAEnumTables.cpp - DIA Table Enumerator Impl ------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/DebugInfo/PDB/DIA/DIAEnumTables.h"
10 #include "llvm/DebugInfo/PDB/DIA/DIATable.h"
13 using namespace llvm::pdb
;
15 DIAEnumTables::DIAEnumTables(CComPtr
<IDiaEnumTables
> DiaEnumerator
)
16 : Enumerator(DiaEnumerator
) {}
18 uint32_t DIAEnumTables::getChildCount() const {
20 return (S_OK
== Enumerator
->get_Count(&Count
)) ? Count
: 0;
23 std::unique_ptr
<IPDBTable
>
24 DIAEnumTables::getChildAtIndex(uint32_t Index
) const {
25 CComPtr
<IDiaTable
> Item
;
29 if (S_OK
!= Enumerator
->Item(Var
, &Item
))
32 return std::unique_ptr
<IPDBTable
>(new DIATable(Item
));
35 std::unique_ptr
<IPDBTable
> DIAEnumTables::getNext() {
36 CComPtr
<IDiaTable
> Item
;
37 ULONG CeltFetched
= 0;
38 if (S_OK
!= Enumerator
->Next(1, &Item
, &CeltFetched
))
41 return std::unique_ptr
<IPDBTable
>(new DIATable(Item
));
44 void DIAEnumTables::reset() { Enumerator
->Reset(); }