aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/reflectdata
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2021-03-27 10:14:30 -0400
committerAustin Clements <austin@google.com>2021-03-29 18:46:28 +0000
commit0d1423583b9106d398740862bca4ad5661fd67ad (patch)
treee69d8ea616d5bd80656edb7c308066039d8376b6 /src/cmd/compile/internal/reflectdata
parent33b4ffc3573eb81854591d39f1029dabacbdec72 (diff)
downloadgo-0d1423583b9106d398740862bca4ad5661fd67ad.tar.gz
go-0d1423583b9106d398740862bca4ad5661fd67ad.zip
cmd/compile: set ir.Name.Func in more cases
ir.Name.Func is non-nil for *almost* all function names. This CL fixes a few more major cases that leave it nil, though there are still a few cases left: interface method values, and algorithms generated by eqFor, hashfor, and hashmem. We'll need this for mapping from ir.Names to function ABIs shortly. The remaining cases would be nice to fix, but they're all guaranteed to be ABIInternal, so we can at least work around them. For #40724. Change-Id: Ifcfa781c78899ccea0bf155d80f8cfc27f30351e Reviewed-on: https://go-review.googlesource.com/c/go/+/305271 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/reflectdata')
-rw-r--r--src/cmd/compile/internal/reflectdata/alg.go2
-rw-r--r--src/cmd/compile/internal/reflectdata/reflect.go3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/reflectdata/alg.go b/src/cmd/compile/internal/reflectdata/alg.go
index faa431a9d1..9f2efbc3a0 100644
--- a/src/cmd/compile/internal/reflectdata/alg.go
+++ b/src/cmd/compile/internal/reflectdata/alg.go
@@ -287,6 +287,7 @@ func hashfor(t *types.Type) ir.Node {
sym = TypeSymPrefix(".hash", t)
}
+ // TODO(austin): This creates an ir.Name with a nil Func.
n := typecheck.NewName(sym)
ir.MarkFunc(n)
n.SetType(types.NewSignature(types.NoPkg, nil, nil, []*types.Field{
@@ -775,6 +776,7 @@ func memrun(t *types.Type, start int) (size int64, next int) {
func hashmem(t *types.Type) ir.Node {
sym := ir.Pkgs.Runtime.Lookup("memhash")
+ // TODO(austin): This creates an ir.Name with a nil Func.
n := typecheck.NewName(sym)
ir.MarkFunc(n)
n.SetType(types.NewSignature(types.NoPkg, nil, nil, []*types.Field{
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go
index 4c974ea324..c1cded826c 100644
--- a/src/cmd/compile/internal/reflectdata/reflect.go
+++ b/src/cmd/compile/internal/reflectdata/reflect.go
@@ -1741,6 +1741,9 @@ func methodWrapper(rcvr *types.Type, method *types.Field) *obj.LSym {
typecheck.NewFuncParams(method.Type.Params(), true),
typecheck.NewFuncParams(method.Type.Results(), false))
+ // TODO(austin): SelectorExpr may have created one or more
+ // ir.Names for these already with a nil Func field. We should
+ // consolidate these and always attach a Func to the Name.
fn := typecheck.DeclFunc(newnam, tfn)
fn.SetDupok(true)