diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-02-14 01:22:49 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-14 10:19:57 +0200 |
commit | 08039257610508b153d13b6cab1f252297d143a9 (patch) | |
tree | 858f2bfab72b5e69b667ae9c8ab35b79e8306793 /gcc/expr.cc | |
parent | ad510c7c8b72cfe43ec0c0c94d650cdff91cc6a6 (diff) | |
download | gcc-08039257610508b153d13b6cab1f252297d143a9.zip gcc-08039257610508b153d13b6cab1f252297d143a9.tar.gz gcc-08039257610508b153d13b6cab1f252297d143a9.tar.bz2 |
ada: Small cleanup about allocators and aggregates
This eliminates a few oddities present in the expander for allocators and
aggregates present in allocators:
- Convert_Array_Aggr_In_Allocator takes both a Decl and Alloc parameters,
and inserts new code before Alloc for records and after Decl for arrays
through Convert_Array_Aggr_In_Allocator. Now, for the 3 (duplicated)
calls to the procedure, that's the same place. It also creates a new
list that it does not use in most cases.
- Expand_Allocator_Expression uses the same code sequence in 3 places
when the expression is an aggregate to build in place.
- Build_Allocate_Deallocate_Proc takes an Is_Allocate parameter that is
entirely determined by the N parameter: if N is an allocator, it must
be true; if N is a free statement, it must be false. Barring that,
the procedure either raises an assertion or Program_Error. It also
contains useless pattern matching code in the second part.
No functional changes.
gcc/ada/
* exp_aggr.ads (Convert_Aggr_In_Allocator): Rename Alloc into N,
replace Decl with Temp and adjust description.
(Convert_Aggr_In_Object_Decl): Alphabetize.
(Is_Delayed_Aggregate): Likewise.
* exp_aggr.adb (Convert_Aggr_In_Allocator): Rename Alloc into N
and replace Decl with Temp. Allocate a list only when neeeded.
(Convert_Array_Aggr_In_Allocator): Replace N with Decl and insert
new code before it.
* exp_ch4.adb (Build_Aggregate_In_Place): New procedure nested in
Expand_Allocator_Expression.
(Expand_Allocator_Expression): Call it to build aggregates in place.
Remove second parameter in calls to Build_Allocate_Deallocate_Proc.
(Expand_N_Allocator): Likewise.
* exp_ch13.adb (Expand_N_Free_Statement): Likewise.
* exp_util.ads (Build_Allocate_Deallocate_Proc): Remove Is_Allocate
parameter.
* exp_util.adb (Build_Allocate_Deallocate_Proc): Remove Is_Allocate
parameter and replace it with local variable of same name. Delete
useless pattern matching.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions