1 //==- DIAEnumSourceFiles.cpp - DIA Source File 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/DIAEnumInjectedSources.h"
10 #include "llvm/DebugInfo/PDB/DIA/DIAInjectedSource.h"
11 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
14 using namespace llvm::pdb;
16 DIAEnumInjectedSources::DIAEnumInjectedSources(
17 CComPtr<IDiaEnumInjectedSources> DiaEnumerator)
18 : Enumerator(DiaEnumerator) {}
20 uint32_t DIAEnumInjectedSources::getChildCount() const {
22 return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;
25 std::unique_ptr<IPDBInjectedSource>
26 DIAEnumInjectedSources::getChildAtIndex(uint32_t Index) const {
27 CComPtr<IDiaInjectedSource> Item;
28 if (S_OK != Enumerator->Item(Index, &Item))
31 return std::unique_ptr<IPDBInjectedSource>(new DIAInjectedSource(Item));
34 std::unique_ptr<IPDBInjectedSource> DIAEnumInjectedSources::getNext() {
35 CComPtr<IDiaInjectedSource> Item;
37 if (S_OK != Enumerator->Next(1, &Item, &NumFetched))
40 return std::unique_ptr<IPDBInjectedSource>(new DIAInjectedSource(Item));
43 void DIAEnumInjectedSources::reset() { Enumerator->Reset(); }