LLVM  6.0.0svn
NativeEnumTypes.cpp
Go to the documentation of this file.
1 //==- NativeEnumTypes.cpp - Native Type Enumerator impl ----------*- 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 
11 
17 
18 namespace llvm {
19 namespace pdb {
20 
24  : Matches(), Index(0), Session(PDBSession), Kind(Kind) {
25  for (auto Index = Types.getFirst(); Index;
26  Index = Types.getNext(Index.getValue())) {
27  if (Types.getType(Index.getValue()).kind() == Kind)
28  Matches.push_back(Index.getValue());
29  }
30 }
31 
33  NativeSession &PDBSession, const std::vector<codeview::TypeIndex> &Matches,
35  : Matches(Matches), Index(0), Session(PDBSession), Kind(Kind) {}
36 
38  return static_cast<uint32_t>(Matches.size());
39 }
40 
41 std::unique_ptr<PDBSymbol>
43  if (Index < Matches.size())
44  return Session.createEnumSymbol(Matches[Index]);
45  return nullptr;
46 }
47 
48 std::unique_ptr<PDBSymbol> NativeEnumTypes::getNext() {
49  return getChildAtIndex(Index++);
50 }
51 
52 void NativeEnumTypes::reset() { Index = 0; }
53 
55  return new NativeEnumTypes(Session, Matches, Kind);
56 }
57 
58 } // namespace pdb
59 } // namespace llvm
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
Definition: CodeView.h:34
Optional< TypeIndex > getNext(TypeIndex Prev) override
std::unique_ptr< PDBSymbolTypeEnum > createEnumSymbol(codeview::TypeIndex Index)
NativeEnumTypes * clone() const override
std::unique_ptr< PDBSymbol > getChildAtIndex(uint32_t Index) const override
std::unique_ptr< PDBSymbol > getNext() override
NativeEnumTypes(NativeSession &Session, codeview::LazyRandomTypeCollection &TypeCollection, codeview::TypeLeafKind Kind)
const unsigned Kind
uint32_t getChildCount() const override
Provides amortized O(1) random access to a CodeView type stream.