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(
51485148 else
51495149 false;
51505150
5151 try emitDbgNode(parent_gz, if_full.ast.cond_expr);
51515152 const cond: struct {
51525153 inst: Zir.Inst.Ref,
51535154 bool_bit: Zir.Inst.Ref,
......@@ -5458,6 +5459,7 @@ fn whileExpr(
54585459 else
54595460 false;
54605461
5462 try emitDbgNode(parent_gz, while_full.ast.cond_expr);
54615463 const cond: struct {
54625464 inst: Zir.Inst.Ref,
54635465 bool_bit: Zir.Inst.Ref,
......@@ -5678,6 +5680,8 @@ fn forExpr(
56785680 else
56795681 false;
56805682
5683 try emitDbgNode(parent_gz, for_full.ast.cond_expr);
5684
56815685 const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none;
56825686 const array_ptr = try expr(parent_gz, scope, cond_rl, for_full.ast.cond_expr);
56835687 const len = try parent_gz.addUnNode(.indexable_ptr_len, array_ptr, for_full.ast.cond_expr);
......@@ -7810,6 +7814,19 @@ fn callExpr(
78107814 break :blk .auto;
78117815 };
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
78137830 assert(callee != .none);
78147831 assert(node != 0);
78157832