From 33166ffc7a6f8b60a47adda36b6bcf918263be52 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 27 Oct 2025 16:11:23 -0700 Subject: [PATCH] Add unit tagging to CustomLayoutId (#6271) --- toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon | 4 ++-- toolchain/sem_ir/file.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon b/toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon index 55003af66860..8ee62b0121ca 100644 --- a/toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon +++ b/toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon @@ -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_fields60000001, arg1: custom_layout00000001, type: type(TypeType)} -// CHECK:STDOUT: inst60000023: {kind: CustomLayoutType, arg0: struct_type_fields60000002, arg1: custom_layout00000001, type: type(TypeType)} +// CHECK:STDOUT: inst60000022: {kind: CustomLayoutType, arg0: struct_type_fields60000001, arg1: custom_layout60000001, type: type(TypeType)} +// CHECK:STDOUT: inst60000023: {kind: CustomLayoutType, arg0: struct_type_fields60000002, arg1: custom_layout60000001, 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)} diff --git a/toolchain/sem_ir/file.cpp b/toolchain/sem_ir/file.cpp index 1bececf9b2df..bc8ef8aaf6f0 100644 --- a/toolchain/sem_ir/file.cpp +++ b/toolchain/sem_ir/file.cpp @@ -60,8 +60,10 @@ File::File(const Parse::Tree* parse_tree, CheckIRId check_ir_id, constant_values_(ConstantId::NotConstant, &insts_), inst_blocks_(allocator_, check_ir_id), constants_(this), - // 1 reserved id for `StructTypeFields::Empty`. + // 1 reserved id for `StructTypeFieldsId::Empty`. struct_type_fields_(allocator_, IdTag(check_ir_id.index, 1)), + // 1 reserved id for `CustomLayoutId::Empty`. + custom_layouts_(allocator_, IdTag(check_ir_id.index, 1)), expr_regions_(check_ir_id), clang_source_locs_(check_ir_id) { // `type` and the error type are both complete & concrete types.