]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: remove some unneeded code in package ir
authorMatthew Dempsky <mdempsky@google.com>
Sun, 27 Dec 2020 07:09:54 +0000 (23:09 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 28 Dec 2020 08:02:51 +0000 (08:02 +0000)
The deepCopy functions haven't been needed since we switched to using
Edit everywhere, and AddStringExpr no longer has an Alloc field that
needs special casing.

Passes toolstash -cmp.

Change-Id: I5bcc8c73d5cb784f7e57fb3162ae6e288e6c9392
Reviewed-on: https://go-review.googlesource.com/c/go/+/280445
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/ir/mknode.go
src/cmd/compile/internal/ir/type.go

index bc6fa3cd305dfd3c9db2747e864d0669b0ae38ef..5c36b729c7c56a0cfc77624e5e77f5fd36c088b1 100644 (file)
@@ -169,10 +169,6 @@ func forNodeFields(typName string, typ *types.Struct, f func(name string, is fun
                case "orig":
                        continue
                }
-               switch typName + "." + v.Name() {
-               case "AddStringExpr.Alloc":
-                       continue
-               }
                f(v.Name(), func(t types.Type) bool { return types.Identical(t, v.Type()) })
        }
 }
index 5e6d76229d32e4396e37c8f56f67d0b031e8275f..bd3a05d06e573dd9ee6a4de6cab719d1290ecedd 100644 (file)
@@ -115,14 +115,6 @@ func (n *StructType) SetOTYPE(t *types.Type) {
        n.Fields = nil
 }
 
-func deepCopyFields(pos src.XPos, fields []*Field) []*Field {
-       var out []*Field
-       for _, f := range fields {
-               out = append(out, f.deepCopy(pos))
-       }
-       return out
-}
-
 // An InterfaceType represents a struct { ... } type syntax.
 type InterfaceType struct {
        miniType
@@ -250,26 +242,6 @@ func editFields(list []*Field, edit func(Node) Node) {
        }
 }
 
-func (f *Field) deepCopy(pos src.XPos) *Field {
-       if f == nil {
-               return nil
-       }
-       fpos := pos
-       if !pos.IsKnown() {
-               fpos = f.Pos
-       }
-       decl := f.Decl
-       if decl != nil {
-               decl = DeepCopy(pos, decl).(*Name)
-       }
-       ntype := f.Ntype
-       if ntype != nil {
-               ntype = DeepCopy(pos, ntype).(Ntype)
-       }
-       // No keyed literal here: if a new struct field is added, we want this to stop compiling.
-       return &Field{fpos, f.Sym, ntype, f.Type, f.Embedded, f.IsDDD, f.Note, decl}
-}
-
 // A SliceType represents a []Elem type syntax.
 // If DDD is true, it's the ...Elem at the end of a function list.
 type SliceType struct {