authorgravatar for jonathan.haehne@hotmail.comTau <jonathan.haehne@hotmail.com> 2024-06-21 15:10:05+02:00
committergravatar for jonathan.haehne@hotmail.comTau <jonathan.haehne@hotmail.com> 2024-07-19 17:51:38+02:00
logb4eb81230500e0e35f2017113eb4ed03be6acfb8
treeacb83ae3c00d98de58c1db285d13c72ddddbaf54
parent359bbdd5748779a4e1b12706e0be704cfacb5078

Don't attach a top-level function to its file, but to the file's struct


1 files changed, 6 insertions(+), 3 deletions(-)

src/codegen/llvm.zig+6-3
......@@ -1642,17 +1642,19 @@ pub const Object = struct {
16421642
16431643 const file, const subprogram = if (!wip.strip) debug_info: {
16441644 const file = try o.getDebugFile(file_scope);
1645 const scope = try o.namespaceToDebugScope(decl.src_namespace);
1645 const scope = try o.lowerDebugType(zcu.declPtr(namespace.decl_index).val.toType(), false);
16461646
16471647 const line_number = decl.navSrcLine(zcu) + 1;
16481648 const is_internal_linkage = decl.val.getExternFunc(zcu) == null;
16491649 const debug_decl_type = try o.lowerDebugType(decl.typeOf(zcu), true);
1650 const decl_name = try o.builder.metadataString(decl.name.toSlice(ip));
1651 const link_name = try o.builder.metadataStringFromStrtabString(function_index.name(&o.builder));
16501652
16511653 const subprogram = try o.builder.debugSubprogram(
16521654 file,
16531655 scope,
1654 try o.builder.metadataString(decl.name.toSlice(ip)),
1655 try o.builder.metadataStringFromStrtabString(function_index.name(&o.builder)),
1656 decl_name,
1657 link_name,
16561658 line_number,
16571659 line_number + func.lbrace_line,
16581660 debug_decl_type,
......@@ -1669,6 +1671,7 @@ pub const Object = struct {
16691671 },
16701672 o.debug_compile_unit,
16711673 );
1674
16721675 function_index.setSubprogram(subprogram, &o.builder);
16731676 break :debug_info .{ file, subprogram };
16741677 } else .{.none} ** 2;