1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:38:00 -07:00

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>
This commit is contained in:
Matthew Dempsky 2021-08-18 14:36:45 -07:00
parent 322879d5c9
commit c85695a117
2 changed files with 11 additions and 2 deletions

View File

@ -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)

View File

@ -2180,8 +2180,6 @@ var types2Failures32Bit = setOf(
var g3Failures = setOf(
"writebarrier.go", // correct diagnostics, but different lines (probably irgen's fault)
"fixedbugs/issue30862.go", // -G=3 doesn't handle //go:nointerface
"typeparam/nested.go", // -G=3 doesn't support function-local types with generics
"typeparam/mdempsky/4.go", // -G=3 can't export functions with labeled breaks in loops