| author | |
| committer | |
| log | 667b4f9054cd0d4c8e9912bddc18049d09107678 |
| tree | 8049d0f1dab34e4bf5994bd4aeacbd1ba7aa804d |
| parent | 95d9292a7a09ed883e65510ec054619747315c48 |
This avoids needing to mutate the intern pool from backends.18 files changed, 135 insertions(+), 187 deletions(-)
src/InternPool.zig+1| ... | ... | @@ -7955,6 +7955,7 @@ fn finishFuncInstance( |
| 7955 | 7955 | const fn_owner_decl = ip.declPtr(ip.funcDeclOwner(generic_owner)); |
| 7956 | 7956 | const decl_index = try ip.createDecl(gpa, tid, .{ |
| 7957 | 7957 | .name = undefined, |
| 7958 | .fqn = undefined, | |
| 7958 | 7959 | .src_namespace = fn_owner_decl.src_namespace, |
| 7959 | 7960 | .has_tv = true, |
| 7960 | 7961 | .owns_tv = true, |
src/Sema.zig+17-18| ... | ... | @@ -2878,7 +2878,7 @@ fn createAnonymousDeclTypeNamed( |
| 2878 | 2878 | switch (name_strategy) { |
| 2879 | 2879 | .anon => {}, // handled after switch |
| 2880 | 2880 | .parent => { |
| 2881 | try zcu.initNewAnonDecl(new_decl_index, val, block.type_name_ctx); | |
| 2881 | try pt.initNewAnonDecl(new_decl_index, val, block.type_name_ctx, .none); | |
| 2882 | 2882 | return new_decl_index; |
| 2883 | 2883 | }, |
| 2884 | 2884 | .func => func_strat: { |
| ... | ... | @@ -2923,7 +2923,7 @@ fn createAnonymousDeclTypeNamed( |
| 2923 | 2923 | |
| 2924 | 2924 | try writer.writeByte(')'); |
| 2925 | 2925 | const name = try ip.getOrPutString(gpa, pt.tid, buf.items, .no_embedded_nulls); |
| 2926 | try zcu.initNewAnonDecl(new_decl_index, val, name); | |
| 2926 | try pt.initNewAnonDecl(new_decl_index, val, name, .none); | |
| 2927 | 2927 | return new_decl_index; |
| 2928 | 2928 | }, |
| 2929 | 2929 | .dbg_var => { |
| ... | ... | @@ -2937,7 +2937,7 @@ fn createAnonymousDeclTypeNamed( |
| 2937 | 2937 | const name = try ip.getOrPutStringFmt(gpa, pt.tid, "{}.{s}", .{ |
| 2938 | 2938 | block.type_name_ctx.fmt(ip), zir_data[i].str_op.getStr(sema.code), |
| 2939 | 2939 | }, .no_embedded_nulls); |
| 2940 | try zcu.initNewAnonDecl(new_decl_index, val, name); | |
| 2940 | try pt.initNewAnonDecl(new_decl_index, val, name, .none); | |
| 2941 | 2941 | return new_decl_index; |
| 2942 | 2942 | }, |
| 2943 | 2943 | else => {}, |
| ... | ... | @@ -2958,7 +2958,7 @@ fn createAnonymousDeclTypeNamed( |
| 2958 | 2958 | const name = ip.getOrPutStringFmt(gpa, pt.tid, "{}__{s}_{d}", .{ |
| 2959 | 2959 | block.type_name_ctx.fmt(ip), anon_prefix, @intFromEnum(new_decl_index), |
| 2960 | 2960 | }, .no_embedded_nulls) catch unreachable; |
| 2961 | try zcu.initNewAnonDecl(new_decl_index, val, name); | |
| 2961 | try pt.initNewAnonDecl(new_decl_index, val, name, .none); | |
| 2962 | 2962 | return new_decl_index; |
| 2963 | 2963 | } |
| 2964 | 2964 | |
| ... | ... | @@ -5527,13 +5527,12 @@ fn failWithBadStructFieldAccess( |
| 5527 | 5527 | const zcu = pt.zcu; |
| 5528 | 5528 | const ip = &zcu.intern_pool; |
| 5529 | 5529 | const decl = zcu.declPtr(struct_type.decl.unwrap().?); |
| 5530 | const fqn = try decl.fullyQualifiedName(pt); | |
| 5531 | 5530 | |
| 5532 | 5531 | const msg = msg: { |
| 5533 | 5532 | const msg = try sema.errMsg( |
| 5534 | 5533 | field_src, |
| 5535 | 5534 | "no field named '{}' in struct '{}'", |
| 5536 | .{ field_name.fmt(ip), fqn.fmt(ip) }, | |
| 5535 | .{ field_name.fmt(ip), decl.fqn.fmt(ip) }, | |
| 5537 | 5536 | ); |
| 5538 | 5537 | errdefer msg.destroy(sema.gpa); |
| 5539 | 5538 | try sema.errNote(struct_ty.srcLoc(zcu), msg, "struct declared here", .{}); |
| ... | ... | @@ -5554,15 +5553,13 @@ fn failWithBadUnionFieldAccess( |
| 5554 | 5553 | const zcu = pt.zcu; |
| 5555 | 5554 | const ip = &zcu.intern_pool; |
| 5556 | 5555 | const gpa = sema.gpa; |
| 5557 | ||
| 5558 | 5556 | const decl = zcu.declPtr(union_obj.decl); |
| 5559 | const fqn = try decl.fullyQualifiedName(pt); | |
| 5560 | 5557 | |
| 5561 | 5558 | const msg = msg: { |
| 5562 | 5559 | const msg = try sema.errMsg( |
| 5563 | 5560 | field_src, |
| 5564 | 5561 | "no field named '{}' in union '{}'", |
| 5565 | .{ field_name.fmt(ip), fqn.fmt(ip) }, | |
| 5562 | .{ field_name.fmt(ip), decl.fqn.fmt(ip) }, | |
| 5566 | 5563 | ); |
| 5567 | 5564 | errdefer msg.destroy(gpa); |
| 5568 | 5565 | try sema.errNote(union_ty.srcLoc(zcu), msg, "union declared here", .{}); |
| ... | ... | @@ -9733,6 +9730,9 @@ fn funcCommon( |
| 9733 | 9730 | .generic_owner = sema.generic_owner, |
| 9734 | 9731 | .comptime_args = sema.comptime_args, |
| 9735 | 9732 | }); |
| 9733 | const func_decl = mod.declPtr(ip.indexToKey(func_index).func.owner_decl); | |
| 9734 | func_decl.fqn = | |
| 9735 | try ip.namespacePtr(func_decl.src_namespace).internFullyQualifiedName(pt, func_decl.name); | |
| 9736 | 9736 | return finishFunc( |
| 9737 | 9737 | sema, |
| 9738 | 9738 | block, |
| ... | ... | @@ -26500,7 +26500,7 @@ fn zirBuiltinExtern( |
| 26500 | 26500 | const new_decl_index = try pt.allocateNewDecl(sema.owner_decl.src_namespace); |
| 26501 | 26501 | errdefer pt.destroyDecl(new_decl_index); |
| 26502 | 26502 | const new_decl = mod.declPtr(new_decl_index); |
| 26503 | try mod.initNewAnonDecl( | |
| 26503 | try pt.initNewAnonDecl( | |
| 26504 | 26504 | new_decl_index, |
| 26505 | 26505 | Value.fromInterned( |
| 26506 | 26506 | if (Type.fromInterned(ptr_info.child).zigTypeTag(mod) == .Fn) |
| ... | ... | @@ -26522,6 +26522,7 @@ fn zirBuiltinExtern( |
| 26522 | 26522 | } }), |
| 26523 | 26523 | ), |
| 26524 | 26524 | options.name, |
| 26525 | .none, | |
| 26525 | 26526 | ); |
| 26526 | 26527 | new_decl.owns_tv = true; |
| 26527 | 26528 | // Note that this will queue the anon decl for codegen, so that the backend can |
| ... | ... | @@ -36735,24 +36736,23 @@ fn generateUnionTagTypeNumbered( |
| 36735 | 36736 | |
| 36736 | 36737 | const new_decl_index = try pt.allocateNewDecl(block.namespace); |
| 36737 | 36738 | errdefer pt.destroyDecl(new_decl_index); |
| 36738 | const fqn = try union_owner_decl.fullyQualifiedName(pt); | |
| 36739 | 36739 | const name = try ip.getOrPutStringFmt( |
| 36740 | 36740 | gpa, |
| 36741 | 36741 | pt.tid, |
| 36742 | 36742 | "@typeInfo({}).Union.tag_type.?", |
| 36743 | .{fqn.fmt(ip)}, | |
| 36743 | .{union_owner_decl.fqn.fmt(ip)}, | |
| 36744 | 36744 | .no_embedded_nulls, |
| 36745 | 36745 | ); |
| 36746 | try mod.initNewAnonDecl( | |
| 36746 | try pt.initNewAnonDecl( | |
| 36747 | 36747 | new_decl_index, |
| 36748 | 36748 | Value.@"unreachable", |
| 36749 | 36749 | name, |
| 36750 | name.toOptional(), | |
| 36750 | 36751 | ); |
| 36751 | 36752 | errdefer pt.abortAnonDecl(new_decl_index); |
| 36752 | 36753 | |
| 36753 | 36754 | const new_decl = mod.declPtr(new_decl_index); |
| 36754 | 36755 | new_decl.owns_tv = true; |
| 36755 | new_decl.name_fully_qualified = true; | |
| 36756 | 36756 | |
| 36757 | 36757 | const enum_ty = try ip.getGeneratedTagEnumType(gpa, pt.tid, .{ |
| 36758 | 36758 | .decl = new_decl_index, |
| ... | ... | @@ -36784,22 +36784,21 @@ fn generateUnionTagTypeSimple( |
| 36784 | 36784 | const gpa = sema.gpa; |
| 36785 | 36785 | |
| 36786 | 36786 | const new_decl_index = new_decl_index: { |
| 36787 | const fqn = try union_owner_decl.fullyQualifiedName(pt); | |
| 36788 | 36787 | const new_decl_index = try pt.allocateNewDecl(block.namespace); |
| 36789 | 36788 | errdefer pt.destroyDecl(new_decl_index); |
| 36790 | 36789 | const name = try ip.getOrPutStringFmt( |
| 36791 | 36790 | gpa, |
| 36792 | 36791 | pt.tid, |
| 36793 | 36792 | "@typeInfo({}).Union.tag_type.?", |
| 36794 | .{fqn.fmt(ip)}, | |
| 36793 | .{union_owner_decl.fqn.fmt(ip)}, | |
| 36795 | 36794 | .no_embedded_nulls, |
| 36796 | 36795 | ); |
| 36797 | try mod.initNewAnonDecl( | |
| 36796 | try pt.initNewAnonDecl( | |
| 36798 | 36797 | new_decl_index, |
| 36799 | 36798 | Value.@"unreachable", |
| 36800 | 36799 | name, |
| 36800 | name.toOptional(), | |
| 36801 | 36801 | ); |
| 36802 | mod.declPtr(new_decl_index).name_fully_qualified = true; | |
| 36803 | 36802 | break :new_decl_index new_decl_index; |
| 36804 | 36803 | }; |
| 36805 | 36804 | errdefer pt.abortAnonDecl(new_decl_index); |
src/Type.zig+7-7| ... | ... | @@ -268,10 +268,10 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error |
| 268 | 268 | return; |
| 269 | 269 | }, |
| 270 | 270 | .inferred_error_set_type => |func_index| { |
| 271 | try writer.writeAll("@typeInfo(@typeInfo(@TypeOf("); | |
| 272 | 271 | const owner_decl = mod.funcOwnerDeclPtr(func_index); |
| 273 | try owner_decl.renderFullyQualifiedName(mod, writer); | |
| 274 | try writer.writeAll(")).Fn.return_type.?).ErrorUnion.error_set"); | |
| 272 | try writer.print("@typeInfo(@typeInfo(@TypeOf({})).Fn.return_type.?).ErrorUnion.error_set", .{ | |
| 273 | owner_decl.fqn.fmt(ip), | |
| 274 | }); | |
| 275 | 275 | }, |
| 276 | 276 | .error_set_type => |error_set_type| { |
| 277 | 277 | const names = error_set_type.names; |
| ... | ... | @@ -334,7 +334,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error |
| 334 | 334 | const struct_type = ip.loadStructType(ty.toIntern()); |
| 335 | 335 | if (struct_type.decl.unwrap()) |decl_index| { |
| 336 | 336 | const decl = mod.declPtr(decl_index); |
| 337 | try decl.renderFullyQualifiedName(mod, writer); | |
| 337 | try writer.print("{}", .{decl.fqn.fmt(ip)}); | |
| 338 | 338 | } else if (ip.loadStructType(ty.toIntern()).namespace.unwrap()) |namespace_index| { |
| 339 | 339 | const namespace = mod.namespacePtr(namespace_index); |
| 340 | 340 | try namespace.renderFullyQualifiedName(mod, .empty, writer); |
| ... | ... | @@ -367,15 +367,15 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error |
| 367 | 367 | |
| 368 | 368 | .union_type => { |
| 369 | 369 | const decl = mod.declPtr(ip.loadUnionType(ty.toIntern()).decl); |
| 370 | try decl.renderFullyQualifiedName(mod, writer); | |
| 370 | try writer.print("{}", .{decl.fqn.fmt(ip)}); | |
| 371 | 371 | }, |
| 372 | 372 | .opaque_type => { |
| 373 | 373 | const decl = mod.declPtr(ip.loadOpaqueType(ty.toIntern()).decl); |
| 374 | try decl.renderFullyQualifiedName(mod, writer); | |
| 374 | try writer.print("{}", .{decl.fqn.fmt(ip)}); | |
| 375 | 375 | }, |
| 376 | 376 | .enum_type => { |
| 377 | 377 | const decl = mod.declPtr(ip.loadEnumType(ty.toIntern()).decl); |
| 378 | try decl.renderFullyQualifiedName(mod, writer); | |
| 378 | try writer.print("{}", .{decl.fqn.fmt(ip)}); | |
| 379 | 379 | }, |
| 380 | 380 | .func_type => |fn_info| { |
| 381 | 381 | if (fn_info.is_noinline) { |
src/Zcu.zig+5-39| ... | ... | @@ -326,7 +326,10 @@ pub const Reference = struct { |
| 326 | 326 | }; |
| 327 | 327 | |
| 328 | 328 | pub const Decl = struct { |
| 329 | /// Equal to `fqn` if already fully qualified. | |
| 329 | 330 | name: InternPool.NullTerminatedString, |
| 331 | /// Fully qualified name. | |
| 332 | fqn: InternPool.NullTerminatedString, | |
| 330 | 333 | /// The most recent Value of the Decl after a successful semantic analysis. |
| 331 | 334 | /// Populated when `has_tv`. |
| 332 | 335 | val: Value, |
| ... | ... | @@ -384,8 +387,6 @@ pub const Decl = struct { |
| 384 | 387 | is_pub: bool, |
| 385 | 388 | /// Whether the corresponding AST decl has a `export` keyword. |
| 386 | 389 | is_exported: bool, |
| 387 | /// If true `name` is already fully qualified. | |
| 388 | name_fully_qualified: bool = false, | |
| 389 | 390 | /// What kind of a declaration is this. |
| 390 | 391 | kind: Kind, |
| 391 | 392 | |
| ... | ... | @@ -408,25 +409,6 @@ pub const Decl = struct { |
| 408 | 409 | return extra.data.getBodies(@intCast(extra.end), zir); |
| 409 | 410 | } |
| 410 | 411 | |
| 411 | pub fn renderFullyQualifiedName(decl: Decl, zcu: *Zcu, writer: anytype) !void { | |
| 412 | if (decl.name_fully_qualified) { | |
| 413 | try writer.print("{}", .{decl.name.fmt(&zcu.intern_pool)}); | |
| 414 | } else { | |
| 415 | try zcu.namespacePtr(decl.src_namespace).renderFullyQualifiedName(zcu, decl.name, writer); | |
| 416 | } | |
| 417 | } | |
| 418 | ||
| 419 | pub fn renderFullyQualifiedDebugName(decl: Decl, zcu: *Zcu, writer: anytype) !void { | |
| 420 | return zcu.namespacePtr(decl.src_namespace).renderFullyQualifiedDebugName(zcu, decl.name, writer); | |
| 421 | } | |
| 422 | ||
| 423 | pub fn fullyQualifiedName(decl: Decl, pt: Zcu.PerThread) !InternPool.NullTerminatedString { | |
| 424 | return if (decl.name_fully_qualified) | |
| 425 | decl.name | |
| 426 | else | |
| 427 | pt.zcu.namespacePtr(decl.src_namespace).fullyQualifiedName(pt, decl.name); | |
| 428 | } | |
| 429 | ||
| 430 | 412 | pub fn typeOf(decl: Decl, zcu: *const Zcu) Type { |
| 431 | 413 | assert(decl.has_tv); |
| 432 | 414 | return decl.val.typeOf(zcu); |
| ... | ... | @@ -686,7 +668,7 @@ pub const Namespace = struct { |
| 686 | 668 | if (name != .empty) try writer.print("{c}{}", .{ sep, name.fmt(&zcu.intern_pool) }); |
| 687 | 669 | } |
| 688 | 670 | |
| 689 | pub fn fullyQualifiedName( | |
| 671 | pub fn internFullyQualifiedName( | |
| 690 | 672 | ns: Namespace, |
| 691 | 673 | pt: Zcu.PerThread, |
| 692 | 674 | name: InternPool.NullTerminatedString, |
| ... | ... | @@ -882,7 +864,7 @@ pub const File = struct { |
| 882 | 864 | }; |
| 883 | 865 | } |
| 884 | 866 | |
| 885 | pub fn fullyQualifiedName(file: File, pt: Zcu.PerThread) !InternPool.NullTerminatedString { | |
| 867 | pub fn internFullyQualifiedName(file: File, pt: Zcu.PerThread) !InternPool.NullTerminatedString { | |
| 886 | 868 | const gpa = pt.zcu.gpa; |
| 887 | 869 | const ip = &pt.zcu.intern_pool; |
| 888 | 870 | const strings = ip.getLocal(pt.tid).getMutableStrings(gpa); |
| ... | ... | @@ -3313,22 +3295,6 @@ pub fn errorSetBits(mod: *Module) u16 { |
| 3313 | 3295 | return std.math.log2_int_ceil(ErrorInt, mod.error_limit + 1); // +1 for no error |
| 3314 | 3296 | } |
| 3315 | 3297 | |
| 3316 | pub fn initNewAnonDecl( | |
| 3317 | mod: *Module, | |
| 3318 | new_decl_index: Decl.Index, | |
| 3319 | val: Value, | |
| 3320 | name: InternPool.NullTerminatedString, | |
| 3321 | ) Allocator.Error!void { | |
| 3322 | const new_decl = mod.declPtr(new_decl_index); | |
| 3323 | ||
| 3324 | new_decl.name = name; | |
| 3325 | new_decl.val = val; | |
| 3326 | new_decl.alignment = .none; | |
| 3327 | new_decl.@"linksection" = .none; | |
| 3328 | new_decl.has_tv = true; | |
| 3329 | new_decl.analysis = .complete; | |
| 3330 | } | |
| 3331 | ||
| 3332 | 3298 | pub fn errNote( |
| 3333 | 3299 | mod: *Module, |
| 3334 | 3300 | src_loc: LazySrcLoc, |
src/Zcu/PerThread.zig+37-21| ... | ... | @@ -548,7 +548,7 @@ pub fn ensureDeclAnalyzed(pt: Zcu.PerThread, decl_index: Zcu.Decl.Index) Zcu.Sem |
| 548 | 548 | }; |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | const decl_prog_node = mod.sema_prog_node.start((try decl.fullyQualifiedName(pt)).toSlice(ip), 0); | |
| 551 | const decl_prog_node = mod.sema_prog_node.start(decl.fqn.toSlice(ip), 0); | |
| 552 | 552 | defer decl_prog_node.end(); |
| 553 | 553 | |
| 554 | 554 | break :blk pt.semaDecl(decl_index) catch |err| switch (err) { |
| ... | ... | @@ -747,10 +747,9 @@ pub fn linkerUpdateFunc(pt: Zcu.PerThread, func_index: InternPool.Index, air: Ai |
| 747 | 747 | defer liveness.deinit(gpa); |
| 748 | 748 | |
| 749 | 749 | if (build_options.enable_debug_extensions and comp.verbose_air) { |
| 750 | const fqn = try decl.fullyQualifiedName(pt); | |
| 751 | std.debug.print("# Begin Function AIR: {}:\n", .{fqn.fmt(ip)}); | |
| 750 | std.debug.print("# Begin Function AIR: {}:\n", .{decl.fqn.fmt(ip)}); | |
| 752 | 751 | @import("../print_air.zig").dump(pt, air, liveness); |
| 753 | std.debug.print("# End Function AIR: {}\n\n", .{fqn.fmt(ip)}); | |
| 752 | std.debug.print("# End Function AIR: {}\n\n", .{decl.fqn.fmt(ip)}); | |
| 754 | 753 | } |
| 755 | 754 | |
| 756 | 755 | if (std.debug.runtime_safety) { |
| ... | ... | @@ -781,7 +780,7 @@ pub fn linkerUpdateFunc(pt: Zcu.PerThread, func_index: InternPool.Index, air: Ai |
| 781 | 780 | }; |
| 782 | 781 | } |
| 783 | 782 | |
| 784 | const codegen_prog_node = zcu.codegen_prog_node.start((try decl.fullyQualifiedName(pt)).toSlice(ip), 0); | |
| 783 | const codegen_prog_node = zcu.codegen_prog_node.start(decl.fqn.toSlice(ip), 0); | |
| 785 | 784 | defer codegen_prog_node.end(); |
| 786 | 785 | |
| 787 | 786 | if (!air.typesFullyResolved(zcu)) { |
| ... | ... | @@ -996,8 +995,8 @@ fn semaFile(pt: Zcu.PerThread, file_index: Zcu.File.Index) Zcu.SemaError!void { |
| 996 | 995 | zcu.setFileRootDecl(file_index, new_decl_index.toOptional()); |
| 997 | 996 | zcu.namespacePtr(new_namespace_index).decl_index = new_decl_index; |
| 998 | 997 | |
| 999 | new_decl.name = try file.fullyQualifiedName(pt); | |
| 1000 | new_decl.name_fully_qualified = true; | |
| 998 | new_decl.fqn = try file.internFullyQualifiedName(pt); | |
| 999 | new_decl.name = new_decl.fqn; | |
| 1001 | 1000 | new_decl.is_pub = true; |
| 1002 | 1001 | new_decl.is_exported = false; |
| 1003 | 1002 | new_decl.alignment = .none; |
| ... | ... | @@ -1058,10 +1057,8 @@ fn semaDecl(pt: Zcu.PerThread, decl_index: Zcu.Decl.Index) !Zcu.SemaDeclResult { |
| 1058 | 1057 | } |
| 1059 | 1058 | |
| 1060 | 1059 | log.debug("semaDecl '{d}'", .{@intFromEnum(decl_index)}); |
| 1061 | log.debug("decl name '{}'", .{(try decl.fullyQualifiedName(pt)).fmt(ip)}); | |
| 1062 | defer blk: { | |
| 1063 | log.debug("finish decl name '{}'", .{(decl.fullyQualifiedName(pt) catch break :blk).fmt(ip)}); | |
| 1064 | } | |
| 1060 | log.debug("decl name '{}'", .{decl.fqn.fmt(ip)}); | |
| 1061 | defer log.debug("finish decl name '{}'", .{decl.fqn.fmt(ip)}); | |
| 1065 | 1062 | |
| 1066 | 1063 | const old_has_tv = decl.has_tv; |
| 1067 | 1064 | // The following values are ignored if `!old_has_tv` |
| ... | ... | @@ -1728,6 +1725,7 @@ const ScanDeclIter = struct { |
| 1728 | 1725 | const was_exported = decl.is_exported; |
| 1729 | 1726 | assert(decl.kind == kind); // ZIR tracking should preserve this |
| 1730 | 1727 | decl.name = decl_name; |
| 1728 | decl.fqn = try namespace.internFullyQualifiedName(pt, decl_name); | |
| 1731 | 1729 | decl.is_pub = declaration.flags.is_pub; |
| 1732 | 1730 | decl.is_exported = declaration.flags.is_export; |
| 1733 | 1731 | break :decl_index .{ was_exported, decl_index }; |
| ... | ... | @@ -1737,6 +1735,7 @@ const ScanDeclIter = struct { |
| 1737 | 1735 | const new_decl = zcu.declPtr(new_decl_index); |
| 1738 | 1736 | new_decl.kind = kind; |
| 1739 | 1737 | new_decl.name = decl_name; |
| 1738 | new_decl.fqn = try namespace.internFullyQualifiedName(pt, decl_name); | |
| 1740 | 1739 | new_decl.is_pub = declaration.flags.is_pub; |
| 1741 | 1740 | new_decl.is_exported = declaration.flags.is_export; |
| 1742 | 1741 | new_decl.zir_decl_index = tracked_inst.toOptional(); |
| ... | ... | @@ -1761,10 +1760,9 @@ const ScanDeclIter = struct { |
| 1761 | 1760 | if (!comp.config.is_test) break :a false; |
| 1762 | 1761 | if (decl_mod != zcu.main_mod) break :a false; |
| 1763 | 1762 | if (is_named_test and comp.test_filters.len > 0) { |
| 1764 | const decl_fqn = try namespace.fullyQualifiedName(pt, decl_name); | |
| 1765 | const decl_fqn_slice = decl_fqn.toSlice(ip); | |
| 1763 | const decl_fqn = decl.fqn.toSlice(ip); | |
| 1766 | 1764 | for (comp.test_filters) |test_filter| { |
| 1767 | if (std.mem.indexOf(u8, decl_fqn_slice, test_filter)) |_| break; | |
| 1765 | if (std.mem.indexOf(u8, decl_fqn, test_filter)) |_| break; | |
| 1768 | 1766 | } else break :a false; |
| 1769 | 1767 | } |
| 1770 | 1768 | zcu.test_functions.putAssumeCapacity(decl_index, {}); // may clobber on incremental update |
| ... | ... | @@ -1805,12 +1803,10 @@ pub fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index, arena: All |
| 1805 | 1803 | const decl_index = func.owner_decl; |
| 1806 | 1804 | const decl = mod.declPtr(decl_index); |
| 1807 | 1805 | |
| 1808 | log.debug("func name '{}'", .{(try decl.fullyQualifiedName(pt)).fmt(ip)}); | |
| 1809 | defer blk: { | |
| 1810 | log.debug("finish func name '{}'", .{(decl.fullyQualifiedName(pt) catch break :blk).fmt(ip)}); | |
| 1811 | } | |
| 1806 | log.debug("func name '{}'", .{decl.fqn.fmt(ip)}); | |
| 1807 | defer log.debug("finish func name '{}'", .{decl.fqn.fmt(ip)}); | |
| 1812 | 1808 | |
| 1813 | const decl_prog_node = mod.sema_prog_node.start((try decl.fullyQualifiedName(pt)).toSlice(ip), 0); | |
| 1809 | const decl_prog_node = mod.sema_prog_node.start(decl.fqn.toSlice(ip), 0); | |
| 1814 | 1810 | defer decl_prog_node.end(); |
| 1815 | 1811 | |
| 1816 | 1812 | mod.intern_pool.removeDependenciesForDepender(gpa, InternPool.AnalUnit.wrap(.{ .func = func_index })); |
| ... | ... | @@ -2053,6 +2049,7 @@ pub fn allocateNewDecl(pt: Zcu.PerThread, namespace: Zcu.Namespace.Index) !Zcu.D |
| 2053 | 2049 | const gpa = zcu.gpa; |
| 2054 | 2050 | const decl_index = try zcu.intern_pool.createDecl(gpa, pt.tid, .{ |
| 2055 | 2051 | .name = undefined, |
| 2052 | .fqn = undefined, | |
| 2056 | 2053 | .src_namespace = namespace, |
| 2057 | 2054 | .has_tv = false, |
| 2058 | 2055 | .owns_tv = false, |
| ... | ... | @@ -2077,6 +2074,25 @@ pub fn allocateNewDecl(pt: Zcu.PerThread, namespace: Zcu.Namespace.Index) !Zcu.D |
| 2077 | 2074 | return decl_index; |
| 2078 | 2075 | } |
| 2079 | 2076 | |
| 2077 | pub fn initNewAnonDecl( | |
| 2078 | pt: Zcu.PerThread, | |
| 2079 | new_decl_index: Zcu.Decl.Index, | |
| 2080 | val: Value, | |
| 2081 | name: InternPool.NullTerminatedString, | |
| 2082 | fqn: InternPool.OptionalNullTerminatedString, | |
| 2083 | ) Allocator.Error!void { | |
| 2084 | const new_decl = pt.zcu.declPtr(new_decl_index); | |
| 2085 | ||
| 2086 | new_decl.name = name; | |
| 2087 | new_decl.fqn = fqn.unwrap() orelse | |
| 2088 | try pt.zcu.namespacePtr(new_decl.src_namespace).internFullyQualifiedName(pt, name); | |
| 2089 | new_decl.val = val; | |
| 2090 | new_decl.alignment = .none; | |
| 2091 | new_decl.@"linksection" = .none; | |
| 2092 | new_decl.has_tv = true; | |
| 2093 | new_decl.analysis = .complete; | |
| 2094 | } | |
| 2095 | ||
| 2080 | 2096 | fn lockAndClearFileCompileError(pt: Zcu.PerThread, file: *Zcu.File) void { |
| 2081 | 2097 | switch (file.status) { |
| 2082 | 2098 | .success_zir, .retryable_failure => {}, |
| ... | ... | @@ -2260,7 +2276,7 @@ pub fn populateTestFunctions( |
| 2260 | 2276 | |
| 2261 | 2277 | for (test_fn_vals, zcu.test_functions.keys()) |*test_fn_val, test_decl_index| { |
| 2262 | 2278 | const test_decl = zcu.declPtr(test_decl_index); |
| 2263 | const test_decl_name = try test_decl.fullyQualifiedName(pt); | |
| 2279 | const test_decl_name = test_decl.fqn; | |
| 2264 | 2280 | const test_decl_name_len = test_decl_name.length(ip); |
| 2265 | 2281 | const test_name_anon_decl: InternPool.Key.Ptr.BaseAddr.AnonDecl = n: { |
| 2266 | 2282 | const test_name_ty = try pt.arrayType(.{ |
| ... | ... | @@ -2366,7 +2382,7 @@ pub fn linkerUpdateDecl(pt: Zcu.PerThread, decl_index: Zcu.Decl.Index) !void { |
| 2366 | 2382 | |
| 2367 | 2383 | const decl = zcu.declPtr(decl_index); |
| 2368 | 2384 | |
| 2369 | const codegen_prog_node = zcu.codegen_prog_node.start((try decl.fullyQualifiedName(pt)).toSlice(&zcu.intern_pool), 0); | |
| 2385 | const codegen_prog_node = zcu.codegen_prog_node.start(decl.fqn.toSlice(&zcu.intern_pool), 0); | |
| 2370 | 2386 | defer codegen_prog_node.end(); |
| 2371 | 2387 | |
| 2372 | 2388 | if (comp.bin_file) |lf| { |
src/arch/riscv64/CodeGen.zig+1-1| ... | ... | @@ -933,7 +933,7 @@ fn formatDecl( |
| 933 | 933 | _: std.fmt.FormatOptions, |
| 934 | 934 | writer: anytype, |
| 935 | 935 | ) @TypeOf(writer).Error!void { |
| 936 | try data.mod.declPtr(data.decl_index).renderFullyQualifiedName(data.mod, writer); | |
| 936 | try writer.print("{}", .{data.mod.declPtr(data.decl_index).fqn.fmt(&data.mod.intern_pool)}); | |
| 937 | 937 | } |
| 938 | 938 | fn fmtDecl(func: *Func, decl_index: InternPool.DeclIndex) std.fmt.Formatter(formatDecl) { |
| 939 | 939 | return .{ .data = .{ |
src/arch/wasm/CodeGen.zig+2-2| ... | ... | @@ -7284,8 +7284,8 @@ fn getTagNameFunction(func: *CodeGen, enum_ty: Type) InnerError!u32 { |
| 7284 | 7284 | defer arena_allocator.deinit(); |
| 7285 | 7285 | const arena = arena_allocator.allocator(); |
| 7286 | 7286 | |
| 7287 | const fqn = try mod.declPtr(enum_decl_index).fullyQualifiedName(pt); | |
| 7288 | const func_name = try std.fmt.allocPrintZ(arena, "__zig_tag_name_{}", .{fqn.fmt(ip)}); | |
| 7287 | const decl = mod.declPtr(enum_decl_index); | |
| 7288 | const func_name = try std.fmt.allocPrintZ(arena, "__zig_tag_name_{}", .{decl.fqn.fmt(ip)}); | |
| 7289 | 7289 | |
| 7290 | 7290 | // check if we already generated code for this. |
| 7291 | 7291 | if (func.bin_file.findGlobalSymbol(func_name)) |loc| { |
src/arch/x86_64/CodeGen.zig+1-1| ... | ... | @@ -1077,7 +1077,7 @@ fn formatDecl( |
| 1077 | 1077 | _: std.fmt.FormatOptions, |
| 1078 | 1078 | writer: anytype, |
| 1079 | 1079 | ) @TypeOf(writer).Error!void { |
| 1080 | try data.zcu.declPtr(data.decl_index).renderFullyQualifiedName(data.zcu, writer); | |
| 1080 | try writer.print("{}", .{data.zcu.declPtr(data.decl_index).fqn.fmt(&data.zcu.intern_pool)}); | |
| 1081 | 1081 | } |
| 1082 | 1082 | fn fmtDecl(self: *Self, decl_index: InternPool.DeclIndex) std.fmt.Formatter(formatDecl) { |
| 1083 | 1083 | return .{ .data = .{ |
src/codegen/c.zig+6-14| ... | ... | @@ -2194,13 +2194,9 @@ pub const DeclGen = struct { |
| 2194 | 2194 | }) else { |
| 2195 | 2195 | // MSVC has a limit of 4095 character token length limit, and fmtIdent can (worst case), |
| 2196 | 2196 | // expand to 3x the length of its input, but let's cut it off at a much shorter limit. |
| 2197 | var name: [100]u8 = undefined; | |
| 2198 | var name_stream = std.io.fixedBufferStream(&name); | |
| 2199 | decl.renderFullyQualifiedName(zcu, name_stream.writer()) catch |err| switch (err) { | |
| 2200 | error.NoSpaceLeft => {}, | |
| 2201 | }; | |
| 2197 | const fqn_slice = decl.fqn.toSlice(ip); | |
| 2202 | 2198 | try writer.print("{}__{d}", .{ |
| 2203 | fmtIdent(name_stream.getWritten()), | |
| 2199 | fmtIdent(fqn_slice[0..@min(fqn_slice.len, 100)]), | |
| 2204 | 2200 | @intFromEnum(decl_index), |
| 2205 | 2201 | }); |
| 2206 | 2202 | } |
| ... | ... | @@ -2587,11 +2583,9 @@ pub fn genTypeDecl( |
| 2587 | 2583 | try writer.writeByte(';'); |
| 2588 | 2584 | const owner_decl = zcu.declPtr(owner_decl_index); |
| 2589 | 2585 | const owner_mod = zcu.namespacePtr(owner_decl.src_namespace).fileScope(zcu).mod; |
| 2590 | if (!owner_mod.strip) { | |
| 2591 | try writer.writeAll(" /* "); | |
| 2592 | try owner_decl.renderFullyQualifiedName(zcu, writer); | |
| 2593 | try writer.writeAll(" */"); | |
| 2594 | } | |
| 2586 | if (!owner_mod.strip) try writer.print(" /* {} */", .{ | |
| 2587 | owner_decl.fqn.fmt(&zcu.intern_pool), | |
| 2588 | }); | |
| 2595 | 2589 | try writer.writeByte('\n'); |
| 2596 | 2590 | }, |
| 2597 | 2591 | }, |
| ... | ... | @@ -4563,9 +4557,7 @@ fn airDbgInlineBlock(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4563 | 4557 | const extra = f.air.extraData(Air.DbgInlineBlock, ty_pl.payload); |
| 4564 | 4558 | const owner_decl = zcu.funcOwnerDeclPtr(extra.data.func); |
| 4565 | 4559 | const writer = f.object.writer(); |
| 4566 | try writer.writeAll("/* inline:"); | |
| 4567 | try owner_decl.renderFullyQualifiedName(zcu, writer); | |
| 4568 | try writer.writeAll(" */\n"); | |
| 4560 | try writer.print("/* inline:{} */\n", .{owner_decl.fqn.fmt(&zcu.intern_pool)}); | |
| 4569 | 4561 | return lowerBlock(f, inst, @ptrCast(f.air.extra[extra.end..][0..extra.data.body_len])); |
| 4570 | 4562 | } |
| 4571 | 4563 |
src/codegen/llvm.zig+17-24| ... | ... | @@ -1744,7 +1744,7 @@ pub const Object = struct { |
| 1744 | 1744 | if (export_indices.len != 0) { |
| 1745 | 1745 | return updateExportedGlobal(self, zcu, global_index, export_indices); |
| 1746 | 1746 | } else { |
| 1747 | const fqn = try self.builder.strtabString((try decl.fullyQualifiedName(pt)).toSlice(ip)); | |
| 1747 | const fqn = try self.builder.strtabString(decl.fqn.toSlice(ip)); | |
| 1748 | 1748 | try global_index.rename(fqn, &self.builder); |
| 1749 | 1749 | global_index.setLinkage(.internal, &self.builder); |
| 1750 | 1750 | if (comp.config.dll_export_fns) |
| ... | ... | @@ -2863,10 +2863,7 @@ pub const Object = struct { |
| 2863 | 2863 | const is_extern = decl.isExtern(zcu); |
| 2864 | 2864 | const function_index = try o.builder.addFunction( |
| 2865 | 2865 | try o.lowerType(zig_fn_type), |
| 2866 | try o.builder.strtabString((if (is_extern) | |
| 2867 | decl.name | |
| 2868 | else | |
| 2869 | try decl.fullyQualifiedName(pt)).toSlice(ip)), | |
| 2866 | try o.builder.strtabString((if (is_extern) decl.name else decl.fqn).toSlice(ip)), | |
| 2870 | 2867 | toLlvmAddressSpace(decl.@"addrspace", target), |
| 2871 | 2868 | ); |
| 2872 | 2869 | gop.value_ptr.* = function_index.ptrConst(&o.builder).global; |
| ... | ... | @@ -3077,14 +3074,12 @@ pub const Object = struct { |
| 3077 | 3074 | |
| 3078 | 3075 | const pt = o.pt; |
| 3079 | 3076 | const zcu = pt.zcu; |
| 3077 | const ip = &zcu.intern_pool; | |
| 3080 | 3078 | const decl = zcu.declPtr(decl_index); |
| 3081 | 3079 | const is_extern = decl.isExtern(zcu); |
| 3082 | 3080 | |
| 3083 | 3081 | const variable_index = try o.builder.addVariable( |
| 3084 | try o.builder.strtabString((if (is_extern) | |
| 3085 | decl.name | |
| 3086 | else | |
| 3087 | try decl.fullyQualifiedName(pt)).toSlice(&zcu.intern_pool)), | |
| 3082 | try o.builder.strtabString((if (is_extern) decl.name else decl.fqn).toSlice(ip)), | |
| 3088 | 3083 | try o.lowerType(decl.typeOf(zcu)), |
| 3089 | 3084 | toLlvmGlobalAddressSpace(decl.@"addrspace", zcu.getTarget()), |
| 3090 | 3085 | ); |
| ... | ... | @@ -3312,7 +3307,7 @@ pub const Object = struct { |
| 3312 | 3307 | return int_ty; |
| 3313 | 3308 | } |
| 3314 | 3309 | |
| 3315 | const fqn = try mod.declPtr(struct_type.decl.unwrap().?).fullyQualifiedName(pt); | |
| 3310 | const decl = mod.declPtr(struct_type.decl.unwrap().?); | |
| 3316 | 3311 | |
| 3317 | 3312 | var llvm_field_types = std.ArrayListUnmanaged(Builder.Type){}; |
| 3318 | 3313 | defer llvm_field_types.deinit(o.gpa); |
| ... | ... | @@ -3377,7 +3372,7 @@ pub const Object = struct { |
| 3377 | 3372 | ); |
| 3378 | 3373 | } |
| 3379 | 3374 | |
| 3380 | const ty = try o.builder.opaqueType(try o.builder.string(fqn.toSlice(ip))); | |
| 3375 | const ty = try o.builder.opaqueType(try o.builder.string(decl.fqn.toSlice(ip))); | |
| 3381 | 3376 | try o.type_map.put(o.gpa, t.toIntern(), ty); |
| 3382 | 3377 | |
| 3383 | 3378 | o.builder.namedTypeSetBody( |
| ... | ... | @@ -3466,7 +3461,7 @@ pub const Object = struct { |
| 3466 | 3461 | return enum_tag_ty; |
| 3467 | 3462 | } |
| 3468 | 3463 | |
| 3469 | const fqn = try mod.declPtr(union_obj.decl).fullyQualifiedName(pt); | |
| 3464 | const decl = mod.declPtr(union_obj.decl); | |
| 3470 | 3465 | |
| 3471 | 3466 | const aligned_field_ty = Type.fromInterned(union_obj.field_types.get(ip)[layout.most_aligned_field]); |
| 3472 | 3467 | const aligned_field_llvm_ty = try o.lowerType(aligned_field_ty); |
| ... | ... | @@ -3486,7 +3481,7 @@ pub const Object = struct { |
| 3486 | 3481 | }; |
| 3487 | 3482 | |
| 3488 | 3483 | if (layout.tag_size == 0) { |
| 3489 | const ty = try o.builder.opaqueType(try o.builder.string(fqn.toSlice(ip))); | |
| 3484 | const ty = try o.builder.opaqueType(try o.builder.string(decl.fqn.toSlice(ip))); | |
| 3490 | 3485 | try o.type_map.put(o.gpa, t.toIntern(), ty); |
| 3491 | 3486 | |
| 3492 | 3487 | o.builder.namedTypeSetBody( |
| ... | ... | @@ -3514,7 +3509,7 @@ pub const Object = struct { |
| 3514 | 3509 | llvm_fields_len += 1; |
| 3515 | 3510 | } |
| 3516 | 3511 | |
| 3517 | const ty = try o.builder.opaqueType(try o.builder.string(fqn.toSlice(ip))); | |
| 3512 | const ty = try o.builder.opaqueType(try o.builder.string(decl.fqn.toSlice(ip))); | |
| 3518 | 3513 | try o.type_map.put(o.gpa, t.toIntern(), ty); |
| 3519 | 3514 | |
| 3520 | 3515 | o.builder.namedTypeSetBody( |
| ... | ... | @@ -3527,8 +3522,7 @@ pub const Object = struct { |
| 3527 | 3522 | const gop = try o.type_map.getOrPut(o.gpa, t.toIntern()); |
| 3528 | 3523 | if (!gop.found_existing) { |
| 3529 | 3524 | const decl = mod.declPtr(ip.loadOpaqueType(t.toIntern()).decl); |
| 3530 | const fqn = try decl.fullyQualifiedName(pt); | |
| 3531 | gop.value_ptr.* = try o.builder.opaqueType(try o.builder.string(fqn.toSlice(ip))); | |
| 3525 | gop.value_ptr.* = try o.builder.opaqueType(try o.builder.string(decl.fqn.toSlice(ip))); | |
| 3532 | 3526 | } |
| 3533 | 3527 | return gop.value_ptr.*; |
| 3534 | 3528 | }, |
| ... | ... | @@ -4587,11 +4581,11 @@ pub const Object = struct { |
| 4587 | 4581 | |
| 4588 | 4582 | const usize_ty = try o.lowerType(Type.usize); |
| 4589 | 4583 | const ret_ty = try o.lowerType(Type.slice_const_u8_sentinel_0); |
| 4590 | const fqn = try zcu.declPtr(enum_type.decl).fullyQualifiedName(pt); | |
| 4584 | const decl = zcu.declPtr(enum_type.decl); | |
| 4591 | 4585 | const target = zcu.root_mod.resolved_target.result; |
| 4592 | 4586 | const function_index = try o.builder.addFunction( |
| 4593 | 4587 | try o.builder.fnType(ret_ty, &.{try o.lowerType(Type.fromInterned(enum_type.tag_ty))}, .normal), |
| 4594 | try o.builder.strtabStringFmt("__zig_tag_name_{}", .{fqn.fmt(ip)}), | |
| 4588 | try o.builder.strtabStringFmt("__zig_tag_name_{}", .{decl.fqn.fmt(ip)}), | |
| 4595 | 4589 | toLlvmAddressSpace(.generic, target), |
| 4596 | 4590 | ); |
| 4597 | 4591 | |
| ... | ... | @@ -5175,8 +5169,6 @@ pub const FuncGen = struct { |
| 5175 | 5169 | const line_number = decl.navSrcLine(zcu) + 1; |
| 5176 | 5170 | self.inlined = self.wip.debug_location; |
| 5177 | 5171 | |
| 5178 | const fqn = try decl.fullyQualifiedName(pt); | |
| 5179 | ||
| 5180 | 5172 | const fn_ty = try pt.funcType(.{ |
| 5181 | 5173 | .param_types = &.{}, |
| 5182 | 5174 | .return_type = .void_type, |
| ... | ... | @@ -5185,7 +5177,7 @@ pub const FuncGen = struct { |
| 5185 | 5177 | self.scope = try o.builder.debugSubprogram( |
| 5186 | 5178 | self.file, |
| 5187 | 5179 | try o.builder.metadataString(decl.name.toSlice(&zcu.intern_pool)), |
| 5188 | try o.builder.metadataString(fqn.toSlice(&zcu.intern_pool)), | |
| 5180 | try o.builder.metadataString(decl.fqn.toSlice(&zcu.intern_pool)), | |
| 5189 | 5181 | line_number, |
| 5190 | 5182 | line_number + func.lbrace_line, |
| 5191 | 5183 | try o.lowerDebugType(fn_ty), |
| ... | ... | @@ -9702,18 +9694,19 @@ pub const FuncGen = struct { |
| 9702 | 9694 | const o = self.dg.object; |
| 9703 | 9695 | const pt = o.pt; |
| 9704 | 9696 | const zcu = pt.zcu; |
| 9705 | const enum_type = zcu.intern_pool.loadEnumType(enum_ty.toIntern()); | |
| 9697 | const ip = &zcu.intern_pool; | |
| 9698 | const enum_type = ip.loadEnumType(enum_ty.toIntern()); | |
| 9706 | 9699 | |
| 9707 | 9700 | // TODO: detect when the type changes and re-emit this function. |
| 9708 | 9701 | const gop = try o.named_enum_map.getOrPut(o.gpa, enum_type.decl); |
| 9709 | 9702 | if (gop.found_existing) return gop.value_ptr.*; |
| 9710 | 9703 | errdefer assert(o.named_enum_map.remove(enum_type.decl)); |
| 9711 | 9704 | |
| 9712 | const fqn = try zcu.declPtr(enum_type.decl).fullyQualifiedName(pt); | |
| 9705 | const decl = zcu.declPtr(enum_type.decl); | |
| 9713 | 9706 | const target = zcu.root_mod.resolved_target.result; |
| 9714 | 9707 | const function_index = try o.builder.addFunction( |
| 9715 | 9708 | try o.builder.fnType(.i1, &.{try o.lowerType(Type.fromInterned(enum_type.tag_ty))}, .normal), |
| 9716 | try o.builder.strtabStringFmt("__zig_is_named_enum_value_{}", .{fqn.fmt(&zcu.intern_pool)}), | |
| 9709 | try o.builder.strtabStringFmt("__zig_is_named_enum_value_{}", .{decl.fqn.fmt(ip)}), | |
| 9717 | 9710 | toLlvmAddressSpace(.generic, target), |
| 9718 | 9711 | ); |
| 9719 | 9712 |
src/codegen/spirv.zig+4-7| ... | ... | @@ -3012,12 +3012,11 @@ const DeclGen = struct { |
| 3012 | 3012 | // Append the actual code into the functions section. |
| 3013 | 3013 | try self.spv.addFunction(spv_decl_index, self.func); |
| 3014 | 3014 | |
| 3015 | const fqn = try decl.fullyQualifiedName(self.pt); | |
| 3016 | try self.spv.debugName(result_id, fqn.toSlice(ip)); | |
| 3015 | try self.spv.debugName(result_id, decl.fqn.toSlice(ip)); | |
| 3017 | 3016 | |
| 3018 | 3017 | // Temporarily generate a test kernel declaration if this is a test function. |
| 3019 | 3018 | if (self.pt.zcu.test_functions.contains(self.decl_index)) { |
| 3020 | try self.generateTestEntryPoint(fqn.toSlice(ip), spv_decl_index); | |
| 3019 | try self.generateTestEntryPoint(decl.fqn.toSlice(ip), spv_decl_index); | |
| 3021 | 3020 | } |
| 3022 | 3021 | }, |
| 3023 | 3022 | .global => { |
| ... | ... | @@ -3041,8 +3040,7 @@ const DeclGen = struct { |
| 3041 | 3040 | .storage_class = final_storage_class, |
| 3042 | 3041 | }); |
| 3043 | 3042 | |
| 3044 | const fqn = try decl.fullyQualifiedName(self.pt); | |
| 3045 | try self.spv.debugName(result_id, fqn.toSlice(ip)); | |
| 3043 | try self.spv.debugName(result_id, decl.fqn.toSlice(ip)); | |
| 3046 | 3044 | try self.spv.declareDeclDeps(spv_decl_index, &.{}); |
| 3047 | 3045 | }, |
| 3048 | 3046 | .invocation_global => { |
| ... | ... | @@ -3086,8 +3084,7 @@ const DeclGen = struct { |
| 3086 | 3084 | try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); |
| 3087 | 3085 | try self.spv.addFunction(spv_decl_index, self.func); |
| 3088 | 3086 | |
| 3089 | const fqn = try decl.fullyQualifiedName(self.pt); | |
| 3090 | try self.spv.debugNameFmt(initializer_id, "initializer of {}", .{fqn.fmt(ip)}); | |
| 3087 | try self.spv.debugNameFmt(initializer_id, "initializer of {}", .{decl.fqn.fmt(ip)}); | |
| 3091 | 3088 | |
| 3092 | 3089 | try self.spv.sections.types_globals_constants.emit(self.spv.gpa, .OpExtInst, .{ |
| 3093 | 3090 | .id_result_type = ptr_ty_id, |
src/link/Coff.zig+8-9| ... | ... | @@ -1176,9 +1176,10 @@ pub fn lowerUnnamedConst(self: *Coff, pt: Zcu.PerThread, val: Value, decl_index: |
| 1176 | 1176 | gop.value_ptr.* = .{}; |
| 1177 | 1177 | } |
| 1178 | 1178 | const unnamed_consts = gop.value_ptr; |
| 1179 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 1180 | 1179 | const index = unnamed_consts.items.len; |
| 1181 | const sym_name = try std.fmt.allocPrint(gpa, "__unnamed_{}_{d}", .{ decl_name.fmt(&mod.intern_pool), index }); | |
| 1180 | const sym_name = try std.fmt.allocPrint(gpa, "__unnamed_{}_{d}", .{ | |
| 1181 | decl.fqn.fmt(&mod.intern_pool), index, | |
| 1182 | }); | |
| 1182 | 1183 | defer gpa.free(sym_name); |
| 1183 | 1184 | const ty = val.typeOf(mod); |
| 1184 | 1185 | const atom_index = switch (try self.lowerConst(pt, sym_name, val, ty.abiAlignment(pt), self.rdata_section_index.?, decl.navSrcLoc(mod))) { |
| ... | ... | @@ -1427,9 +1428,7 @@ fn updateDeclCode(self: *Coff, pt: Zcu.PerThread, decl_index: InternPool.DeclInd |
| 1427 | 1428 | const mod = pt.zcu; |
| 1428 | 1429 | const decl = mod.declPtr(decl_index); |
| 1429 | 1430 | |
| 1430 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 1431 | ||
| 1432 | log.debug("updateDeclCode {}{*}", .{ decl_name.fmt(&mod.intern_pool), decl }); | |
| 1431 | log.debug("updateDeclCode {}{*}", .{ decl.fqn.fmt(&mod.intern_pool), decl }); | |
| 1433 | 1432 | const required_alignment: u32 = @intCast(decl.getAlignment(pt).toByteUnits() orelse 0); |
| 1434 | 1433 | |
| 1435 | 1434 | const decl_metadata = self.decls.get(decl_index).?; |
| ... | ... | @@ -1441,7 +1440,7 @@ fn updateDeclCode(self: *Coff, pt: Zcu.PerThread, decl_index: InternPool.DeclInd |
| 1441 | 1440 | |
| 1442 | 1441 | if (atom.size != 0) { |
| 1443 | 1442 | const sym = atom.getSymbolPtr(self); |
| 1444 | try self.setSymbolName(sym, decl_name.toSlice(&mod.intern_pool)); | |
| 1443 | try self.setSymbolName(sym, decl.fqn.toSlice(&mod.intern_pool)); | |
| 1445 | 1444 | sym.section_number = @as(coff.SectionNumber, @enumFromInt(sect_index + 1)); |
| 1446 | 1445 | sym.type = .{ .complex_type = complex_type, .base_type = .NULL }; |
| 1447 | 1446 | |
| ... | ... | @@ -1449,7 +1448,7 @@ fn updateDeclCode(self: *Coff, pt: Zcu.PerThread, decl_index: InternPool.DeclInd |
| 1449 | 1448 | const need_realloc = code.len > capacity or !mem.isAlignedGeneric(u64, sym.value, required_alignment); |
| 1450 | 1449 | if (need_realloc) { |
| 1451 | 1450 | const vaddr = try self.growAtom(atom_index, code_len, required_alignment); |
| 1452 | log.debug("growing {} from 0x{x} to 0x{x}", .{ decl_name.fmt(&mod.intern_pool), sym.value, vaddr }); | |
| 1451 | log.debug("growing {} from 0x{x} to 0x{x}", .{ decl.fqn.fmt(&mod.intern_pool), sym.value, vaddr }); | |
| 1453 | 1452 | log.debug(" (required alignment 0x{x}", .{required_alignment}); |
| 1454 | 1453 | |
| 1455 | 1454 | if (vaddr != sym.value) { |
| ... | ... | @@ -1465,13 +1464,13 @@ fn updateDeclCode(self: *Coff, pt: Zcu.PerThread, decl_index: InternPool.DeclInd |
| 1465 | 1464 | self.getAtomPtr(atom_index).size = code_len; |
| 1466 | 1465 | } else { |
| 1467 | 1466 | const sym = atom.getSymbolPtr(self); |
| 1468 | try self.setSymbolName(sym, decl_name.toSlice(&mod.intern_pool)); | |
| 1467 | try self.setSymbolName(sym, decl.fqn.toSlice(&mod.intern_pool)); | |
| 1469 | 1468 | sym.section_number = @as(coff.SectionNumber, @enumFromInt(sect_index + 1)); |
| 1470 | 1469 | sym.type = .{ .complex_type = complex_type, .base_type = .NULL }; |
| 1471 | 1470 | |
| 1472 | 1471 | const vaddr = try self.allocateAtom(atom_index, code_len, required_alignment); |
| 1473 | 1472 | errdefer self.freeAtom(atom_index); |
| 1474 | log.debug("allocated atom for {} at 0x{x}", .{ decl_name.fmt(&mod.intern_pool), vaddr }); | |
| 1473 | log.debug("allocated atom for {} at 0x{x}", .{ decl.fqn.fmt(&mod.intern_pool), vaddr }); | |
| 1475 | 1474 | self.getAtomPtr(atom_index).size = code_len; |
| 1476 | 1475 | sym.value = vaddr; |
| 1477 | 1476 |
src/link/Dwarf.zig+2-4| ... | ... | @@ -1082,9 +1082,7 @@ pub fn initDeclState(self: *Dwarf, pt: Zcu.PerThread, decl_index: InternPool.Dec |
| 1082 | 1082 | defer tracy.end(); |
| 1083 | 1083 | |
| 1084 | 1084 | const decl = pt.zcu.declPtr(decl_index); |
| 1085 | const decl_linkage_name = try decl.fullyQualifiedName(pt); | |
| 1086 | ||
| 1087 | log.debug("initDeclState {}{*}", .{ decl_linkage_name.fmt(&pt.zcu.intern_pool), decl }); | |
| 1085 | log.debug("initDeclState {}{*}", .{ decl.fqn.fmt(&pt.zcu.intern_pool), decl }); | |
| 1088 | 1086 | |
| 1089 | 1087 | const gpa = self.allocator; |
| 1090 | 1088 | var decl_state: DeclState = .{ |
| ... | ... | @@ -1157,7 +1155,7 @@ pub fn initDeclState(self: *Dwarf, pt: Zcu.PerThread, decl_index: InternPool.Dec |
| 1157 | 1155 | |
| 1158 | 1156 | // .debug_info subprogram |
| 1159 | 1157 | const decl_name_slice = decl.name.toSlice(&pt.zcu.intern_pool); |
| 1160 | const decl_linkage_name_slice = decl_linkage_name.toSlice(&pt.zcu.intern_pool); | |
| 1158 | const decl_linkage_name_slice = decl.fqn.toSlice(&pt.zcu.intern_pool); | |
| 1161 | 1159 | try dbg_info_buffer.ensureUnusedCapacity(1 + ptr_width_bytes + 4 + 4 + |
| 1162 | 1160 | (decl_name_slice.len + 1) + (decl_linkage_name_slice.len + 1)); |
| 1163 | 1161 |
src/link/Elf/ZigObject.zig+9-11| ... | ... | @@ -907,10 +907,10 @@ fn updateDeclCode( |
| 907 | 907 | ) !void { |
| 908 | 908 | const gpa = elf_file.base.comp.gpa; |
| 909 | 909 | const mod = pt.zcu; |
| 910 | const ip = &mod.intern_pool; | |
| 910 | 911 | const decl = mod.declPtr(decl_index); |
| 911 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 912 | 912 | |
| 913 | log.debug("updateDeclCode {}{*}", .{ decl_name.fmt(&mod.intern_pool), decl }); | |
| 913 | log.debug("updateDeclCode {}{*}", .{ decl.fqn.fmt(ip), decl }); | |
| 914 | 914 | |
| 915 | 915 | const required_alignment = decl.getAlignment(pt).max( |
| 916 | 916 | target_util.minFunctionAlignment(mod.getTarget()), |
| ... | ... | @@ -923,7 +923,7 @@ fn updateDeclCode( |
| 923 | 923 | sym.output_section_index = shdr_index; |
| 924 | 924 | atom_ptr.output_section_index = shdr_index; |
| 925 | 925 | |
| 926 | sym.name_offset = try self.strtab.insert(gpa, decl_name.toSlice(&mod.intern_pool)); | |
| 926 | sym.name_offset = try self.strtab.insert(gpa, decl.fqn.toSlice(ip)); | |
| 927 | 927 | atom_ptr.flags.alive = true; |
| 928 | 928 | atom_ptr.name_offset = sym.name_offset; |
| 929 | 929 | esym.st_name = sym.name_offset; |
| ... | ... | @@ -940,7 +940,7 @@ fn updateDeclCode( |
| 940 | 940 | const need_realloc = code.len > capacity or !required_alignment.check(@intCast(atom_ptr.value)); |
| 941 | 941 | if (need_realloc) { |
| 942 | 942 | try atom_ptr.grow(elf_file); |
| 943 | log.debug("growing {} from 0x{x} to 0x{x}", .{ decl_name.fmt(&mod.intern_pool), old_vaddr, atom_ptr.value }); | |
| 943 | log.debug("growing {} from 0x{x} to 0x{x}", .{ decl.fqn.fmt(ip), old_vaddr, atom_ptr.value }); | |
| 944 | 944 | if (old_vaddr != atom_ptr.value) { |
| 945 | 945 | sym.value = 0; |
| 946 | 946 | esym.st_value = 0; |
| ... | ... | @@ -1007,11 +1007,11 @@ fn updateTlv( |
| 1007 | 1007 | code: []const u8, |
| 1008 | 1008 | ) !void { |
| 1009 | 1009 | const mod = pt.zcu; |
| 1010 | const ip = &mod.intern_pool; | |
| 1010 | 1011 | const gpa = mod.gpa; |
| 1011 | 1012 | const decl = mod.declPtr(decl_index); |
| 1012 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 1013 | 1013 | |
| 1014 | log.debug("updateTlv {} ({*})", .{ decl_name.fmt(&mod.intern_pool), decl }); | |
| 1014 | log.debug("updateTlv {} ({*})", .{ decl.fqn.fmt(ip), decl }); | |
| 1015 | 1015 | |
| 1016 | 1016 | const required_alignment = decl.getAlignment(pt); |
| 1017 | 1017 | |
| ... | ... | @@ -1023,7 +1023,7 @@ fn updateTlv( |
| 1023 | 1023 | sym.output_section_index = shndx; |
| 1024 | 1024 | atom_ptr.output_section_index = shndx; |
| 1025 | 1025 | |
| 1026 | sym.name_offset = try self.strtab.insert(gpa, decl_name.toSlice(&mod.intern_pool)); | |
| 1026 | sym.name_offset = try self.strtab.insert(gpa, decl.fqn.toSlice(ip)); | |
| 1027 | 1027 | atom_ptr.flags.alive = true; |
| 1028 | 1028 | atom_ptr.name_offset = sym.name_offset; |
| 1029 | 1029 | esym.st_value = 0; |
| ... | ... | @@ -1286,9 +1286,8 @@ pub fn lowerUnnamedConst( |
| 1286 | 1286 | } |
| 1287 | 1287 | const unnamed_consts = gop.value_ptr; |
| 1288 | 1288 | const decl = mod.declPtr(decl_index); |
| 1289 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 1290 | 1289 | const index = unnamed_consts.items.len; |
| 1291 | const name = try std.fmt.allocPrint(gpa, "__unnamed_{}_{d}", .{ decl_name.fmt(&mod.intern_pool), index }); | |
| 1290 | const name = try std.fmt.allocPrint(gpa, "__unnamed_{}_{d}", .{ decl.fqn.fmt(&mod.intern_pool), index }); | |
| 1292 | 1291 | defer gpa.free(name); |
| 1293 | 1292 | const ty = val.typeOf(mod); |
| 1294 | 1293 | const sym_index = switch (try self.lowerConst( |
| ... | ... | @@ -1473,9 +1472,8 @@ pub fn updateDeclLineNumber( |
| 1473 | 1472 | defer tracy.end(); |
| 1474 | 1473 | |
| 1475 | 1474 | const decl = pt.zcu.declPtr(decl_index); |
| 1476 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 1477 | 1475 | |
| 1478 | log.debug("updateDeclLineNumber {}{*}", .{ decl_name.fmt(&pt.zcu.intern_pool), decl }); | |
| 1476 | log.debug("updateDeclLineNumber {}{*}", .{ decl.fqn.fmt(&pt.zcu.intern_pool), decl }); | |
| 1479 | 1477 | |
| 1480 | 1478 | if (self.dwarf) |*dw| { |
| 1481 | 1479 | try dw.updateDeclLineNumber(pt.zcu, decl_index); |
src/link/MachO/ZigObject.zig+10-14| ... | ... | @@ -809,10 +809,10 @@ fn updateDeclCode( |
| 809 | 809 | ) !void { |
| 810 | 810 | const gpa = macho_file.base.comp.gpa; |
| 811 | 811 | const mod = pt.zcu; |
| 812 | const ip = &mod.intern_pool; | |
| 812 | 813 | const decl = mod.declPtr(decl_index); |
| 813 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 814 | 814 | |
| 815 | log.debug("updateDeclCode {}{*}", .{ decl_name.fmt(&mod.intern_pool), decl }); | |
| 815 | log.debug("updateDeclCode {}{*}", .{ decl.fqn.fmt(ip), decl }); | |
| 816 | 816 | |
| 817 | 817 | const required_alignment = decl.getAlignment(pt); |
| 818 | 818 | |
| ... | ... | @@ -824,7 +824,7 @@ fn updateDeclCode( |
| 824 | 824 | sym.out_n_sect = sect_index; |
| 825 | 825 | atom.out_n_sect = sect_index; |
| 826 | 826 | |
| 827 | sym.name = try self.strtab.insert(gpa, decl_name.toSlice(&mod.intern_pool)); | |
| 827 | sym.name = try self.strtab.insert(gpa, decl.fqn.toSlice(ip)); | |
| 828 | 828 | atom.flags.alive = true; |
| 829 | 829 | atom.name = sym.name; |
| 830 | 830 | nlist.n_strx = sym.name; |
| ... | ... | @@ -843,7 +843,7 @@ fn updateDeclCode( |
| 843 | 843 | |
| 844 | 844 | if (need_realloc) { |
| 845 | 845 | try atom.grow(macho_file); |
| 846 | log.debug("growing {} from 0x{x} to 0x{x}", .{ decl_name.fmt(&mod.intern_pool), old_vaddr, atom.value }); | |
| 846 | log.debug("growing {} from 0x{x} to 0x{x}", .{ decl.fqn.fmt(ip), old_vaddr, atom.value }); | |
| 847 | 847 | if (old_vaddr != atom.value) { |
| 848 | 848 | sym.value = 0; |
| 849 | 849 | nlist.n_value = 0; |
| ... | ... | @@ -893,25 +893,22 @@ fn updateTlv( |
| 893 | 893 | sect_index: u8, |
| 894 | 894 | code: []const u8, |
| 895 | 895 | ) !void { |
| 896 | const ip = &pt.zcu.intern_pool; | |
| 896 | 897 | const decl = pt.zcu.declPtr(decl_index); |
| 897 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 898 | 898 | |
| 899 | log.debug("updateTlv {} ({*})", .{ decl_name.fmt(&pt.zcu.intern_pool), decl }); | |
| 900 | ||
| 901 | const decl_name_slice = decl_name.toSlice(&pt.zcu.intern_pool); | |
| 902 | const required_alignment = decl.getAlignment(pt); | |
| 899 | log.debug("updateTlv {} ({*})", .{ decl.fqn.fmt(&pt.zcu.intern_pool), decl }); | |
| 903 | 900 | |
| 904 | 901 | // 1. Lower TLV initializer |
| 905 | 902 | const init_sym_index = try self.createTlvInitializer( |
| 906 | 903 | macho_file, |
| 907 | decl_name_slice, | |
| 908 | required_alignment, | |
| 904 | decl.fqn.toSlice(ip), | |
| 905 | decl.getAlignment(pt), | |
| 909 | 906 | sect_index, |
| 910 | 907 | code, |
| 911 | 908 | ); |
| 912 | 909 | |
| 913 | 910 | // 2. Create TLV descriptor |
| 914 | try self.createTlvDescriptor(macho_file, sym_index, init_sym_index, decl_name_slice); | |
| 911 | try self.createTlvDescriptor(macho_file, sym_index, init_sym_index, decl.fqn.toSlice(ip)); | |
| 915 | 912 | } |
| 916 | 913 | |
| 917 | 914 | fn createTlvInitializer( |
| ... | ... | @@ -1099,9 +1096,8 @@ pub fn lowerUnnamedConst( |
| 1099 | 1096 | } |
| 1100 | 1097 | const unnamed_consts = gop.value_ptr; |
| 1101 | 1098 | const decl = mod.declPtr(decl_index); |
| 1102 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 1103 | 1099 | const index = unnamed_consts.items.len; |
| 1104 | const name = try std.fmt.allocPrint(gpa, "__unnamed_{}_{d}", .{ decl_name.fmt(&mod.intern_pool), index }); | |
| 1100 | const name = try std.fmt.allocPrint(gpa, "__unnamed_{}_{d}", .{ decl.fqn.fmt(&mod.intern_pool), index }); | |
| 1105 | 1101 | defer gpa.free(name); |
| 1106 | 1102 | const sym_index = switch (try self.lowerConst( |
| 1107 | 1103 | macho_file, |
src/link/Plan9.zig+1-3| ... | ... | @@ -483,11 +483,9 @@ pub fn lowerUnnamedConst(self: *Plan9, pt: Zcu.PerThread, val: Value, decl_index |
| 483 | 483 | } |
| 484 | 484 | const unnamed_consts = gop.value_ptr; |
| 485 | 485 | |
| 486 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 487 | ||
| 488 | 486 | const index = unnamed_consts.items.len; |
| 489 | 487 | // name is freed when the unnamed const is freed |
| 490 | const name = try std.fmt.allocPrint(gpa, "__unnamed_{}_{d}", .{ decl_name.fmt(&mod.intern_pool), index }); | |
| 488 | const name = try std.fmt.allocPrint(gpa, "__unnamed_{}_{d}", .{ decl.fqn.fmt(&mod.intern_pool), index }); | |
| 491 | 489 | |
| 492 | 490 | const sym_index = try self.allocateSymbolIndex(); |
| 493 | 491 | const new_atom_idx = try self.createAtom(); |
src/link/Wasm/ZigObject.zig+5-10| ... | ... | @@ -346,8 +346,7 @@ fn finishUpdateDecl( |
| 346 | 346 | const atom_index = decl_info.atom; |
| 347 | 347 | const atom = wasm_file.getAtomPtr(atom_index); |
| 348 | 348 | const sym = zig_object.symbol(atom.sym_index); |
| 349 | const full_name = try decl.fullyQualifiedName(pt); | |
| 350 | sym.name = try zig_object.string_table.insert(gpa, full_name.toSlice(ip)); | |
| 349 | sym.name = try zig_object.string_table.insert(gpa, decl.fqn.toSlice(ip)); | |
| 351 | 350 | try atom.code.appendSlice(gpa, code); |
| 352 | 351 | atom.size = @intCast(code.len); |
| 353 | 352 | |
| ... | ... | @@ -387,7 +386,7 @@ fn finishUpdateDecl( |
| 387 | 386 | // Will be freed upon freeing of decl or after cleanup of Wasm binary. |
| 388 | 387 | const full_segment_name = try std.mem.concat(gpa, u8, &.{ |
| 389 | 388 | segment_name, |
| 390 | full_name.toSlice(ip), | |
| 389 | decl.fqn.toSlice(ip), | |
| 391 | 390 | }); |
| 392 | 391 | errdefer gpa.free(full_segment_name); |
| 393 | 392 | sym.tag = .data; |
| ... | ... | @@ -436,9 +435,8 @@ pub fn getOrCreateAtomForDecl( |
| 436 | 435 | const sym_index = try zig_object.allocateSymbol(gpa); |
| 437 | 436 | gop.value_ptr.* = .{ .atom = try wasm_file.createAtom(sym_index, zig_object.index) }; |
| 438 | 437 | const decl = pt.zcu.declPtr(decl_index); |
| 439 | const full_name = try decl.fullyQualifiedName(pt); | |
| 440 | 438 | const sym = zig_object.symbol(sym_index); |
| 441 | sym.name = try zig_object.string_table.insert(gpa, full_name.toSlice(&pt.zcu.intern_pool)); | |
| 439 | sym.name = try zig_object.string_table.insert(gpa, decl.fqn.toSlice(&pt.zcu.intern_pool)); | |
| 442 | 440 | } |
| 443 | 441 | return gop.value_ptr.atom; |
| 444 | 442 | } |
| ... | ... | @@ -494,9 +492,8 @@ pub fn lowerUnnamedConst( |
| 494 | 492 | const parent_atom_index = try zig_object.getOrCreateAtomForDecl(wasm_file, pt, decl_index); |
| 495 | 493 | const parent_atom = wasm_file.getAtom(parent_atom_index); |
| 496 | 494 | const local_index = parent_atom.locals.items.len; |
| 497 | const fqn = try decl.fullyQualifiedName(pt); | |
| 498 | 495 | const name = try std.fmt.allocPrintZ(gpa, "__unnamed_{}_{d}", .{ |
| 499 | fqn.fmt(&mod.intern_pool), local_index, | |
| 496 | decl.fqn.fmt(&mod.intern_pool), local_index, | |
| 500 | 497 | }); |
| 501 | 498 | defer gpa.free(name); |
| 502 | 499 | |
| ... | ... | @@ -1127,9 +1124,7 @@ pub fn updateDeclLineNumber( |
| 1127 | 1124 | ) !void { |
| 1128 | 1125 | if (zig_object.dwarf) |*dw| { |
| 1129 | 1126 | const decl = pt.zcu.declPtr(decl_index); |
| 1130 | const decl_name = try decl.fullyQualifiedName(pt); | |
| 1131 | ||
| 1132 | log.debug("updateDeclLineNumber {}{*}", .{ decl_name.fmt(&pt.zcu.intern_pool), decl }); | |
| 1127 | log.debug("updateDeclLineNumber {}{*}", .{ decl.fqn.fmt(&pt.zcu.intern_pool), decl }); | |
| 1133 | 1128 | try dw.updateDeclLineNumber(pt.zcu, decl_index); |
| 1134 | 1129 | } |
| 1135 | 1130 | } |
src/print_value.zig+2-2| ... | ... | @@ -299,8 +299,8 @@ fn printPtrDerivation(derivation: Value.PointerDeriveStep, writer: anytype, leve |
| 299 | 299 | int.ptr_ty.fmt(pt), |
| 300 | 300 | int.addr, |
| 301 | 301 | }), |
| 302 | .decl_ptr => |decl| { | |
| 303 | try zcu.declPtr(decl).renderFullyQualifiedName(zcu, writer); | |
| 302 | .decl_ptr => |decl_index| { | |
| 303 | try writer.print("{}", .{zcu.declPtr(decl_index).fqn.fmt(ip)}); | |
| 304 | 304 | }, |
| 305 | 305 | .anon_decl_ptr => |anon| { |
| 306 | 306 | const ty = Value.fromInterned(anon.val).typeOf(zcu); |