IPDBEnumChildren.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- IPDBEnumChildren.h - base interface for child enumerator -*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
  14. #define LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
  15. #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
  16. #include <cassert>
  17. #include <cstdint>
  18. #include <memory>
  19. namespace llvm {
  20. namespace pdb {
  21. template <typename ChildType> class IPDBEnumChildren {
  22. public:
  23. using ChildTypePtr = std::unique_ptr<ChildType>;
  24. using MyType = IPDBEnumChildren<ChildType>;
  25. virtual ~IPDBEnumChildren() = default;
  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. template <typename ChildType>
  32. class NullEnumerator : public IPDBEnumChildren<ChildType> {
  33. uint32_t getChildCount() const override { return 0; }
  34. std::unique_ptr<ChildType> getChildAtIndex(uint32_t Index) const override {
  35. return nullptr;
  36. }
  37. std::unique_ptr<ChildType> getNext() override { return nullptr; }
  38. void reset() override {}
  39. };
  40. } // end namespace pdb
  41. } // end namespace llvm
  42. #endif // LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
  43. #ifdef __GNUC__
  44. #pragma GCC diagnostic pop
  45. #endif