LLVM 19.0.0git
AppendingTypeTableBuilder.h
Go to the documentation of this file.
1//===- AppendingTypeTableBuilder.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//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_CODEVIEW_APPENDINGTYPETABLEBUILDER_H
10#define LLVM_DEBUGINFO_CODEVIEW_APPENDINGTYPETABLEBUILDER_H
11
12#include "llvm/ADT/ArrayRef.h"
19#include <cstdint>
20
21namespace llvm {
22namespace codeview {
23
25
27
28 BumpPtrAllocator &RecordStorage;
29 SimpleTypeSerializer SimpleSerializer;
30
31 /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
32 SmallVector<ArrayRef<uint8_t>, 2> SeenRecords;
33
34public:
37
38 // TypeCollection overrides
39 std::optional<TypeIndex> getFirst() override;
40 std::optional<TypeIndex> getNext(TypeIndex Prev) override;
41 CVType getType(TypeIndex Index) override;
43 bool contains(TypeIndex Index) override;
44 uint32_t size() override;
45 uint32_t capacity() override;
46 bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
47
48 // public interface
49 void reset();
51
52 BumpPtrAllocator &getAllocator() { return RecordStorage; }
53
57
58 template <typename T> TypeIndex writeLeafType(T &Record) {
59 ArrayRef<uint8_t> Data = SimpleSerializer.serialize(Record);
60 return insertRecordBytes(Data);
61 }
62};
63
64} // end namespace codeview
65} // end namespace llvm
66
67#endif // LLVM_DEBUGINFO_CODEVIEW_APPENDINGTYPETABLEBUILDER_H
This file defines the BumpPtrAllocator interface.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
std::optional< TypeIndex > getFirst() override
std::optional< TypeIndex > getNext(TypeIndex Prev) override
TypeIndex insertRecordBytes(ArrayRef< uint8_t > &Record)
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
ArrayRef< ArrayRef< uint8_t > > records() const
ArrayRef< uint8_t > serialize(T &Record)
A 32-bit type reference.
Definition: TypeIndex.h:96
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
StringRef getTypeName()
We provide a function which tries to compute the (demangled) name of a type statically.
Definition: TypeName.h:27