mirror of
https://github.com/golang/go
synced 2024-11-26 01:07:57 -07:00
[dev.regabi] cmd/compile: change AddrExpr.Alloc to AddrExpr.Prealloc
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>
This commit is contained in:
parent
850aa7c60c
commit
f5816624cd
@ -106,8 +106,8 @@ func NewAddStringExpr(pos src.XPos, list []Node) *AddStringExpr {
|
||||
// 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 {
|
||||
|
@ -38,16 +38,16 @@ func (n *AddrExpr) doChildren(do func(Node) error) error {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ func walkClosure(clo *ir.ClosureExpr, init *ir.Nodes) ir.Node {
|
||||
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
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ func walkCallPart(n *ir.SelectorExpr, init *ir.Nodes) ir.Node {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -549,10 +549,10 @@ func anylit(n ir.Node, var_ ir.Node, init *ir.Nodes) {
|
||||
}
|
||||
|
||||
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())
|
||||
|
Loading…
Reference in New Issue
Block a user