all: upgrade golangci-lint and formatters (#240)

This commit is contained in:
Michael McLoughlin
2022-03-27 15:31:26 -07:00
committed by GitHub
parent 553930530f
commit 72b8db9c80
24 changed files with 179 additions and 118 deletions

View File

@@ -257,14 +257,17 @@ func ComputeCFG(t *testing.T, f *ir.Function) error {
}
func AssertSuccessors(t *testing.T, f *ir.Function, expect map[string][]string) {
t.Helper()
AssertEqual(t, "successors", OpcodeSuccessorGraph(f), expect)
}
func AssertPredecessors(t *testing.T, f *ir.Function, expect map[string][]string) {
t.Helper()
AssertEqual(t, "predecessors", OpcodePredecessorGraph(f), expect)
}
func AssertEqual(t *testing.T, what string, got, expect interface{}) {
t.Helper()
t.Logf("%s=%#v\n", what, got)
if reflect.DeepEqual(expect, got) {
return

View File

@@ -83,6 +83,7 @@ func TestLivenessBasic(t *testing.T) {
}
func AssertLiveness(t *testing.T, ctx *build.Context, in, out [][]reg.Register) {
t.Helper()
fn := ConstructLiveness(t, ctx)
is := fn.Instructions()
@@ -97,12 +98,14 @@ func AssertLiveness(t *testing.T, ctx *build.Context, in, out [][]reg.Register)
}
func AssertRegistersMatchSet(t *testing.T, rs []reg.Register, s reg.MaskSet) {
t.Helper()
if !s.Equals(reg.NewMaskSetFromRegisters(rs)) {
t.Fatalf("register slice does not match set: %#v and %#v", rs, s)
}
}
func ConstructLiveness(t *testing.T, ctx *build.Context) *ir.Function {
t.Helper()
return BuildFunction(t, ctx, pass.LabelTarget, pass.CFG, pass.Liveness)
}