From 08565b23f94655e3b2610187f71ba774ce89eeb8 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Wed, 30 Mar 2022 20:47:45 -0700 Subject: [PATCH] stage2: fix print_zir for .builtin_src --- src/AstGen.zig | 7 ++----- src/Zir.zig | 2 +- src/print_zir.zig | 7 ++++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index b6ca1fe848..0fe64ec36b 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -7205,14 +7205,11 @@ fn builtinCall( .src => { const token_starts = tree.tokens.items(.start); const node_start = token_starts[tree.firstToken(node)]; - astgen.advanceSourceCursor(node_start); - const result = try gz.addExtendedPayload(.builtin_src, Zir.Inst.LineColumn{ - .line = @intCast(u32, astgen.source_line), - .column = @intCast(u32, astgen.source_column), + .line = astgen.source_line, + .column = astgen.source_column, }); - return rvalue(gz, rl, result, node); }, diff --git a/src/Zir.zig b/src/Zir.zig index 9474627675..6c9cd9d778 100644 --- a/src/Zir.zig +++ b/src/Zir.zig @@ -1587,7 +1587,7 @@ pub const Inst = struct { /// `operand` is `src_node: i32`. ret_addr, /// Implements the `@src` builtin. - /// `operand` is payload index to `ColumnLine`. + /// `operand` is payload index to `LineColumn`. builtin_src, /// Implements the `@errorReturnTrace` builtin. /// `operand` is `src_node: i32`. diff --git a/src/print_zir.zig b/src/print_zir.zig index 81562dc7bc..e85e69fe7f 100644 --- a/src/print_zir.zig +++ b/src/print_zir.zig @@ -461,9 +461,14 @@ const Writer = struct { .error_return_trace, .frame, .frame_address, - .builtin_src, => try self.writeExtNode(stream, extended), + .builtin_src => { + try stream.writeAll("))"); + const inst_data = self.code.extraData(Zir.Inst.LineColumn, extended.operand).data; + try stream.print(":{d}:{d}", .{ inst_data.line + 1, inst_data.column + 1 }); + }, + .dbg_block_begin, .dbg_block_end, => try stream.writeAll("))"),