Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/PDB/DIA/DIAEnumSectionContribs.cpp
35294 views
//==- DIAEnumSectionContribs.cpp ---------------------------------*- 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/DIAEnumSectionContribs.h"9#include "llvm/DebugInfo/PDB/DIA/DIASectionContrib.h"10#include "llvm/DebugInfo/PDB/DIA/DIASession.h"1112using namespace llvm;13using namespace llvm::pdb;1415DIAEnumSectionContribs::DIAEnumSectionContribs(16const DIASession &PDBSession,17CComPtr<IDiaEnumSectionContribs> DiaEnumerator)18: Session(PDBSession), Enumerator(DiaEnumerator) {}1920uint32_t DIAEnumSectionContribs::getChildCount() const {21LONG Count = 0;22return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;23}2425std::unique_ptr<IPDBSectionContrib>26DIAEnumSectionContribs::getChildAtIndex(uint32_t Index) const {27CComPtr<IDiaSectionContrib> Item;28if (S_OK != Enumerator->Item(Index, &Item))29return nullptr;3031return std::unique_ptr<IPDBSectionContrib>(32new DIASectionContrib(Session, Item));33}3435std::unique_ptr<IPDBSectionContrib> DIAEnumSectionContribs::getNext() {36CComPtr<IDiaSectionContrib> Item;37ULONG NumFetched = 0;38if (S_OK != Enumerator->Next(1, &Item, &NumFetched))39return nullptr;4041return std::unique_ptr<IPDBSectionContrib>(42new DIASectionContrib(Session, Item));43}4445void DIAEnumSectionContribs::reset() { Enumerator->Reset(); }464748