]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Implement built-in-place expansion of two-pass array aggregates
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 24 Jan 2025 09:26:13 +0000 (10:26 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Thu, 5 Jun 2025 13:39:27 +0000 (15:39 +0200)
commitb7e10f86d5cbd95ac38a1141f3e0a95424ede281
tree1a331ede93724c67f5be592c3510ecdbe1aa9a51
parent9f9476c195e4234f2bda930b5adee7d18d43d34e
ada: Implement built-in-place expansion of two-pass array aggregates

These are array aggregates containing only component associations that are
iterated with iterator specifications, as per RM 4.3.3(20.2/5-20.4/5).

It is implemented for the array aggregates that are used to initialize an
object, as specified by RM 7.6(17.2/3-17.3/3) for immutably limited types
and types that need finalization, but for all types like other aggregates.

gcc/ada/ChangeLog:

* exp_aggr.adb (Build_Two_Pass_Aggr_Code): New function containing
most of the code initially present in Two_Pass_Aggregate_Expansion.
(Two_Pass_Aggregate_Expansion): Remove redundant N parameter.
Implement built-in-place expansion for (static) object declarations
and allocators, using Build_Two_Pass_Aggr_Code for the main work.
(Expand_Array_Aggregate): Adjust Two_Pass_Aggregate_Expansion call.
Replace Etype (N) by Typ in a couple of places.
* exp_ch3.adb (Expand_Freeze_Array_Type): Remove special case for
two-pass array aggregates.
(Expand_N_Object_Declaration): Do not adjust the object when it is
initialized by a two-pass array aggregate.
* exp_ch4.adb (Expand_Allocator_Expression): Apply the processing
used for container aggregates to two-pass array aggregates.
* exp_ch6.adb (Validate_Subprogram_Calls): Skip calls present in
initialization expressions of N_Object_Declaration nodes that have
No_Initialization set.
* sem_ch3.adb (Analyze_Object_Declaration): Detect the cases of an
array originally initialized by an aggregate consistently.
gcc/ada/exp_aggr.adb
gcc/ada/exp_ch3.adb
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch6.adb
gcc/ada/sem_ch3.adb