aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-02-26 05:27:26 -0500
committerJacob Young <jacobly0@users.noreply.github.com>2023-02-27 05:18:47 -0500
commit9e519727014fcc484714d8230a0a8bce8744998d (patch)
treeae36057271dbb16f4932b3e6b9d48ffadf19ca32 /src/codegen
parentf6c934677315665c140151b8dd28a56f948205e2 (diff)
downloadzig-9e519727014fcc484714d8230a0a8bce8744998d.tar.gz
zig-9e519727014fcc484714d8230a0a8bce8744998d.zip
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.
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/llvm.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 558556f108..6f240b88f5 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -2214,11 +2214,16 @@ pub const Object = struct {
));
}
- const union_name = if (layout.tag_size == 0) name.ptr else "AnonUnion";
+ var union_name_buf: ?[:0]const u8 = null;
+ defer if (union_name_buf) |buf| gpa.free(buf);
+ const union_name = if (layout.tag_size == 0) name else name: {
+ union_name_buf = try std.fmt.allocPrintZ(gpa, "{s}:Payload", .{name});
+ break :name union_name_buf.?;
+ };
const union_di_ty = dib.createUnionType(
compile_unit_scope,
- union_name,
+ union_name.ptr,
null, // file
0, // line
ty.abiSize(target) * 8, // size in bits