1 //==- DIAEnumSymbols.cpp - DIA Symbol 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/DIAEnumSymbols.h"
10 #include "llvm/DebugInfo/PDB/DIA/DIARawSymbol.h"
11 #include "llvm/DebugInfo/PDB/DIA/DIASession.h"
12 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
15 using namespace llvm::pdb
;
17 DIAEnumSymbols::DIAEnumSymbols(const DIASession
&PDBSession
,
18 CComPtr
<IDiaEnumSymbols
> DiaEnumerator
)
19 : Session(PDBSession
), Enumerator(DiaEnumerator
) {}
21 uint32_t DIAEnumSymbols::getChildCount() const {
23 return (S_OK
== Enumerator
->get_Count(&Count
)) ? Count
: 0;
26 std::unique_ptr
<PDBSymbol
>
27 DIAEnumSymbols::getChildAtIndex(uint32_t Index
) const {
28 CComPtr
<IDiaSymbol
> Item
;
29 if (S_OK
!= Enumerator
->Item(Index
, &Item
))
32 std::unique_ptr
<DIARawSymbol
> RawSymbol(new DIARawSymbol(Session
, Item
));
33 return std::unique_ptr
<PDBSymbol
>(PDBSymbol::create(Session
, std::move(RawSymbol
)));
36 std::unique_ptr
<PDBSymbol
> DIAEnumSymbols::getNext() {
37 CComPtr
<IDiaSymbol
> Item
;
39 if (S_OK
!= Enumerator
->Next(1, &Item
, &NumFetched
))
42 std::unique_ptr
<DIARawSymbol
> RawSymbol(new DIARawSymbol(Session
, Item
));
43 return std::unique_ptr
<PDBSymbol
>(
44 PDBSymbol::create(Session
, std::move(RawSymbol
)));
47 void DIAEnumSymbols::reset() { Enumerator
->Reset(); }