]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / PDB / IPDBEnumChildren.h
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>;
22   using MyType = IPDBEnumChildren<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