authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-12-17 22:52:30+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-12-17 22:52:30+00:00
log98f63990d55c27969ebae3c0fe392c6716548781
tree99b60573b0d8ab3ed72a6faf541159b360d576e9
parent737154fcd80e31ba7d1035384b8178e39734379b
signaturelock-open Commit is signed but in an unrecognized format.

Zir: store declaration column number so Dwarf doesn't need to load the AST

Resolves: #21227

3 files changed, 60 insertions(+), 62 deletions(-)

lib/std/zig/AstGen.zig+18
...@@ -4151,6 +4151,8 @@ fn fnDecl(...@@ -4151,6 +4151,8 @@ fn fnDecl(
4151 };4151 };
4152 defer fn_gz.unstack();4152 defer fn_gz.unstack();
41534153
4154 const decl_column = astgen.source_column;
4155
4154 // Set this now, since parameter types, return type, etc may be generic.4156 // Set this now, since parameter types, return type, etc may be generic.
4155 const prev_within_fn = astgen.within_fn;4157 const prev_within_fn = astgen.within_fn;
4156 defer astgen.within_fn = prev_within_fn;4158 defer astgen.within_fn = prev_within_fn;
...@@ -4523,6 +4525,7 @@ fn fnDecl(...@@ -4523,6 +4525,7 @@ fn fnDecl(
4523 hash,4525 hash,
4524 .{ .named = fn_name_token },4526 .{ .named = fn_name_token },
4525 decl_gz.decl_line,4527 decl_gz.decl_line,
4528 decl_column,
4526 is_pub,4529 is_pub,
4527 is_export,4530 is_export,
4528 &decl_gz,4531 &decl_gz,
...@@ -4568,6 +4571,8 @@ fn globalVarDecl(...@@ -4568,6 +4571,8 @@ fn globalVarDecl(
4568 };4571 };
4569 defer block_scope.unstack();4572 defer block_scope.unstack();
45704573
4574 const decl_column = astgen.source_column;
4575
4571 const is_pub = var_decl.visib_token != null;4576 const is_pub = var_decl.visib_token != null;
4572 const is_export = blk: {4577 const is_export = blk: {
4573 const maybe_export_token = var_decl.extern_export_token orelse break :blk false;4578 const maybe_export_token = var_decl.extern_export_token orelse break :blk false;
...@@ -4693,6 +4698,7 @@ fn globalVarDecl(...@@ -4693,6 +4698,7 @@ fn globalVarDecl(
4693 hash,4698 hash,
4694 .{ .named = name_token },4699 .{ .named = name_token },
4695 block_scope.decl_line,4700 block_scope.decl_line,
4701 decl_column,
4696 is_pub,4702 is_pub,
4697 is_export,4703 is_export,
4698 &block_scope,4704 &block_scope,
...@@ -4738,6 +4744,8 @@ fn comptimeDecl(...@@ -4738,6 +4744,8 @@ fn comptimeDecl(
4738 };4744 };
4739 defer decl_block.unstack();4745 defer decl_block.unstack();
47404746
4747 const decl_column = astgen.source_column;
4748
4741 const block_result = try fullBodyExpr(&decl_block, &decl_block.base, .{ .rl = .none }, body_node, .normal);4749 const block_result = try fullBodyExpr(&decl_block, &decl_block.base, .{ .rl = .none }, body_node, .normal);
4742 if (decl_block.isEmpty() or !decl_block.refIsNoReturn(block_result)) {4750 if (decl_block.isEmpty() or !decl_block.refIsNoReturn(block_result)) {
4743 _ = try decl_block.addBreak(.break_inline, decl_inst, .void_value);4751 _ = try decl_block.addBreak(.break_inline, decl_inst, .void_value);
...@@ -4750,6 +4758,7 @@ fn comptimeDecl(...@@ -4750,6 +4758,7 @@ fn comptimeDecl(
4750 hash,4758 hash,
4751 .@"comptime",4759 .@"comptime",
4752 decl_block.decl_line,4760 decl_block.decl_line,
4761 decl_column,
4753 false,4762 false,
4754 false,4763 false,
4755 &decl_block,4764 &decl_block,
...@@ -4797,6 +4806,8 @@ fn usingnamespaceDecl(...@@ -4797,6 +4806,8 @@ fn usingnamespaceDecl(
4797 };4806 };
4798 defer decl_block.unstack();4807 defer decl_block.unstack();
47994808
4809 const decl_column = astgen.source_column;
4810
4800 const namespace_inst = try typeExpr(&decl_block, &decl_block.base, type_expr);4811 const namespace_inst = try typeExpr(&decl_block, &decl_block.base, type_expr);
4801 _ = try decl_block.addBreak(.break_inline, decl_inst, namespace_inst);4812 _ = try decl_block.addBreak(.break_inline, decl_inst, namespace_inst);
48024813
...@@ -4807,6 +4818,7 @@ fn usingnamespaceDecl(...@@ -4807,6 +4818,7 @@ fn usingnamespaceDecl(
4807 hash,4818 hash,
4808 .@"usingnamespace",4819 .@"usingnamespace",
4809 decl_block.decl_line,4820 decl_block.decl_line,
4821 decl_column,
4810 is_pub,4822 is_pub,
4811 false,4823 false,
4812 &decl_block,4824 &decl_block,
...@@ -4849,6 +4861,8 @@ fn testDecl(...@@ -4849,6 +4861,8 @@ fn testDecl(
4849 };4861 };
4850 defer decl_block.unstack();4862 defer decl_block.unstack();
48514863
4864 const decl_column = astgen.source_column;
4865
4852 const main_tokens = tree.nodes.items(.main_token);4866 const main_tokens = tree.nodes.items(.main_token);
4853 const token_tags = tree.tokens.items(.tag);4867 const token_tags = tree.tokens.items(.tag);
4854 const test_token = main_tokens[node];4868 const test_token = main_tokens[node];
...@@ -5013,6 +5027,7 @@ fn testDecl(...@@ -5013,6 +5027,7 @@ fn testDecl(
5013 hash,5027 hash,
5014 test_name,5028 test_name,
5015 decl_block.decl_line,5029 decl_block.decl_line,
5030 decl_column,
5016 false,5031 false,
5017 false,5032 false,
5018 &decl_block,5033 &decl_block,
...@@ -14013,6 +14028,7 @@ fn addFailedDeclaration(...@@ -14013,6 +14028,7 @@ fn addFailedDeclaration(
14013 @splat(0), // use a fixed hash to represent an AstGen failure; we don't care about source changes if AstGen still failed!14028 @splat(0), // use a fixed hash to represent an AstGen failure; we don't care about source changes if AstGen still failed!
14014 name,14029 name,
14015 gz.astgen.source_line,14030 gz.astgen.source_line,
14031 gz.astgen.source_column,
14016 is_pub,14032 is_pub,
14017 false, // we don't care about exports since semantic analysis will fail14033 false, // we don't care about exports since semantic analysis will fail
14018 &decl_gz,14034 &decl_gz,
...@@ -14027,6 +14043,7 @@ fn setDeclaration(...@@ -14027,6 +14043,7 @@ fn setDeclaration(
14027 src_hash: std.zig.SrcHash,14043 src_hash: std.zig.SrcHash,
14028 name: DeclarationName,14044 name: DeclarationName,
14029 src_line: u32,14045 src_line: u32,
14046 src_column: u32,
14030 is_pub: bool,14047 is_pub: bool,
14031 is_export: bool,14048 is_export: bool,
14032 value_gz: *GenZir,14049 value_gz: *GenZir,
...@@ -14079,6 +14096,7 @@ fn setDeclaration(...@@ -14079,6 +14096,7 @@ fn setDeclaration(
14079 .@"usingnamespace" => .@"usingnamespace",14096 .@"usingnamespace" => .@"usingnamespace",
14080 },14097 },
14081 .src_line = src_line,14098 .src_line = src_line,
14099 .src_column = src_column,
14082 .flags = .{14100 .flags = .{
14083 .value_body_len = @intCast(value_len),14101 .value_body_len = @intCast(value_len),
14084 .is_pub = is_pub,14102 .is_pub = is_pub,
lib/std/zig/Zir.zig+1
...@@ -2636,6 +2636,7 @@ pub const Inst = struct {...@@ -2636,6 +2636,7 @@ pub const Inst = struct {
2636 /// The name of this `Decl`. Also indicates whether it is a test, comptime block, etc.2636 /// The name of this `Decl`. Also indicates whether it is a test, comptime block, etc.
2637 name: Name,2637 name: Name,
2638 src_line: u32,2638 src_line: u32,
2639 src_column: u32,
2639 flags: Flags,2640 flags: Flags,
26402641
2641 pub const Flags = packed struct(u32) {2642 pub const Flags = packed struct(u32) {
src/link/Dwarf.zig+41-62
...@@ -2259,25 +2259,20 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2259,25 +2259,20 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2259 switch (ip.indexToKey(nav_val.toIntern())) {2259 switch (ip.indexToKey(nav_val.toIntern())) {
2260 else => {2260 else => {
2261 assert(file.zir_loaded);2261 assert(file.zir_loaded);
2262 const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst));2262 const decl = file.zir.getDeclaration(inst_info.inst)[0];
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));
22672263
2268 const parent_type, const accessibility: u8 = if (nav.analysis_owner.unwrap()) |cau| parent: {2264 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;
2270 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);2265 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
2271 break :parent .{2266 break :parent .{
2272 parent_namespace_ptr.owner_type,2267 parent_namespace_ptr.owner_type,
2273 switch (decl_extra.name) {2268 switch (decl.name) {
2274 .@"comptime",2269 .@"comptime",
2275 .@"usingnamespace",2270 .@"usingnamespace",
2276 .unnamed_test,2271 .unnamed_test,
2277 => DW.ACCESS.private,2272 => DW.ACCESS.private,
2278 _ => if (decl_extra.name.isNamedTest(file.zir))2273 _ => if (decl.name.isNamedTest(file.zir))
2279 DW.ACCESS.private2274 DW.ACCESS.private
2280 else if (decl_extra.flags.is_pub)2275 else if (decl.flags.is_pub)
2281 DW.ACCESS.public2276 DW.ACCESS.public
2282 else2277 else
2283 DW.ACCESS.private,2278 DW.ACCESS.private,
...@@ -2289,8 +2284,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2289,8 +2284,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2289 try wip_nav.abbrevCode(.decl_var);2284 try wip_nav.abbrevCode(.decl_var);
2290 try wip_nav.refType(.fromInterned(parent_type));2285 try wip_nav.refType(.fromInterned(parent_type));
2291 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2286 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2292 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2287 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2293 try uleb128(diw, loc.column + 1);2288 try uleb128(diw, decl.src_column + 1);
2294 try diw.writeByte(accessibility);2289 try diw.writeByte(accessibility);
2295 try wip_nav.strp(nav.name.toSlice(ip));2290 try wip_nav.strp(nav.name.toSlice(ip));
2296 try wip_nav.strp(nav.fqn.toSlice(ip));2291 try wip_nav.strp(nav.fqn.toSlice(ip));
...@@ -2306,25 +2301,20 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2306,25 +2301,20 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2306 },2301 },
2307 .variable => |variable| {2302 .variable => |variable| {
2308 assert(file.zir_loaded);2303 assert(file.zir_loaded);
2309 const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst));2304 const decl = file.zir.getDeclaration(inst_info.inst)[0];
2310 assert(decl_inst.tag == .declaration);
2311 const tree = try file.getTree(dwarf.gpa);
2312 const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]);
2313 assert(loc.line == zcu.navSrcLine(nav_index));
23142305
2315 const parent_type, const accessibility: u8 = if (nav.analysis_owner.unwrap()) |cau| parent: {2306 const parent_type, const accessibility: u8 = if (nav.analysis_owner.unwrap()) |cau| parent: {
2316 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index).data;
2317 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);2307 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
2318 break :parent .{2308 break :parent .{
2319 parent_namespace_ptr.owner_type,2309 parent_namespace_ptr.owner_type,
2320 switch (decl_extra.name) {2310 switch (decl.name) {
2321 .@"comptime",2311 .@"comptime",
2322 .@"usingnamespace",2312 .@"usingnamespace",
2323 .unnamed_test,2313 .unnamed_test,
2324 => DW.ACCESS.private,2314 => DW.ACCESS.private,
2325 _ => if (decl_extra.name.isNamedTest(file.zir))2315 _ => if (decl.name.isNamedTest(file.zir))
2326 DW.ACCESS.private2316 DW.ACCESS.private
2327 else if (decl_extra.flags.is_pub)2317 else if (decl.flags.is_pub)
2328 DW.ACCESS.public2318 DW.ACCESS.public
2329 else2319 else
2330 DW.ACCESS.private,2320 DW.ACCESS.private,
...@@ -2336,8 +2326,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2336,8 +2326,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2336 try wip_nav.abbrevCode(.decl_var);2326 try wip_nav.abbrevCode(.decl_var);
2337 try wip_nav.refType(.fromInterned(parent_type));2327 try wip_nav.refType(.fromInterned(parent_type));
2338 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2328 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2339 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2329 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2340 try uleb128(diw, loc.column + 1);2330 try uleb128(diw, decl.src_column + 1);
2341 try diw.writeByte(accessibility);2331 try diw.writeByte(accessibility);
2342 try wip_nav.strp(nav.name.toSlice(ip));2332 try wip_nav.strp(nav.name.toSlice(ip));
2343 try wip_nav.strp(nav.fqn.toSlice(ip));2333 try wip_nav.strp(nav.fqn.toSlice(ip));
...@@ -2351,25 +2341,20 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2351,25 +2341,20 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2351 },2341 },
2352 .func => |func| {2342 .func => |func| {
2353 assert(file.zir_loaded);2343 assert(file.zir_loaded);
2354 const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst));2344 const decl = file.zir.getDeclaration(inst_info.inst)[0];
2355 assert(decl_inst.tag == .declaration);
2356 const tree = try file.getTree(dwarf.gpa);
2357 const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]);
2358 assert(loc.line == zcu.navSrcLine(nav_index));
23592345
2360 const parent_type, const accessibility: u8 = if (nav.analysis_owner.unwrap()) |cau| parent: {2346 const parent_type, const accessibility: u8 = if (nav.analysis_owner.unwrap()) |cau| parent: {
2361 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index).data;
2362 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);2347 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
2363 break :parent .{2348 break :parent .{
2364 parent_namespace_ptr.owner_type,2349 parent_namespace_ptr.owner_type,
2365 switch (decl_extra.name) {2350 switch (decl.name) {
2366 .@"comptime",2351 .@"comptime",
2367 .@"usingnamespace",2352 .@"usingnamespace",
2368 .unnamed_test,2353 .unnamed_test,
2369 => DW.ACCESS.private,2354 => DW.ACCESS.private,
2370 _ => if (decl_extra.name.isNamedTest(file.zir))2355 _ => if (decl.name.isNamedTest(file.zir))
2371 DW.ACCESS.private2356 DW.ACCESS.private
2372 else if (decl_extra.flags.is_pub)2357 else if (decl.flags.is_pub)
2373 DW.ACCESS.public2358 DW.ACCESS.public
2374 else2359 else
2375 DW.ACCESS.private,2360 DW.ACCESS.private,
...@@ -2426,8 +2411,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2426,8 +2411,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2426 try wip_nav.abbrevCode(.decl_func);2411 try wip_nav.abbrevCode(.decl_func);
2427 try wip_nav.refType(.fromInterned(parent_type));2412 try wip_nav.refType(.fromInterned(parent_type));
2428 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2413 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2429 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2414 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2430 try uleb128(diw, loc.column + 1);2415 try uleb128(diw, decl.src_column + 1);
2431 try diw.writeByte(accessibility);2416 try diw.writeByte(accessibility);
2432 try wip_nav.strp(nav.name.toSlice(ip));2417 try wip_nav.strp(nav.name.toSlice(ip));
2433 try wip_nav.strp(nav.fqn.toSlice(ip));2418 try wip_nav.strp(nav.fqn.toSlice(ip));
...@@ -2476,7 +2461,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2476,7 +2461,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2476 try dlw.writeByte(DW.LNS.set_column);2461 try dlw.writeByte(DW.LNS.set_column);
2477 try uleb128(dlw, func.lbrace_column + 1);2462 try uleb128(dlw, func.lbrace_column + 1);
24782463
2479 try wip_nav.advancePCAndLine(@intCast(loc.line + func.lbrace_line), 0);2464 try wip_nav.advancePCAndLine(@intCast(decl.src_line + func.lbrace_line), 0);
2480 }2465 }
2481 },2466 },
2482 }2467 }
...@@ -2600,14 +2585,12 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2600,14 +2585,12 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2600 const inst_info = nav.srcInst(ip).resolveFull(ip).?;2585 const inst_info = nav.srcInst(ip).resolveFull(ip).?;
2601 const file = zcu.fileByIndex(inst_info.file);2586 const file = zcu.fileByIndex(inst_info.file);
2602 assert(file.zir_loaded);2587 assert(file.zir_loaded);
2603 const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst));2588 const decl = file.zir.getDeclaration(inst_info.inst)[0];
2604 assert(decl_inst.tag == .declaration);
2605 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index);
26062589
2607 const is_test = switch (decl_extra.data.name) {2590 const is_test = switch (decl.name) {
2608 .unnamed_test => true,2591 .unnamed_test => true,
2609 .@"comptime", .@"usingnamespace" => false,2592 .@"comptime", .@"usingnamespace" => false,
2610 _ => decl_extra.data.name.isNamedTest(file.zir),2593 _ => decl.name.isNamedTest(file.zir),
2611 };2594 };
2612 if (is_test) {2595 if (is_test) {
2613 // This isn't actually a comptime Nav! It's a test, so it'll definitely never be referenced at comptime.2596 // This isn't actually a comptime Nav! It's a test, so it'll definitely never be referenced at comptime.
...@@ -2618,14 +2601,10 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2618,14 +2601,10 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2618 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);2601 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
2619 break :parent .{2602 break :parent .{
2620 parent_namespace_ptr.owner_type,2603 parent_namespace_ptr.owner_type,
2621 if (decl_extra.data.flags.is_pub) DW.ACCESS.public else DW.ACCESS.private,2604 if (decl.flags.is_pub) DW.ACCESS.public else DW.ACCESS.private,
2622 };2605 };
2623 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };2606 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
26242607
2625 const tree = try file.getTree(dwarf.gpa);
2626 const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]);
2627 assert(loc.line == zcu.navSrcLine(nav_index));
2628
2629 var wip_nav: WipNav = .{2608 var wip_nav: WipNav = .{
2630 .dwarf = dwarf,2609 .dwarf = dwarf,
2631 .pt = pt,2610 .pt = pt,
...@@ -2688,8 +2667,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2688,8 +2667,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2688 try wip_nav.abbrevCode(if (loaded_struct.field_types.len == 0) .decl_namespace_struct else .decl_struct);2667 try wip_nav.abbrevCode(if (loaded_struct.field_types.len == 0) .decl_namespace_struct else .decl_struct);
2689 try wip_nav.refType(.fromInterned(parent_type));2668 try wip_nav.refType(.fromInterned(parent_type));
2690 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2669 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2691 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2670 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2692 try uleb128(diw, loc.column + 1);2671 try uleb128(diw, decl.src_column + 1);
2693 try diw.writeByte(accessibility);2672 try diw.writeByte(accessibility);
2694 try wip_nav.strp(nav.name.toSlice(ip));2673 try wip_nav.strp(nav.name.toSlice(ip));
2695 if (loaded_struct.field_types.len == 0) try diw.writeByte(@intFromBool(false)) else {2674 if (loaded_struct.field_types.len == 0) try diw.writeByte(@intFromBool(false)) else {
...@@ -2748,8 +2727,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2748,8 +2727,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2748 try wip_nav.abbrevCode(.decl_packed_struct);2727 try wip_nav.abbrevCode(.decl_packed_struct);
2749 try wip_nav.refType(.fromInterned(parent_type));2728 try wip_nav.refType(.fromInterned(parent_type));
2750 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2729 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2751 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2730 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2752 try uleb128(diw, loc.column + 1);2731 try uleb128(diw, decl.src_column + 1);
2753 try diw.writeByte(accessibility);2732 try diw.writeByte(accessibility);
2754 try wip_nav.strp(nav.name.toSlice(ip));2733 try wip_nav.strp(nav.name.toSlice(ip));
2755 try wip_nav.refType(.fromInterned(loaded_struct.backingIntTypeUnordered(ip)));2734 try wip_nav.refType(.fromInterned(loaded_struct.backingIntTypeUnordered(ip)));
...@@ -2790,8 +2769,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2790,8 +2769,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2790 try wip_nav.abbrevCode(if (loaded_enum.names.len > 0) .decl_enum else .decl_empty_enum);2769 try wip_nav.abbrevCode(if (loaded_enum.names.len > 0) .decl_enum else .decl_empty_enum);
2791 try wip_nav.refType(.fromInterned(parent_type));2770 try wip_nav.refType(.fromInterned(parent_type));
2792 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2771 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2793 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2772 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2794 try uleb128(diw, loc.column + 1);2773 try uleb128(diw, decl.src_column + 1);
2795 try diw.writeByte(accessibility);2774 try diw.writeByte(accessibility);
2796 try wip_nav.strp(nav.name.toSlice(ip));2775 try wip_nav.strp(nav.name.toSlice(ip));
2797 try wip_nav.refType(.fromInterned(loaded_enum.tag_ty));2776 try wip_nav.refType(.fromInterned(loaded_enum.tag_ty));
...@@ -2828,8 +2807,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2828,8 +2807,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2828 try wip_nav.abbrevCode(.decl_union);2807 try wip_nav.abbrevCode(.decl_union);
2829 try wip_nav.refType(.fromInterned(parent_type));2808 try wip_nav.refType(.fromInterned(parent_type));
2830 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2809 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2831 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2810 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2832 try uleb128(diw, loc.column + 1);2811 try uleb128(diw, decl.src_column + 1);
2833 try diw.writeByte(accessibility);2812 try diw.writeByte(accessibility);
2834 try wip_nav.strp(nav.name.toSlice(ip));2813 try wip_nav.strp(nav.name.toSlice(ip));
2835 const union_layout = Type.getUnionLayout(loaded_union, zcu);2814 const union_layout = Type.getUnionLayout(loaded_union, zcu);
...@@ -2902,8 +2881,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2902,8 +2881,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2902 try wip_nav.abbrevCode(.decl_namespace_struct);2881 try wip_nav.abbrevCode(.decl_namespace_struct);
2903 try wip_nav.refType(.fromInterned(parent_type));2882 try wip_nav.refType(.fromInterned(parent_type));
2904 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2883 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2905 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2884 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2906 try uleb128(diw, loc.column + 1);2885 try uleb128(diw, decl.src_column + 1);
2907 try diw.writeByte(accessibility);2886 try diw.writeByte(accessibility);
2908 try wip_nav.strp(nav.name.toSlice(ip));2887 try wip_nav.strp(nav.name.toSlice(ip));
2909 try diw.writeByte(@intFromBool(false));2888 try diw.writeByte(@intFromBool(false));
...@@ -2958,8 +2937,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2958,8 +2937,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2958 .decl_empty_func_generic);2937 .decl_empty_func_generic);
2959 try wip_nav.refType(.fromInterned(parent_type));2938 try wip_nav.refType(.fromInterned(parent_type));
2960 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2939 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2961 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2940 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2962 try uleb128(diw, loc.column + 1);2941 try uleb128(diw, decl.src_column + 1);
2963 try diw.writeByte(accessibility);2942 try diw.writeByte(accessibility);
2964 try wip_nav.strp(nav.name.toSlice(ip));2943 try wip_nav.strp(nav.name.toSlice(ip));
2965 try wip_nav.refType(.fromInterned(func_type.return_type));2944 try wip_nav.refType(.fromInterned(func_type.return_type));
...@@ -2990,8 +2969,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2990,8 +2969,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2990 try wip_nav.abbrevCode(.decl_alias);2969 try wip_nav.abbrevCode(.decl_alias);
2991 try wip_nav.refType(.fromInterned(parent_type));2970 try wip_nav.refType(.fromInterned(parent_type));
2992 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2971 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
2993 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2972 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
2994 try uleb128(diw, loc.column + 1);2973 try uleb128(diw, decl.src_column + 1);
2995 try diw.writeByte(accessibility);2974 try diw.writeByte(accessibility);
2996 try wip_nav.strp(nav.name.toSlice(ip));2975 try wip_nav.strp(nav.name.toSlice(ip));
2997 try wip_nav.refType(nav_val.toType());2976 try wip_nav.refType(nav_val.toType());
...@@ -3001,8 +2980,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -3001,8 +2980,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
3001 try wip_nav.abbrevCode(.decl_var);2980 try wip_nav.abbrevCode(.decl_var);
3002 try wip_nav.refType(.fromInterned(parent_type));2981 try wip_nav.refType(.fromInterned(parent_type));
3003 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));2982 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
3004 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);2983 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
3005 try uleb128(diw, loc.column + 1);2984 try uleb128(diw, decl.src_column + 1);
3006 try diw.writeByte(accessibility);2985 try diw.writeByte(accessibility);
3007 try wip_nav.strp(nav.name.toSlice(ip));2986 try wip_nav.strp(nav.name.toSlice(ip));
3008 try wip_nav.strp(nav.fqn.toSlice(ip));2987 try wip_nav.strp(nav.fqn.toSlice(ip));
...@@ -3028,8 +3007,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -3028,8 +3007,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
3028 .decl_const);3007 .decl_const);
3029 try wip_nav.refType(.fromInterned(parent_type));3008 try wip_nav.refType(.fromInterned(parent_type));
3030 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));3009 assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf));
3031 try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian);3010 try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian);
3032 try uleb128(diw, loc.column + 1);3011 try uleb128(diw, decl.src_column + 1);
3033 try diw.writeByte(accessibility);3012 try diw.writeByte(accessibility);
3034 try wip_nav.strp(nav.name.toSlice(ip));3013 try wip_nav.strp(nav.name.toSlice(ip));
3035 try wip_nav.strp(nav.fqn.toSlice(ip));3014 try wip_nav.strp(nav.fqn.toSlice(ip));