For being consistent with other Prealloc fields.
[git-generate]
cd src/cmd/compile/internal/ir
rf '
mv AddrExpr.Alloc AddrExpr.Prealloc
'
go generate
Change-Id: Id1b05119092036e3f8208b73b63bd0ca6ceb7b15
Reviewed-on: https://go-review.googlesource.com/c/go/+/279450
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
// It may end up being a normal address-of or an allocation of a composite literal.
type AddrExpr struct {
miniExpr
- X Node
- Alloc *Name // preallocated storage if any
+ X Node
+ Prealloc *Name // preallocated storage if any
}
func NewAddrExpr(pos src.XPos, x Node) *AddrExpr {
var err error
err = maybeDoList(n.init, err, do)
err = maybeDo(n.X, err, do)
- if n.Alloc != nil {
- err = maybeDo(n.Alloc, err, do)
+ if n.Prealloc != nil {
+ err = maybeDo(n.Prealloc, err, do)
}
return err
}
func (n *AddrExpr) editChildren(edit func(Node) Node) {
editList(n.init, edit)
n.X = maybeEdit(n.X, edit)
- if n.Alloc != nil {
- n.Alloc = edit(n.Alloc).(*Name)
+ if n.Prealloc != nil {
+ n.Prealloc = edit(n.Prealloc).(*Name)
}
}
if !types.Identical(typ, x.Type()) {
panic("closure type does not match order's assigned type")
}
- addr.Alloc = x
+ addr.Prealloc = x
clo.Prealloc = nil
}
if !types.Identical(typ, x.Type()) {
panic("partial call type does not match order's assigned type")
}
- addr.Alloc = x
+ addr.Prealloc = x
n.Prealloc = nil
}
}
var r ir.Node
- if n.Alloc != nil {
+ if n.Prealloc != nil {
// n.Right is stack temporary used as backing store.
- appendWalkStmt(init, ir.NewAssignStmt(base.Pos, n.Alloc, nil)) // zero backing store, just in case (#18410)
- r = typecheck.NodAddr(n.Alloc)
+ appendWalkStmt(init, ir.NewAssignStmt(base.Pos, n.Prealloc, nil)) // zero backing store, just in case (#18410)
+ r = typecheck.NodAddr(n.Prealloc)
} else {
r = ir.NewUnaryExpr(base.Pos, ir.ONEW, ir.TypeNode(n.X.Type()))
r.SetEsc(n.Esc())