1 //==- DIAEnumSectionContribs.cpp ---------------------------------*- 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/DIAEnumSectionContribs.h"
10 #include "llvm/DebugInfo/PDB/DIA/DIASectionContrib.h"
11 #include "llvm/DebugInfo/PDB/DIA/DIASession.h"
14 using namespace llvm::pdb
;
16 DIAEnumSectionContribs::DIAEnumSectionContribs(
17 const DIASession
&PDBSession
,
18 CComPtr
<IDiaEnumSectionContribs
> DiaEnumerator
)
19 : Session(PDBSession
), Enumerator(DiaEnumerator
) {}
21 uint32_t DIAEnumSectionContribs::getChildCount() const {
23 return (S_OK
== Enumerator
->get_Count(&Count
)) ? Count
: 0;
26 std::unique_ptr
<IPDBSectionContrib
>
27 DIAEnumSectionContribs::getChildAtIndex(uint32_t Index
) const {
28 CComPtr
<IDiaSectionContrib
> Item
;
29 if (S_OK
!= Enumerator
->Item(Index
, &Item
))
32 return std::unique_ptr
<IPDBSectionContrib
>(
33 new DIASectionContrib(Session
, Item
));
36 std::unique_ptr
<IPDBSectionContrib
> DIAEnumSectionContribs::getNext() {
37 CComPtr
<IDiaSectionContrib
> Item
;
39 if (S_OK
!= Enumerator
->Next(1, &Item
, &NumFetched
))
42 return std::unique_ptr
<IPDBSectionContrib
>(
43 new DIASectionContrib(Session
, Item
));
46 void DIAEnumSectionContribs::reset() { Enumerator
->Reset(); }