Add unit tagging to StructTypeFieldId (#6260)

Based on #6259
This commit is contained in:
David Blaikie
2025-10-22 22:22:53 +00:00
committed by GitHub
parent 2dd9e7f0d7
commit 79541ee50c
3 changed files with 8 additions and 6 deletions
@@ -74,9 +74,9 @@ fn G(x: Cpp.X) {
// CHECK:STDOUT: specifics: {}
// CHECK:STDOUT: struct_type_fields:
// CHECK:STDOUT: struct_type_fields00000000: {}
// CHECK:STDOUT: struct_type_fields00000001:
// CHECK:STDOUT: struct_type_fields60000001:
// CHECK:STDOUT: 0: {name_id: name00000006, type_inst_id: inst6000001F}
// CHECK:STDOUT: struct_type_fields00000002:
// CHECK:STDOUT: struct_type_fields60000002:
// CHECK:STDOUT: 0: {name_id: name00000006, type_inst_id: inst6000001F}
// CHECK:STDOUT: types:
// CHECK:STDOUT: 'type(TypeType)':
@@ -144,8 +144,8 @@ fn G(x: Cpp.X) {
// CHECK:STDOUT: inst6000001F: {kind: PointerType, arg0: inst60000013, type: type(TypeType)}
// CHECK:STDOUT: inst60000020: {kind: UnboundElementType, arg0: inst60000013, arg1: inst6000001F, type: type(TypeType)}
// CHECK:STDOUT: inst60000021: {kind: FieldDecl, arg0: name00000006, arg1: element0, type: type(inst60000020)}
// CHECK:STDOUT: inst60000022: {kind: CustomLayoutType, arg0: struct_type_fields00000001, arg1: custom_layout00000001, type: type(TypeType)}
// CHECK:STDOUT: inst60000023: {kind: CustomLayoutType, arg0: struct_type_fields00000002, arg1: custom_layout00000001, type: type(TypeType)}
// CHECK:STDOUT: inst60000022: {kind: CustomLayoutType, arg0: struct_type_fields60000001, arg1: custom_layout00000001, type: type(TypeType)}
// CHECK:STDOUT: inst60000023: {kind: CustomLayoutType, arg0: struct_type_fields60000002, arg1: custom_layout00000001, type: type(TypeType)}
// CHECK:STDOUT: inst60000024: {kind: CompleteTypeWitness, arg0: inst60000022, type: type(inst(WitnessType))}
// CHECK:STDOUT: inst60000025: {kind: CompleteTypeWitness, arg0: inst60000023, type: type(inst(WitnessType))}
// CHECK:STDOUT: inst60000026: {kind: PointerType, arg0: inst60000023, type: type(TypeType)}
+3 -1
View File
@@ -55,7 +55,9 @@ File::File(const Parse::Tree* parse_tree, CheckIRId check_ir_id,
vtables_(check_ir_id),
constant_values_(ConstantId::NotConstant, &insts_),
inst_blocks_(allocator_, check_ir_id),
constants_(this) {
constants_(this),
// 1 reserved id for `StructTypeFields::Empty`.
struct_type_fields_(allocator_, IdTag(check_ir_id.index, 1)) {
// `type` and the error type are both complete & concrete types.
types_.SetComplete(
TypeType::TypeId,
+1 -1
View File
@@ -403,7 +403,7 @@ class File : public Printable<File> {
ConstantStore constants_;
// Storage for StructTypeField lists.
StructTypeFieldsStore struct_type_fields_ = StructTypeFieldsStore(allocator_);
StructTypeFieldsStore struct_type_fields_;
// Storage for custom layouts.
CustomLayoutStore custom_layouts_ = CustomLayoutStore(allocator_);