Skip to content

Commit 5de9cbe

Browse files
committed
go/ssa: show instruction line numbers in -build=FS mode
Change-Id: I7cf2083a3a34eb2f039f71162cc9e2348e7376cc Reviewed-on: https://go-review.googlesource.com/c/tools/+/563956 Reviewed-by: Tim King <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 0f0698e commit 5de9cbe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

go/ssa/func.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,12 @@ func WriteFunction(buf *bytes.Buffer, f *Function) {
586586
default:
587587
buf.WriteString(instr.String())
588588
}
589+
// -mode=S: show line numbers
590+
if f.Prog.mode&LogSource != 0 {
591+
if pos := instr.Pos(); pos.IsValid() {
592+
fmt.Fprintf(buf, " L%d", f.Prog.Fset.Position(pos).Line)
593+
}
594+
}
589595
buf.WriteString("\n")
590596
}
591597
}

0 commit comments

Comments
 (0)