authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-02-26 05:27:26-05:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-02-27 05:18:47-05:00
log9e519727014fcc484714d8230a0a8bce8744998d
treeae36057271dbb16f4932b3e6b9d48ffadf19ca32
parentf6c934677315665c140151b8dd28a56f948205e2

llvm: fix untagged struct names in debug info for llvm (again)

At least lldb misbehaves with all these same-named unions, so just generate a unique name.

1 files changed, 7 insertions(+), 2 deletions(-)

src/codegen/llvm.zig+7-2
...@@ -2214,11 +2214,16 @@ pub const Object = struct {...@@ -2214,11 +2214,16 @@ pub const Object = struct {
2214 ));2214 ));
2215 }2215 }
22162216
2217 const union_name = if (layout.tag_size == 0) name.ptr else "AnonUnion";2217 var union_name_buf: ?[:0]const u8 = null;
2218 defer if (union_name_buf) |buf| gpa.free(buf);
2219 const union_name = if (layout.tag_size == 0) name else name: {
2220 union_name_buf = try std.fmt.allocPrintZ(gpa, "{s}:Payload", .{name});
2221 break :name union_name_buf.?;
2222 };
22182223
2219 const union_di_ty = dib.createUnionType(2224 const union_di_ty = dib.createUnionType(
2220 compile_unit_scope,2225 compile_unit_scope,
2221 union_name,2226 union_name.ptr,
2222 null, // file2227 null, // file
2223 0, // line2228 0, // line
2224 ty.abiSize(target) * 8, // size in bits2229 ty.abiSize(target) * 8, // size in bits