IPDBEnumChildren.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 <cassert>
  16. #include <cstdint>
  17. #include <memory>
  18. namespace llvm {
  19. namespace pdb {
  20. template <typename ChildType> class IPDBEnumChildren {
  21. public:
  22. using ChildTypePtr = std::unique_ptr<ChildType>;
  23. using MyType = IPDBEnumChildren<ChildType>;
  24. virtual ~IPDBEnumChildren() = default;
  25. virtual uint32_t getChildCount() const = 0;
  26. virtual ChildTypePtr getChildAtIndex(uint32_t Index) const = 0;
  27. virtual ChildTypePtr getNext() = 0;
  28. virtual void reset() = 0;
  29. };
  30. template <typename ChildType>
  31. class NullEnumerator : public IPDBEnumChildren<ChildType> {
  32. virtual uint32_t getChildCount() const override { return 0; }
  33. virtual std::unique_ptr<ChildType>
  34. getChildAtIndex(uint32_t Index) const override {
  35. return nullptr;
  36. }
  37. virtual std::unique_ptr<ChildType> getNext() override {
  38. return nullptr;
  39. }
  40. virtual void reset() override {}
  41. };
  42. } // end namespace pdb
  43. } // end namespace llvm
  44. #endif // LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
  45. #ifdef __GNUC__
  46. #pragma GCC diagnostic pop
  47. #endif