aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder/decl.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-08-18 14:36:45 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-08-19 00:26:22 +0000
commitc85695a117f1ec3b800ba14570876cfcd2075c1f (patch)
tree4e89dc7f4910ebf53edc916c1835a793b75593ab /src/cmd/compile/internal/noder/decl.go
parent322879d5c9dc34975a42ac77fbef7b4a8b255e8a (diff)
downloadgo-c85695a117f1ec3b800ba14570876cfcd2075c1f.tar.gz
go-c85695a117f1ec3b800ba14570876cfcd2075c1f.zip
cmd/compile: add support for //go:nointerface for -G=3
This is used within Google's internal code repo, so getting it working is a pre-req for enabling -G=3 by default. Change-Id: Icbc570948c852ca09cdb2a59f778140f620244b2 Reviewed-on: https://go-review.googlesource.com/c/go/+/343429 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder/decl.go')
-rw-r--r--src/cmd/compile/internal/noder/decl.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/decl.go b/src/cmd/compile/internal/noder/decl.go
index 429c8a14c8..cec31d87b7 100644
--- a/src/cmd/compile/internal/noder/decl.go
+++ b/src/cmd/compile/internal/noder/decl.go
@@ -97,6 +97,17 @@ func (g *irgen) funcDecl(out *ir.Nodes, decl *syntax.FuncDecl) {
if fn.Pragma&ir.Systemstack != 0 && fn.Pragma&ir.Nosplit != 0 {
base.ErrorfAt(fn.Pos(), "go:nosplit and go:systemstack cannot be combined")
}
+ if fn.Pragma&ir.Nointerface != 0 {
+ // Propagate //go:nointerface from Func.Pragma to Field.Nointerface.
+ // This is a bit roundabout, but this is the earliest point where we've
+ // processed the function's pragma flags, and we've also already created
+ // the Fields to represent the receiver's method set.
+ if recv := fn.Type().Recv(); recv != nil {
+ typ := types.ReceiverBaseType(recv.Type)
+ meth := typecheck.Lookdot1(fn, typecheck.Lookup(decl.Name.Value), typ, typ.Methods(), 0)
+ meth.SetNointerface(true)
+ }
+ }
if decl.Name.Value == "init" && decl.Recv == nil {
g.target.Inits = append(g.target.Inits, fn)