| ... | ... | @@ -1063,22 +1063,8 @@ pub fn commitDeclDebugInfo( |
| 1063 | 1063 | try leb.writeULEB128(dbg_line_buffer.writer(), text_block.size); |
| 1064 | 1064 | |
| 1065 | 1065 | try dbg_line_buffer.append(DW.LNS_advance_line); |
| 1066 | | const line_off: u28 = blk: { |
| 1067 | | const tree = decl.container.file_scope.tree; |
| 1068 | | const node_tags = tree.nodes.items(.tag); |
| 1069 | | const node_datas = tree.nodes.items(.data); |
| 1070 | | const token_starts = tree.tokens.items(.start); |
| 1071 | | |
| 1072 | | // TODO Look into improving the performance here by adding a token-index-to-line |
| 1073 | | // lookup table. Currently this involves scanning over the source code for newlines. |
| 1074 | | const fn_decl = decl.src_node; |
| 1075 | | assert(node_tags[fn_decl] == .fn_decl); |
| 1076 | | const block = node_datas[fn_decl].rhs; |
| 1077 | | const lbrace = tree.firstToken(block); |
| 1078 | | const rbrace = tree.lastToken(block); |
| 1079 | | const line_delta = std.zig.lineDelta(tree.source, token_starts[lbrace], token_starts[rbrace]); |
| 1080 | | break :blk @intCast(u28, line_delta); |
| 1081 | | }; |
| 1066 | const func = decl.val.castTag(.function).?.data; |
| 1067 | const line_off = @intCast(u28, decl.src_line + func.lbrace_line); |
| 1082 | 1068 | try leb.writeULEB128(dbg_line_buffer.writer(), line_off); |
| 1083 | 1069 | } |
| 1084 | 1070 | |