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 {...@@ -1642,17 +1642,19 @@ pub const Object = struct {
16421642
1643 const file, const subprogram = if (!wip.strip) debug_info: {1643 const file, const subprogram = if (!wip.strip) debug_info: {
1644 const file = try o.getDebugFile(file_scope);1644 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
1647 const line_number = decl.navSrcLine(zcu) + 1;1647 const line_number = decl.navSrcLine(zcu) + 1;
1648 const is_internal_linkage = decl.val.getExternFunc(zcu) == null;1648 const is_internal_linkage = decl.val.getExternFunc(zcu) == null;
1649 const debug_decl_type = try o.lowerDebugType(decl.typeOf(zcu), true);1649 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
1651 const subprogram = try o.builder.debugSubprogram(1653 const subprogram = try o.builder.debugSubprogram(
1652 file,1654 file,
1653 scope,1655 scope,
1654 try o.builder.metadataString(decl.name.toSlice(ip)),1656 decl_name,
1655 try o.builder.metadataStringFromStrtabString(function_index.name(&o.builder)),1657 link_name,
1656 line_number,1658 line_number,
1657 line_number + func.lbrace_line,1659 line_number + func.lbrace_line,
1658 debug_decl_type,1660 debug_decl_type,
...@@ -1669,6 +1671,7 @@ pub const Object = struct {...@@ -1669,6 +1671,7 @@ pub const Object = struct {
1669 },1671 },
1670 o.debug_compile_unit,1672 o.debug_compile_unit,
1671 );1673 );
1674
1672 function_index.setSubprogram(subprogram, &o.builder);1675 function_index.setSubprogram(subprogram, &o.builder);
1673 break :debug_info .{ file, subprogram };1676 break :debug_info .{ file, subprogram };
1674 } else .{.none} ** 2;1677 } else .{.none} ** 2;