Update and fix staticcheck
This commit is contained in:
12
vendor/honnef.co/go/tools/functions/loops.go
vendored
12
vendor/honnef.co/go/tools/functions/loops.go
vendored
@ -1,10 +1,10 @@
|
||||
package functions
|
||||
|
||||
import "honnef.co/go/tools/ssa"
|
||||
import "honnef.co/go/tools/ir"
|
||||
|
||||
type Loop struct{ ssa.BlockSet }
|
||||
type Loop struct{ *ir.BlockSet }
|
||||
|
||||
func FindLoops(fn *ssa.Function) []Loop {
|
||||
func FindLoops(fn *ir.Function) []Loop {
|
||||
if fn.Blocks == nil {
|
||||
return nil
|
||||
}
|
||||
@ -18,12 +18,12 @@ func FindLoops(fn *ssa.Function) []Loop {
|
||||
// n is a back-edge to h
|
||||
// h is the loop header
|
||||
if n == h {
|
||||
set := Loop{}
|
||||
set := Loop{ir.NewBlockSet(len(fn.Blocks))}
|
||||
set.Add(n)
|
||||
sets = append(sets, set)
|
||||
continue
|
||||
}
|
||||
set := Loop{}
|
||||
set := Loop{ir.NewBlockSet(len(fn.Blocks))}
|
||||
set.Add(h)
|
||||
set.Add(n)
|
||||
for _, b := range allPredsBut(n, h, nil) {
|
||||
@ -35,7 +35,7 @@ func FindLoops(fn *ssa.Function) []Loop {
|
||||
return sets
|
||||
}
|
||||
|
||||
func allPredsBut(b, but *ssa.BasicBlock, list []*ssa.BasicBlock) []*ssa.BasicBlock {
|
||||
func allPredsBut(b, but *ir.BasicBlock, list []*ir.BasicBlock) []*ir.BasicBlock {
|
||||
outer:
|
||||
for _, pred := range b.Preds {
|
||||
if pred == but {
|
||||
|
Reference in New Issue
Block a user