diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-01-04 10:35:26 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-01-11 16:30:08 +0100 |
| commit | 983508d80442a85b78118e6c6a03d5ae4897e4df (patch) | |
| tree | 4d45c36a95a2ae407fa780a68925e0014c75e7e6 /pkg/compiler | |
| parent | bad18a53de8fa8d3d097e3d701efb72a014661cb (diff) | |
prog: pass ctx by pointer to ForeachType callback
This will allow callbacks to stop iteration early by
setting ctx.Stop flag (as it works for ForeachArg).
Diffstat (limited to 'pkg/compiler')
| -rw-r--r-- | pkg/compiler/gen.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/compiler/gen.go b/pkg/compiler/gen.go index 3d5517ae8..c4909b853 100644 --- a/pkg/compiler/gen.go +++ b/pkg/compiler/gen.go @@ -147,7 +147,7 @@ func (comp *compiler) generateTypes(syscalls []*prog.Syscall) []prog.Type { // Replace all Type's in the descriptions with Ref's // and prepare a sorted array of corresponding real types. proxies := make(map[string]*typeProxy) - prog.ForeachTypePost(syscalls, func(typ prog.Type, ctx prog.TypeCtx) { + prog.ForeachTypePost(syscalls, func(typ prog.Type, ctx *prog.TypeCtx) { if _, ok := typ.(prog.Ref); ok { return } @@ -195,7 +195,7 @@ func (comp *compiler) generateTypes(syscalls []*prog.Syscall) []prog.Type { func (comp *compiler) layoutTypes(syscalls []*prog.Syscall) { // Calculate struct/union/array sizes, add padding to structs, mark bitfields. padded := make(map[prog.Type]bool) - prog.ForeachTypePost(syscalls, func(typ prog.Type, _ prog.TypeCtx) { + prog.ForeachTypePost(syscalls, func(typ prog.Type, _ *prog.TypeCtx) { comp.layoutType(typ, padded) }) } |
