LLVM  8.0.0svn
ConcreteSymbolEnumerator.h
Go to the documentation of this file.
1 //===- ConcreteSymbolEnumerator.h -------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
11 #define LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
12 
15 #include "llvm/Support/Casting.h"
16 #include <algorithm>
17 #include <cstdint>
18 #include <memory>
19 
20 namespace llvm {
21 namespace pdb {
22 
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 
29  ~ConcreteSymbolEnumerator() override = default;
30 
31  uint32_t getChildCount() const override {
32  return Enumerator->getChildCount();
33  }
34 
35  std::unique_ptr<ChildType> getChildAtIndex(uint32_t Index) const override {
36  std::unique_ptr<PDBSymbol> Child = Enumerator->getChildAtIndex(Index);
37  return unique_dyn_cast_or_null<ChildType>(Child);
38  }
39 
40  std::unique_ptr<ChildType> getNext() override {
41  return unique_dyn_cast_or_null<ChildType>(Enumerator->getNext());
42  }
43 
44  void reset() override { Enumerator->reset(); }
45 
46 private:
47 
48  std::unique_ptr<IPDBEnumSymbols> Enumerator;
49 };
50 
51 } // end namespace pdb
52 } // end namespace llvm
53 
54 #endif // LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
std::unique_ptr< ChildType > getChildAtIndex(uint32_t Index) const override
Definition: BitVector.h:921
std::unique_ptr< ChildType > getNext() override
~ConcreteSymbolEnumerator() override=default
ConcreteSymbolEnumerator(std::unique_ptr< IPDBEnumSymbols > SymbolEnumerator)