1 //==- DIAEnumSourceFiles.cpp - DIA Source File Enumerator impl ---*- C++ -*-==// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "llvm/DebugInfo/PDB/DIA/DIAEnumInjectedSources.h" 11 #include "llvm/DebugInfo/PDB/DIA/DIAInjectedSource.h" 12 #include "llvm/DebugInfo/PDB/PDBSymbol.h" 13 14 using namespace llvm; 15 using namespace llvm::pdb; 16 17 DIAEnumInjectedSources::DIAEnumInjectedSources( 18 CComPtr<IDiaEnumInjectedSources> DiaEnumerator) 19 : Enumerator(DiaEnumerator) {} 20 21 uint32_t DIAEnumInjectedSources::getChildCount() const { 22 LONG Count = 0; 23 return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0; 24 } 25 26 std::unique_ptr<IPDBInjectedSource> 27 DIAEnumInjectedSources::getChildAtIndex(uint32_t Index) const { 28 CComPtr<IDiaInjectedSource> Item; 29 if (S_OK != Enumerator->Item(Index, &Item)) 30 return nullptr; 31 32 return std::unique_ptr<IPDBInjectedSource>(new DIAInjectedSource(Item)); 33 } 34 35 std::unique_ptr<IPDBInjectedSource> DIAEnumInjectedSources::getNext() { 36 CComPtr<IDiaInjectedSource> Item; 37 ULONG NumFetched = 0; 38 if (S_OK != Enumerator->Next(1, &Item, &NumFetched)) 39 return nullptr; 40 41 return std::unique_ptr<IPDBInjectedSource>(new DIAInjectedSource(Item)); 42 } 43 44 void DIAEnumInjectedSources::reset() { Enumerator->Reset(); } 45