diff options
| author | hopehook <hopehook@qq.com> | 2022-04-08 17:59:05 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-04-18 18:43:21 +0000 |
| commit | 3df9df8d6a1a140239e4cba0d0595bdab2ba9c60 (patch) | |
| tree | 2b132166fea32a3300e23d2d71bb52f513bbc98e /src/cmd/compile/internal/noder | |
| parent | 91b9915d3f6f8cd2e9e9fda63f67772803adfa03 (diff) | |
| download | go-3df9df8d6a1a140239e4cba0d0595bdab2ba9c60.tar.xz | |
cmd/compile: fix missing source information in ssa view
Endlineno is lost when we call "genericSubst" to create the new
instantiation of the generic function. This will cause "readFuncLines"
to fail to read the target function.
To fix this issue, as @mdempsky pointed out, add the line in
cmd/compile/internal/noder/stencil.go:
newf.Endlineno = gf.Endlineno
Fixes #51988
Change-Id: Ib408e4ed0ceb68df8dedda4fb551309e8385aada
Reviewed-on: https://go-review.googlesource.com/c/go/+/399057
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder')
| -rw-r--r-- | src/cmd/compile/internal/noder/stencil.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go index eeac8d8de7..41435a7afe 100644 --- a/src/cmd/compile/internal/noder/stencil.go +++ b/src/cmd/compile/internal/noder/stencil.go @@ -741,6 +741,7 @@ func (g *genInst) genericSubst(newsym *types.Sym, nameNode *ir.Name, tparams []* // Pos of the instantiated function is same as the generic function newf := ir.NewFunc(gf.Pos()) newf.Pragma = gf.Pragma // copy over pragmas from generic function to stenciled implementation. + newf.Endlineno = gf.Endlineno newf.Nname = ir.NewNameAt(gf.Pos(), newsym) newf.Nname.Func = newf newf.Nname.Defn = newf |
