]> gcc.gnu.org Git - gcc.git/commit
ada: Fix missing finalization in library-level instance body
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 3 Mar 2023 19:34:09 +0000 (20:34 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 26 May 2023 07:29:16 +0000 (09:29 +0200)
commit0c1d2675f964808b042b9fafae2c540933bb8269
treeec0c0ba62718895a80ef4a690fc50de54ffc3b1c
parent9df0c1198ecba478ac27d28765224412ee6606e9
ada: Fix missing finalization in library-level instance body

This extends the delaying mechanism present in the cases where the instance
is not at library level, so as to wait until after the instantiation of the
body is performed, before generating the finalizer of the compilation unit.

gcc/ada/

* einfo.ads (Delay_Cleanups): Document new usage.
* exp_ch7.ads (Build_Finalizer): New declaration.
* exp_ch7.adb (Build_Finalizer.Process_Declarations): Do not treat
library-level package instantiations specially.
(Build_Finalizer): Return early for package bodies and specs that
are not compilation units instead of using a more convoluted test.
(Expand_N_Package_Body): Do not build a finalizer if Delay_Cleanups
is set on the defining entity.
(Expand_N_Package_Declaration): Likewise.
* inline.ads (Pending_Body_Info): Reorder and add Fin_Scop.
(Add_Pending_Instantiation): Add Fin_Scop parameter.
* inline.adb (Add_Pending_Instantiation): Likewise and copy it into
the Pending_Body_Info appended to Pending_Instantiations.
(Add_Scope_To_Clean): Change parameter name to Scop and remove now
irrelevant processing.
(Cleanup_Scopes): Deal with scopes that are package specs or bodies.
(Instantiate_Body): For package instantiations, deal specially with
scopes that are package bodies and with scopes that are dynamic.
Pass the resulting scope to Add_Scope_To_Clean directly.
* sem_ch12.adb (Analyze_Package_Instantiation): In the case where a
body is needed, compute the enclosing finalization scope and pass it
in the call to Add_Pending_Instantiation.
(Inline_Instance_Body): Adjust aggregate passed in the calls to
Instantiate_Package_Body.
(Load_Parent_Of_Generic): Likewise.
gcc/ada/einfo.ads
gcc/ada/exp_ch7.adb
gcc/ada/exp_ch7.ads
gcc/ada/inline.adb
gcc/ada/inline.ads
gcc/ada/sem_ch12.adb
This page took 0.063212 seconds and 6 git commands to generate.