stage2: fix print_zir for .builtin_src

This commit is contained in:
Meghan Denny 2022-03-30 20:47:45 -07:00 committed by Andrew Kelley
parent 75c2cff40e
commit 08565b23f9
3 changed files with 9 additions and 7 deletions

View File

@ -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);
},

View File

@ -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`.

View File

@ -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("))"),