LLVM  10.0.0svn
TypeCollection.h
Go to the documentation of this file.
1 //===- TypeCollection.h - A collection of CodeView type records -*- 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_CODEVIEW_TYPECOLLECTION_H
10 #define LLVM_DEBUGINFO_CODEVIEW_TYPECOLLECTION_H
11 
12 #include "llvm/ADT/StringRef.h"
13 
16 
17 namespace llvm {
18 namespace codeview {
20 public:
21  virtual ~TypeCollection() = default;
22 
23  bool empty() { return size() == 0; }
24 
25  virtual Optional<TypeIndex> getFirst() = 0;
26  virtual Optional<TypeIndex> getNext(TypeIndex Prev) = 0;
27 
28  virtual CVType getType(TypeIndex Index) = 0;
29  virtual StringRef getTypeName(TypeIndex Index) = 0;
30  virtual bool contains(TypeIndex Index) = 0;
31  virtual uint32_t size() = 0;
32  virtual uint32_t capacity() = 0;
33 
34  template <typename TFunc> void ForEachRecord(TFunc Func) {
36 
37  while (Next.hasValue()) {
38  TypeIndex N = *Next;
39  Func(N, getType(N));
40  Next = getNext(N);
41  }
42  }
43 };
44 }
45 }
46 
47 #endif
virtual Optional< TypeIndex > getNext(TypeIndex Prev)=0
This class represents lattice values for constants.
Definition: AllocatorList.h:23
virtual CVType getType(TypeIndex Index)=0
virtual uint32_t size()=0
virtual Optional< TypeIndex > getFirst()=0
A 32-bit type reference.
Definition: TypeIndex.h:95
virtual bool contains(TypeIndex Index)=0
virtual uint32_t capacity()=0
virtual StringRef getTypeName(TypeIndex Index)=0
bool hasValue() const
Definition: Optional.h:259
#define N
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
virtual ~TypeCollection()=default