diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-05-16 18:05:05 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-05-16 18:05:05 +0200 |
| commit | 76fc461b55cfe334e8d4be121f61fa25d079f8ba (patch) | |
| tree | 88cc3472e7352c2cd74f3234acb4bd2083ff61d4 /prog/size_test.go | |
| parent | f59a9cb554a8dfcbe13c8a0775542ee7a0d8a353 (diff) | |
pkg/compiler: add offsetof type
Similar to C offsetof gives offset of a field
from the beginning of the parent struct.
We have several TODOs in descriptions asking for this.
Diffstat (limited to 'prog/size_test.go')
| -rw-r--r-- | prog/size_test.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/prog/size_test.go b/prog/size_test.go index 613104bf1..7b248bd4f 100644 --- a/prog/size_test.go +++ b/prog/size_test.go @@ -155,6 +155,10 @@ func TestAssignSize(t *testing.T) { "test$length30(&(0x7f0000000000)={{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, {'a', 'aaa', 'aaaaa', 'aaaaaa'}, &(0x7f0000000000)={'a', 'aaa', 'aaaaa', 'aaaaaa'}, &(0x7f0000000000)=&(0x7f0000000000)={'a', 'aaa', 'aaaaa', 'aaaaaa'}, 0x0}, 0x0}, 0x0, &(0x7f0000000000)=0x0, 0x0)", "test$length30(&(0x7f0000000000)={{{0x0, 0x18, 0x1, 0x3, 0x5, 0x6}, {'a', 'aaa', 'aaaaa', 'aaaaaa'}, &(0x7f0000000000)={'a', 'aaa', 'aaaaa', 'aaaaaa'}, &(0x7f0000000000)=&(0x7f0000000000)={'a', 'aaa', 'aaaaa', 'aaaaaa'}, 0x2}, 0x4}, 0x40, &(0x7f0000000000)=0x18, 0x2)", }, + { + "test$offsetof0(&(0x7f0000000000)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0})", + "test$offsetof0(&(0x7f0000000000)={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x6, 0x8, 0x10, 0x18, 0x18, 0x20})", + }, } for i, test := range tests { p, err := target.Deserialize([]byte(test.unsizedProg), Strict) |
