aboutsummaryrefslogtreecommitdiffstats
path: root/prog/prog.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-05-01 17:19:27 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-02 12:16:06 +0200
commit58da4c35b15200b7279f18ea15bc8644618aae78 (patch)
tree412d59572c980c4eb582d6d0e187eb6ec32345c9 /prog/prog.go
parentbc734e7ada413654f1b7d948b2a857260a52dd9c (diff)
prog: introduce Field type
Remvoe FieldName from Type and add a separate Field type that holds field name. Use Field for struct fields, union options and syscalls arguments, only these really have names. Reduces size of sys/linux/gen/amd64.go from 5665583 to 5201321 (-8.2%). Allows to not create new type for squashed any pointer. But main advantages will follow, e.g. removing StructDesc, using TypeRef in Arg, etc. Update #1580
Diffstat (limited to 'prog/prog.go')
-rw-r--r--prog/prog.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/prog/prog.go b/prog/prog.go
index 017a0dbbb..dc1c8dd6c 100644
--- a/prog/prog.go
+++ b/prog/prog.go
@@ -234,10 +234,11 @@ func (arg *GroupArg) fixedInnerSize() bool {
type UnionArg struct {
ArgCommon
Option Arg
+ Index int // Index of the selected option in the union type.
}
-func MakeUnionArg(t Type, dir Dir, opt Arg) *UnionArg {
- return &UnionArg{ArgCommon: ArgCommon{typ: t, dir: dir}, Option: opt}
+func MakeUnionArg(t Type, dir Dir, opt Arg, index int) *UnionArg {
+ return &UnionArg{ArgCommon: ArgCommon{typ: t, dir: dir}, Option: opt, Index: index}
}
func (arg *UnionArg) Size() uint64 {