1
0
mirror of https://github.com/golang/go synced 2024-09-30 05:24:29 -06:00

cmd/compile: preserve full inlined location for ir.Name locals

This was noticed while testing hash-search debugging
of the loopvar experiment.

The change is incomplete -- it only addresses local
variables, not parameters.  The code to log/search
changes in loop variable semantics depends on this,
so that will be the test.

Change-Id: I0f84ab7696c6cab43486242cacaba6a0bfc45475
Reviewed-on: https://go-review.googlesource.com/c/go/+/464315
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
This commit is contained in:
David Chase 2023-01-30 23:54:13 -05:00
parent ab86d29bb5
commit 6dd20f4f12

View File

@ -1566,13 +1566,6 @@ func (r *reader) addLocal(name *ir.Name, ctxt ir.Class) {
name.SetInlFormal(true)
ctxt = ir.PAUTO
}
// TODO(mdempsky): Rethink this hack.
if strings.HasPrefix(name.Sym().Name, "~") || base.Flag.GenDwarfInl == 0 {
name.SetPos(r.inlCall.Pos())
name.SetInlFormal(false)
name.SetInlLocal(false)
}
}
name.Class = ctxt
@ -3549,15 +3542,9 @@ func unifiedInlineCall(call *ir.CallExpr, fn *ir.Func, inlIndex int) *ir.Inlined
name.Curfn = callerfn
callerfn.Dcl = append(callerfn.Dcl, name)
// Quirkish. TODO(mdempsky): Document why.
if name.AutoTemp() {
name.SetEsc(ir.EscUnknown)
if base.Flag.GenDwarfInl != 0 {
name.SetInlLocal(true)
} else {
name.SetPos(r.inlCall.Pos())
}
name.SetInlLocal(true)
}
}
}