authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-12-18 00:41:44-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-12-18 00:41:44-05:00
log4ae101ca851bb8a5437153137cfa70c4bf0c8d15
treeeda15ab2484e040370d68a418e9fae5659c837ae
parent12d64c456b7590b1486717232f77c6d3700813a6
parent98f63990d55c27969ebae3c0fe392c6716548781
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #22260 from jacobly0/dwarf-cleanup

Dwarf: cleanup

4 files changed, 64 insertions(+), 145 deletions(-)

lib/std/zig/AstGen.zig+18
......@@ -4151,6 +4151,8 @@ fn fnDecl(
41514151 };
41524152 defer fn_gz.unstack();
41534153
4154 const decl_column = astgen.source_column;
4155
41544156 // Set this now, since parameter types, return type, etc may be generic.
41554157 const prev_within_fn = astgen.within_fn;
41564158 defer astgen.within_fn = prev_within_fn;
......@@ -4523,6 +4525,7 @@ fn fnDecl(
45234525 hash,
45244526 .{ .named = fn_name_token },
45254527 decl_gz.decl_line,
4528 decl_column,
45264529 is_pub,
45274530 is_export,
45284531 &decl_gz,
......@@ -4568,6 +4571,8 @@ fn globalVarDecl(
45684571 };
45694572 defer block_scope.unstack();
45704573
4574 const decl_column = astgen.source_column;
4575
45714576 const is_pub = var_decl.visib_token != null;
45724577 const is_export = blk: {
45734578 const maybe_export_token = var_decl.extern_export_token orelse break :blk false;
......@@ -4693,6 +4698,7 @@ fn globalVarDecl(
46934698 hash,
46944699 .{ .named = name_token },
46954700 block_scope.decl_line,
4701 decl_column,
46964702 is_pub,
46974703 is_export,
46984704 &block_scope,
......@@ -4738,6 +4744,8 @@ fn comptimeDecl(
47384744 };
47394745 defer decl_block.unstack();
47404746
4747 const decl_column = astgen.source_column;
4748
47414749 const block_result = try fullBodyExpr(&decl_block, &decl_block.base, .{ .rl = .none }, body_node, .normal);
47424750 if (decl_block.isEmpty() or !decl_block.refIsNoReturn(block_result)) {
47434751 _ = try decl_block.addBreak(.break_inline, decl_inst, .void_value);
......@@ -4750,6 +4758,7 @@ fn comptimeDecl(
47504758 hash,
47514759 .@"comptime",
47524760 decl_block.decl_line,
4761 decl_column,
47534762 false,
47544763 false,
47554764 &decl_block,
......@@ -4797,6 +4806,8 @@ fn usingnamespaceDecl(
47974806 };
47984807 defer decl_block.unstack();
47994808
4809 const decl_column = astgen.source_column;
4810
48004811 const namespace_inst = try typeExpr(&decl_block, &decl_block.base, type_expr);
48014812 _ = try decl_block.addBreak(.break_inline, decl_inst, namespace_inst);
48024813
......@@ -4807,6 +4818,7 @@ fn usingnamespaceDecl(
48074818 hash,
48084819 .@"usingnamespace",
48094820 decl_block.decl_line,
4821 decl_column,
48104822 is_pub,
48114823 false,
48124824 &decl_block,
......@@ -4849,6 +4861,8 @@ fn testDecl(
48494861 };
48504862 defer decl_block.unstack();
48514863
4864 const decl_column = astgen.source_column;
4865
48524866 const main_tokens = tree.nodes.items(.main_token);
48534867 const token_tags = tree.tokens.items(.tag);
48544868 const test_token = main_tokens[node];
......@@ -5013,6 +5027,7 @@ fn testDecl(
50135027 hash,
50145028 test_name,
50155029 decl_block.decl_line,
5030 decl_column,
50165031 false,
50175032 false,
50185033 &decl_block,
......@@ -14013,6 +14028,7 @@ fn addFailedDeclaration(
1401314028 @splat(0), // use a fixed hash to represent an AstGen failure; we don't care about source changes if AstGen still failed!
1401414029 name,
1401514030 gz.astgen.source_line,
14031 gz.astgen.source_column,
1401614032 is_pub,
1401714033 false, // we don't care about exports since semantic analysis will fail
1401814034 &decl_gz,
......@@ -14027,6 +14043,7 @@ fn setDeclaration(
1402714043 src_hash: std.zig.SrcHash,
1402814044 name: DeclarationName,
1402914045 src_line: u32,
14046 src_column: u32,
1403014047 is_pub: bool,
1403114048 is_export: bool,
1403214049 value_gz: *GenZir,
......@@ -14079,6 +14096,7 @@ fn setDeclaration(
1407914096 .@"usingnamespace" => .@"usingnamespace",
1408014097 },
1408114098 .src_line = src_line,
14099 .src_column = src_column,
1408214100 .flags = .{
1408314101 .value_body_len = @intCast(value_len),
1408414102 .is_pub = is_pub,
lib/std/zig/Zir.zig+1
......@@ -2636,6 +2636,7 @@ pub const Inst = struct {
26362636 /// The name of this `Decl`. Also indicates whether it is a test, comptime block, etc.
26372637 name: Name,
26382638 src_line: u32,
2639 src_column: u32,
26392640 flags: Flags,
26402641
26412642 pub const Flags = packed struct(u32) {
src/InternPool.zig+1-1
......@@ -5365,7 +5365,7 @@ pub const Tag = enum(u8) {
53655365 .@"trailing.field_is_comptime_bits.?" = .@"payload.flags.any_comptime_fields",
53665366 .@"trailing.field_is_comptime_bits.?.len" = .@"(payload.fields_len + 31) / 32",
53675367 .@"trailing.field_index.?" = .@"!payload.flags.is_extern",
5368 .@"trailing.field_index.?.len" = .@"!payload.flags.is_extern",
5368 .@"trailing.field_index.?.len" = .@"payload.fields_len",
53695369 .@"trailing.field_offset.len" = .@"payload.fields_len",
53705370 },
53715371 },
src/link/Dwarf.zig+44-144
......@@ -2259,30 +2259,23 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
22592259 switch (ip.indexToKey(nav_val.toIntern())) {
22602260 else => {
22612261 assert(file.zir_loaded);
2262 const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst));
2263 assert(decl_inst.tag == .declaration);
2264 const tree = try file.getTree(dwarf.gpa);
2265 const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]);
2266 assert(loc.line == zcu.navSrcLine(nav_index));
2262 const decl = file.zir.getDeclaration(inst_info.inst)[0];
22672263
22682264 const parent_type, const accessibility: u8 = if (nav.analysis_owner.unwrap()) |cau| parent: {
2269 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index).data;
22702265 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
22712266 break :parent .{
22722267 parent_namespace_ptr.owner_type,
2273 switch (decl_extra.name) {
2268 switch (decl.name) {
22742269 .@"comptime",
22752270 .@"usingnamespace",
22762271 .unnamed_test,
22772272 => DW.ACCESS.private,
2278 _ => if (decl_extra.name.isNamedTest(file.zir))
2273 _ => if (decl.name.isNamedTest(file.zir))
22792274 DW.ACCESS.private
2280 else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))
2275 else if (decl.flags.is_pub)
22812276 DW.ACCESS.public
2282 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2283 DW.ACCESS.private
22842277 else
2285 unreachable,
2278 DW.ACCESS.private,
22862279 },
22872280 };
22882281 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
......@@ -2291,8 +2284,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
22912284 try wip_nav.abbrevCode(.decl_var);
22922285 try wip_nav.refType(.fromInterned(parent_type));
22932286 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2294 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
2295 try uleb128(diw, loc.column + 1);
2287 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2288 try uleb128(diw, decl.src_column + 1);
22962289 try diw.writeByte(accessibility);
22972290 try wip_nav.strp(nav.name.toSlice(ip));
22982291 try wip_nav.strp(nav.fqn.toSlice(ip));
......@@ -2308,30 +2301,23 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
23082301 },
23092302 .variable => |variable| {
23102303 assert(file.zir_loaded);
2311 const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst));
2312 assert(decl_inst.tag == .declaration);
2313 const tree = try file.getTree(dwarf.gpa);
2314 const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]);
2315 assert(loc.line == zcu.navSrcLine(nav_index));
2304 const decl = file.zir.getDeclaration(inst_info.inst)[0];
23162305
23172306 const parent_type, const accessibility: u8 = if (nav.analysis_owner.unwrap()) |cau| parent: {
2318 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index).data;
23192307 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
23202308 break :parent .{
23212309 parent_namespace_ptr.owner_type,
2322 switch (decl_extra.name) {
2310 switch (decl.name) {
23232311 .@"comptime",
23242312 .@"usingnamespace",
23252313 .unnamed_test,
23262314 => DW.ACCESS.private,
2327 _ => if (decl_extra.name.isNamedTest(file.zir))
2315 _ => if (decl.name.isNamedTest(file.zir))
23282316 DW.ACCESS.private
2329 else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))
2317 else if (decl.flags.is_pub)
23302318 DW.ACCESS.public
2331 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2332 DW.ACCESS.private
23332319 else
2334 unreachable,
2320 DW.ACCESS.private,
23352321 },
23362322 };
23372323 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
......@@ -2340,8 +2326,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
23402326 try wip_nav.abbrevCode(.decl_var);
23412327 try wip_nav.refType(.fromInterned(parent_type));
23422328 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2343 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
2344 try uleb128(diw, loc.column + 1);
2329 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2330 try uleb128(diw, decl.src_column + 1);
23452331 try diw.writeByte(accessibility);
23462332 try wip_nav.strp(nav.name.toSlice(ip));
23472333 try wip_nav.strp(nav.fqn.toSlice(ip));
......@@ -2355,30 +2341,23 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
23552341 },
23562342 .func => |func| {
23572343 assert(file.zir_loaded);
2358 const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst));
2359 assert(decl_inst.tag == .declaration);
2360 const tree = try file.getTree(dwarf.gpa);
2361 const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]);
2362 assert(loc.line == zcu.navSrcLine(nav_index));
2344 const decl = file.zir.getDeclaration(inst_info.inst)[0];
23632345
23642346 const parent_type, const accessibility: u8 = if (nav.analysis_owner.unwrap()) |cau| parent: {
2365 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index).data;
23662347 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
23672348 break :parent .{
23682349 parent_namespace_ptr.owner_type,
2369 switch (decl_extra.name) {
2350 switch (decl.name) {
23702351 .@"comptime",
23712352 .@"usingnamespace",
23722353 .unnamed_test,
23732354 => DW.ACCESS.private,
2374 _ => if (decl_extra.name.isNamedTest(file.zir))
2355 _ => if (decl.name.isNamedTest(file.zir))
23752356 DW.ACCESS.private
2376 else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))
2357 else if (decl.flags.is_pub)
23772358 DW.ACCESS.public
2378 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2379 DW.ACCESS.private
23802359 else
2381 unreachable,
2360 DW.ACCESS.private,
23822361 },
23832362 };
23842363 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
......@@ -2432,8 +2411,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
24322411 try wip_nav.abbrevCode(.decl_func);
24332412 try wip_nav.refType(.fromInterned(parent_type));
24342413 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2435 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
2436 try uleb128(diw, loc.column + 1);
2414 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2415 try uleb128(diw, decl.src_column + 1);
24372416 try diw.writeByte(accessibility);
24382417 try wip_nav.strp(nav.name.toSlice(ip));
24392418 try wip_nav.strp(nav.fqn.toSlice(ip));
......@@ -2482,7 +2461,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
24822461 try dlw.writeByte(DW.LNS.set_column);
24832462 try uleb128(dlw, func.lbrace_column + 1);
24842463
2485 try wip_nav.advancePCAndLine(@intCast(loc.line + func.lbrace_line), 0);
2464 try wip_nav.advancePCAndLine(@intCast(decl.src_line + func.lbrace_line), 0);
24862465 }
24872466 },
24882467 }
......@@ -2606,14 +2585,12 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
26062585 const inst_info = nav.srcInst(ip).resolveFull(ip).?;
26072586 const file = zcu.fileByIndex(inst_info.file);
26082587 assert(file.zir_loaded);
2609 const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst));
2610 assert(decl_inst.tag == .declaration);
2611 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index);
2588 const decl = file.zir.getDeclaration(inst_info.inst)[0];
26122589
2613 const is_test = switch (decl_extra.data.name) {
2590 const is_test = switch (decl.name) {
26142591 .unnamed_test => true,
26152592 .@"comptime", .@"usingnamespace" => false,
2616 _ => decl_extra.data.name.isNamedTest(file.zir),
2593 _ => decl.name.isNamedTest(file.zir),
26172594 };
26182595 if (is_test) {
26192596 // This isn't actually a comptime Nav! It's a test, so it'll definitely never be referenced at comptime.
......@@ -2624,19 +2601,10 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
26242601 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
26252602 break :parent .{
26262603 parent_namespace_ptr.owner_type,
2627 if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))
2628 DW.ACCESS.public
2629 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2630 DW.ACCESS.private
2631 else
2632 unreachable,
2604 if (decl.flags.is_pub) DW.ACCESS.public else DW.ACCESS.private,
26332605 };
26342606 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
26352607
2636 const tree = try file.getTree(dwarf.gpa);
2637 const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]);
2638 assert(loc.line == zcu.navSrcLine(nav_index));
2639
26402608 var wip_nav: WipNav = .{
26412609 .dwarf = dwarf,
26422610 .pt = pt,
......@@ -2679,23 +2647,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
26792647 const type_inst_info = loaded_struct.zir_index.resolveFull(ip).?;
26802648 if (type_inst_info.file != inst_info.file) break :tag .decl_alias;
26812649
2682 const value_inst = value_inst: {
2683 const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body;
2684 const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1]));
2685 if (break_inst.tag != .break_inline) break :value_inst null;
2686 assert(file.zir.extraData(Zir.Inst.Break, break_inst.data.@"break".payload_index).data.block_inst == inst_info.inst);
2687 var value_inst = break_inst.data.@"break".operand.toIndex();
2688 while (value_inst) |value_inst_index| switch (file.zir.instructions.items(.tag)[@intFromEnum(value_inst_index)]) {
2689 else => break,
2690 .as_node => value_inst = file.zir.extraData(
2691 Zir.Inst.As,
2692 file.zir.instructions.items(.data)[@intFromEnum(value_inst_index)].pl_node.payload_index,
2693 ).data.operand.toIndex(),
2694 };
2695 break :value_inst value_inst;
2696 };
2697 if (type_inst_info.inst != value_inst) break :tag .decl_alias;
2698
26992650 const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern());
27002651 if (type_gop.found_existing) {
27012652 if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias;
......@@ -2716,8 +2667,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
27162667 try wip_nav.abbrevCode(if (loaded_struct.field_types.len == 0) .decl_namespace_struct else .decl_struct);
27172668 try wip_nav.refType(.fromInterned(parent_type));
27182669 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2719 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
2720 try uleb128(diw, loc.column + 1);
2670 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2671 try uleb128(diw, decl.src_column + 1);
27212672 try diw.writeByte(accessibility);
27222673 try wip_nav.strp(nav.name.toSlice(ip));
27232674 if (loaded_struct.field_types.len == 0) try diw.writeByte(@intFromBool(false)) else {
......@@ -2776,8 +2727,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
27762727 try wip_nav.abbrevCode(.decl_packed_struct);
27772728 try wip_nav.refType(.fromInterned(parent_type));
27782729 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2779 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
2780 try uleb128(diw, loc.column + 1);
2730 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2731 try uleb128(diw, decl.src_column + 1);
27812732 try diw.writeByte(accessibility);
27822733 try wip_nav.strp(nav.name.toSlice(ip));
27832734 try wip_nav.refType(.fromInterned(loaded_struct.backingIntTypeUnordered(ip)));
......@@ -2802,23 +2753,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
28022753 const type_inst_info = loaded_enum.zir_index.unwrap().?.resolveFull(ip).?;
28032754 if (type_inst_info.file != inst_info.file) break :tag .decl_alias;
28042755
2805 const value_inst = value_inst: {
2806 const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body;
2807 const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1]));
2808 if (break_inst.tag != .break_inline) break :value_inst null;
2809 assert(file.zir.extraData(Zir.Inst.Break, break_inst.data.@"break".payload_index).data.block_inst == inst_info.inst);
2810 var value_inst = break_inst.data.@"break".operand.toIndex();
2811 while (value_inst) |value_inst_index| switch (file.zir.instructions.items(.tag)[@intFromEnum(value_inst_index)]) {
2812 else => break,
2813 .as_node => value_inst = file.zir.extraData(
2814 Zir.Inst.As,
2815 file.zir.instructions.items(.data)[@intFromEnum(value_inst_index)].pl_node.payload_index,
2816 ).data.operand.toIndex(),
2817 };
2818 break :value_inst value_inst;
2819 };
2820 if (type_inst_info.inst != value_inst) break :tag .decl_alias;
2821
28222756 const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern());
28232757 if (type_gop.found_existing) {
28242758 if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias;
......@@ -2835,8 +2769,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
28352769 try wip_nav.abbrevCode(if (loaded_enum.names.len > 0) .decl_enum else .decl_empty_enum);
28362770 try wip_nav.refType(.fromInterned(parent_type));
28372771 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2838 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
2839 try uleb128(diw, loc.column + 1);
2772 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2773 try uleb128(diw, decl.src_column + 1);
28402774 try diw.writeByte(accessibility);
28412775 try wip_nav.strp(nav.name.toSlice(ip));
28422776 try wip_nav.refType(.fromInterned(loaded_enum.tag_ty));
......@@ -2857,23 +2791,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
28572791 const type_inst_info = loaded_union.zir_index.resolveFull(ip).?;
28582792 if (type_inst_info.file != inst_info.file) break :tag .decl_alias;
28592793
2860 const value_inst = value_inst: {
2861 const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body;
2862 const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1]));
2863 if (break_inst.tag != .break_inline) break :value_inst null;
2864 assert(file.zir.extraData(Zir.Inst.Break, break_inst.data.@"break".payload_index).data.block_inst == inst_info.inst);
2865 var value_inst = break_inst.data.@"break".operand.toIndex();
2866 while (value_inst) |value_inst_index| switch (file.zir.instructions.items(.tag)[@intFromEnum(value_inst_index)]) {
2867 else => break,
2868 .as_node => value_inst = file.zir.extraData(
2869 Zir.Inst.As,
2870 file.zir.instructions.items(.data)[@intFromEnum(value_inst_index)].pl_node.payload_index,
2871 ).data.operand.toIndex(),
2872 };
2873 break :value_inst value_inst;
2874 };
2875 if (type_inst_info.inst != value_inst) break :tag .decl_alias;
2876
28772794 const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern());
28782795 if (type_gop.found_existing) {
28792796 if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias;
......@@ -2890,8 +2807,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
28902807 try wip_nav.abbrevCode(.decl_union);
28912808 try wip_nav.refType(.fromInterned(parent_type));
28922809 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2893 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
2894 try uleb128(diw, loc.column + 1);
2810 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2811 try uleb128(diw, decl.src_column + 1);
28952812 try diw.writeByte(accessibility);
28962813 try wip_nav.strp(nav.name.toSlice(ip));
28972814 const union_layout = Type.getUnionLayout(loaded_union, zcu);
......@@ -2948,23 +2865,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
29482865 const type_inst_info = loaded_opaque.zir_index.resolveFull(ip).?;
29492866 if (type_inst_info.file != inst_info.file) break :tag .decl_alias;
29502867
2951 const value_inst = value_inst: {
2952 const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body;
2953 const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1]));
2954 if (break_inst.tag != .break_inline) break :value_inst null;
2955 assert(file.zir.extraData(Zir.Inst.Break, break_inst.data.@"break".payload_index).data.block_inst == inst_info.inst);
2956 var value_inst = break_inst.data.@"break".operand.toIndex();
2957 while (value_inst) |value_inst_index| switch (file.zir.instructions.items(.tag)[@intFromEnum(value_inst_index)]) {
2958 else => break,
2959 .as_node => value_inst = file.zir.extraData(
2960 Zir.Inst.As,
2961 file.zir.instructions.items(.data)[@intFromEnum(value_inst_index)].pl_node.payload_index,
2962 ).data.operand.toIndex(),
2963 };
2964 break :value_inst value_inst;
2965 };
2966 if (type_inst_info.inst != value_inst) break :tag .decl_alias;
2967
29682868 const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern());
29692869 if (type_gop.found_existing) {
29702870 if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias;
......@@ -2981,8 +2881,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
29812881 try wip_nav.abbrevCode(.decl_namespace_struct);
29822882 try wip_nav.refType(.fromInterned(parent_type));
29832883 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2984 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
2985 try uleb128(diw, loc.column + 1);
2884 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2885 try uleb128(diw, decl.src_column + 1);
29862886 try diw.writeByte(accessibility);
29872887 try wip_nav.strp(nav.name.toSlice(ip));
29882888 try diw.writeByte(@intFromBool(false));
......@@ -3037,8 +2937,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
30372937 .decl_empty_func_generic);
30382938 try wip_nav.refType(.fromInterned(parent_type));
30392939 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
3040 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
3041 try uleb128(diw, loc.column + 1);
2940 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2941 try uleb128(diw, decl.src_column + 1);
30422942 try diw.writeByte(accessibility);
30432943 try wip_nav.strp(nav.name.toSlice(ip));
30442944 try wip_nav.refType(.fromInterned(func_type.return_type));
......@@ -3069,8 +2969,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
30692969 try wip_nav.abbrevCode(.decl_alias);
30702970 try wip_nav.refType(.fromInterned(parent_type));
30712971 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
3072 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
3073 try uleb128(diw, loc.column + 1);
2972 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2973 try uleb128(diw, decl.src_column + 1);
30742974 try diw.writeByte(accessibility);
30752975 try wip_nav.strp(nav.name.toSlice(ip));
30762976 try wip_nav.refType(nav_val.toType());
......@@ -3080,8 +2980,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
30802980 try wip_nav.abbrevCode(.decl_var);
30812981 try wip_nav.refType(.fromInterned(parent_type));
30822982 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
3083 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
3084 try uleb128(diw, loc.column + 1);
2983 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2984 try uleb128(diw, decl.src_column + 1);
30852985 try diw.writeByte(accessibility);
30862986 try wip_nav.strp(nav.name.toSlice(ip));
30872987 try wip_nav.strp(nav.fqn.toSlice(ip));
......@@ -3107,8 +3007,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
31073007 .decl_const);
31083008 try wip_nav.refType(.fromInterned(parent_type));
31093009 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
3110 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);
3111 try uleb128(diw, loc.column + 1);
3010 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
3011 try uleb128(diw, decl.src_column + 1);
31123012 try diw.writeByte(accessibility);
31133013 try wip_nav.strp(nav.name.toSlice(ip));
31143014 try wip_nav.strp(nav.fqn.toSlice(ip));