| author | |
| committer | |
| log | 4184767f7d92e8efca05756abb12cf4d448f3f7a |
| tree | 3e15afe7249eb5860f0186a2fdcaea9ee5147b60 |
| parent | c41b7d1b850ba998bd253461536d25b06bcb41cb |
13 files changed, 213 insertions(+), 106 deletions(-)
src/IncrementalDebugServer.zig+3-3| ... | ... | @@ -243,7 +243,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 243 | 243 | var num_results: usize = 0; |
| 244 | 244 | for (zcu.incremental_debug_state.types.keys()) |type_ip_index| { |
| 245 | 245 | const ty: Type = .fromInterned(type_ip_index); |
| 246 | const ty_name = ty.containerTypeName(ip).toSlice(ip); | |
| 246 | const ty_name = ty.containerTypeName(ip).fqn.toSlice(ip); | |
| 247 | 247 | const success = switch (@as(u2, @intFromBool(anchor_start)) << 1 | @intFromBool(anchor_end)) { |
| 248 | 248 | 0b00 => std.mem.find(u8, ty_name, query) != null, |
| 249 | 249 | 0b01 => std.mem.endsWith(u8, ty_name, query), |
| ... | ... | @@ -347,7 +347,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 347 | 347 | \\created on generation: {d} |
| 348 | 348 | \\ |
| 349 | 349 | , .{ |
| 350 | Type.fromInterned(ip_index).containerTypeName(ip).fmt(ip), | |
| 350 | Type.fromInterned(ip_index).containerTypeName(ip).fqn.fmt(ip), | |
| 351 | 351 | create_gen, |
| 352 | 352 | }); |
| 353 | 353 | } else if (std.mem.eql(u8, cmd_str, "type_namespace")) { |
| ... | ... | @@ -451,7 +451,7 @@ fn printType(ty: Type, zcu: *const Zcu, w: *Io.Writer) Io.Writer.Error!void { |
| 451 | 451 | .union_type, |
| 452 | 452 | .enum_type, |
| 453 | 453 | .opaque_type, |
| 454 | => try w.print("{f}[{d}]", .{ ty.containerTypeName(ip).fmt(ip), @backingInt(ty.toIntern()) }), | |
| 454 | => try w.print("{f}[{d}]", .{ ty.containerTypeName(ip).fqn.fmt(ip), @backingInt(ty.toIntern()) }), | |
| 455 | 455 | |
| 456 | 456 | else => unreachable, |
| 457 | 457 | } |
src/InternPool.zig+47-4| ... | ... | @@ -3207,9 +3207,10 @@ pub const LoadedStructType = struct { |
| 3207 | 3207 | captures: CaptureValue.Slice, |
| 3208 | 3208 | is_reified: bool, |
| 3209 | 3209 | |
| 3210 | // TODO: the non-fqn will be needed by the new dwarf structure | |
| 3211 | 3210 | /// The name of this struct type. |
| 3212 | 3211 | name: NullTerminatedString, |
| 3212 | /// The fully-qualified name of this struct type. | |
| 3213 | fqn: NullTerminatedString, | |
| 3213 | 3214 | /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after. |
| 3214 | 3215 | /// Otherwise, or if this is a file's root struct type, this is `.none`. |
| 3215 | 3216 | name_nav: Nav.Index.Optional, |
| ... | ... | @@ -3390,9 +3391,10 @@ pub const LoadedUnionType = struct { |
| 3390 | 3391 | captures: CaptureValue.Slice, |
| 3391 | 3392 | is_reified: bool, |
| 3392 | 3393 | |
| 3393 | // TODO: the non-fqn will be needed by the new dwarf structure | |
| 3394 | 3394 | /// The name of this union type. |
| 3395 | 3395 | name: NullTerminatedString, |
| 3396 | /// The fully-qualified name of this union type. | |
| 3397 | fqn: NullTerminatedString, | |
| 3396 | 3398 | /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after. |
| 3397 | 3399 | /// Otherwise, this is `.none`. |
| 3398 | 3400 | name_nav: Nav.Index.Optional, |
| ... | ... | @@ -3457,9 +3459,10 @@ pub const LoadedEnumType = struct { |
| 3457 | 3459 | owner_union: Index, |
| 3458 | 3460 | is_reified: bool, |
| 3459 | 3461 | |
| 3460 | // TODO: the non-fqn will be needed by the new dwarf structure | |
| 3461 | 3462 | /// The name of this enum type. |
| 3462 | 3463 | name: NullTerminatedString, |
| 3464 | /// The fully-qualified name of this enum type. | |
| 3465 | fqn: NullTerminatedString, | |
| 3463 | 3466 | /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after. |
| 3464 | 3467 | /// Otherwise, this is `.none`. |
| 3465 | 3468 | name_nav: Nav.Index.Optional, |
| ... | ... | @@ -3519,9 +3522,10 @@ pub const LoadedOpaqueType = struct { |
| 3519 | 3522 | zir_index: TrackedInst.Index, |
| 3520 | 3523 | captures: CaptureValue.Slice, |
| 3521 | 3524 | |
| 3522 | // TODO: the non-fqn will be needed by the new dwarf structure | |
| 3523 | 3525 | /// The name of this opaque type. |
| 3524 | 3526 | name: NullTerminatedString, |
| 3527 | /// The fully-qualified name of this opaque type. | |
| 3528 | fqn: NullTerminatedString, | |
| 3525 | 3529 | /// If this is a declared type with the `.parent` name strategy, this is the `Nav` it was named after. |
| 3526 | 3530 | /// Otherwise, this is `.none`. |
| 3527 | 3531 | name_nav: Nav.Index.Optional, |
| ... | ... | @@ -3607,6 +3611,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType { |
| 3607 | 3611 | .captures = captures, |
| 3608 | 3612 | .is_reified = extra.data.flags.any_captures == .reified, |
| 3609 | 3613 | .name = extra.data.name, |
| 3614 | .fqn = extra.data.fqn, | |
| 3610 | 3615 | .name_nav = extra.data.name_nav, |
| 3611 | 3616 | .namespace = extra.data.namespace, |
| 3612 | 3617 | .layout = switch (extra.data.flags.layout) { |
| ... | ... | @@ -3670,6 +3675,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType { |
| 3670 | 3675 | .captures = captures, |
| 3671 | 3676 | .is_reified = extra.data.bits.captures_len == .reified, |
| 3672 | 3677 | .name = extra.data.name, |
| 3678 | .fqn = extra.data.fqn, | |
| 3673 | 3679 | .name_nav = extra.data.name_nav, |
| 3674 | 3680 | .namespace = extra.data.namespace, |
| 3675 | 3681 | .layout = .@"packed", |
| ... | ... | @@ -3745,6 +3751,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType { |
| 3745 | 3751 | .captures = captures, |
| 3746 | 3752 | .is_reified = extra.data.flags.any_captures == .reified, |
| 3747 | 3753 | .name = extra.data.name, |
| 3754 | .fqn = extra.data.fqn, | |
| 3748 | 3755 | .name_nav = extra.data.name_nav, |
| 3749 | 3756 | .namespace = extra.data.namespace, |
| 3750 | 3757 | .layout = switch (extra.data.flags.layout) { |
| ... | ... | @@ -3800,6 +3807,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType { |
| 3800 | 3807 | .captures = captures, |
| 3801 | 3808 | .is_reified = extra.data.bits.captures_len == .reified, |
| 3802 | 3809 | .name = extra.data.name, |
| 3810 | .fqn = extra.data.fqn, | |
| 3803 | 3811 | .name_nav = extra.data.name_nav, |
| 3804 | 3812 | .namespace = extra.data.namespace, |
| 3805 | 3813 | .layout = .@"packed", |
| ... | ... | @@ -3880,6 +3888,7 @@ pub fn loadEnumType(ip: *const InternPool, index: Index) LoadedEnumType { |
| 3880 | 3888 | .is_reified = extra.data.bits.captures_len == .reified, |
| 3881 | 3889 | .owner_union = owner_union, |
| 3882 | 3890 | .name = extra.data.name, |
| 3891 | .fqn = extra.data.fqn, | |
| 3883 | 3892 | .name_nav = extra.data.name_nav, |
| 3884 | 3893 | .namespace = extra.data.namespace, |
| 3885 | 3894 | .int_tag_type = extra.data.int_tag_type, |
| ... | ... | @@ -3906,6 +3915,7 @@ pub fn loadOpaqueType(ip: *const InternPool, index: Index) LoadedOpaqueType { |
| 3906 | 3915 | .len = extra.data.captures_len, |
| 3907 | 3916 | }, |
| 3908 | 3917 | .name = extra.data.name, |
| 3918 | .fqn = extra.data.fqn, | |
| 3909 | 3919 | .name_nav = extra.data.name_nav, |
| 3910 | 3920 | .namespace = extra.data.namespace, |
| 3911 | 3921 | }; |
| ... | ... | @@ -5538,6 +5548,7 @@ pub const Tag = enum(u8) { |
| 5538 | 5548 | zir_index: TrackedInst.Index, |
| 5539 | 5549 | |
| 5540 | 5550 | name: NullTerminatedString, |
| 5551 | fqn: NullTerminatedString, | |
| 5541 | 5552 | name_nav: Nav.Index.Optional, |
| 5542 | 5553 | namespace: NamespaceIndex, |
| 5543 | 5554 | |
| ... | ... | @@ -5580,6 +5591,7 @@ pub const Tag = enum(u8) { |
| 5580 | 5591 | bits: Bits, |
| 5581 | 5592 | |
| 5582 | 5593 | name: NullTerminatedString, |
| 5594 | fqn: NullTerminatedString, | |
| 5583 | 5595 | name_nav: Nav.Index.Optional, |
| 5584 | 5596 | namespace: NamespaceIndex, |
| 5585 | 5597 | |
| ... | ... | @@ -5614,6 +5626,7 @@ pub const Tag = enum(u8) { |
| 5614 | 5626 | zir_index: TrackedInst.Index, |
| 5615 | 5627 | |
| 5616 | 5628 | name: NullTerminatedString, |
| 5629 | fqn: NullTerminatedString, | |
| 5617 | 5630 | name_nav: Nav.Index.Optional, |
| 5618 | 5631 | namespace: NamespaceIndex, |
| 5619 | 5632 | /// The enum that provides the list of field names and values. |
| ... | ... | @@ -5673,6 +5686,7 @@ pub const Tag = enum(u8) { |
| 5673 | 5686 | bits: Bits, |
| 5674 | 5687 | |
| 5675 | 5688 | name: NullTerminatedString, |
| 5689 | fqn: NullTerminatedString, | |
| 5676 | 5690 | name_nav: Nav.Index.Optional, |
| 5677 | 5691 | namespace: NamespaceIndex, |
| 5678 | 5692 | |
| ... | ... | @@ -5708,6 +5722,7 @@ pub const Tag = enum(u8) { |
| 5708 | 5722 | bits: Bits, |
| 5709 | 5723 | |
| 5710 | 5724 | name: NullTerminatedString, |
| 5725 | fqn: NullTerminatedString, | |
| 5711 | 5726 | name_nav: Nav.Index.Optional, |
| 5712 | 5727 | namespace: NamespaceIndex, |
| 5713 | 5728 | |
| ... | ... | @@ -5735,6 +5750,7 @@ pub const Tag = enum(u8) { |
| 5735 | 5750 | captures_len: u32, |
| 5736 | 5751 | |
| 5737 | 5752 | name: NullTerminatedString, |
| 5753 | fqn: NullTerminatedString, | |
| 5738 | 5754 | name_nav: Nav.Index.Optional, |
| 5739 | 5755 | namespace: NamespaceIndex, |
| 5740 | 5756 | }; |
| ... | ... | @@ -8063,6 +8079,7 @@ pub fn getDeclaredStructType( |
| 8063 | 8079 | .want_layout = false, |
| 8064 | 8080 | }, |
| 8065 | 8081 | .name = undefined, // set by `finish` |
| 8082 | .fqn = undefined, // set by `finish` | |
| 8066 | 8083 | .name_nav = undefined, // set by `finish` |
| 8067 | 8084 | .namespace = undefined, // set by `finish` |
| 8068 | 8085 | .backing_int_type = .none, |
| ... | ... | @@ -8086,6 +8103,7 @@ pub fn getDeclaredStructType( |
| 8086 | 8103 | .index = gop.put(), |
| 8087 | 8104 | .tid = tid, |
| 8088 | 8105 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name").?, |
| 8106 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "fqn").?, | |
| 8089 | 8107 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name_nav").?, |
| 8090 | 8108 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?, |
| 8091 | 8109 | .field_names = undefined, |
| ... | ... | @@ -8111,6 +8129,7 @@ pub fn getDeclaredStructType( |
| 8111 | 8129 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStruct{ |
| 8112 | 8130 | .zir_index = ini.zir_index, |
| 8113 | 8131 | .name = undefined, // set by `finish` |
| 8132 | .fqn = undefined, // set by `finish` | |
| 8114 | 8133 | .name_nav = undefined, // set by `finish` |
| 8115 | 8134 | .namespace = undefined, // set by `finish` |
| 8116 | 8135 | .fields_len = ini.fields_len, |
| ... | ... | @@ -8154,6 +8173,7 @@ pub fn getDeclaredStructType( |
| 8154 | 8173 | .index = gop.put(), |
| 8155 | 8174 | .tid = tid, |
| 8156 | 8175 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name").?, |
| 8176 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "fqn").?, | |
| 8157 | 8177 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name_nav").?, |
| 8158 | 8178 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "namespace").?, |
| 8159 | 8179 | .field_names = undefined, |
| ... | ... | @@ -8207,6 +8227,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8207 | 8227 | .want_layout = false, |
| 8208 | 8228 | }, |
| 8209 | 8229 | .name = undefined, // set by `finish` |
| 8230 | .fqn = undefined, // set by `finish` | |
| 8210 | 8231 | .name_nav = undefined, // set by `finish` |
| 8211 | 8232 | .namespace = undefined, // set by `finish` |
| 8212 | 8233 | .backing_int_type = ini.packed_backing_int_type, |
| ... | ... | @@ -8233,6 +8254,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8233 | 8254 | .index = gop.put(), |
| 8234 | 8255 | .tid = tid, |
| 8235 | 8256 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name").?, |
| 8257 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "fqn").?, | |
| 8236 | 8258 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "name_nav").?, |
| 8237 | 8259 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?, |
| 8238 | 8260 | .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len }, |
| ... | ... | @@ -8260,6 +8282,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8260 | 8282 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStruct{ |
| 8261 | 8283 | .zir_index = ini.zir_index, |
| 8262 | 8284 | .name = undefined, // set by `finish` |
| 8285 | .fqn = undefined, // set by `finish` | |
| 8263 | 8286 | .name_nav = undefined, // set by `finish` |
| 8264 | 8287 | .namespace = undefined, // set by `finish` |
| 8265 | 8288 | .fields_len = ini.fields_len, |
| ... | ... | @@ -8305,6 +8328,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8305 | 8328 | .index = gop.put(), |
| 8306 | 8329 | .tid = tid, |
| 8307 | 8330 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name").?, |
| 8331 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "fqn").?, | |
| 8308 | 8332 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "name_nav").?, |
| 8309 | 8333 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeStruct, "namespace").?, |
| 8310 | 8334 | .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len }, |
| ... | ... | @@ -8378,6 +8402,7 @@ pub fn getDeclaredUnionType( |
| 8378 | 8402 | .want_layout = false, |
| 8379 | 8403 | }, |
| 8380 | 8404 | .name = undefined, // set by `finish` |
| 8405 | .fqn = undefined, // set by `finish` | |
| 8381 | 8406 | .name_nav = undefined, // set by `finish` |
| 8382 | 8407 | .namespace = undefined, // set by `finish` |
| 8383 | 8408 | .backing_int_type = .none, |
| ... | ... | @@ -8397,6 +8422,7 @@ pub fn getDeclaredUnionType( |
| 8397 | 8422 | .index = gop.put(), |
| 8398 | 8423 | .tid = tid, |
| 8399 | 8424 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name").?, |
| 8425 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "fqn").?, | |
| 8400 | 8426 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name_nav").?, |
| 8401 | 8427 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "namespace").?, |
| 8402 | 8428 | .field_names = undefined, |
| ... | ... | @@ -8417,6 +8443,7 @@ pub fn getDeclaredUnionType( |
| 8417 | 8443 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeUnion{ |
| 8418 | 8444 | .zir_index = ini.zir_index, |
| 8419 | 8445 | .name = undefined, // set by `finish` |
| 8446 | .fqn = undefined, // set by `finish` | |
| 8420 | 8447 | .name_nav = undefined, // set by `finish` |
| 8421 | 8448 | .namespace = undefined, // set by `finish` |
| 8422 | 8449 | .enum_tag_type = .none, |
| ... | ... | @@ -8451,6 +8478,7 @@ pub fn getDeclaredUnionType( |
| 8451 | 8478 | .index = gop.put(), |
| 8452 | 8479 | .tid = tid, |
| 8453 | 8480 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name").?, |
| 8481 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "fqn").?, | |
| 8454 | 8482 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name_nav").?, |
| 8455 | 8483 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "namespace").?, |
| 8456 | 8484 | .field_names = undefined, |
| ... | ... | @@ -8501,6 +8529,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per |
| 8501 | 8529 | .want_layout = false, |
| 8502 | 8530 | }, |
| 8503 | 8531 | .name = undefined, // set by `finish` |
| 8532 | .fqn = undefined, // set by `finish` | |
| 8504 | 8533 | .name_nav = undefined, // set by `finish` |
| 8505 | 8534 | .namespace = undefined, // set by `finish` |
| 8506 | 8535 | .backing_int_type = ini.packed_backing_int_type, |
| ... | ... | @@ -8523,6 +8552,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per |
| 8523 | 8552 | .index = gop.put(), |
| 8524 | 8553 | .tid = tid, |
| 8525 | 8554 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name").?, |
| 8555 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "fqn").?, | |
| 8526 | 8556 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "name_nav").?, |
| 8527 | 8557 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnionPacked, "namespace").?, |
| 8528 | 8558 | .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len }, |
| ... | ... | @@ -8543,6 +8573,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per |
| 8543 | 8573 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeUnion{ |
| 8544 | 8574 | .zir_index = ini.zir_index, |
| 8545 | 8575 | .name = undefined, // set by `finish` |
| 8576 | .fqn = undefined, // set by `finish` | |
| 8546 | 8577 | .name_nav = undefined, // set by `finish` |
| 8547 | 8578 | .namespace = undefined, // set by `finish` |
| 8548 | 8579 | .enum_tag_type = ini.enum_tag_type, |
| ... | ... | @@ -8578,6 +8609,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per |
| 8578 | 8609 | .index = gop.put(), |
| 8579 | 8610 | .tid = tid, |
| 8580 | 8611 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name").?, |
| 8612 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "fqn").?, | |
| 8581 | 8613 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "name_nav").?, |
| 8582 | 8614 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeUnion, "namespace").?, |
| 8583 | 8615 | .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len }, |
| ... | ... | @@ -8654,6 +8686,7 @@ pub fn getDeclaredEnumType( |
| 8654 | 8686 | .want_layout = false, |
| 8655 | 8687 | }, |
| 8656 | 8688 | .name = undefined, // set by `finish` |
| 8689 | .fqn = undefined, // set by `finish` | |
| 8657 | 8690 | .name_nav = undefined, // set by `finish` |
| 8658 | 8691 | .namespace = undefined, // set by `finish` |
| 8659 | 8692 | .int_tag_type = .none, |
| ... | ... | @@ -8673,6 +8706,7 @@ pub fn getDeclaredEnumType( |
| 8673 | 8706 | .index = gop.put(), |
| 8674 | 8707 | .tid = tid, |
| 8675 | 8708 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name").?, |
| 8709 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "fqn").?, | |
| 8676 | 8710 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name_nav").?, |
| 8677 | 8711 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "namespace").?, |
| 8678 | 8712 | .field_names = undefined, |
| ... | ... | @@ -8729,6 +8763,7 @@ pub fn getReifiedEnumType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerT |
| 8729 | 8763 | .want_layout = false, |
| 8730 | 8764 | }, |
| 8731 | 8765 | .name = undefined, // set by `finish` |
| 8766 | .fqn = undefined, // set by `finish` | |
| 8732 | 8767 | .name_nav = undefined, // set by `finish` |
| 8733 | 8768 | .namespace = undefined, // set by `finish` |
| 8734 | 8769 | .int_tag_type = ini.int_tag_type, |
| ... | ... | @@ -8750,6 +8785,7 @@ pub fn getReifiedEnumType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerT |
| 8750 | 8785 | .index = gop.put(), |
| 8751 | 8786 | .tid = tid, |
| 8752 | 8787 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name").?, |
| 8788 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "fqn").?, | |
| 8753 | 8789 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name_nav").?, |
| 8754 | 8790 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "namespace").?, |
| 8755 | 8791 | .field_names = .{ .tid = tid, .start = field_names_start, .len = ini.fields_len }, |
| ... | ... | @@ -8828,6 +8864,7 @@ pub fn getGeneratedEnumTagType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu |
| 8828 | 8864 | .want_layout = false, |
| 8829 | 8865 | }, |
| 8830 | 8866 | .name = undefined, // set by `finish` |
| 8867 | .fqn = undefined, // set by `finish` | |
| 8831 | 8868 | .name_nav = undefined, // set by `finish` |
| 8832 | 8869 | .namespace = undefined, // set by `finish` |
| 8833 | 8870 | .int_tag_type = .none, |
| ... | ... | @@ -8849,6 +8886,7 @@ pub fn getGeneratedEnumTagType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu |
| 8849 | 8886 | .index = gop.put(), |
| 8850 | 8887 | .tid = tid, |
| 8851 | 8888 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name").?, |
| 8889 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "fqn").?, | |
| 8852 | 8890 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "name_nav").?, |
| 8853 | 8891 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeEnum, "namespace").?, |
| 8854 | 8892 | .field_names = undefined, |
| ... | ... | @@ -8880,6 +8918,7 @@ pub fn getDeclaredOpaqueType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.P |
| 8880 | 8918 | .zir_index = ini.zir_index, |
| 8881 | 8919 | .captures_len = @intCast(ini.captures.len), |
| 8882 | 8920 | .name = undefined, // set by `finish` |
| 8921 | .fqn = undefined, // set by `finish` | |
| 8883 | 8922 | .name_nav = undefined, // set by `finish` |
| 8884 | 8923 | .namespace = undefined, // set by `finish` |
| 8885 | 8924 | }); |
| ... | ... | @@ -8892,6 +8931,7 @@ pub fn getDeclaredOpaqueType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.P |
| 8892 | 8931 | .index = gop.put(), |
| 8893 | 8932 | .tid = tid, |
| 8894 | 8933 | .type_name_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "name").?, |
| 8934 | .type_fqn_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "fqn").?, | |
| 8895 | 8935 | .name_nav_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "name_nav").?, |
| 8896 | 8936 | .namespace_index = extra_index + std.meta.fieldIndex(Tag.TypeOpaque, "namespace").?, |
| 8897 | 8937 | .field_names = undefined, |
| ... | ... | @@ -8906,6 +8946,7 @@ pub const WipContainerType = struct { |
| 8906 | 8946 | index: Index, |
| 8907 | 8947 | tid: Zcu.PerThread.Id, |
| 8908 | 8948 | type_name_index: u32, |
| 8949 | type_fqn_index: u32, | |
| 8909 | 8950 | name_nav_index: u32, |
| 8910 | 8951 | namespace_index: u32, |
| 8911 | 8952 | |
| ... | ... | @@ -8923,6 +8964,7 @@ pub const WipContainerType = struct { |
| 8923 | 8964 | wip: WipContainerType, |
| 8924 | 8965 | ip: *InternPool, |
| 8925 | 8966 | type_name: NullTerminatedString, |
| 8967 | type_fqn: NullTerminatedString, | |
| 8926 | 8968 | /// This should be the `Nav` we are named after if we use the `.parent` name strategy; `.none` otherwise. |
| 8927 | 8969 | /// This is also `.none` if we use `.parent` because we are the root struct type for a file. |
| 8928 | 8970 | name_nav: Nav.Index.Optional, |
| ... | ... | @@ -8930,6 +8972,7 @@ pub const WipContainerType = struct { |
| 8930 | 8972 | const extra = ip.getLocalShared(wip.tid).extra.acquire(); |
| 8931 | 8973 | const extra_items = extra.view().items(.@"0"); |
| 8932 | 8974 | extra_items[wip.type_name_index] = @backingInt(type_name); |
| 8975 | extra_items[wip.type_fqn_index] = @backingInt(type_fqn); | |
| 8933 | 8976 | extra_items[wip.name_nav_index] = @backingInt(name_nav); |
| 8934 | 8977 | } |
| 8935 | 8978 |
src/Sema.zig+37-11| ... | ... | @@ -403,6 +403,7 @@ pub const Block = struct { |
| 403 | 403 | /// is always incorporated into the type name somehow. |
| 404 | 404 | /// See `Sema.setTypeName`. |
| 405 | 405 | type_name_ctx: InternPool.NullTerminatedString, |
| 406 | type_fqn_ctx: InternPool.NullTerminatedString, | |
| 406 | 407 | |
| 407 | 408 | /// Create a `LazySrcLoc` based on an `Offset` from the code being analyzed in this block. |
| 408 | 409 | /// Specifically, the given `Offset` is treated as relative to `block.src_base_inst`. |
| ... | ... | @@ -531,6 +532,7 @@ pub const Block = struct { |
| 531 | 532 | .need_debug_scope = parent.need_debug_scope, |
| 532 | 533 | .src_base_inst = parent.src_base_inst, |
| 533 | 534 | .type_name_ctx = parent.type_name_ctx, |
| 535 | .type_fqn_ctx = parent.type_fqn_ctx, | |
| 534 | 536 | }; |
| 535 | 537 | } |
| 536 | 538 | |
| ... | ... | @@ -4782,7 +4784,7 @@ fn failWithBadStructFieldAccess( |
| 4782 | 4784 | const msg = try sema.errMsg( |
| 4783 | 4785 | field_src, |
| 4784 | 4786 | "no field named '{f}' in struct '{f}'", |
| 4785 | .{ field_name.fmt(ip), struct_type.name.fmt(ip) }, | |
| 4787 | .{ field_name.fmt(ip), struct_type.fqn.fmt(ip) }, | |
| 4786 | 4788 | ); |
| 4787 | 4789 | errdefer msg.destroy(sema.gpa); |
| 4788 | 4790 | try sema.errNote(struct_ty.srcLoc(zcu), msg, "struct declared here", .{}); |
| ... | ... | @@ -4808,7 +4810,7 @@ fn failWithBadUnionFieldAccess( |
| 4808 | 4810 | const msg = try sema.errMsg( |
| 4809 | 4811 | field_src, |
| 4810 | 4812 | "no field named '{f}' in union '{f}'", |
| 4811 | .{ field_name.fmt(ip), union_obj.name.fmt(ip) }, | |
| 4813 | .{ field_name.fmt(ip), union_obj.fqn.fmt(ip) }, | |
| 4812 | 4814 | ); |
| 4813 | 4815 | errdefer msg.destroy(gpa); |
| 4814 | 4816 | try sema.errNote(union_ty.srcLoc(zcu), msg, "union declared here", .{}); |
| ... | ... | @@ -5291,6 +5293,7 @@ fn zirBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErro |
| 5291 | 5293 | .error_return_trace_index = parent_block.error_return_trace_index, |
| 5292 | 5294 | .src_base_inst = parent_block.src_base_inst, |
| 5293 | 5295 | .type_name_ctx = parent_block.type_name_ctx, |
| 5296 | .type_fqn_ctx = parent_block.type_fqn_ctx, | |
| 5294 | 5297 | }; |
| 5295 | 5298 | |
| 5296 | 5299 | defer child_block.instructions.deinit(gpa); |
| ... | ... | @@ -6773,7 +6776,8 @@ fn analyzeCall( |
| 6773 | 6776 | .instructions = .empty, |
| 6774 | 6777 | .inlining = &generic_inlining, |
| 6775 | 6778 | .src_base_inst = fn_nav.analysis.?.zir_index, |
| 6776 | .type_name_ctx = fn_nav.fqn, | |
| 6779 | .type_name_ctx = fn_nav.name, | |
| 6780 | .type_fqn_ctx = fn_nav.fqn, | |
| 6777 | 6781 | } else undefined; |
| 6778 | 6782 | defer if (any_generic_types) generic_block.instructions.deinit(gpa); |
| 6779 | 6783 | |
| ... | ... | @@ -7309,7 +7313,8 @@ fn analyzeCall( |
| 7309 | 7313 | .runtime_loop = block.runtime_loop, |
| 7310 | 7314 | .runtime_index = block.runtime_index, |
| 7311 | 7315 | .src_base_inst = fn_nav.analysis.?.zir_index, |
| 7312 | .type_name_ctx = fn_nav.fqn, | |
| 7316 | .type_name_ctx = fn_nav.name, | |
| 7317 | .type_fqn_ctx = fn_nav.fqn, | |
| 7313 | 7318 | }; |
| 7314 | 7319 | |
| 7315 | 7320 | defer child_block.instructions.deinit(gpa); |
| ... | ... | @@ -17315,6 +17320,7 @@ fn zirTypeofBuiltin(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 17315 | 17320 | .error_return_trace_index = block.error_return_trace_index, |
| 17316 | 17321 | .src_base_inst = block.src_base_inst, |
| 17317 | 17322 | .type_name_ctx = block.type_name_ctx, |
| 17323 | .type_fqn_ctx = block.type_fqn_ctx, | |
| 17318 | 17324 | }; |
| 17319 | 17325 | defer child_block.instructions.deinit(sema.gpa); |
| 17320 | 17326 | |
| ... | ... | @@ -17381,6 +17387,7 @@ fn zirTypeofPeer( |
| 17381 | 17387 | .runtime_index = block.runtime_index, |
| 17382 | 17388 | .src_base_inst = block.src_base_inst, |
| 17383 | 17389 | .type_name_ctx = block.type_name_ctx, |
| 17390 | .type_fqn_ctx = block.type_fqn_ctx, | |
| 17384 | 17391 | }; |
| 17385 | 17392 | defer child_block.instructions.deinit(sema.gpa); |
| 17386 | 17393 | // Ignore the result, we only care about the instructions in `args`. |
| ... | ... | @@ -17940,6 +17947,7 @@ fn ensurePostHoc(sema: *Sema, block: *Block, dest_block: Zir.Inst.Index) !*Label |
| 17940 | 17947 | .comptime_reason = block.comptime_reason, |
| 17941 | 17948 | .src_base_inst = block.src_base_inst, |
| 17942 | 17949 | .type_name_ctx = block.type_name_ctx, |
| 17950 | .type_fqn_ctx = block.type_fqn_ctx, | |
| 17943 | 17951 | }, |
| 17944 | 17952 | }; |
| 17945 | 17953 | sema.post_hoc_blocks.putAssumeCapacityNoClobber(new_block_inst, labeled_block); |
| ... | ... | @@ -25935,6 +25943,7 @@ fn addSafetyCheck( |
| 25935 | 25943 | .comptime_reason = null, |
| 25936 | 25944 | .src_base_inst = parent_block.src_base_inst, |
| 25937 | 25945 | .type_name_ctx = parent_block.type_name_ctx, |
| 25946 | .type_fqn_ctx = parent_block.type_fqn_ctx, | |
| 25938 | 25947 | }; |
| 25939 | 25948 | |
| 25940 | 25949 | defer fail_block.instructions.deinit(gpa); |
| ... | ... | @@ -26029,6 +26038,7 @@ fn addSafetyCheckUnwrapError( |
| 26029 | 26038 | .comptime_reason = null, |
| 26030 | 26039 | .src_base_inst = parent_block.src_base_inst, |
| 26031 | 26040 | .type_name_ctx = parent_block.type_name_ctx, |
| 26041 | .type_fqn_ctx = parent_block.type_fqn_ctx, | |
| 26032 | 26042 | }; |
| 26033 | 26043 | |
| 26034 | 26044 | defer fail_block.instructions.deinit(gpa); |
| ... | ... | @@ -26152,6 +26162,7 @@ fn addSafetyCheckCall( |
| 26152 | 26162 | .comptime_reason = null, |
| 26153 | 26163 | .src_base_inst = parent_block.src_base_inst, |
| 26154 | 26164 | .type_name_ctx = parent_block.type_name_ctx, |
| 26165 | .type_fqn_ctx = parent_block.type_fqn_ctx, | |
| 26155 | 26166 | }; |
| 26156 | 26167 | |
| 26157 | 26168 | defer fail_block.instructions.deinit(gpa); |
| ... | ... | @@ -34994,6 +35005,7 @@ pub fn analyzeMemoizedState(sema: *Sema, stage: InternPool.MemoizedStateStage) C |
| 34994 | 35005 | .comptime_reason = null, |
| 34995 | 35006 | .src_base_inst = std_type.typeDeclInst(zcu).?, |
| 34996 | 35007 | .type_name_ctx = .empty, |
| 35008 | .type_fqn_ctx = .empty, | |
| 34997 | 35009 | }; |
| 34998 | 35010 | }; |
| 34999 | 35011 | defer block.instructions.deinit(gpa); |
| ... | ... | @@ -35225,10 +35237,17 @@ pub fn setTypeName( |
| 35225 | 35237 | "{f}__{s}_{d}", |
| 35226 | 35238 | .{ block.type_name_ctx.fmt(ip), anon_prefix, zcu.anon_name_counter }, |
| 35227 | 35239 | .no_embedded_nulls, |
| 35240 | ), try ip.getOrPutStringFmt( | |
| 35241 | gpa, | |
| 35242 | io, | |
| 35243 | pt.tid, | |
| 35244 | "{f}__{s}_{d}", | |
| 35245 | .{ block.type_fqn_ctx.fmt(ip), anon_prefix, zcu.anon_name_counter }, | |
| 35246 | .no_embedded_nulls, | |
| 35228 | 35247 | ), .none); |
| 35229 | 35248 | zcu.anon_name_counter += 1; |
| 35230 | 35249 | }, |
| 35231 | .parent => wip.setName(ip, block.type_name_ctx, sema.owner.unwrap().nav_val.toOptional()), | |
| 35250 | .parent => wip.setName(ip, block.type_name_ctx, block.type_fqn_ctx, sema.owner.unwrap().nav_val.toOptional()), | |
| 35232 | 35251 | .func => { |
| 35233 | 35252 | const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse { |
| 35234 | 35253 | return sema.failTransitive(.{ .lost_tracking = ip.funcZirBodyInst(sema.func_index) }); |
| ... | ... | @@ -35238,7 +35257,7 @@ pub fn setTypeName( |
| 35238 | 35257 | var aw: std.Io.Writer.Allocating = .init(gpa); |
| 35239 | 35258 | defer aw.deinit(); |
| 35240 | 35259 | const w = &aw.writer; |
| 35241 | w.print("{f}(", .{block.type_name_ctx.fmt(ip)}) catch return error.OutOfMemory; | |
| 35260 | w.writeByte('(') catch return error.OutOfMemory; | |
| 35242 | 35261 | |
| 35243 | 35262 | var arg_i: usize = 0; |
| 35244 | 35263 | for (fn_info.param_body) |zir_inst| switch (zir_tags[@backingInt(zir_inst)]) { |
| ... | ... | @@ -35273,8 +35292,13 @@ pub fn setTypeName( |
| 35273 | 35292 | }; |
| 35274 | 35293 | |
| 35275 | 35294 | w.writeByte(')') catch return error.OutOfMemory; |
| 35276 | const name = try ip.getOrPutString(gpa, io, pt.tid, aw.written(), .no_embedded_nulls); | |
| 35277 | wip.setName(ip, name, .none); | |
| 35295 | wip.setName(ip, try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}{s}", .{ | |
| 35296 | block.type_name_ctx.fmt(ip), | |
| 35297 | aw.written(), | |
| 35298 | }, .no_embedded_nulls), try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}{s}", .{ | |
| 35299 | block.type_fqn_ctx.fmt(ip), | |
| 35300 | aw.written(), | |
| 35301 | }, .no_embedded_nulls), .none); | |
| 35278 | 35302 | }, |
| 35279 | 35303 | .dbg_var => { |
| 35280 | 35304 | // TODO: this logic is questionable. We ideally should be traversing the `Block` rather than relying on the order of AstGen instructions. |
| ... | ... | @@ -35289,10 +35313,12 @@ pub fn setTypeName( |
| 35289 | 35313 | } else { |
| 35290 | 35314 | continue :strat .anon; |
| 35291 | 35315 | }; |
| 35292 | const name = try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.{s}", .{ | |
| 35316 | wip.setName(ip, try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.{s}", .{ | |
| 35317 | // this "{f}." should be elided, but there's currently no way to get the parent function | |
| 35293 | 35318 | block.type_name_ctx.fmt(ip), var_name, |
| 35294 | }, .no_embedded_nulls); | |
| 35295 | wip.setName(ip, name, .none); | |
| 35319 | }, .no_embedded_nulls), try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.{s}", .{ | |
| 35320 | block.type_fqn_ctx.fmt(ip), var_name, | |
| 35321 | }, .no_embedded_nulls), .none); | |
| 35296 | 35322 | }, |
| 35297 | 35323 | } |
| 35298 | 35324 | } |
src/Sema/type_resolution.zig+15-4| ... | ... | @@ -187,7 +187,7 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void { |
| 187 | 187 | |
| 188 | 188 | const tracy = trace(@src()); |
| 189 | 189 | defer tracy.end(); |
| 190 | tracy.addText(struct_ty.containerTypeName(ip).toSlice(ip)); | |
| 190 | tracy.addText(struct_ty.containerTypeName(ip).fqn.toSlice(ip)); | |
| 191 | 191 | tracy.addTextFmt("ip_index={d}", .{struct_ty.toIntern()}); |
| 192 | 192 | |
| 193 | 193 | assert(sema.owner.unwrap().type_layout == struct_ty.toIntern()); |
| ... | ... | @@ -207,6 +207,7 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void { |
| 207 | 207 | .comptime_reason = undefined, // always set before using `block` |
| 208 | 208 | .src_base_inst = struct_obj.zir_index, |
| 209 | 209 | .type_name_ctx = struct_obj.name, |
| 210 | .type_fqn_ctx = struct_obj.fqn, | |
| 210 | 211 | }; |
| 211 | 212 | defer block.instructions.deinit(gpa); |
| 212 | 213 | |
| ... | ... | @@ -613,7 +614,7 @@ pub fn resolveStructDefaults(sema: *Sema, struct_ty: Type) CompileError!void { |
| 613 | 614 | |
| 614 | 615 | const tracy = trace(@src()); |
| 615 | 616 | defer tracy.end(); |
| 616 | tracy.addText(struct_ty.containerTypeName(ip).toSlice(ip)); | |
| 617 | tracy.addText(struct_ty.containerTypeName(ip).fqn.toSlice(ip)); | |
| 617 | 618 | tracy.addTextFmt("ip_index={d}", .{struct_ty.toIntern()}); |
| 618 | 619 | |
| 619 | 620 | assert(sema.owner.unwrap().struct_defaults == struct_ty.toIntern()); |
| ... | ... | @@ -653,6 +654,7 @@ pub fn resolveStructDefaults(sema: *Sema, struct_ty: Type) CompileError!void { |
| 653 | 654 | .comptime_reason = undefined, // always set before using `block` |
| 654 | 655 | .src_base_inst = struct_obj.zir_index, |
| 655 | 656 | .type_name_ctx = struct_obj.name, |
| 657 | .type_fqn_ctx = struct_obj.fqn, | |
| 656 | 658 | }; |
| 657 | 659 | defer block.instructions.deinit(gpa); |
| 658 | 660 | |
| ... | ... | @@ -727,7 +729,7 @@ pub fn resolveUnionLayout(sema: *Sema, union_ty: Type) CompileError!void { |
| 727 | 729 | |
| 728 | 730 | const tracy = trace(@src()); |
| 729 | 731 | defer tracy.end(); |
| 730 | tracy.addText(union_ty.containerTypeName(ip).toSlice(ip)); | |
| 732 | tracy.addText(union_ty.containerTypeName(ip).fqn.toSlice(ip)); | |
| 731 | 733 | tracy.addTextFmt("ip_index={d}", .{union_ty.toIntern()}); |
| 732 | 734 | |
| 733 | 735 | assert(sema.owner.unwrap().type_layout == union_ty.toIntern()); |
| ... | ... | @@ -747,6 +749,7 @@ pub fn resolveUnionLayout(sema: *Sema, union_ty: Type) CompileError!void { |
| 747 | 749 | .comptime_reason = undefined, // always set before using `block` |
| 748 | 750 | .src_base_inst = union_obj.zir_index, |
| 749 | 751 | .type_name_ctx = union_obj.name, |
| 752 | .type_fqn_ctx = union_obj.fqn, | |
| 750 | 753 | }; |
| 751 | 754 | defer block.instructions.deinit(gpa); |
| 752 | 755 | |
| ... | ... | @@ -801,6 +804,13 @@ pub fn resolveUnionLayout(sema: *Sema, union_ty: Type) CompileError!void { |
| 801 | 804 | "@typeInfo({f}).@\"union\".tag_type.?", |
| 802 | 805 | .{union_obj.name.fmt(ip)}, |
| 803 | 806 | .no_embedded_nulls, |
| 807 | ), try ip.getOrPutStringFmt( | |
| 808 | gpa, | |
| 809 | io, | |
| 810 | pt.tid, | |
| 811 | "@typeInfo({f}).@\"union\".tag_type.?", | |
| 812 | .{union_obj.fqn.fmt(ip)}, | |
| 813 | .no_embedded_nulls, | |
| 804 | 814 | ), .none); |
| 805 | 815 | const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{ |
| 806 | 816 | .parent = union_obj.namespace.toOptional(), |
| ... | ... | @@ -1221,7 +1231,7 @@ pub fn resolveEnumLayout(sema: *Sema, enum_ty: Type) CompileError!void { |
| 1221 | 1231 | |
| 1222 | 1232 | const tracy = trace(@src()); |
| 1223 | 1233 | defer tracy.end(); |
| 1224 | tracy.addText(enum_ty.containerTypeName(ip).toSlice(ip)); | |
| 1234 | tracy.addText(enum_ty.containerTypeName(ip).fqn.toSlice(ip)); | |
| 1225 | 1235 | tracy.addTextFmt("ip_index={d}", .{enum_ty.toIntern()}); |
| 1226 | 1236 | |
| 1227 | 1237 | assert(sema.owner.unwrap().type_layout == enum_ty.toIntern()); |
| ... | ... | @@ -1248,6 +1258,7 @@ pub fn resolveEnumLayout(sema: *Sema, enum_ty: Type) CompileError!void { |
| 1248 | 1258 | .comptime_reason = undefined, // always set before using `block` |
| 1249 | 1259 | .src_base_inst = tracked_inst, |
| 1250 | 1260 | .type_name_ctx = enum_obj.name, |
| 1261 | .type_fqn_ctx = enum_obj.fqn, | |
| 1251 | 1262 | }; |
| 1252 | 1263 | defer block.instructions.deinit(gpa); |
| 1253 | 1264 |
src/Type.zig+30-15| ... | ... | @@ -607,8 +607,8 @@ pub fn print(ty: Type, writer: *std.Io.Writer, pt: Zcu.PerThread, ctx: ?*Compari |
| 607 | 607 | .generic_poison => unreachable, |
| 608 | 608 | }, |
| 609 | 609 | .struct_type => { |
| 610 | const name = ip.loadStructType(ty.toIntern()).name; | |
| 611 | try writer.print("{f}", .{name.fmt(ip)}); | |
| 610 | const fqn = ip.loadStructType(ty.toIntern()).fqn; | |
| 611 | try writer.print("{f}", .{fqn.fmt(ip)}); | |
| 612 | 612 | }, |
| 613 | 613 | .tuple_type => |tuple| { |
| 614 | 614 | if (tuple.types.len == 0) { |
| ... | ... | @@ -625,16 +625,16 @@ pub fn print(ty: Type, writer: *std.Io.Writer, pt: Zcu.PerThread, ctx: ?*Compari |
| 625 | 625 | }, |
| 626 | 626 | |
| 627 | 627 | .union_type => { |
| 628 | const name = ip.loadUnionType(ty.toIntern()).name; | |
| 629 | try writer.print("{f}", .{name.fmt(ip)}); | |
| 628 | const fqn = ip.loadUnionType(ty.toIntern()).fqn; | |
| 629 | try writer.print("{f}", .{fqn.fmt(ip)}); | |
| 630 | 630 | }, |
| 631 | 631 | .opaque_type => { |
| 632 | const name = ip.loadOpaqueType(ty.toIntern()).name; | |
| 633 | try writer.print("{f}", .{name.fmt(ip)}); | |
| 632 | const fqn = ip.loadOpaqueType(ty.toIntern()).fqn; | |
| 633 | try writer.print("{f}", .{fqn.fmt(ip)}); | |
| 634 | 634 | }, |
| 635 | 635 | .enum_type => { |
| 636 | const name = ip.loadEnumType(ty.toIntern()).name; | |
| 637 | try writer.print("{f}", .{name.fmt(ip)}); | |
| 636 | const fqn = ip.loadEnumType(ty.toIntern()).fqn; | |
| 637 | try writer.print("{f}", .{fqn.fmt(ip)}); | |
| 638 | 638 | }, |
| 639 | 639 | .spirv_type => { |
| 640 | 640 | const info = ip.loadSpirvType(ty.toIntern()); |
| ... | ... | @@ -3020,14 +3020,29 @@ pub fn fieldPtrType(ptr_ty: Type, field_index: u32, pt: Zcu.PerThread) Allocator |
| 3020 | 3020 | return pt.ptrType(field_ptr_info); |
| 3021 | 3021 | } |
| 3022 | 3022 | |
| 3023 | pub fn containerTypeName(ty: Type, ip: *const InternPool) InternPool.NullTerminatedString { | |
| 3024 | return switch (ip.indexToKey(ty.toIntern())) { | |
| 3025 | .struct_type => ip.loadStructType(ty.toIntern()).name, | |
| 3026 | .union_type => ip.loadUnionType(ty.toIntern()).name, | |
| 3027 | .enum_type => ip.loadEnumType(ty.toIntern()).name, | |
| 3028 | .opaque_type => ip.loadOpaqueType(ty.toIntern()).name, | |
| 3023 | pub fn containerTypeName(ty: Type, ip: *const InternPool) struct { | |
| 3024 | name: InternPool.NullTerminatedString, | |
| 3025 | fqn: InternPool.NullTerminatedString, | |
| 3026 | } { | |
| 3027 | switch (ip.indexToKey(ty.toIntern())) { | |
| 3028 | .struct_type => { | |
| 3029 | const loaded_struct = ip.loadStructType(ty.toIntern()); | |
| 3030 | return .{ .name = loaded_struct.name, .fqn = loaded_struct.fqn }; | |
| 3031 | }, | |
| 3032 | .union_type => { | |
| 3033 | const loaded_union = ip.loadUnionType(ty.toIntern()); | |
| 3034 | return .{ .name = loaded_union.name, .fqn = loaded_union.fqn }; | |
| 3035 | }, | |
| 3036 | .enum_type => { | |
| 3037 | const loaded_enum = ip.loadEnumType(ty.toIntern()); | |
| 3038 | return .{ .name = loaded_enum.name, .fqn = loaded_enum.fqn }; | |
| 3039 | }, | |
| 3040 | .opaque_type => { | |
| 3041 | const loaded_opaque = ip.loadOpaqueType(ty.toIntern()); | |
| 3042 | return .{ .name = loaded_opaque.name, .fqn = loaded_opaque.fqn }; | |
| 3043 | }, | |
| 3029 | 3044 | else => unreachable, |
| 3030 | }; | |
| 3045 | } | |
| 3031 | 3046 | } |
| 3032 | 3047 | |
| 3033 | 3048 | pub fn destructurable(ty: Type, zcu: *const Zcu) bool { |
src/Zcu.zig+18-18| ... | ... | @@ -947,9 +947,9 @@ pub const Namespace = struct { |
| 947 | 947 | tid: Zcu.PerThread.Id, |
| 948 | 948 | name: InternPool.NullTerminatedString, |
| 949 | 949 | ) !InternPool.NullTerminatedString { |
| 950 | const ns_name = Type.fromInterned(ns.owner_type).containerTypeName(ip); | |
| 951 | if (name == .empty) return ns_name; | |
| 952 | return ip.getOrPutStringFmt(gpa, io, tid, "{f}.{f}", .{ ns_name.fmt(ip), name.fmt(ip) }, .no_embedded_nulls); | |
| 950 | const ns_fqn = Type.fromInterned(ns.owner_type).containerTypeName(ip).fqn; | |
| 951 | if (name == .empty) return ns_fqn; | |
| 952 | return ip.getOrPutStringFmt(gpa, io, tid, "{f}.{f}", .{ ns_fqn.fmt(ip), name.fmt(ip) }, .no_embedded_nulls); | |
| 953 | 953 | } |
| 954 | 954 | }; |
| 955 | 955 | |
| ... | ... | @@ -4237,7 +4237,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4237 | 4237 | const referencer = types.values()[type_idx]; |
| 4238 | 4238 | type_idx += 1; |
| 4239 | 4239 | |
| 4240 | refs_log.debug("handle type '{f}'", .{Type.fromInterned(ty).containerTypeName(ip).fmt(ip)}); | |
| 4240 | refs_log.debug("handle type '{f}'", .{Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip)}); | |
| 4241 | 4241 | |
| 4242 | 4242 | // Queue any decls within this type which would be automatically analyzed. |
| 4243 | 4243 | // Keep in sync with analysis queueing logic in `Zcu.PerThread.ScanDeclIter.scanDecl`. |
| ... | ... | @@ -4248,7 +4248,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4248 | 4248 | const gop = try units.getOrPut(gpa, unit); |
| 4249 | 4249 | if (!gop.found_existing) { |
| 4250 | 4250 | refs_log.debug("type '{f}': ref comptime %{}", .{ |
| 4251 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | |
| 4251 | Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip), | |
| 4252 | 4252 | @backingInt(ip.getComptimeUnit(cu).zir_index.resolve(ip) orelse continue), |
| 4253 | 4253 | }); |
| 4254 | 4254 | gop.value_ptr.* = referencer; |
| ... | ... | @@ -4282,7 +4282,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4282 | 4282 | const gop = try units.getOrPut(gpa, .wrap(.{ .nav_val = nav_id })); |
| 4283 | 4283 | if (!gop.found_existing) { |
| 4284 | 4284 | refs_log.debug("type '{f}': ref test %{}", .{ |
| 4285 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | |
| 4285 | Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip), | |
| 4286 | 4286 | @backingInt(inst_info.inst), |
| 4287 | 4287 | }); |
| 4288 | 4288 | gop.value_ptr.* = referencer; |
| ... | ... | @@ -4305,7 +4305,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4305 | 4305 | const gop = try units.getOrPut(gpa, unit); |
| 4306 | 4306 | if (!gop.found_existing) { |
| 4307 | 4307 | refs_log.debug("type '{f}': ref named %{}", .{ |
| 4308 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | |
| 4308 | Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip), | |
| 4309 | 4309 | @backingInt(inst_info.inst), |
| 4310 | 4310 | }); |
| 4311 | 4311 | gop.value_ptr.* = referencer; |
| ... | ... | @@ -4322,7 +4322,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4322 | 4322 | const gop = try units.getOrPut(gpa, unit); |
| 4323 | 4323 | if (!gop.found_existing) { |
| 4324 | 4324 | refs_log.debug("type '{f}': ref named %{}", .{ |
| 4325 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | |
| 4325 | Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip), | |
| 4326 | 4326 | @backingInt(inst_info.inst), |
| 4327 | 4327 | }); |
| 4328 | 4328 | gop.value_ptr.* = referencer; |
| ... | ... | @@ -4385,7 +4385,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4385 | 4385 | if (!gop.found_existing) { |
| 4386 | 4386 | refs_log.debug("unit '{f}': ref type '{f}'", .{ |
| 4387 | 4387 | zcu.fmtAnalUnit(unit), |
| 4388 | Type.fromInterned(ref.referenced).containerTypeName(ip).fmt(ip), | |
| 4388 | Type.fromInterned(ref.referenced).containerTypeName(ip).fqn.fmt(ip), | |
| 4389 | 4389 | }); |
| 4390 | 4390 | gop.value_ptr.* = .{ |
| 4391 | 4391 | .referencer = unit, |
| ... | ... | @@ -4498,7 +4498,7 @@ fn formatAnalUnit(data: FormatAnalUnit, writer: *Io.Writer) Io.Writer.Error!void |
| 4498 | 4498 | } |
| 4499 | 4499 | }, |
| 4500 | 4500 | .nav_val, .nav_ty => |nav, tag| return writer.print("{t}('{f}' [{}])", .{ tag, ip.getNav(nav).fqn.fmt(ip), @backingInt(nav) }), |
| 4501 | .type_layout, .struct_defaults => |ty, tag| return writer.print("{t}('{f}' [{}])", .{ tag, Type.fromInterned(ty).containerTypeName(ip).fmt(ip), @backingInt(ty) }), | |
| 4501 | .type_layout, .struct_defaults => |ty, tag| return writer.print("{t}('{f}' [{}])", .{ tag, Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip), @backingInt(ty) }), | |
| 4502 | 4502 | .func => |func| { |
| 4503 | 4503 | const nav = zcu.funcInfo(func).owner_nav; |
| 4504 | 4504 | return writer.print("func('{f}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @backingInt(func) }); |
| ... | ... | @@ -4524,8 +4524,8 @@ fn formatDependee(data: FormatDependee, writer: *Io.Writer) Io.Writer.Error!void |
| 4524 | 4524 | return writer.print("{t}('{f}')", .{ tag, fqn.fmt(ip) }); |
| 4525 | 4525 | }, |
| 4526 | 4526 | .type_layout, .struct_defaults => |ip_index, tag| { |
| 4527 | const name = Type.fromInterned(ip_index).containerTypeName(ip); | |
| 4528 | return writer.print("{t}('{f}')", .{ tag, name.fmt(ip) }); | |
| 4527 | const fqn = Type.fromInterned(ip_index).containerTypeName(ip).fqn; | |
| 4528 | return writer.print("{t}('{f}')", .{ tag, fqn.fmt(ip) }); | |
| 4529 | 4529 | }, |
| 4530 | 4530 | .func_ies => |ip_index| { |
| 4531 | 4531 | const fqn = ip.getNav(ip.indexToKey(ip_index).func.owner_nav).fqn; |
| ... | ... | @@ -5002,7 +5002,7 @@ fn addDependencyLoopErrorLine( |
| 5002 | 5002 | }), |
| 5003 | 5003 | .struct_defaults => |ty| try eb.printString( |
| 5004 | 5004 | "default field values of '{f}' depend on themselves for initialization here", |
| 5005 | .{Type.fromInterned(ty).containerTypeName(ip).fmt(ip)}, | |
| 5005 | .{Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip)}, | |
| 5006 | 5006 | ), |
| 5007 | 5007 | } else switch (dep_node.unit.unwrap()) { |
| 5008 | 5008 | .@"comptime" => unreachable, // cannot be involved in a dependency loop |
| ... | ... | @@ -5021,12 +5021,12 @@ fn addDependencyLoopErrorLine( |
| 5021 | 5021 | }), |
| 5022 | 5022 | .type_layout => |ty| try eb.printString("{f} depends on type '{f}' {s}", .{ |
| 5023 | 5023 | fmt_source, |
| 5024 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | |
| 5024 | Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip), | |
| 5025 | 5025 | dep_node.reason.type_layout_reason.msg(), |
| 5026 | 5026 | }), |
| 5027 | 5027 | .struct_defaults => |ty| try eb.printString( |
| 5028 | 5028 | "{f} uses default field values of '{f}' here", |
| 5029 | .{ fmt_source, Type.fromInterned(ty).containerTypeName(ip).fmt(ip) }, | |
| 5029 | .{ fmt_source, Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip) }, | |
| 5030 | 5030 | ), |
| 5031 | 5031 | }; |
| 5032 | 5032 | |
| ... | ... | @@ -5068,10 +5068,10 @@ fn formatDependencyLoopSourceUnit(data: FormatAnalUnit, w: *Io.Writer) Io.Writer |
| 5068 | 5068 | else => try w.writeAll("'std.lang' declarations"), |
| 5069 | 5069 | }, |
| 5070 | 5070 | .type_layout => |ty| try w.print("type '{f}'", .{ |
| 5071 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | |
| 5071 | Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip), | |
| 5072 | 5072 | }), |
| 5073 | 5073 | .struct_defaults => |ty| try w.print("default field value of '{f}'", .{ |
| 5074 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | |
| 5074 | Type.fromInterned(ty).containerTypeName(ip).fqn.fmt(ip), | |
| 5075 | 5075 | }), |
| 5076 | 5076 | .func => |func| try w.print("function '{f}'", .{ |
| 5077 | 5077 | ip.getNav(zcu.funcInfo(func).owner_nav).fqn.fmt(ip), |
| ... | ... | @@ -5121,7 +5121,7 @@ pub fn populateReferenceTrace( |
| 5121 | 5121 | const root_name: ?[]const u8 = switch (ref.referencer.unwrap()) { |
| 5122 | 5122 | .@"comptime" => "comptime", |
| 5123 | 5123 | .nav_val, .nav_ty => |nav| ip.getNav(nav).name.toSlice(ip), |
| 5124 | .type_layout, .struct_defaults => |ty| Type.fromInterned(ty).containerTypeName(ip).toSlice(ip), | |
| 5124 | .type_layout, .struct_defaults => |ty| Type.fromInterned(ty).containerTypeName(ip).fqn.toSlice(ip), | |
| 5125 | 5125 | .func => |f| ip.getNav(zcu.funcInfo(f).owner_nav).name.toSlice(ip), |
| 5126 | 5126 | .memoized_state => null, |
| 5127 | 5127 | }; |
src/Zcu/PerThread.zig+21-9| ... | ... | @@ -1026,7 +1026,12 @@ pub fn ensureFilePopulated(pt: Zcu.PerThread, file_index: Zcu.File.Index) (Alloc |
| 1026 | 1026 | }; |
| 1027 | 1027 | errdefer wip.cancel(ip, pt.tid); |
| 1028 | 1028 | |
| 1029 | wip.setName(ip, try file.internFullyQualifiedName(pt), .none); | |
| 1029 | wip.setName( | |
| 1030 | ip, | |
| 1031 | try ip.getOrPutString(gpa, io, pt.tid, std.fs.path.stem(file.sub_file_path), .no_embedded_nulls), | |
| 1032 | try file.internFullyQualifiedName(pt), | |
| 1033 | .none, | |
| 1034 | ); | |
| 1030 | 1035 | const new_namespace_index: InternPool.NamespaceIndex = try pt.createNamespace(.{ |
| 1031 | 1036 | .parent = .none, |
| 1032 | 1037 | .owner_type = wip.index, |
| ... | ... | @@ -1267,6 +1272,7 @@ fn analyzeComptimeUnit(pt: Zcu.PerThread, cu_id: InternPool.ComptimeUnit.Id) Zcu |
| 1267 | 1272 | // The comptime unit declares on the source of the corresponding `comptime` declaration. |
| 1268 | 1273 | try sema.declareDependency(.{ .src_hash = comptime_unit.zir_index }); |
| 1269 | 1274 | |
| 1275 | const parent_ns = Type.fromInterned(zcu.namespacePtr(comptime_unit.namespace).owner_type).containerTypeName(ip); | |
| 1270 | 1276 | var block: Sema.Block = .{ |
| 1271 | 1277 | .parent = null, |
| 1272 | 1278 | .sema = &sema, |
| ... | ... | @@ -1282,7 +1288,10 @@ fn analyzeComptimeUnit(pt: Zcu.PerThread, cu_id: InternPool.ComptimeUnit.Id) Zcu |
| 1282 | 1288 | } }, |
| 1283 | 1289 | .src_base_inst = comptime_unit.zir_index, |
| 1284 | 1290 | .type_name_ctx = try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.comptime", .{ |
| 1285 | Type.fromInterned(zcu.namespacePtr(comptime_unit.namespace).owner_type).containerTypeName(ip).fmt(ip), | |
| 1291 | parent_ns.name.fmt(ip), | |
| 1292 | }, .no_embedded_nulls), | |
| 1293 | .type_fqn_ctx = try ip.getOrPutStringFmt(gpa, io, pt.tid, "{f}.comptime", .{ | |
| 1294 | parent_ns.fqn.fmt(ip), | |
| 1286 | 1295 | }, .no_embedded_nulls), |
| 1287 | 1296 | }; |
| 1288 | 1297 | defer block.instructions.deinit(gpa); |
| ... | ... | @@ -1358,7 +1367,7 @@ pub fn ensureTypeLayoutUpToDate( |
| 1358 | 1367 | info.deps.clearRetainingCapacity(); |
| 1359 | 1368 | } |
| 1360 | 1369 | |
| 1361 | const unit_tracking = zcu.trackUnitSema(ty.containerTypeName(ip).toSlice(ip), null); | |
| 1370 | const unit_tracking = zcu.trackUnitSema(ty.containerTypeName(ip).fqn.toSlice(ip), null); | |
| 1362 | 1371 | defer unit_tracking.end(zcu); |
| 1363 | 1372 | |
| 1364 | 1373 | try zcu.analysis_in_progress.put(gpa, anal_unit, reason); |
| ... | ... | @@ -1470,7 +1479,7 @@ pub fn ensureStructDefaultsUpToDate( |
| 1470 | 1479 | info.deps.clearRetainingCapacity(); |
| 1471 | 1480 | } |
| 1472 | 1481 | |
| 1473 | const unit_tracking = zcu.trackUnitSema(ty.containerTypeName(ip).toSlice(ip), null); | |
| 1482 | const unit_tracking = zcu.trackUnitSema(ty.containerTypeName(ip).fqn.toSlice(ip), null); | |
| 1474 | 1483 | defer unit_tracking.end(zcu); |
| 1475 | 1484 | |
| 1476 | 1485 | try zcu.analysis_in_progress.put(gpa, anal_unit, reason); |
| ... | ... | @@ -1679,7 +1688,8 @@ fn analyzeNavVal( |
| 1679 | 1688 | .inlining = null, |
| 1680 | 1689 | .comptime_reason = undefined, // set below |
| 1681 | 1690 | .src_base_inst = old_nav.analysis.?.zir_index, |
| 1682 | .type_name_ctx = old_nav.fqn, | |
| 1691 | .type_name_ctx = old_nav.name, | |
| 1692 | .type_fqn_ctx = old_nav.fqn, | |
| 1683 | 1693 | }; |
| 1684 | 1694 | defer block.instructions.deinit(gpa); |
| 1685 | 1695 | |
| ... | ... | @@ -2048,7 +2058,8 @@ fn analyzeNavType( |
| 2048 | 2058 | .inlining = null, |
| 2049 | 2059 | .comptime_reason = undefined, // set below |
| 2050 | 2060 | .src_base_inst = old_nav.analysis.?.zir_index, |
| 2051 | .type_name_ctx = old_nav.fqn, | |
| 2061 | .type_name_ctx = old_nav.name, | |
| 2062 | .type_fqn_ctx = old_nav.fqn, | |
| 2052 | 2063 | }; |
| 2053 | 2064 | defer block.instructions.deinit(gpa); |
| 2054 | 2065 | |
| ... | ... | @@ -2989,11 +3000,11 @@ pub fn scanNamespace( |
| 2989 | 3000 | |
| 2990 | 3001 | const tracy_trace = trace(@src()); |
| 2991 | 3002 | defer tracy_trace.end(); |
| 2992 | tracy_trace.addText(Type.fromInterned(namespace.owner_type).containerTypeName(ip).toSlice(ip)); | |
| 3003 | tracy_trace.addText(Type.fromInterned(namespace.owner_type).containerTypeName(ip).fqn.toSlice(ip)); | |
| 2993 | 3004 | tracy_trace.addTextFmt("type_ip_index={d}", .{namespace.owner_type}); |
| 2994 | 3005 | |
| 2995 | 3006 | const tracked_unit = zcu.trackUnitSema( |
| 2996 | Type.fromInterned(namespace.owner_type).containerTypeName(ip).toSlice(ip), | |
| 3007 | Type.fromInterned(namespace.owner_type).containerTypeName(ip).fqn.toSlice(ip), | |
| 2997 | 3008 | null, |
| 2998 | 3009 | ); |
| 2999 | 3010 | defer tracked_unit.end(zcu); |
| ... | ... | @@ -3315,7 +3326,8 @@ fn analyzeFuncBodyInner( |
| 3315 | 3326 | .inlining = null, |
| 3316 | 3327 | .comptime_reason = null, |
| 3317 | 3328 | .src_base_inst = decl_analysis.zir_index, |
| 3318 | .type_name_ctx = func_nav.fqn, | |
| 3329 | .type_name_ctx = func_nav.name, | |
| 3330 | .type_fqn_ctx = func_nav.fqn, | |
| 3319 | 3331 | }; |
| 3320 | 3332 | defer inner_block.instructions.deinit(gpa); |
| 3321 | 3333 |
src/codegen/c.zig+3-3| ... | ... | @@ -2175,11 +2175,11 @@ pub fn genTagNameFn( |
| 2175 | 2175 | } |
| 2176 | 2176 | |
| 2177 | 2177 | if (!zcu.comp.config.root_strip) try w.print("/* @tagName({f}) */\n", .{ |
| 2178 | loaded_enum.name.fmt(ip), | |
| 2178 | loaded_enum.fqn.fmt(ip), | |
| 2179 | 2179 | }); |
| 2180 | 2180 | try w.print("static {s} zig_tagName_{f}__{d}({s} tag) {{\n", .{ |
| 2181 | 2181 | slice_const_u8_sentinel_0_type_name, |
| 2182 | fmtIdentUnsolo(loaded_enum.name.toSlice(ip)), | |
| 2182 | fmtIdentUnsolo(loaded_enum.fqn.toSlice(ip)), | |
| 2183 | 2183 | @backingInt(enum_ty.toIntern()), |
| 2184 | 2184 | enum_type_name, |
| 2185 | 2185 | }); |
| ... | ... | @@ -6667,7 +6667,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6667 | 6667 | try f.writeCValue(w, local, .other); |
| 6668 | 6668 | try f.need_tag_name_funcs.put(gpa, enum_ty.toIntern(), {}); |
| 6669 | 6669 | try w.print(" = zig_tagName_{f}__{d}(", .{ |
| 6670 | fmtIdentUnsolo(enum_ty.containerTypeName(ip).toSlice(ip)), | |
| 6670 | fmtIdentUnsolo(enum_ty.containerTypeName(ip).fqn.toSlice(ip)), | |
| 6671 | 6671 | @backingInt(enum_ty.toIntern()), |
| 6672 | 6672 | }); |
| 6673 | 6673 | try f.writeCValue(w, operand, .other); |
src/codegen/c/type.zig+3-3| ... | ... | @@ -1140,17 +1140,17 @@ pub const CType = union(enum) { |
| 1140 | 1140 | try w.print("_{f}", .{fmtZigType(field_ty, zcu)}); |
| 1141 | 1141 | } |
| 1142 | 1142 | } else { |
| 1143 | const name = ty.containerTypeName(ip).toSlice(ip); | |
| 1143 | const name = ty.containerTypeName(ip).fqn.toSlice(ip); | |
| 1144 | 1144 | try w.print("{f}", .{@import("../c.zig").fmtIdentUnsolo(name)}); |
| 1145 | 1145 | }, |
| 1146 | 1146 | .@"opaque" => if (ty.toIntern() == .anyopaque_type) { |
| 1147 | 1147 | try w.writeAll("anyopaque"); |
| 1148 | 1148 | } else { |
| 1149 | const name = ty.containerTypeName(ip).toSlice(ip); | |
| 1149 | const name = ty.containerTypeName(ip).fqn.toSlice(ip); | |
| 1150 | 1150 | try w.print("{f}", .{@import("../c.zig").fmtIdentUnsolo(name)}); |
| 1151 | 1151 | }, |
| 1152 | 1152 | .@"union", .@"enum" => { |
| 1153 | const name = ty.containerTypeName(ip).toSlice(ip); | |
| 1153 | const name = ty.containerTypeName(ip).fqn.toSlice(ip); | |
| 1154 | 1154 | try w.print("{f}", .{@import("../c.zig").fmtIdentUnsolo(name)}); |
| 1155 | 1155 | }, |
| 1156 | 1156 | } |
src/codegen/llvm.zig+5-5| ... | ... | @@ -2893,7 +2893,7 @@ pub const Object = struct { |
| 2893 | 2893 | } |
| 2894 | 2894 | } |
| 2895 | 2895 | |
| 2896 | const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).toSlice(ip))); | |
| 2896 | const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).fqn.toSlice(ip))); | |
| 2897 | 2897 | try o.type_map.put(o.gpa, t.toIntern(), ty); |
| 2898 | 2898 | |
| 2899 | 2899 | o.builder.namedTypeSetBody( |
| ... | ... | @@ -2983,7 +2983,7 @@ pub const Object = struct { |
| 2983 | 2983 | }; |
| 2984 | 2984 | |
| 2985 | 2985 | if (layout.tag_size == 0) { |
| 2986 | const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).toSlice(ip))); | |
| 2986 | const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).fqn.toSlice(ip))); | |
| 2987 | 2987 | try o.type_map.put(o.gpa, t.toIntern(), ty); |
| 2988 | 2988 | |
| 2989 | 2989 | o.builder.namedTypeSetBody( |
| ... | ... | @@ -3011,7 +3011,7 @@ pub const Object = struct { |
| 3011 | 3011 | llvm_fields_len += 1; |
| 3012 | 3012 | } |
| 3013 | 3013 | |
| 3014 | const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).toSlice(ip))); | |
| 3014 | const ty = try o.builder.opaqueType(try o.builder.string(t.containerTypeName(ip).fqn.toSlice(ip))); | |
| 3015 | 3015 | try o.type_map.put(o.gpa, t.toIntern(), ty); |
| 3016 | 3016 | |
| 3017 | 3017 | o.builder.namedTypeSetBody( |
| ... | ... | @@ -4026,7 +4026,7 @@ pub const Object = struct { |
| 4026 | 4026 | // Dummy function type; `updateEnumTagNameFunction` will replace it with the correct type. |
| 4027 | 4027 | // TODO: change the builder API so we don't need to do this. |
| 4028 | 4028 | try o.builder.fnType(.void, &.{}, .normal), |
| 4029 | try o.builder.strtabStringFmt("__zig_tag_name_{f}", .{enum_ty.containerTypeName(ip).fmt(ip)}), | |
| 4029 | try o.builder.strtabStringFmt("__zig_tag_name_{f}", .{enum_ty.containerTypeName(ip).fqn.fmt(ip)}), | |
| 4030 | 4030 | toLlvmAddressSpace(.generic, zcu.getTarget()), |
| 4031 | 4031 | ); |
| 4032 | 4032 | gop.value_ptr.* = llvm_function; |
| ... | ... | @@ -4123,7 +4123,7 @@ pub const Object = struct { |
| 4123 | 4123 | // Dummy function type; `updateIsNamedEnumValue` will replace it with the correct type. |
| 4124 | 4124 | // TODO: change the builder API so we don't need to do this. |
| 4125 | 4125 | try o.builder.fnType(.void, &.{}, .normal), |
| 4126 | try o.builder.strtabStringFmt("__zig_is_named_enum_value_{f}", .{enum_ty.containerTypeName(ip).fmt(ip)}), | |
| 4126 | try o.builder.strtabStringFmt("__zig_is_named_enum_value_{f}", .{enum_ty.containerTypeName(ip).fqn.fmt(ip)}), | |
| 4127 | 4127 | toLlvmAddressSpace(.generic, zcu.getTarget()), |
| 4128 | 4128 | ); |
| 4129 | 4129 | gop.value_ptr.* = llvm_function; |
src/link.zig+2-2| ... | ... | @@ -1705,8 +1705,8 @@ pub fn doZcuTask(comp: *Compilation, tid: Zcu.PerThread.Id, task: ZcuTask) void |
| 1705 | 1705 | break :nav ip.indexToKey(func).func.owner_nav; |
| 1706 | 1706 | }, |
| 1707 | 1707 | .debug_update_container_type => |container_update| nav: { |
| 1708 | const name = Type.fromInterned(container_update.ty).containerTypeName(ip).toSlice(ip); | |
| 1709 | const ty_prog_node = comp.link_prog_node.start(name, 0); | |
| 1708 | const fqn = Type.fromInterned(container_update.ty).containerTypeName(ip).fqn.toSlice(ip); | |
| 1709 | const ty_prog_node = comp.link_prog_node.start(fqn, 0); | |
| 1710 | 1710 | defer ty_prog_node.end(); |
| 1711 | 1711 | (if (zcu.llvm_object) |llvm_object| |
| 1712 | 1712 | llvm_object.updateContainerType(pt, container_update.ty, container_update.success) |
src/link/Dwarf.zig+15-15| ... | ... | @@ -3387,12 +3387,12 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde |
| 3387 | 3387 | const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file_index); |
| 3388 | 3388 | try wip_nav.abbrevCode(.empty_file); |
| 3389 | 3389 | try wip_nav.debug_info.writer.writeUleb128(file_gop.index); |
| 3390 | try wip_nav.strp(loaded_struct.name.toSlice(ip)); | |
| 3390 | try wip_nav.strp(loaded_struct.fqn.toSlice(ip)); | |
| 3391 | 3391 | } else { |
| 3392 | 3392 | try dwarf.emitIncompleteContainerType( |
| 3393 | 3393 | &wip_nav, |
| 3394 | 3394 | loaded_struct.zir_index, |
| 3395 | loaded_struct.name, | |
| 3395 | loaded_struct.fqn, | |
| 3396 | 3396 | loaded_struct.name_nav, |
| 3397 | 3397 | ); |
| 3398 | 3398 | } |
| ... | ... | @@ -3402,7 +3402,7 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde |
| 3402 | 3402 | try dwarf.emitIncompleteContainerType( |
| 3403 | 3403 | &wip_nav, |
| 3404 | 3404 | loaded_union.zir_index, |
| 3405 | loaded_union.name, | |
| 3405 | loaded_union.fqn, | |
| 3406 | 3406 | loaded_union.name_nav, |
| 3407 | 3407 | ); |
| 3408 | 3408 | }, |
| ... | ... | @@ -3412,12 +3412,12 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde |
| 3412 | 3412 | try dwarf.emitIncompleteContainerType( |
| 3413 | 3413 | &wip_nav, |
| 3414 | 3414 | zir_index, |
| 3415 | loaded_enum.name, | |
| 3415 | loaded_enum.fqn, | |
| 3416 | 3416 | loaded_enum.name_nav, |
| 3417 | 3417 | ); |
| 3418 | 3418 | } else { |
| 3419 | 3419 | try wip_nav.abbrevCode(.generated_empty_struct_type); |
| 3420 | try wip_nav.strp(loaded_enum.name.toSlice(ip)); | |
| 3420 | try wip_nav.strp(loaded_enum.fqn.toSlice(ip)); | |
| 3421 | 3421 | try wip_nav.debug_info.writer.writeByte(@intFromBool(true)); |
| 3422 | 3422 | } |
| 3423 | 3423 | }, |
| ... | ... | @@ -3426,7 +3426,7 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde |
| 3426 | 3426 | try dwarf.emitIncompleteContainerType( |
| 3427 | 3427 | &wip_nav, |
| 3428 | 3428 | loaded_opaque.zir_index, |
| 3429 | loaded_opaque.name, | |
| 3429 | loaded_opaque.fqn, | |
| 3430 | 3430 | loaded_opaque.name_nav, |
| 3431 | 3431 | ); |
| 3432 | 3432 | }, |
| ... | ... | @@ -3451,7 +3451,7 @@ fn emitIncompleteContainerType( |
| 3451 | 3451 | dwarf: *Dwarf, |
| 3452 | 3452 | wip_nav: *WipNav, |
| 3453 | 3453 | zir_index: InternPool.TrackedInst.Index, |
| 3454 | name: InternPool.NullTerminatedString, | |
| 3454 | fqn: InternPool.NullTerminatedString, | |
| 3455 | 3455 | name_nav: InternPool.Nav.Index.Optional, |
| 3456 | 3456 | ) !void { |
| 3457 | 3457 | const zcu = wip_nav.pt.zcu; |
| ... | ... | @@ -3472,7 +3472,7 @@ fn emitIncompleteContainerType( |
| 3472 | 3472 | const file_gop = try dwarf.getModInfo(wip_nav.unit).files.getOrPut(dwarf.gpa, file); |
| 3473 | 3473 | try wip_nav.abbrevCode(.empty_struct_type); |
| 3474 | 3474 | try diw.writeUleb128(file_gop.index); |
| 3475 | try wip_nav.strp(name.toSlice(ip)); | |
| 3475 | try wip_nav.strp(fqn.toSlice(ip)); | |
| 3476 | 3476 | try diw.writeByte(@intFromBool(true)); |
| 3477 | 3477 | } |
| 3478 | 3478 | } |
| ... | ... | @@ -3895,7 +3895,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3895 | 3895 | else => if (struct_is_file) .file else .struct_type, |
| 3896 | 3896 | }); |
| 3897 | 3897 | try diw.writeUleb128(file_gop.index); |
| 3898 | try wip_nav.strp(loaded_struct.name.toSlice(ip)); | |
| 3898 | try wip_nav.strp(loaded_struct.fqn.toSlice(ip)); | |
| 3899 | 3899 | } |
| 3900 | 3900 | if (loaded_struct.field_types.len == 0) { |
| 3901 | 3901 | if (!struct_is_file) try diw.writeByte(@intFromBool(false)); |
| ... | ... | @@ -3968,7 +3968,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3968 | 3968 | const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file); |
| 3969 | 3969 | try wip_nav.abbrevCode(if (loaded_struct.field_types.len > 0) .packed_struct_type else .empty_packed_struct_type); |
| 3970 | 3970 | try diw.writeUleb128(file_gop.index); |
| 3971 | try wip_nav.strp(loaded_struct.name.toSlice(ip)); | |
| 3971 | try wip_nav.strp(loaded_struct.fqn.toSlice(ip)); | |
| 3972 | 3972 | break :t loaded_struct.field_types.len > 0; |
| 3973 | 3973 | }; |
| 3974 | 3974 | try wip_nav.refType(.fromInterned(loaded_struct.packed_backing_int_type)); |
| ... | ... | @@ -4005,7 +4005,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4005 | 4005 | const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file); |
| 4006 | 4006 | try wip_nav.abbrevCode(if (loaded_union.field_types.len > 0) .union_type else .empty_union_type); |
| 4007 | 4007 | try diw.writeUleb128(file_gop.index); |
| 4008 | try wip_nav.strp(loaded_union.name.toSlice(ip)); | |
| 4008 | try wip_nav.strp(loaded_union.fqn.toSlice(ip)); | |
| 4009 | 4009 | break :t loaded_union.field_types.len > 0; |
| 4010 | 4010 | }; |
| 4011 | 4011 | const union_layout = Type.getUnionLayout(loaded_union, zcu); |
| ... | ... | @@ -4067,7 +4067,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4067 | 4067 | const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file); |
| 4068 | 4068 | try wip_nav.abbrevCode(if (loaded_union.field_types.len > 0) .packed_union_type else .empty_packed_union_type); |
| 4069 | 4069 | try diw.writeUleb128(file_gop.index); |
| 4070 | try wip_nav.strp(loaded_union.name.toSlice(ip)); | |
| 4070 | try wip_nav.strp(loaded_union.fqn.toSlice(ip)); | |
| 4071 | 4071 | break :t loaded_union.field_types.len > 0; |
| 4072 | 4072 | }; |
| 4073 | 4073 | try wip_nav.refType(.fromInterned(loaded_union.packed_backing_int_type)); |
| ... | ... | @@ -4103,7 +4103,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4103 | 4103 | const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file); |
| 4104 | 4104 | try wip_nav.abbrevCode(if (loaded_enum.field_names.len > 0) .enum_type else .empty_enum_type); |
| 4105 | 4105 | try diw.writeUleb128(file_gop.index); |
| 4106 | try wip_nav.strp(loaded_enum.name.toSlice(ip)); | |
| 4106 | try wip_nav.strp(loaded_enum.fqn.toSlice(ip)); | |
| 4107 | 4107 | } |
| 4108 | 4108 | try wip_nav.refType(.fromInterned(loaded_enum.int_tag_type)); |
| 4109 | 4109 | for (0..loaded_enum.field_names.len) |field_index| { |
| ... | ... | @@ -4115,7 +4115,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4115 | 4115 | } else { |
| 4116 | 4116 | assert(loaded_enum.owner_union != .none); |
| 4117 | 4117 | try wip_nav.abbrevCode(if (loaded_enum.field_names.len == 0) .generated_empty_enum_type else .generated_enum_type); |
| 4118 | try wip_nav.strp(loaded_enum.name.toSlice(ip)); | |
| 4118 | try wip_nav.strp(loaded_enum.fqn.toSlice(ip)); | |
| 4119 | 4119 | try wip_nav.refType(.fromInterned(loaded_enum.int_tag_type)); |
| 4120 | 4120 | for (0..loaded_enum.field_names.len) |field_index| { |
| 4121 | 4121 | try wip_nav.abbrevCode(.enum_field); |
| ... | ... | @@ -4141,7 +4141,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4141 | 4141 | const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, file); |
| 4142 | 4142 | try wip_nav.abbrevCode(.empty_struct_type); |
| 4143 | 4143 | try diw.writeUleb128(file_gop.index); |
| 4144 | try wip_nav.strp(loaded_opaque.name.toSlice(ip)); | |
| 4144 | try wip_nav.strp(loaded_opaque.fqn.toSlice(ip)); | |
| 4145 | 4145 | } |
| 4146 | 4146 | try diw.writeByte(@intFromBool(true)); |
| 4147 | 4147 | }, |
src/link/Dwarf2.zig+14-14| ... | ... | @@ -2349,7 +2349,7 @@ fn updateConstInner( |
| 2349 | 2349 | else => if (struct_is_file) .file else .struct_type, |
| 2350 | 2350 | })); |
| 2351 | 2351 | try diw.writeUleb128(@backingInt(fi)); |
| 2352 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.name.toSlice(ip)); | |
| 2352 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.fqn.toSlice(ip)); | |
| 2353 | 2353 | } |
| 2354 | 2354 | if (loaded_struct.field_types.len > 0) { |
| 2355 | 2355 | const ty: Type = .fromInterned(val); |
| ... | ... | @@ -2422,14 +2422,14 @@ fn updateConstInner( |
| 2422 | 2422 | if (loaded_enum.field_names.len > 0) .enum_type else .empty_enum_type, |
| 2423 | 2423 | )); |
| 2424 | 2424 | try diw.writeUleb128(@backingInt(fi)); |
| 2425 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.name.toSlice(ip)); | |
| 2425 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.fqn.toSlice(ip)); | |
| 2426 | 2426 | } |
| 2427 | 2427 | } else { |
| 2428 | 2428 | assert(loaded_enum.owner_union != .none); |
| 2429 | 2429 | try diw.writeUleb128(try dwarf.refAbbrevCode( |
| 2430 | 2430 | if (loaded_enum.field_names.len == 0) .generated_empty_enum_type else .generated_enum_type, |
| 2431 | 2431 | )); |
| 2432 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.name.toSlice(ip)); | |
| 2432 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.fqn.toSlice(ip)); | |
| 2433 | 2433 | } |
| 2434 | 2434 | try dwarf.refConst(pt, di_nw, .fromInterned(loaded_enum.int_tag_type)); |
| 2435 | 2435 | for (0..loaded_enum.field_names.len) |field_index| { |
| ... | ... | @@ -2465,7 +2465,7 @@ fn updateConstIncompleteInner( |
| 2465 | 2465 | const ip = &zcu.intern_pool; |
| 2466 | 2466 | const diw = &di_nw.interface; |
| 2467 | 2467 | done: { |
| 2468 | const src_inst, const zf, const capture_names, const captures, const name, const maybe_name_nav, const namespace = container: switch (ip.indexToKey(val)) { | |
| 2468 | const src_inst, const zf, const capture_names, const captures, const fqn, const maybe_name_nav, const namespace = container: switch (ip.indexToKey(val)) { | |
| 2469 | 2469 | .struct_type => { |
| 2470 | 2470 | const loaded_struct = ip.loadStructType(val); |
| 2471 | 2471 | const src_inst = loaded_struct.zir_index.resolveFull(ip) orelse { |
| ... | ... | @@ -2479,7 +2479,7 @@ fn updateConstIncompleteInner( |
| 2479 | 2479 | _, const fi = try ui.get(dwarf).getFile(zcu.gpa, ui, src_inst.file); |
| 2480 | 2480 | try diw.writeUleb128(try dwarf.refAbbrevCode(.empty_file)); |
| 2481 | 2481 | try diw.writeUleb128(@backingInt(fi)); |
| 2482 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.name.toSlice(ip)); | |
| 2482 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.fqn.toSlice(ip)); | |
| 2483 | 2483 | try diw.writeByte(@intFromBool(true)); |
| 2484 | 2484 | break :done; |
| 2485 | 2485 | }, |
| ... | ... | @@ -2488,7 +2488,7 @@ fn updateConstIncompleteInner( |
| 2488 | 2488 | zf, |
| 2489 | 2489 | zf.zir.?.getStructDecl(src_inst.inst).capture_names, |
| 2490 | 2490 | loaded_struct.captures, |
| 2491 | loaded_struct.name, | |
| 2491 | loaded_struct.fqn, | |
| 2492 | 2492 | loaded_struct.name_nav, |
| 2493 | 2493 | loaded_struct.namespace, |
| 2494 | 2494 | }, |
| ... | ... | @@ -2506,7 +2506,7 @@ fn updateConstIncompleteInner( |
| 2506 | 2506 | zf, |
| 2507 | 2507 | zf.zir.?.getUnionDecl(src_inst.inst).capture_names, |
| 2508 | 2508 | loaded_union.captures, |
| 2509 | loaded_union.name, | |
| 2509 | loaded_union.fqn, | |
| 2510 | 2510 | loaded_union.name_nav, |
| 2511 | 2511 | loaded_union.namespace, |
| 2512 | 2512 | }; |
| ... | ... | @@ -2515,7 +2515,7 @@ fn updateConstIncompleteInner( |
| 2515 | 2515 | const loaded_enum = ip.loadEnumType(val); |
| 2516 | 2516 | const zir_index = loaded_enum.zir_index.unwrap() orelse { |
| 2517 | 2517 | try diw.writeUleb128(try dwarf.refAbbrevCode(.generated_empty_struct_type)); |
| 2518 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.name.toSlice(ip)); | |
| 2518 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.fqn.toSlice(ip)); | |
| 2519 | 2519 | try diw.writeByte(@intFromBool(true)); |
| 2520 | 2520 | break :done; |
| 2521 | 2521 | }; |
| ... | ... | @@ -2529,7 +2529,7 @@ fn updateConstIncompleteInner( |
| 2529 | 2529 | zf, |
| 2530 | 2530 | zf.zir.?.getEnumDecl(src_inst.inst).capture_names, |
| 2531 | 2531 | loaded_enum.captures, |
| 2532 | loaded_enum.name, | |
| 2532 | loaded_enum.fqn, | |
| 2533 | 2533 | loaded_enum.name_nav, |
| 2534 | 2534 | loaded_enum.namespace, |
| 2535 | 2535 | }; |
| ... | ... | @@ -2546,7 +2546,7 @@ fn updateConstIncompleteInner( |
| 2546 | 2546 | zf, |
| 2547 | 2547 | zf.zir.?.getOpaqueDecl(src_inst.inst).capture_names, |
| 2548 | 2548 | loaded_opaque.captures, |
| 2549 | loaded_opaque.name, | |
| 2549 | loaded_opaque.fqn, | |
| 2550 | 2550 | loaded_opaque.name_nav, |
| 2551 | 2551 | loaded_opaque.namespace, |
| 2552 | 2552 | }; |
| ... | ... | @@ -2597,7 +2597,7 @@ fn updateConstIncompleteInner( |
| 2597 | 2597 | if (capturing) .capturing_empty_struct_type else .empty_struct_type, |
| 2598 | 2598 | )); |
| 2599 | 2599 | try diw.writeUleb128(@backingInt(fi)); |
| 2600 | try dwarf.strp(&dwarf.debug_str, di_nw, name.toSlice(ip)); | |
| 2600 | try dwarf.strp(&dwarf.debug_str, di_nw, fqn.toSlice(ip)); | |
| 2601 | 2601 | } |
| 2602 | 2602 | try diw.writeByte(@intFromBool(true)); |
| 2603 | 2603 | if (capturing) { |
| ... | ... | @@ -2661,7 +2661,7 @@ fn genDeclInner( |
| 2661 | 2661 | try diw.writeInt(u32, 0, dwarf.endian); |
| 2662 | 2662 | try diw.writeUleb128(0); |
| 2663 | 2663 | try diw.writeByte(DW.ACCESS.public); |
| 2664 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.name.toSlice(ip)); | |
| 2664 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_struct.fqn.toSlice(ip)); | |
| 2665 | 2665 | }, |
| 2666 | 2666 | .enum_type => { |
| 2667 | 2667 | const loaded_enum = ip.loadEnumType(instance_val); |
| ... | ... | @@ -2673,7 +2673,7 @@ fn genDeclInner( |
| 2673 | 2673 | try diw.writeInt(u32, 0, dwarf.endian); |
| 2674 | 2674 | try diw.writeUleb128(0); |
| 2675 | 2675 | try diw.writeByte(DW.ACCESS.public); |
| 2676 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.name.toSlice(ip)); | |
| 2676 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_enum.fqn.toSlice(ip)); | |
| 2677 | 2677 | }, |
| 2678 | 2678 | .union_type => { |
| 2679 | 2679 | const loaded_union = ip.loadUnionType(instance_val); |
| ... | ... | @@ -2685,7 +2685,7 @@ fn genDeclInner( |
| 2685 | 2685 | try diw.writeInt(u32, 0, dwarf.endian); |
| 2686 | 2686 | try diw.writeUleb128(0); |
| 2687 | 2687 | try diw.writeByte(DW.ACCESS.public); |
| 2688 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_union.name.toSlice(ip)); | |
| 2688 | try dwarf.strp(&dwarf.debug_str, di_nw, loaded_union.fqn.toSlice(ip)); | |
| 2689 | 2689 | }, |
| 2690 | 2690 | } |
| 2691 | 2691 | try dwarf.genDebugInfoPadding(diw, diw.unusedCapacityLen()); |