[PATCH vkd3d v3 3/8] vkd3d-shader/hlsl: Concatenate nested initializers.
Zebediah Figura (she/her)
zfigura at codeweavers.com
Fri Mar 4 19:01:45 CST 2022
On 3/2/22 12:31, Francisco Casas wrote:
> Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
>
> ---
> v3:
> - It seemed right to bring this patch forward before
> applying the braces flag.
>
> Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
> ---
> libs/vkd3d-shader/hlsl.y | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
> index 459ad03b..7678cf3c 100644
> --- a/libs/vkd3d-shader/hlsl.y
> +++ b/libs/vkd3d-shader/hlsl.y
> @@ -2310,6 +2310,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
> %type <function> func_prototype
>
> %type <initializer> complex_initializer
> +%type <initializer> complex_initializer_list
> %type <initializer> func_arguments
> %type <initializer> initializer_expr_list
>
> @@ -3114,15 +3115,28 @@ complex_initializer:
> $$.args[0] = node_from_list($1);
> $$.instrs = $1;
> }
> - | '{' initializer_expr_list '}'
> + | '{' complex_initializer_list '}'
> {
> $$ = $2;
> }
> - | '{' initializer_expr_list ',' '}'
> + | '{' complex_initializer_list ',' '}'
> {
> $$ = $2;
> }
>
> +complex_initializer_list:
> + complex_initializer
> + | complex_initializer_list ',' complex_initializer
> + {
> + $$ = $1;
> + if (!($$.args = hlsl_realloc(ctx, $$.args, ($$.args_count + $3.args_count) * sizeof(*$$.args))))
> + YYABORT;
This leaks $1 and $3.
> + for (unsigned int i = 0; i < $3.args_count; i++)
> + $$.args[$$.args_count++] = $3.args[i];
> + list_move_tail($$.instrs, $3.instrs);
> + free_parse_initializer(&$3);
> + }
> +
> initializer_expr:
> assignment_expr
>
More information about the wine-devel
mailing list