ConcreteSymbolEnumerator.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- ConcreteSymbolEnumerator.h -------------------------------*- 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_CONCRETESYMBOLENUMERATOR_H
  14. #define LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
  15. #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
  16. #include "llvm/DebugInfo/PDB/PDBTypes.h"
  17. #include "llvm/Support/Casting.h"
  18. #include <algorithm>
  19. #include <cstdint>
  20. #include <memory>
  21. namespace llvm {
  22. namespace pdb {
  23. template <typename ChildType>
  24. class ConcreteSymbolEnumerator : public IPDBEnumChildren<ChildType> {
  25. public:
  26. ConcreteSymbolEnumerator(std::unique_ptr<IPDBEnumSymbols> SymbolEnumerator)
  27. : Enumerator(std::move(SymbolEnumerator)) {}
  28. ~ConcreteSymbolEnumerator() override = default;
  29. uint32_t getChildCount() const override {
  30. return Enumerator->getChildCount();
  31. }
  32. std::unique_ptr<ChildType> getChildAtIndex(uint32_t Index) const override {
  33. std::unique_ptr<PDBSymbol> Child = Enumerator->getChildAtIndex(Index);
  34. return unique_dyn_cast_or_null<ChildType>(Child);
  35. }
  36. std::unique_ptr<ChildType> getNext() override {
  37. return unique_dyn_cast_or_null<ChildType>(Enumerator->getNext());
  38. }
  39. void reset() override { Enumerator->reset(); }
  40. private:
  41. std::unique_ptr<IPDBEnumSymbols> Enumerator;
  42. };
  43. } // end namespace pdb
  44. } // end namespace llvm
  45. #endif // LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
  46. #ifdef __GNUC__
  47. #pragma GCC diagnostic pop
  48. #endif