mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: convert externdecl to []*Node
This one of a set of changes to make the transition away from NodeList easier by removing cases in which NodeList doesn't act semi-trivially like a []*Node. This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>. This change passes go build -toolexec 'toolstash -cmp' -a std. Change-Id: Ifd73501e06e8ea5efd028b6d473b3e5d1b07a5ac Reviewed-on: https://go-review.googlesource.com/14570 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
1fd78e1f60
commit
d5fe165ca0
6 changed files with 29 additions and 36 deletions
|
|
@ -1584,33 +1584,32 @@ func Ptrto(t *Type) *Type {
|
|||
}
|
||||
|
||||
func frame(context int) {
|
||||
var l *NodeList
|
||||
|
||||
if context != 0 {
|
||||
fmt.Printf("--- external frame ---\n")
|
||||
l = externdcl
|
||||
} else if Curfn != nil {
|
||||
fmt.Printf("--- %v frame ---\n", Curfn.Func.Nname.Sym)
|
||||
l = Curfn.Func.Dcl
|
||||
} else {
|
||||
for _, n := range externdcl {
|
||||
printframenode(n)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var n *Node
|
||||
var w int64
|
||||
for ; l != nil; l = l.Next {
|
||||
n = l.N
|
||||
w = -1
|
||||
if n.Type != nil {
|
||||
w = n.Type.Width
|
||||
if Curfn != nil {
|
||||
fmt.Printf("--- %v frame ---\n", Curfn.Func.Nname.Sym)
|
||||
for l := Curfn.Func.Dcl; l != nil; l = l.Next {
|
||||
printframenode(l.N)
|
||||
}
|
||||
switch n.Op {
|
||||
case ONAME:
|
||||
fmt.Printf("%v %v G%d %v width=%d\n", Oconv(int(n.Op), 0), n.Sym, n.Name.Vargen, n.Type, w)
|
||||
}
|
||||
}
|
||||
|
||||
case OTYPE:
|
||||
fmt.Printf("%v %v width=%d\n", Oconv(int(n.Op), 0), n.Type, w)
|
||||
}
|
||||
func printframenode(n *Node) {
|
||||
w := int64(-1)
|
||||
if n.Type != nil {
|
||||
w = n.Type.Width
|
||||
}
|
||||
switch n.Op {
|
||||
case ONAME:
|
||||
fmt.Printf("%v %v G%d %v width=%d\n", Oconv(int(n.Op), 0), n.Sym, n.Name.Vargen, n.Type, w)
|
||||
case OTYPE:
|
||||
fmt.Printf("%v %v width=%d\n", Oconv(int(n.Op), 0), n.Type, w)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue