aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/gen.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/compiler/gen.go')
-rw-r--r--pkg/compiler/gen.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/compiler/gen.go b/pkg/compiler/gen.go
index f91e2502c..1fcf8dcac 100644
--- a/pkg/compiler/gen.go
+++ b/pkg/compiler/gen.go
@@ -103,6 +103,14 @@ func (comp *compiler) genSyscalls() []*prog.Syscall {
calls = append(calls, comp.genSyscall(n, callArgSizes[n.CallName]))
}
}
+ // We assign SquashableElem here rather than during pointer type generation
+ // because during pointer generation recursive struct types may not be fully
+ // generated yet, thus ForeachArgType won't observe all types.
+ prog.ForeachTypePost(calls, func(typ prog.Type, ctx *prog.TypeCtx) {
+ if ptr, ok := typ.(*prog.PtrType); ok {
+ ptr.SquashableElem = isSquashableElem(ptr.Elem, ptr.ElemDir)
+ }
+ })
sort.Slice(calls, func(i, j int) bool {
return calls[i].Name < calls[j].Name
})