LLVM  14.0.0git
IPDBEnumChildren.h
Go to the documentation of this file.
1 //===- IPDBEnumChildren.h - base interface for child enumerator -*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
10 #define LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
11 
12 #include <cassert>
13 #include <cstdint>
14 #include <memory>
15 
16 namespace llvm {
17 namespace pdb {
18 
19 template <typename ChildType> class IPDBEnumChildren {
20 public:
21  using ChildTypePtr = std::unique_ptr<ChildType>;
23 
24  virtual ~IPDBEnumChildren() = default;
25 
26  virtual uint32_t getChildCount() const = 0;
27  virtual ChildTypePtr getChildAtIndex(uint32_t Index) const = 0;
28  virtual ChildTypePtr getNext() = 0;
29  virtual void reset() = 0;
30 };
31 
32 template <typename ChildType>
33 class NullEnumerator : public IPDBEnumChildren<ChildType> {
34  virtual uint32_t getChildCount() const override { return 0; }
35  virtual std::unique_ptr<ChildType>
36  getChildAtIndex(uint32_t Index) const override {
37  return nullptr;
38  }
39  virtual std::unique_ptr<ChildType> getNext() override {
40  return nullptr;
41  }
42  virtual void reset() override {}
43 };
44 
45 } // end namespace pdb
46 } // end namespace llvm
47 
48 #endif // LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
llvm::pdb::IPDBEnumChildren< IPDBDataStream >::ChildTypePtr
std::unique_ptr< IPDBDataStream > ChildTypePtr
Definition: IPDBEnumChildren.h:21
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::pdb::IPDBEnumChildren::getChildCount
virtual uint32_t getChildCount() const =0
llvm::pdb::IPDBEnumChildren::~IPDBEnumChildren
virtual ~IPDBEnumChildren()=default
llvm::pdb::NullEnumerator
Definition: IPDBEnumChildren.h:33
llvm::pdb::IPDBEnumChildren::getChildAtIndex
virtual ChildTypePtr getChildAtIndex(uint32_t Index) const =0
llvm::pdb::IPDBEnumChildren::getNext
virtual ChildTypePtr getNext()=0
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
uint32_t
llvm::pdb::IPDBEnumChildren
Definition: IPDBEnumChildren.h:19
llvm::pdb::IPDBEnumChildren::reset
virtual void reset()=0