mirror of
https://github.com/ziglang/zig.git
synced 2025-12-12 17:23:09 +00:00
Don't attach a top-level function to its file, but to the file's struct
This commit is contained in:
parent
359bbdd574
commit
b4eb812305
@ -1642,17 +1642,19 @@ pub const Object = struct {
|
|||||||
|
|
||||||
const file, const subprogram = if (!wip.strip) debug_info: {
|
const file, const subprogram = if (!wip.strip) debug_info: {
|
||||||
const file = try o.getDebugFile(file_scope);
|
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 line_number = decl.navSrcLine(zcu) + 1;
|
||||||
const is_internal_linkage = decl.val.getExternFunc(zcu) == null;
|
const is_internal_linkage = decl.val.getExternFunc(zcu) == null;
|
||||||
const debug_decl_type = try o.lowerDebugType(decl.typeOf(zcu), true);
|
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(
|
const subprogram = try o.builder.debugSubprogram(
|
||||||
file,
|
file,
|
||||||
scope,
|
scope,
|
||||||
try o.builder.metadataString(decl.name.toSlice(ip)),
|
decl_name,
|
||||||
try o.builder.metadataStringFromStrtabString(function_index.name(&o.builder)),
|
link_name,
|
||||||
line_number,
|
line_number,
|
||||||
line_number + func.lbrace_line,
|
line_number + func.lbrace_line,
|
||||||
debug_decl_type,
|
debug_decl_type,
|
||||||
@ -1669,6 +1671,7 @@ pub const Object = struct {
|
|||||||
},
|
},
|
||||||
o.debug_compile_unit,
|
o.debug_compile_unit,
|
||||||
);
|
);
|
||||||
|
|
||||||
function_index.setSubprogram(subprogram, &o.builder);
|
function_index.setSubprogram(subprogram, &o.builder);
|
||||||
break :debug_info .{ file, subprogram };
|
break :debug_info .{ file, subprogram };
|
||||||
} else .{.none} ** 2;
|
} else .{.none} ** 2;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user