1 //===- TypeCollection.h - A collection of CodeView type records -*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPECOLLECTION_H
10 #define LLVM_DEBUGINFO_CODEVIEW_TYPECOLLECTION_H
12 #include "llvm/ADT/StringRef.h"
14 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
15 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
19 class TypeCollection
{
21 virtual ~TypeCollection() = default;
23 bool empty() { return size() == 0; }
25 virtual Optional
<TypeIndex
> getFirst() = 0;
26 virtual Optional
<TypeIndex
> getNext(TypeIndex Prev
) = 0;
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;
34 template <typename TFunc
> void ForEachRecord(TFunc Func
) {
35 Optional
<TypeIndex
> Next
= getFirst();
37 while (Next
.hasValue()) {