authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-08-14 22:17:25-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-09-03 12:59:38-04:00
logccb22d831699263b4c43e6d8c1b8b3538deac4bc
tree89fbc3124d9f1309cc12d4ba4e7b9a2f9701d7ef
parent1b9e78d8e538c023281d597960ec15ca9e2211ad

Dwarf2: fix incremental test failure with lost incomplete container type


1 files changed, 10 insertions(+), 9 deletions(-)

src/link/Dwarf2.zig+10-9
...@@ -2188,25 +2188,26 @@ fn updateConstIncompleteInner(...@@ -2188,25 +2188,26 @@ fn updateConstIncompleteInner(
2188 },2188 },
2189 },2189 },
2190 };2190 };
2191 const src_inst = zir_index.resolveFull(ip) orelse {
2192 try diw.writeUleb128(try dwarf.refAbbrevCode(.decl_lost));
2193 break :done;
2194 };
2191 if (maybe_name_nav.unwrap()) |name_nav| {2195 if (maybe_name_nav.unwrap()) |name_nav| {
2192 const src_inst = ip.getNav(name_nav).srcInst(ip).resolveFull(ip).?;2196 const name_src_inst = ip.getNav(name_nav).srcInst(ip).resolve(ip).?;
2193 const decl = zcu.fileByIndex(src_inst.file).zir.?.getDeclaration(src_inst.inst);2197 const decl = zcu.fileByIndex(src_inst.file).zir.?.getDeclaration(name_src_inst);
2194 const parent_cpi = try dwarf.getConst(pt, .fromInterned(zcu.fileRootType(src_inst.file)));2198 const parent_cpi = try dwarf.getConst(pt, .fromInterned(zcu.fileRootType(src_inst.file)));
2195 try diw.writeUleb128(try dwarf.refAbbrevCode(.decl_func_generic));2199 try diw.writeUleb128(try dwarf.refAbbrevCode(.decl_namespace_struct));
2196 try dwarf.sectionOffset(di_nw, Const.get(parent_cpi, dwarf).debug_info_ni.unwrap().?, 0);2200 try dwarf.sectionOffset(di_nw, Const.get(parent_cpi, dwarf).debug_info_ni.unwrap().?, 0);
2197 try diw.writeInt(u32, decl.src_line + 1, dwarf.endian);2201 try diw.writeInt(u32, decl.src_line + 1, dwarf.endian);
2198 try diw.writeUleb128(decl.src_column + 1);2202 try diw.writeUleb128(decl.src_column + 1);
2199 try diw.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private);2203 try diw.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private);
2200 try dwarf.strp(&dwarf.debug_str, di_nw, name.toSlice(ip));
2201 try diw.writeUleb128(@backingInt(AbbrevCode.null));
2202 } else {2204 } else {
2203 const zfi = zir_index.resolveFile(ip);2205 const ui = dwarf.getUnit(zcu.fileByIndex(src_inst.file).mod.?);
2204 const ui = dwarf.getUnit(zcu.fileByIndex(zfi).mod.?);2206 _, const fi = try ui.get(dwarf).getFile(comp.gpa, ui, src_inst.file);
2205 _, const fi = try ui.get(dwarf).getFile(comp.gpa, ui, zfi);
2206 try diw.writeUleb128(try dwarf.refAbbrevCode(.empty_struct_type));2207 try diw.writeUleb128(try dwarf.refAbbrevCode(.empty_struct_type));
2207 try diw.writeUleb128(@backingInt(fi));2208 try diw.writeUleb128(@backingInt(fi));
2208 try dwarf.strp(&dwarf.debug_str, di_nw, name.toSlice(ip));
2209 }2209 }
2210 try dwarf.strp(&dwarf.debug_str, di_nw, name.toSlice(ip));
2210 try diw.writeByte(@intFromBool(true));2211 try diw.writeByte(@intFromBool(true));
2211 }2212 }
2212 try dwarf.genDebugInfoPadding(diw, diw.unusedCapacityLen());2213 try dwarf.genDebugInfoPadding(diw, diw.unusedCapacityLen());