aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_aggr.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_aggr.adb')
-rw-r--r--gcc/ada/exp_aggr.adb63
1 files changed, 38 insertions, 25 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 3c2101f..de784b2 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -75,6 +75,15 @@ package body Exp_Aggr is
type Case_Table_Type is array (Nat range <>) of Case_Bounds;
-- Table type used by Check_Case_Choices procedure
+ procedure Collect_Initialization_Statements
+ (Obj : Entity_Id;
+ N : Node_Id;
+ Node_After : Node_Id);
+ -- If Obj is not frozen, collect actions inserted after N until, but not
+ -- including, Node_After, for initialization of Obj, and move them to an
+ -- expression with actions, which becomes the Initialization_Statements for
+ -- Obj.
+
function Has_Default_Init_Comps (N : Node_Id) return Boolean;
-- N is an aggregate (record or array). Checks the presence of default
-- initialization (<>) in any component (Ada 2005: AI-287).
@@ -103,15 +112,6 @@ package body Exp_Aggr is
-- statement of variant part will usually be small and probably in near
-- sorted order.
- procedure Collect_Initialization_Statements
- (Obj : Entity_Id;
- N : Node_Id;
- Node_After : Node_Id);
- -- If Obj is not frozen, collect actions inserted after N until, but not
- -- including, Node_After, for initialization of Obj, and move them to an
- -- expression with actions, which becomes the Initialization_Statements for
- -- Obj.
-
------------------------------------------------------
-- Local subprograms for Record Aggregate Expansion --
------------------------------------------------------
@@ -5233,6 +5233,19 @@ package body Exp_Aggr is
Index => First_Index (Typ),
Into => Target,
Scalar_Comp => Is_Scalar_Type (Ctyp));
+
+ -- Save the last assignment statement associated with the aggregate
+ -- when building a controlled object. This reference is utilized by
+ -- the finalization machinery when marking an object as successfully
+ -- initialized.
+
+ if Needs_Finalization (Typ)
+ and then Is_Entity_Name (Target)
+ and then Present (Entity (Target))
+ and then Ekind_In (Entity (Target), E_Constant, E_Variable)
+ then
+ Set_Last_Aggregate_Assignment (Entity (Target), Last (Aggr_Code));
+ end if;
end;
-- If the aggregate is the expression in a declaration, the expanded
@@ -6210,23 +6223,8 @@ package body Exp_Aggr is
if Is_Record_Type (Etype (N)) then
Aggr_Code := Build_Record_Aggr_Code (N, Typ, Target);
- -- Save the last assignment statement associated with the aggregate
- -- when building a controlled object. This reference is utilized by
- -- the finalization machinery when marking an object as successfully
- -- initialized.
-
- if Needs_Finalization (Typ)
- and then Is_Entity_Name (Target)
- and then Present (Entity (Target))
- and then Ekind (Entity (Target)) = E_Variable
- then
- Set_Last_Aggregate_Assignment (Entity (Target), Last (Aggr_Code));
- end if;
-
- return Aggr_Code;
-
else pragma Assert (Is_Array_Type (Etype (N)));
- return
+ Aggr_Code :=
Build_Array_Aggr_Code
(N => N,
Ctype => Component_Type (Etype (N)),
@@ -6235,6 +6233,21 @@ package body Exp_Aggr is
Scalar_Comp => Is_Scalar_Type (Component_Type (Typ)),
Indexes => No_List);
end if;
+
+ -- Save the last assignment statement associated with the aggregate
+ -- when building a controlled object. This reference is utilized by
+ -- the finalization machinery when marking an object as successfully
+ -- initialized.
+
+ if Needs_Finalization (Typ)
+ and then Is_Entity_Name (Target)
+ and then Present (Entity (Target))
+ and then Ekind_In (Entity (Target), E_Constant, E_Variable)
+ then
+ Set_Last_Aggregate_Assignment (Entity (Target), Last (Aggr_Code));
+ end if;
+
+ return Aggr_Code;
end Late_Expansion;
----------------------------------