]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: change AddrExpr.Alloc to AddrExpr.Prealloc
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 29 Dec 2020 18:44:56 +0000 (01:44 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 29 Dec 2020 19:37:00 +0000 (19:37 +0000)
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>

src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ir/node_gen.go
src/cmd/compile/internal/walk/closure.go
src/cmd/compile/internal/walk/complit.go

index bb32d96088bf186a6a9de4b33fbb679aa79523c3..a989ce5e01a5e4f71d4227cedb0d9462a212d68a 100644 (file)
@@ -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 {
index 6c1a28022f3a849769a04fdb0693739331f1dde6..0dd5100018d38a1aa117d5dd11d15244417b2450 100644 (file)
@@ -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)
        }
 }
 
index 00d3f50bc4c75c3cdf04b5a82f68cf335f49ff04..0726d3b5521eacc192de8a61846089a96bae3d2f 100644 (file)
@@ -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
        }
 
index 3c28ed70ade7af2c65ed5552e359f6a05030124a..d8605d39bdc0b54a748a8d11611f1ad08d4791c6 100644 (file)
@@ -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())