mirror of
https://github.com/ziglang/zig.git
synced 2026-01-05 04:53:17 +00:00
linker: update MachO DebugSymbols to use the new line/column Decl API
This commit is contained in:
parent
ae04ec776d
commit
c8b78706b7
@ -1063,22 +1063,8 @@ pub fn commitDeclDebugInfo(
|
||||
try leb.writeULEB128(dbg_line_buffer.writer(), text_block.size);
|
||||
|
||||
try dbg_line_buffer.append(DW.LNS_advance_line);
|
||||
const line_off: u28 = blk: {
|
||||
const tree = decl.container.file_scope.tree;
|
||||
const node_tags = tree.nodes.items(.tag);
|
||||
const node_datas = tree.nodes.items(.data);
|
||||
const token_starts = tree.tokens.items(.start);
|
||||
|
||||
// TODO Look into improving the performance here by adding a token-index-to-line
|
||||
// lookup table. Currently this involves scanning over the source code for newlines.
|
||||
const fn_decl = decl.src_node;
|
||||
assert(node_tags[fn_decl] == .fn_decl);
|
||||
const block = node_datas[fn_decl].rhs;
|
||||
const lbrace = tree.firstToken(block);
|
||||
const rbrace = tree.lastToken(block);
|
||||
const line_delta = std.zig.lineDelta(tree.source, token_starts[lbrace], token_starts[rbrace]);
|
||||
break :blk @intCast(u28, line_delta);
|
||||
};
|
||||
const func = decl.val.castTag(.function).?.data;
|
||||
const line_off = @intCast(u28, decl.src_line + func.lbrace_line);
|
||||
try leb.writeULEB128(dbg_line_buffer.writer(), line_off);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user