mirror of
https://github.com/golang/go
synced 2024-11-05 11:36:10 -07:00
cmd/compile/internal/gc: various cleanups
Remove a couple of unnecessary var declarations, an unused sort.Sort type, and simplify a range by using the two-name variant. Change-Id: Ia251f634db0bfbe8b1d553b8659272ddbd13b2c3 Reviewed-on: https://go-review.googlesource.com/102336 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
bf8eef2adc
commit
b1892d740e
@ -465,8 +465,8 @@ func createComplexVars(fn *Func) ([]*Node, []*dwarf.Var, map[*Node]bool) {
|
||||
var vars []*dwarf.Var
|
||||
ssaVars := make(map[*Node]bool)
|
||||
|
||||
for varID := range debugInfo.Vars {
|
||||
n := debugInfo.Vars[varID].(*Node)
|
||||
for varID, dvar := range debugInfo.Vars {
|
||||
n := dvar.(*Node)
|
||||
ssaVars[n] = true
|
||||
for _, slot := range debugInfo.VarSlots[varID] {
|
||||
ssaVars[debugInfo.Slots[slot].N.(*Node)] = true
|
||||
|
@ -304,17 +304,16 @@ func affectedNode(v *ssa.Value) (*Node, ssa.SymEffect) {
|
||||
return nil, 0
|
||||
}
|
||||
|
||||
var n *Node
|
||||
switch a := v.Aux.(type) {
|
||||
case nil, *obj.LSym:
|
||||
// ok, but no node
|
||||
return nil, e
|
||||
case *Node:
|
||||
n = a
|
||||
return a, e
|
||||
default:
|
||||
Fatalf("weird aux: %s", v.LongString())
|
||||
return nil, e
|
||||
}
|
||||
|
||||
return n, e
|
||||
}
|
||||
|
||||
// Constructs a new liveness structure used to hold the global state of the
|
||||
|
@ -343,9 +343,8 @@ func methodfunc(f *types.Type, receiver *types.Type) *types.Type {
|
||||
in = append(in, d)
|
||||
}
|
||||
|
||||
var d *Node
|
||||
for _, t := range f.Params().Fields().Slice() {
|
||||
d = nod(ODCLFIELD, nil, nil)
|
||||
d := nod(ODCLFIELD, nil, nil)
|
||||
d.Type = t.Type
|
||||
d.SetIsddd(t.Isddd())
|
||||
in = append(in, d)
|
||||
@ -353,7 +352,7 @@ func methodfunc(f *types.Type, receiver *types.Type) *types.Type {
|
||||
|
||||
var out []*Node
|
||||
for _, t := range f.Results().Fields().Slice() {
|
||||
d = nod(ODCLFIELD, nil, nil)
|
||||
d := nod(ODCLFIELD, nil, nil)
|
||||
d.Type = t.Type
|
||||
out = append(out, d)
|
||||
}
|
||||
|
@ -113,14 +113,6 @@ func compactScopes(dwarfScopes []dwarf.Scope) []dwarf.Scope {
|
||||
return dwarfScopes
|
||||
}
|
||||
|
||||
type pcsByPC []scopedPCs
|
||||
|
||||
func (s pcsByPC) Len() int { return len(s) }
|
||||
func (s pcsByPC) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
func (s pcsByPC) Less(i, j int) bool {
|
||||
return s[i].start < s[j].start
|
||||
}
|
||||
|
||||
type varsByScopeAndOffset struct {
|
||||
vars []*dwarf.Var
|
||||
scopes []ScopeID
|
||||
|
Loading…
Reference in New Issue
Block a user