mirror of
https://github.com/golang/go
synced 2024-09-05 07:54:46 +00:00
[dev.typeparams] cmd/compile/internal/ir: more position details in dump
When dumping node positions, include column position and the full inlining tree. These details are helpful for diagnosing "toolstash -cmp" failures due to subtly changing positions. Change-Id: I953292d6c01899fd98e2f315bafaa123c4d98ffd Reviewed-on: https://go-review.googlesource.com/c/go/+/321089 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
fb79f6955e
commit
c2966ae272
|
@ -1114,16 +1114,21 @@ func dumpNodeHeader(w io.Writer, n Node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.Pos().IsKnown() {
|
if n.Pos().IsKnown() {
|
||||||
pfx := ""
|
fmt.Fprint(w, " # ")
|
||||||
switch n.Pos().IsStmt() {
|
switch n.Pos().IsStmt() {
|
||||||
case src.PosNotStmt:
|
case src.PosNotStmt:
|
||||||
pfx = "_" // "-" would be confusing
|
fmt.Fprint(w, "_") // "-" would be confusing
|
||||||
case src.PosIsStmt:
|
case src.PosIsStmt:
|
||||||
pfx = "+"
|
fmt.Fprint(w, "+")
|
||||||
|
}
|
||||||
|
for i, pos := range base.Ctxt.AllPos(n.Pos(), nil) {
|
||||||
|
if i > 0 {
|
||||||
|
fmt.Fprint(w, ",")
|
||||||
|
}
|
||||||
|
// TODO(mdempsky): Print line pragma details too.
|
||||||
|
file := filepath.Base(pos.Filename())
|
||||||
|
fmt.Fprintf(w, "%s:%d:%d", file, pos.Line(), pos.Col())
|
||||||
}
|
}
|
||||||
pos := base.Ctxt.PosTable.Pos(n.Pos())
|
|
||||||
file := filepath.Base(pos.Filename())
|
|
||||||
fmt.Fprintf(w, " # %s%s:%d", pfx, file, pos.Line())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue