1 //==- DIAEnumDebugStreams.cpp - DIA Debug Stream 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/DIAEnumDebugStreams.h"
10 #include "llvm/DebugInfo/PDB/DIA/DIADataStream.h"
11 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
14 using namespace llvm::pdb
;
16 DIAEnumDebugStreams::DIAEnumDebugStreams(
17 CComPtr
<IDiaEnumDebugStreams
> DiaEnumerator
)
18 : Enumerator(DiaEnumerator
) {}
20 uint32_t DIAEnumDebugStreams::getChildCount() const {
22 return (S_OK
== Enumerator
->get_Count(&Count
)) ? Count
: 0;
25 std::unique_ptr
<IPDBDataStream
>
26 DIAEnumDebugStreams::getChildAtIndex(uint32_t Index
) const {
27 CComPtr
<IDiaEnumDebugStreamData
> Item
;
30 VarIndex
.lVal
= Index
;
31 if (S_OK
!= Enumerator
->Item(VarIndex
, &Item
))
34 return std::unique_ptr
<IPDBDataStream
>(new DIADataStream(Item
));
37 std::unique_ptr
<IPDBDataStream
> DIAEnumDebugStreams::getNext() {
38 CComPtr
<IDiaEnumDebugStreamData
> Item
;
40 if (S_OK
!= Enumerator
->Next(1, &Item
, &NumFetched
))
43 return std::unique_ptr
<IPDBDataStream
>(new DIADataStream(Item
));
46 void DIAEnumDebugStreams::reset() { Enumerator
->Reset(); }