LLVM  13.0.0git
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"
15 
16 namespace llvm {
17 namespace codeview {
19 public:
20  virtual ~TypeCollection() = default;
21 
22  bool empty() { return size() == 0; }
23 
24  virtual Optional<TypeIndex> getFirst() = 0;
25  virtual Optional<TypeIndex> getNext(TypeIndex Prev) = 0;
26 
27  virtual CVType getType(TypeIndex Index) = 0;
28  virtual StringRef getTypeName(TypeIndex Index) = 0;
29  virtual bool contains(TypeIndex Index) = 0;
30  virtual uint32_t size() = 0;
31  virtual uint32_t capacity() = 0;
32  virtual bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) = 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
llvm::codeview::TypeCollection::contains
virtual bool contains(TypeIndex Index)=0
llvm
Definition: AllocatorList.h:23
llvm::codeview::TypeCollection::ForEachRecord
void ForEachRecord(TFunc Func)
Definition: TypeCollection.h:34
llvm::codeview::TypeCollection::getFirst
virtual Optional< TypeIndex > getFirst()=0
StringRef.h
llvm::codeview::TypeCollection::capacity
virtual uint32_t capacity()=0
llvm::Optional
Definition: APInt.h:33
llvm::codeview::TypeCollection::~TypeCollection
virtual ~TypeCollection()=default
llvm::Optional::hasValue
constexpr bool hasValue() const
Definition: Optional.h:288
llvm::codeview::TypeCollection::getNext
virtual Optional< TypeIndex > getNext(TypeIndex Prev)=0
llvm::codeview::TypeCollection
Definition: TypeCollection.h:18
llvm::codeview::TypeCollection::getType
virtual CVType getType(TypeIndex Index)=0
llvm::codeview::TypeCollection::size
virtual uint32_t size()=0
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::codeview::TypeCollection::getTypeName
virtual StringRef getTypeName(TypeIndex Index)=0
llvm::codeview::TypeCollection::empty
bool empty()
Definition: TypeCollection.h:22
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::codeview::CVRecord< TypeLeafKind >
uint32_t
CVRecord.h
TypeIndex.h
llvm::codeview::TypeCollection::replaceType
virtual bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize)=0
N
#define N
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition: TypeIndex.h:95