ada: Small cleanups and fixes in expansion of aggregates
commit4f061cf29a348178e084ef179a23c6b950a0e283
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 17 Apr 2023 13:19:06 +0000 (17 15:19 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 30 May 2023 07:12:17 +0000 (30 09:12 +0200)
tree1eb71f298055a668e1c2212d86d520f243c2e6b1
parentc8df233586990a903afe3b017d24541bc4689f08
ada: Small cleanups and fixes in expansion of aggregates

This streamlines the handling of qualified expressions in the expansion of
aggregates and plugs a couple of loopholes that may cause memory leaks.

gcc/ada/

* exp_aggr.adb (Build_Array_Aggr_Code): Move the declaration of Typ
to the beginning.
(Initialize_Array_Component): Test the unqualified version of the
expression for the nested array case.
(Initialize_Ctrl_Array_Component): Do not duplicate the expression
here.  Do the pattern matching of the unqualified version of it.
(Gen_Assign): Call Unqualify to compute Expr_Q and use Expr_Q in
subsequent pattern matching.
(Initialize_Ctrl_Record_Component): Do the pattern matching of the
unqualified version of the aggregate.
(Build_Record_Aggr_Code): Call Unqualify.
(Convert_Aggr_In_Assignment): Likewise.
(Convert_Aggr_In_Object_Decl): Likewise.
(Component_OK_For_Backend): Likewise.
(Is_Delayed_Aggregate): Likewise.
gcc/ada/exp_aggr.adb