Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/PDB/DIA/DIAEnumDebugStreams.cpp
35294 views
//==- DIAEnumDebugStreams.cpp - DIA Debug Stream Enumerator impl -*- C++ -*-==//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h"9#include "llvm/DebugInfo/PDB/DIA/DIADataStream.h"10#include "llvm/DebugInfo/PDB/PDBSymbol.h"1112using namespace llvm;13using namespace llvm::pdb;1415DIAEnumDebugStreams::DIAEnumDebugStreams(16CComPtr<IDiaEnumDebugStreams> DiaEnumerator)17: Enumerator(DiaEnumerator) {}1819uint32_t DIAEnumDebugStreams::getChildCount() const {20LONG Count = 0;21return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;22}2324std::unique_ptr<IPDBDataStream>25DIAEnumDebugStreams::getChildAtIndex(uint32_t Index) const {26CComPtr<IDiaEnumDebugStreamData> Item;27VARIANT VarIndex;28VarIndex.vt = VT_I4;29VarIndex.lVal = Index;30if (S_OK != Enumerator->Item(VarIndex, &Item))31return nullptr;3233return std::unique_ptr<IPDBDataStream>(new DIADataStream(Item));34}3536std::unique_ptr<IPDBDataStream> DIAEnumDebugStreams::getNext() {37CComPtr<IDiaEnumDebugStreamData> Item;38ULONG NumFetched = 0;39if (S_OK != Enumerator->Next(1, &Item, &NumFetched))40return nullptr;4142return std::unique_ptr<IPDBDataStream>(new DIADataStream(Item));43}4445void DIAEnumDebugStreams::reset() { Enumerator->Reset(); }464748