ada: Further cleanup in finalization machinery
commit6b92b664aa2c9ba541526266bfc8d57842d378e1
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 24 Nov 2023 15:26:00 +0000 (24 16:26 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 19 Dec 2023 14:27:48 +0000 (19 15:27 +0100)
treef76cec4e8d1bafa10e65751b2fbc411db13f3515
parentc3d97f236e942e7fd46d6ae8e0f684f9426f3ac7
ada: Further cleanup in finalization machinery

This removes the setting of the Is_Ignored_Transient flag on the temporaries
needing finalization created by Expand_Ctrl_Function_Call when invoked from
within the dependent expressions of conditional expressions.

This flag tells the general finalization machinery to disregard the object.
But temporaries needing finalization present in action lists of dependent
expressions are picked up by Process_Transients_In_Expression, which deals
with their finalization and sets the Is_Finalized_Transient flag on them.

Now this latter flag has exactly the same effect as Is_Ignored_Transient
as far as the general finalization machinery is concerned, so setting the
flag is unnecessary.  In the end, the flag can be decoupled entirely from
transient objects and renamed into Is_Ignored_For_Finalization.

This also moves around the declaration of a local variable and turns a
library-level procedure into a nested procedure.

gcc/ada/

* einfo.ads (Is_Ignored_Transient): Rename into...
(Is_Ignored_For_Finalization): ...this.
* gen_il-fields.ads (Opt_Field_Enum): Adjust to above renaming.
* gen_il-gen-gen_entities.adb (Object_Kind): Likewise.
* exp_aggr.adb (Expand_Array_Aggregate): Likewise.
* exp_ch7.adb (Build_Finalizer.Process_Declarations): Likewise.
* exp_util.adb (Requires_Cleanup_Actions): Likewise.
* exp_ch4.adb (Expand_N_If_Expression): Move down declaration of
variable Optimize_Return_Stmt.
(Process_Transient_In_Expression): Turn procedure into a child of...
(Process_Transients_In_Expression): ...this procedure.
* exp_ch6.adb (Expand_Ctrl_Function_Call): Remove obsolete setting
of Is_Ignored_Transient flag on the temporary if within a dependent
expression of a conditional expression.
gcc/ada/einfo.ads
gcc/ada/exp_aggr.adb
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch6.adb
gcc/ada/exp_ch7.adb
gcc/ada/exp_util.adb
gcc/ada/gen_il-fields.ads
gcc/ada/gen_il-gen-gen_entities.adb