Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 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 "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h" |
||
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>; |
||
23 | using MyType = IPDBEnumChildren<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 | uint32_t getChildCount() const override { return 0; } |
||
36 | std::unique_ptr<ChildType> getChildAtIndex(uint32_t Index) const override { |
||
37 | return nullptr; |
||
38 | } |
||
39 | std::unique_ptr<ChildType> getNext() override { return nullptr; } |
||
40 | void reset() override {} |
||
41 | }; |
||
42 | |||
43 | } // end namespace pdb |
||
44 | } // end namespace llvm |
||
45 | |||
46 | #endif // LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H |