From bde8fd413bd79491702c8ff7103f5069745574e9 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 28 Dec 2023 11:36:49 +0100 Subject: pkg/compiler: extend parent reference support in len Earlier only len[parent, T] was supported and meant the size of the whole structure. Logically, len[parent:b, T] should be equivalent to just len[b, T]. Let len[parent:parent:a, T] refer to the structure that encloses the current one. Support len fields inside unions. --- pkg/compiler/testdata/all.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pkg/compiler/testdata/all.txt') diff --git a/pkg/compiler/testdata/all.txt b/pkg/compiler/testdata/all.txt index edf4bd896..f7639c761 100644 --- a/pkg/compiler/testdata/all.txt +++ b/pkg/compiler/testdata/all.txt @@ -95,6 +95,7 @@ len_expr2 { f23 ptr[in, len_expr4] f24 ptr[in, ptr[in, len_expr4]] f25 len[f21:f31, int32] + f26 len_union } len_expr3 { @@ -112,6 +113,11 @@ len_expr4 { f41 int32 } +len_union [ + u1 len[parent:parent:f21:f31, int32] + u2 int32 +] + foo_len_expr(a ptr[in, len_expr1], b ptr[in, array[int8, 3]]) # Pointer type. @@ -342,4 +348,4 @@ union_compressed [ compressed$1(a compressed_image) (no_generate, no_minimize) compressed$2(a ptr[in, compressed_image]) (no_generate, no_minimize) compressed$3(a ptr[in, struct_compressed]) (no_generate, no_minimize) -compressed$4(a ptr[in, union_compressed]) (no_generate, no_minimize) \ No newline at end of file +compressed$4(a ptr[in, union_compressed]) (no_generate, no_minimize) -- cgit mrf-deployment