LLVM  14.0.0git
ConcreteSymbolEnumerator.h
Go to the documentation of this file.
1 //===- ConcreteSymbolEnumerator.h -------------------------------*- 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_CONCRETESYMBOLENUMERATOR_H
10 #define LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
11 
14 #include "llvm/Support/Casting.h"
15 #include <algorithm>
16 #include <cstdint>
17 #include <memory>
18 
19 namespace llvm {
20 namespace pdb {
21 
22 template <typename ChildType>
23 class ConcreteSymbolEnumerator : public IPDBEnumChildren<ChildType> {
24 public:
25  ConcreteSymbolEnumerator(std::unique_ptr<IPDBEnumSymbols> SymbolEnumerator)
26  : Enumerator(std::move(SymbolEnumerator)) {}
27 
28  ~ConcreteSymbolEnumerator() override = default;
29 
30  uint32_t getChildCount() const override {
31  return Enumerator->getChildCount();
32  }
33 
34  std::unique_ptr<ChildType> getChildAtIndex(uint32_t Index) const override {
35  std::unique_ptr<PDBSymbol> Child = Enumerator->getChildAtIndex(Index);
36  return unique_dyn_cast_or_null<ChildType>(Child);
37  }
38 
39  std::unique_ptr<ChildType> getNext() override {
40  return unique_dyn_cast_or_null<ChildType>(Enumerator->getNext());
41  }
42 
43  void reset() override { Enumerator->reset(); }
44 
45 private:
46 
47  std::unique_ptr<IPDBEnumSymbols> Enumerator;
48 };
49 
50 } // end namespace pdb
51 } // end namespace llvm
52 
53 #endif // LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::pdb::ConcreteSymbolEnumerator::reset
void reset() override
Definition: ConcreteSymbolEnumerator.h:43
llvm::pdb::ConcreteSymbolEnumerator::getNext
std::unique_ptr< ChildType > getNext() override
Definition: ConcreteSymbolEnumerator.h:39
llvm::pdb::ConcreteSymbolEnumerator::ConcreteSymbolEnumerator
ConcreteSymbolEnumerator(std::unique_ptr< IPDBEnumSymbols > SymbolEnumerator)
Definition: ConcreteSymbolEnumerator.h:25
llvm::pdb::ConcreteSymbolEnumerator::~ConcreteSymbolEnumerator
~ConcreteSymbolEnumerator() override=default
llvm::pdb::ConcreteSymbolEnumerator
Definition: ConcreteSymbolEnumerator.h:23
PDBTypes.h
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
IPDBEnumChildren.h
llvm::pdb::ConcreteSymbolEnumerator::getChildCount
uint32_t getChildCount() const override
Definition: ConcreteSymbolEnumerator.h:30
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1609
uint32_t
std
Definition: BitVector.h:838
Casting.h
llvm::pdb::ConcreteSymbolEnumerator::getChildAtIndex
std::unique_ptr< ChildType > getChildAtIndex(uint32_t Index) const override
Definition: ConcreteSymbolEnumerator.h:34
llvm::pdb::IPDBEnumChildren
Definition: IPDBEnumChildren.h:19