mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:25:24 +02:00
ada: Remove obsolete call to Establish_Transient_Scope
There is a preceding call to Establish_Transient_Scope in the procedure for the cases where it is required, and we no longer build the aggregate on the stack before copying it to the heap for an allocator. gcc/ada/ChangeLog: * exp_aggr.adb (Expand_Array_Aggregate): Remove obsolete call to Establish_Transient_Scope for an allocator in a loop. * exp_ch7.adb (Establish_Transient_Scope): Adjust description.
This commit is contained in:
committed by
Marc Poulhiès
parent
57d3933a87
commit
56722ed86e
@@ -6400,21 +6400,10 @@ package body Exp_Aggr is
|
||||
Object_Definition => New_Occurrence_Of (Typ, Loc));
|
||||
Set_No_Initialization (Tmp_Decl, True);
|
||||
|
||||
-- If we are within a loop, the temporary will be pushed on the
|
||||
-- stack at each iteration. If the aggregate is the expression
|
||||
-- for an allocator, it will be immediately copied to the heap
|
||||
-- and can be reclaimed at once. We create a transient scope
|
||||
-- around the aggregate for this purpose.
|
||||
|
||||
if Ekind (Current_Scope) = E_Loop
|
||||
and then Nkind (Parent_Node) = N_Allocator
|
||||
then
|
||||
Establish_Transient_Scope (N, Manage_Sec_Stack => False);
|
||||
|
||||
-- If the parent is an assignment for which no controlled actions
|
||||
-- should take place, prevent the temporary from being finalized.
|
||||
|
||||
elsif Nkind (Parent_Node) = N_Assignment_Statement
|
||||
if Nkind (Parent_Node) = N_Assignment_Statement
|
||||
and then No_Ctrl_Actions (Parent_Node)
|
||||
then
|
||||
Mutate_Ekind (Tmp, E_Variable);
|
||||
|
||||
@@ -4276,8 +4276,9 @@ package body Exp_Ch7 is
|
||||
-- Establish_Transient_Scope --
|
||||
-------------------------------
|
||||
|
||||
-- This procedure is called each time a transient block has to be inserted
|
||||
-- that is to say for each call to a function with unconstrained or tagged
|
||||
-- This procedure is called when a transient scope has to be inserted in
|
||||
-- the tree to manage the lifetime of temporaries created for a construct,
|
||||
-- most notably for calls to functions with a controlled or unconstrained
|
||||
-- result. It creates a new scope on the scope stack in order to enclose
|
||||
-- all transient variables generated.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user