authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-03-15 15:11:35+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-03-16 09:27:31+02:00
log0f112b9f6d390ad4c95b7bf214a8243ad9e3b9a7
tree88a196d9aa23eb08a7ce27fd5f48af2fe94e3623
parentaf2b03de83b8ec60c967e53823496904ecc66c0d

AstGen: emit dbg_stmt before function calls and branch conditions


1 files changed, 17 insertions(+), 0 deletions(-)

src/AstGen.zig+17
...@@ -5148,6 +5148,7 @@ fn ifExpr(...@@ -5148,6 +5148,7 @@ fn ifExpr(
5148 else5148 else
5149 false;5149 false;
51505150
5151 try emitDbgNode(parent_gz, if_full.ast.cond_expr);
5151 const cond: struct {5152 const cond: struct {
5152 inst: Zir.Inst.Ref,5153 inst: Zir.Inst.Ref,
5153 bool_bit: Zir.Inst.Ref,5154 bool_bit: Zir.Inst.Ref,
...@@ -5458,6 +5459,7 @@ fn whileExpr(...@@ -5458,6 +5459,7 @@ fn whileExpr(
5458 else5459 else
5459 false;5460 false;
54605461
5462 try emitDbgNode(parent_gz, while_full.ast.cond_expr);
5461 const cond: struct {5463 const cond: struct {
5462 inst: Zir.Inst.Ref,5464 inst: Zir.Inst.Ref,
5463 bool_bit: Zir.Inst.Ref,5465 bool_bit: Zir.Inst.Ref,
...@@ -5678,6 +5680,8 @@ fn forExpr(...@@ -5678,6 +5680,8 @@ fn forExpr(
5678 else5680 else
5679 false;5681 false;
56805682
5683 try emitDbgNode(parent_gz, for_full.ast.cond_expr);
5684
5681 const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none;5685 const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none;
5682 const array_ptr = try expr(parent_gz, scope, cond_rl, for_full.ast.cond_expr);5686 const array_ptr = try expr(parent_gz, scope, cond_rl, for_full.ast.cond_expr);
5683 const len = try parent_gz.addUnNode(.indexable_ptr_len, array_ptr, for_full.ast.cond_expr);5687 const len = try parent_gz.addUnNode(.indexable_ptr_len, array_ptr, for_full.ast.cond_expr);
...@@ -7810,6 +7814,19 @@ fn callExpr(...@@ -7810,6 +7814,19 @@ fn callExpr(
7810 break :blk .auto;7814 break :blk .auto;
7811 };7815 };
78127816
7817 {
7818 astgen.advanceSourceCursor(astgen.tree.tokens.items(.start)[call.ast.lparen]);
7819 const line = astgen.source_line - gz.decl_line;
7820 const column = astgen.source_column;
7821
7822 _ = try gz.add(.{ .tag = .dbg_stmt, .data = .{
7823 .dbg_stmt = .{
7824 .line = line,
7825 .column = column,
7826 },
7827 } });
7828 }
7829
7813 assert(callee != .none);7830 assert(callee != .none);
7814 assert(node != 0);7831 assert(node != 0);
78157832