LLVM  15.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 
13 #include <cassert>
14 #include <cstdint>
15 #include <memory>
16 
17 namespace llvm {
18 namespace pdb {
19 
20 template <typename ChildType> class IPDBEnumChildren {
21 public:
22  using ChildTypePtr = std::unique_ptr<ChildType>;
24 
25  virtual ~IPDBEnumChildren() = default;
26 
27  virtual uint32_t getChildCount() const = 0;
28  virtual ChildTypePtr getChildAtIndex(uint32_t Index) const = 0;
29  virtual ChildTypePtr getNext() = 0;
30  virtual void reset() = 0;
31 };
32 
33 template <typename ChildType>
34 class NullEnumerator : public IPDBEnumChildren<ChildType> {
35  virtual uint32_t getChildCount() const override { return 0; }
36  virtual std::unique_ptr<ChildType>
37  getChildAtIndex(uint32_t Index) const override {
38  return nullptr;
39  }
40  virtual std::unique_ptr<ChildType> getNext() override {
41  return nullptr;
42  }
43  virtual void reset() override {}
44 };
45 
46 } // end namespace pdb
47 } // end namespace llvm
48 
49 #endif // LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
llvm::pdb::IPDBEnumChildren< IPDBDataStream >::ChildTypePtr
std::unique_ptr< IPDBDataStream > ChildTypePtr
Definition: IPDBEnumChildren.h:22
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::pdb::IPDBEnumChildren::getChildCount
virtual uint32_t getChildCount() const =0
llvm::pdb::IPDBEnumChildren::~IPDBEnumChildren
virtual ~IPDBEnumChildren()=default
LazyRandomTypeCollection.h
llvm::pdb::NullEnumerator
Definition: IPDBEnumChildren.h:34
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
llvm::pdb::IPDBEnumChildren::getChildAtIndex
virtual ChildTypePtr getChildAtIndex(uint32_t Index) const =0
llvm::pdb::IPDBEnumChildren::getNext
virtual ChildTypePtr getNext()=0
uint32_t
llvm::pdb::IPDBEnumChildren
Definition: IPDBEnumChildren.h:20
llvm::pdb::IPDBEnumChildren::reset
virtual void reset()=0