File indexing completed on 2026-05-10 08:43:39
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
0010 #define LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
0011
0012 #include "llvm/ADT/ArrayRef.h"
0013 #include "llvm/ADT/DenseMap.h"
0014 #include "llvm/ADT/SmallVector.h"
0015 #include "llvm/DebugInfo/CodeView/CVRecord.h"
0016 #include "llvm/DebugInfo/CodeView/SimpleTypeSerializer.h"
0017 #include "llvm/DebugInfo/CodeView/TypeCollection.h"
0018 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
0019 #include "llvm/Support/Allocator.h"
0020 #include <cstdint>
0021
0022 namespace llvm {
0023 namespace codeview {
0024 struct LocallyHashedType;
0025
0026 class ContinuationRecordBuilder;
0027
0028 class MergingTypeTableBuilder : public TypeCollection {
0029
0030 BumpPtrAllocator &RecordStorage;
0031
0032
0033
0034
0035 SimpleTypeSerializer SimpleSerializer;
0036
0037
0038 DenseMap<LocallyHashedType, TypeIndex> HashedRecords;
0039
0040
0041 SmallVector<ArrayRef<uint8_t>, 2> SeenRecords;
0042
0043 public:
0044 explicit MergingTypeTableBuilder(BumpPtrAllocator &Storage);
0045 ~MergingTypeTableBuilder();
0046
0047
0048 std::optional<TypeIndex> getFirst() override;
0049 std::optional<TypeIndex> getNext(TypeIndex Prev) override;
0050 CVType getType(TypeIndex Index) override;
0051 StringRef getTypeName(TypeIndex Index) override;
0052 bool contains(TypeIndex Index) override;
0053 uint32_t size() override;
0054 uint32_t capacity() override;
0055 bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
0056
0057
0058 void reset();
0059 TypeIndex nextTypeIndex() const;
0060
0061 BumpPtrAllocator &getAllocator() { return RecordStorage; }
0062
0063 ArrayRef<ArrayRef<uint8_t>> records() const;
0064
0065 TypeIndex insertRecordAs(hash_code Hash, ArrayRef<uint8_t> &Record);
0066 TypeIndex insertRecordBytes(ArrayRef<uint8_t> &Record);
0067 TypeIndex insertRecord(ContinuationRecordBuilder &Builder);
0068
0069 template <typename T> TypeIndex writeLeafType(T &Record) {
0070 ArrayRef<uint8_t> Data = SimpleSerializer.serialize(Record);
0071 return insertRecordBytes(Data);
0072 }
0073 };
0074
0075 }
0076 }
0077
0078 #endif