mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 22:03:57 +08:00
ada: Further cleanup in finalization machinery
The bodies of generic units are instantiated separately by GNAT at the end of the processing of the compilation unit. This requires the deferral of the generation of cleanups and finalization actions in enclosing scopes, except for instantiations in generic units where they are not generated. The criterion used to detect this latter case is Inside_A_Generic, but this global variable is not properly updated during the instantiation of generic bodies, leading to problems with nested instantiations, so it is changed to Expander_Active instead. As a matter of fact, the exact same idiom is used a few lines above to clear the Needs_Body variable. gcc/ada/ * sem_ch12.adb (Analyze_Package_Instantiation): Test Expander_Active to detect generic contexts for the generation of cleanup actions.
This commit is contained in:
parent
5c7854b28f
commit
706535a9a2
@ -4824,10 +4824,7 @@ package body Sem_Ch12 is
|
||||
-- Cleanup actions are not generated within generic units
|
||||
-- or in the formal part of generic units.
|
||||
|
||||
if Inside_A_Generic
|
||||
or else Is_Generic_Unit (S)
|
||||
or else Ekind (S) = E_Void
|
||||
then
|
||||
if not Expander_Active then
|
||||
exit;
|
||||
|
||||
-- For package scopes, cleanup actions are generated only
|
||||
|
Loading…
Reference in New Issue
Block a user