diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-05-16 00:04:16 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-05-16 00:04:16 -0700 |
| commit | c8b78706b74d16ed21113096d2b47717abb53d4d (patch) | |
| tree | 39a61c5dcc06ac8fd1afe128f2239f3700347638 /src | |
| parent | ae04ec776d87eb6312b9172fc494f1ab25c1c52e (diff) | |
| download | zig-c8b78706b74d16ed21113096d2b47717abb53d4d.tar.gz zig-c8b78706b74d16ed21113096d2b47717abb53d4d.zip | |
linker: update MachO DebugSymbols to use the new line/column Decl API
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/MachO/DebugSymbols.zig | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/link/MachO/DebugSymbols.zig b/src/link/MachO/DebugSymbols.zig index 6dcd4973aa..38cb9c0bb0 100644 --- a/src/link/MachO/DebugSymbols.zig +++ b/src/link/MachO/DebugSymbols.zig @@ -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); } |
