[llvm] [cmake] Add possibility to use ChooseMSVCCRT.cmake when include LLVM library
[llvm-core.git] / include / llvm / DebugInfo / PDB / ConcreteSymbolEnumerator.h
blob49ba20af7263601772b6600d4e17d07d6eab5e62
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
10 #define LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
12 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
13 #include "llvm/DebugInfo/PDB/PDBTypes.h"
14 #include "llvm/Support/Casting.h"
15 #include <algorithm>
16 #include <cstdint>
17 #include <memory>
19 namespace llvm {
20 namespace pdb {
22 template <typename ChildType>
23 class ConcreteSymbolEnumerator : public IPDBEnumChildren<ChildType> {
24 public:
25 ConcreteSymbolEnumerator(std::unique_ptr<IPDBEnumSymbols> SymbolEnumerator)
26 : Enumerator(std::move(SymbolEnumerator)) {}
28 ~ConcreteSymbolEnumerator() override = default;
30 uint32_t getChildCount() const override {
31 return Enumerator->getChildCount();
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);
39 std::unique_ptr<ChildType> getNext() override {
40 return unique_dyn_cast_or_null<ChildType>(Enumerator->getNext());
43 void reset() override { Enumerator->reset(); }
45 private:
47 std::unique_ptr<IPDBEnumSymbols> Enumerator;
50 } // end namespace pdb
51 } // end namespace llvm
53 #endif // LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H