cmd/compile: minor cleanup to HashDebugPos

HashDebugPos function/method included a parameter that was always
the same, and a variable in the same package as the hashdebug code.
So remove it.

(I wrote that code, there was no reason for it to be that way).

Also corrects a stale comment in the loopvar code.

Change-Id: Id3da69cfe6dadeb31d5de62fb76d15103a5d6152
Reviewed-on: https://go-review.googlesource.com/c/go/+/482816
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
David Chase 2023-04-06 10:09:51 -04:00
parent 46a49eb52e
commit 42866e566a
4 changed files with 11 additions and 8 deletions

View file

@ -71,7 +71,7 @@ func ForCapture(fn *ir.Func) []*ir.Name {
// subject to hash-variable debugging.
maybeReplaceVar := func(k ir.Node, x *ir.RangeStmt) ir.Node {
if n, ok := k.(*ir.Name); ok && possiblyLeaked[n] {
if base.LoopVarHash.DebugHashMatchPos(base.Ctxt, n.Pos()) {
if base.LoopVarHash.DebugHashMatchPos(n.Pos()) {
// Rename the loop key, prefix body with assignment from loop key
transformed = append(transformed, n)
tk := typecheck.Temp(n.Type())
@ -167,7 +167,7 @@ func ForCapture(fn *ir.Func) []*ir.Name {
forAllDefInInit(x, func(z ir.Node) {
if n, ok := z.(*ir.Name); ok && possiblyLeaked[n] {
// Hash on n.Pos() for most precise failure location.
if base.LoopVarHash.DebugHashMatchPos(base.Ctxt, n.Pos()) {
if base.LoopVarHash.DebugHashMatchPos(n.Pos()) {
leaked = append(leaked, n)
}
}