| ... | @@ -2259,30 +2259,23 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In | ... | @@ -2259,30 +2259,23 @@ 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)); | | |
| 2267 | | 2263 | |
| 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.private | 2274 | DW.ACCESS.private |
| 2280 | else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu })) | 2275 | else if (decl.flags.is_pub) |
| 2281 | DW.ACCESS.public | 2276 | DW.ACCESS.public |
| 2282 | else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu })) | | |
| 2283 | DW.ACCESS.private | | |
| 2284 | else | 2277 | else |
| 2285 | unreachable, | 2278 | DW.ACCESS.private, |
| 2286 | }, | 2279 | }, |
| 2287 | }; | 2280 | }; |
| 2288 | } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private }; | 2281 | } 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 | ... | @@ -2291,8 +2284,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In |
| 2291 | try wip_nav.abbrevCode(.decl_var); | 2284 | try wip_nav.abbrevCode(.decl_var); |
| 2292 | try wip_nav.refType(.fromInterned(parent_type)); | 2285 | try wip_nav.refType(.fromInterned(parent_type)); |
| 2293 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2286 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 2294 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2287 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 2295 | try uleb128(diw, loc.column + 1); | 2288 | try uleb128(diw, decl.src_column + 1); |
| 2296 | try diw.writeByte(accessibility); | 2289 | try diw.writeByte(accessibility); |
| 2297 | try wip_nav.strp(nav.name.toSlice(ip)); | 2290 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 2298 | try wip_nav.strp(nav.fqn.toSlice(ip)); | 2291 | 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 | ... | @@ -2308,30 +2301,23 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In |
| 2308 | }, | 2301 | }, |
| 2309 | .variable => |variable| { | 2302 | .variable => |variable| { |
| 2310 | assert(file.zir_loaded); | 2303 | assert(file.zir_loaded); |
| 2311 | const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst)); | 2304 | const decl = file.zir.getDeclaration(inst_info.inst)[0]; |
| 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)); | | |
| 2316 | | 2305 | |
| 2317 | 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: { |
| 2318 | const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index).data; | | |
| 2319 | const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace); | 2307 | const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace); |
| 2320 | break :parent .{ | 2308 | break :parent .{ |
| 2321 | parent_namespace_ptr.owner_type, | 2309 | parent_namespace_ptr.owner_type, |
| 2322 | switch (decl_extra.name) { | 2310 | switch (decl.name) { |
| 2323 | .@"comptime", | 2311 | .@"comptime", |
| 2324 | .@"usingnamespace", | 2312 | .@"usingnamespace", |
| 2325 | .unnamed_test, | 2313 | .unnamed_test, |
| 2326 | => DW.ACCESS.private, | 2314 | => DW.ACCESS.private, |
| 2327 | _ => if (decl_extra.name.isNamedTest(file.zir)) | 2315 | _ => if (decl.name.isNamedTest(file.zir)) |
| 2328 | DW.ACCESS.private | 2316 | DW.ACCESS.private |
| 2329 | else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu })) | 2317 | else if (decl.flags.is_pub) |
| 2330 | DW.ACCESS.public | 2318 | DW.ACCESS.public |
| 2331 | else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu })) | | |
| 2332 | DW.ACCESS.private | | |
| 2333 | else | 2319 | else |
| 2334 | unreachable, | 2320 | DW.ACCESS.private, |
| 2335 | }, | 2321 | }, |
| 2336 | }; | 2322 | }; |
| 2337 | } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private }; | 2323 | } 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 | ... | @@ -2340,8 +2326,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In |
| 2340 | try wip_nav.abbrevCode(.decl_var); | 2326 | try wip_nav.abbrevCode(.decl_var); |
| 2341 | try wip_nav.refType(.fromInterned(parent_type)); | 2327 | try wip_nav.refType(.fromInterned(parent_type)); |
| 2342 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2328 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 2343 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2329 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 2344 | try uleb128(diw, loc.column + 1); | 2330 | try uleb128(diw, decl.src_column + 1); |
| 2345 | try diw.writeByte(accessibility); | 2331 | try diw.writeByte(accessibility); |
| 2346 | try wip_nav.strp(nav.name.toSlice(ip)); | 2332 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 2347 | try wip_nav.strp(nav.fqn.toSlice(ip)); | 2333 | 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 | ... | @@ -2355,30 +2341,23 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In |
| 2355 | }, | 2341 | }, |
| 2356 | .func => |func| { | 2342 | .func => |func| { |
| 2357 | assert(file.zir_loaded); | 2343 | assert(file.zir_loaded); |
| 2358 | const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst)); | 2344 | const decl = file.zir.getDeclaration(inst_info.inst)[0]; |
| 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)); | | |
| 2363 | | 2345 | |
| 2364 | 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: { |
| 2365 | const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index).data; | | |
| 2366 | const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace); | 2347 | const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace); |
| 2367 | break :parent .{ | 2348 | break :parent .{ |
| 2368 | parent_namespace_ptr.owner_type, | 2349 | parent_namespace_ptr.owner_type, |
| 2369 | switch (decl_extra.name) { | 2350 | switch (decl.name) { |
| 2370 | .@"comptime", | 2351 | .@"comptime", |
| 2371 | .@"usingnamespace", | 2352 | .@"usingnamespace", |
| 2372 | .unnamed_test, | 2353 | .unnamed_test, |
| 2373 | => DW.ACCESS.private, | 2354 | => DW.ACCESS.private, |
| 2374 | _ => if (decl_extra.name.isNamedTest(file.zir)) | 2355 | _ => if (decl.name.isNamedTest(file.zir)) |
| 2375 | DW.ACCESS.private | 2356 | DW.ACCESS.private |
| 2376 | else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu })) | 2357 | else if (decl.flags.is_pub) |
| 2377 | DW.ACCESS.public | 2358 | DW.ACCESS.public |
| 2378 | else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu })) | | |
| 2379 | DW.ACCESS.private | | |
| 2380 | else | 2359 | else |
| 2381 | unreachable, | 2360 | DW.ACCESS.private, |
| 2382 | }, | 2361 | }, |
| 2383 | }; | 2362 | }; |
| 2384 | } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private }; | 2363 | } 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 | ... | @@ -2432,8 +2411,8 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In |
| 2432 | try wip_nav.abbrevCode(.decl_func); | 2411 | try wip_nav.abbrevCode(.decl_func); |
| 2433 | try wip_nav.refType(.fromInterned(parent_type)); | 2412 | try wip_nav.refType(.fromInterned(parent_type)); |
| 2434 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2413 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 2435 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2414 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 2436 | try uleb128(diw, loc.column + 1); | 2415 | try uleb128(diw, decl.src_column + 1); |
| 2437 | try diw.writeByte(accessibility); | 2416 | try diw.writeByte(accessibility); |
| 2438 | try wip_nav.strp(nav.name.toSlice(ip)); | 2417 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 2439 | try wip_nav.strp(nav.fqn.toSlice(ip)); | 2418 | 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 | ... | @@ -2482,7 +2461,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In |
| 2482 | try dlw.writeByte(DW.LNS.set_column); | 2461 | try dlw.writeByte(DW.LNS.set_column); |
| 2483 | try uleb128(dlw, func.lbrace_column + 1); | 2462 | try uleb128(dlw, func.lbrace_column + 1); |
| 2484 | | 2463 | |
| 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); |
| 2486 | } | 2465 | } |
| 2487 | }, | 2466 | }, |
| 2488 | } | 2467 | } |
| ... | @@ -2606,14 +2585,12 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2606,14 +2585,12 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2606 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; | 2585 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; |
| 2607 | const file = zcu.fileByIndex(inst_info.file); | 2586 | const file = zcu.fileByIndex(inst_info.file); |
| 2608 | assert(file.zir_loaded); | 2587 | assert(file.zir_loaded); |
| 2609 | const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst)); | 2588 | const decl = file.zir.getDeclaration(inst_info.inst)[0]; |
| 2610 | assert(decl_inst.tag == .declaration); | | |
| 2611 | const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index); | | |
| 2612 | | 2589 | |
| 2613 | const is_test = switch (decl_extra.data.name) { | 2590 | const is_test = switch (decl.name) { |
| 2614 | .unnamed_test => true, | 2591 | .unnamed_test => true, |
| 2615 | .@"comptime", .@"usingnamespace" => false, | 2592 | .@"comptime", .@"usingnamespace" => false, |
| 2616 | _ => decl_extra.data.name.isNamedTest(file.zir), | 2593 | _ => decl.name.isNamedTest(file.zir), |
| 2617 | }; | 2594 | }; |
| 2618 | if (is_test) { | 2595 | if (is_test) { |
| 2619 | // 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. |
| ... | @@ -2624,19 +2601,10 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2624,19 +2601,10 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2624 | const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace); | 2601 | const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace); |
| 2625 | break :parent .{ | 2602 | break :parent .{ |
| 2626 | parent_namespace_ptr.owner_type, | 2603 | parent_namespace_ptr.owner_type, |
| 2627 | if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu })) | 2604 | if (decl.flags.is_pub) DW.ACCESS.public else DW.ACCESS.private, |
| 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, | | |
| 2633 | }; | 2605 | }; |
| 2634 | } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private }; | 2606 | } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private }; |
| 2635 | | 2607 | |
| 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 | | | |
| 2640 | var wip_nav: WipNav = .{ | 2608 | var wip_nav: WipNav = .{ |
| 2641 | .dwarf = dwarf, | 2609 | .dwarf = dwarf, |
| 2642 | .pt = pt, | 2610 | .pt = pt, |
| ... | @@ -2679,23 +2647,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2679,23 +2647,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2679 | const type_inst_info = loaded_struct.zir_index.resolveFull(ip).?; | 2647 | const type_inst_info = loaded_struct.zir_index.resolveFull(ip).?; |
| 2680 | if (type_inst_info.file != inst_info.file) break :tag .decl_alias; | 2648 | if (type_inst_info.file != inst_info.file) break :tag .decl_alias; |
| 2681 | | 2649 | |
| 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 | | | |
| 2699 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); | 2650 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); |
| 2700 | if (type_gop.found_existing) { | 2651 | if (type_gop.found_existing) { |
| 2701 | if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias; | 2652 | 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 | ... | @@ -2716,8 +2667,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2716 | 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); |
| 2717 | try wip_nav.refType(.fromInterned(parent_type)); | 2668 | try wip_nav.refType(.fromInterned(parent_type)); |
| 2718 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2669 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 2719 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2670 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 2720 | try uleb128(diw, loc.column + 1); | 2671 | try uleb128(diw, decl.src_column + 1); |
| 2721 | try diw.writeByte(accessibility); | 2672 | try diw.writeByte(accessibility); |
| 2722 | try wip_nav.strp(nav.name.toSlice(ip)); | 2673 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 2723 | 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 { |
| ... | @@ -2776,8 +2727,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2776,8 +2727,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2776 | try wip_nav.abbrevCode(.decl_packed_struct); | 2727 | try wip_nav.abbrevCode(.decl_packed_struct); |
| 2777 | try wip_nav.refType(.fromInterned(parent_type)); | 2728 | try wip_nav.refType(.fromInterned(parent_type)); |
| 2778 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2729 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 2779 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2730 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 2780 | try uleb128(diw, loc.column + 1); | 2731 | try uleb128(diw, decl.src_column + 1); |
| 2781 | try diw.writeByte(accessibility); | 2732 | try diw.writeByte(accessibility); |
| 2782 | try wip_nav.strp(nav.name.toSlice(ip)); | 2733 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 2783 | try wip_nav.refType(.fromInterned(loaded_struct.backingIntTypeUnordered(ip))); | 2734 | try wip_nav.refType(.fromInterned(loaded_struct.backingIntTypeUnordered(ip))); |
| ... | @@ -2802,23 +2753,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2802,23 +2753,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2802 | const type_inst_info = loaded_enum.zir_index.unwrap().?.resolveFull(ip).?; | 2753 | const type_inst_info = loaded_enum.zir_index.unwrap().?.resolveFull(ip).?; |
| 2803 | if (type_inst_info.file != inst_info.file) break :tag .decl_alias; | 2754 | if (type_inst_info.file != inst_info.file) break :tag .decl_alias; |
| 2804 | | 2755 | |
| 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 | | | |
| 2822 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); | 2756 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); |
| 2823 | if (type_gop.found_existing) { | 2757 | if (type_gop.found_existing) { |
| 2824 | if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias; | 2758 | 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 | ... | @@ -2835,8 +2769,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2835 | 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); |
| 2836 | try wip_nav.refType(.fromInterned(parent_type)); | 2770 | try wip_nav.refType(.fromInterned(parent_type)); |
| 2837 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2771 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 2838 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2772 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 2839 | try uleb128(diw, loc.column + 1); | 2773 | try uleb128(diw, decl.src_column + 1); |
| 2840 | try diw.writeByte(accessibility); | 2774 | try diw.writeByte(accessibility); |
| 2841 | try wip_nav.strp(nav.name.toSlice(ip)); | 2775 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 2842 | try wip_nav.refType(.fromInterned(loaded_enum.tag_ty)); | 2776 | try wip_nav.refType(.fromInterned(loaded_enum.tag_ty)); |
| ... | @@ -2857,23 +2791,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2857,23 +2791,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2857 | const type_inst_info = loaded_union.zir_index.resolveFull(ip).?; | 2791 | const type_inst_info = loaded_union.zir_index.resolveFull(ip).?; |
| 2858 | if (type_inst_info.file != inst_info.file) break :tag .decl_alias; | 2792 | if (type_inst_info.file != inst_info.file) break :tag .decl_alias; |
| 2859 | | 2793 | |
| 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 | | | |
| 2877 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); | 2794 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); |
| 2878 | if (type_gop.found_existing) { | 2795 | if (type_gop.found_existing) { |
| 2879 | if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias; | 2796 | 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 | ... | @@ -2890,8 +2807,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2890 | try wip_nav.abbrevCode(.decl_union); | 2807 | try wip_nav.abbrevCode(.decl_union); |
| 2891 | try wip_nav.refType(.fromInterned(parent_type)); | 2808 | try wip_nav.refType(.fromInterned(parent_type)); |
| 2892 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2809 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 2893 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2810 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 2894 | try uleb128(diw, loc.column + 1); | 2811 | try uleb128(diw, decl.src_column + 1); |
| 2895 | try diw.writeByte(accessibility); | 2812 | try diw.writeByte(accessibility); |
| 2896 | try wip_nav.strp(nav.name.toSlice(ip)); | 2813 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 2897 | const union_layout = Type.getUnionLayout(loaded_union, zcu); | 2814 | const union_layout = Type.getUnionLayout(loaded_union, zcu); |
| ... | @@ -2948,23 +2865,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2948,23 +2865,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2948 | const type_inst_info = loaded_opaque.zir_index.resolveFull(ip).?; | 2865 | const type_inst_info = loaded_opaque.zir_index.resolveFull(ip).?; |
| 2949 | if (type_inst_info.file != inst_info.file) break :tag .decl_alias; | 2866 | if (type_inst_info.file != inst_info.file) break :tag .decl_alias; |
| 2950 | | 2867 | |
| 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 | | | |
| 2968 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); | 2868 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); |
| 2969 | if (type_gop.found_existing) { | 2869 | if (type_gop.found_existing) { |
| 2970 | if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias; | 2870 | 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 | ... | @@ -2981,8 +2881,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2981 | try wip_nav.abbrevCode(.decl_namespace_struct); | 2881 | try wip_nav.abbrevCode(.decl_namespace_struct); |
| 2982 | try wip_nav.refType(.fromInterned(parent_type)); | 2882 | try wip_nav.refType(.fromInterned(parent_type)); |
| 2983 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2883 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 2984 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2884 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 2985 | try uleb128(diw, loc.column + 1); | 2885 | try uleb128(diw, decl.src_column + 1); |
| 2986 | try diw.writeByte(accessibility); | 2886 | try diw.writeByte(accessibility); |
| 2987 | try wip_nav.strp(nav.name.toSlice(ip)); | 2887 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 2988 | try diw.writeByte(@intFromBool(false)); | 2888 | try diw.writeByte(@intFromBool(false)); |
| ... | @@ -3037,8 +2937,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -3037,8 +2937,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 3037 | .decl_empty_func_generic); | 2937 | .decl_empty_func_generic); |
| 3038 | try wip_nav.refType(.fromInterned(parent_type)); | 2938 | try wip_nav.refType(.fromInterned(parent_type)); |
| 3039 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2939 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 3040 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2940 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 3041 | try uleb128(diw, loc.column + 1); | 2941 | try uleb128(diw, decl.src_column + 1); |
| 3042 | try diw.writeByte(accessibility); | 2942 | try diw.writeByte(accessibility); |
| 3043 | try wip_nav.strp(nav.name.toSlice(ip)); | 2943 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 3044 | try wip_nav.refType(.fromInterned(func_type.return_type)); | 2944 | try wip_nav.refType(.fromInterned(func_type.return_type)); |
| ... | @@ -3069,8 +2969,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -3069,8 +2969,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 3069 | try wip_nav.abbrevCode(.decl_alias); | 2969 | try wip_nav.abbrevCode(.decl_alias); |
| 3070 | try wip_nav.refType(.fromInterned(parent_type)); | 2970 | try wip_nav.refType(.fromInterned(parent_type)); |
| 3071 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2971 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 3072 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2972 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 3073 | try uleb128(diw, loc.column + 1); | 2973 | try uleb128(diw, decl.src_column + 1); |
| 3074 | try diw.writeByte(accessibility); | 2974 | try diw.writeByte(accessibility); |
| 3075 | try wip_nav.strp(nav.name.toSlice(ip)); | 2975 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 3076 | try wip_nav.refType(nav_val.toType()); | 2976 | try wip_nav.refType(nav_val.toType()); |
| ... | @@ -3080,8 +2980,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -3080,8 +2980,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 3080 | try wip_nav.abbrevCode(.decl_var); | 2980 | try wip_nav.abbrevCode(.decl_var); |
| 3081 | try wip_nav.refType(.fromInterned(parent_type)); | 2981 | try wip_nav.refType(.fromInterned(parent_type)); |
| 3082 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 2982 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 3083 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 2983 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 3084 | try uleb128(diw, loc.column + 1); | 2984 | try uleb128(diw, decl.src_column + 1); |
| 3085 | try diw.writeByte(accessibility); | 2985 | try diw.writeByte(accessibility); |
| 3086 | try wip_nav.strp(nav.name.toSlice(ip)); | 2986 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 3087 | try wip_nav.strp(nav.fqn.toSlice(ip)); | 2987 | try wip_nav.strp(nav.fqn.toSlice(ip)); |
| ... | @@ -3107,8 +3007,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -3107,8 +3007,8 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 3107 | .decl_const); | 3007 | .decl_const); |
| 3108 | try wip_nav.refType(.fromInterned(parent_type)); | 3008 | try wip_nav.refType(.fromInterned(parent_type)); |
| 3109 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); | 3009 | assert(wip_nav.debug_info.items.len == DebugInfo.declEntryLineOff(dwarf)); |
| 3110 | try diw.writeInt(u32, @intCast(loc.line + 1), dwarf.endian); | 3010 | try diw.writeInt(u32, @intCast(decl.src_line + 1), dwarf.endian); |
| 3111 | try uleb128(diw, loc.column + 1); | 3011 | try uleb128(diw, decl.src_column + 1); |
| 3112 | try diw.writeByte(accessibility); | 3012 | try diw.writeByte(accessibility); |
| 3113 | try wip_nav.strp(nav.name.toSlice(ip)); | 3013 | try wip_nav.strp(nav.name.toSlice(ip)); |
| 3114 | try wip_nav.strp(nav.fqn.toSlice(ip)); | 3014 | try wip_nav.strp(nav.fqn.toSlice(ip)); |