aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorTau <jonathan.haehne@hotmail.com>2024-06-21 15:10:05 +0200
committerTau <jonathan.haehne@hotmail.com>2024-07-19 17:51:38 +0200
commitb4eb81230500e0e35f2017113eb4ed03be6acfb8 (patch)
treeacb83ae3c00d98de58c1db285d13c72ddddbaf54 /src/codegen
parent359bbdd5748779a4e1b12706e0be704cfacb5078 (diff)
downloadzig-b4eb81230500e0e35f2017113eb4ed03be6acfb8.tar.gz
zig-b4eb81230500e0e35f2017113eb4ed03be6acfb8.zip
Don't attach a top-level function to its file, but to the file's struct
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/llvm.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 4018c9eead..f7472fe4bc 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -1642,17 +1642,19 @@ pub const Object = struct {
const file, const subprogram = if (!wip.strip) debug_info: {
const file = try o.getDebugFile(file_scope);
- const scope = try o.namespaceToDebugScope(decl.src_namespace);
+ const scope = try o.lowerDebugType(zcu.declPtr(namespace.decl_index).val.toType(), false);
const line_number = decl.navSrcLine(zcu) + 1;
const is_internal_linkage = decl.val.getExternFunc(zcu) == null;
const debug_decl_type = try o.lowerDebugType(decl.typeOf(zcu), true);
+ const decl_name = try o.builder.metadataString(decl.name.toSlice(ip));
+ const link_name = try o.builder.metadataStringFromStrtabString(function_index.name(&o.builder));
const subprogram = try o.builder.debugSubprogram(
file,
scope,
- try o.builder.metadataString(decl.name.toSlice(ip)),
- try o.builder.metadataStringFromStrtabString(function_index.name(&o.builder)),
+ decl_name,
+ link_name,
line_number,
line_number + func.lbrace_line,
debug_decl_type,
@@ -1669,6 +1671,7 @@ pub const Object = struct {
},
o.debug_compile_unit,
);
+
function_index.setSubprogram(subprogram, &o.builder);
break :debug_info .{ file, subprogram };
} else .{.none} ** 2;