From: Eric Botcazou <ebotca...@adacore.com>

This moves a few declarations around and tweaks a few comments.

gcc/ada/ChangeLog:

        * exp_aggr.adb (Case_Table_Type): Fix reference in comment.
        (In_Place_Assign_OK): Move declaration around.
        (Is_Build_In_Place_Aggregate_Return): Likewise and adjust.
        (Expand_Array_Aggregate): Streamline for the sake of consistency.
        (Aggr_Assignment_OK_For_Backend): Remove reference to Gigi/gcc.
        (Backend_Processing_Possible): Likewise.
        (Expand_Array_Aggregate): Add comment.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_aggr.adb | 41 +++++++++++++++++++----------------------
 1 file changed, 19 insertions(+), 22 deletions(-)

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index dae9d4e5009..fb5cfc6d1f0 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -85,7 +85,7 @@ package body Exp_Aggr is
    end record;
 
    type Case_Table_Type is array (Nat range <>) of Case_Bounds;
-   --  Table type used by Check_Case_Choices procedure
+   --  Table type used by Sort_Case_Table procedure
 
    function Get_Base_Object (N : Node_Id) return Entity_Id;
    --  Return the base object, i.e. the outermost prefix object, that N refers
@@ -106,6 +106,17 @@ package body Exp_Aggr is
    --  Comp_Typ of aggregate N. Init_Expr denotes the initialization
    --  expression of the component. All generated code is added to Stmts.
 
+   function In_Place_Assign_OK
+     (N             : Node_Id;
+      Target_Object : Entity_Id := Empty) return Boolean;
+   --  Predicate to determine whether an aggregate assignment can be done in
+   --  place, because none of the new values can depend on the components of
+   --  the target of the assignment.
+
+   function Is_Build_In_Place_Aggregate_Return (N : Node_Id) return Boolean;
+   --  Return True if N is a simple return whose expression needs to be built
+   --  in place in the return object, assuming the expression is an aggregate.
+
    function Is_Static_Dispatch_Table_Aggregate (N : Node_Id) return Boolean;
    --  Returns true if N is an aggregate used to initialize the components
    --  of a statically allocated dispatch table.
@@ -162,14 +173,6 @@ package body Exp_Aggr is
    -- Local subprograms for Record Aggregate Expansion --
    ------------------------------------------------------
 
-   function Is_Build_In_Place_Aggregate_Return (N : Node_Id) return Boolean;
-   --  Return True if N is a simple return whose expression needs to be built
-   --  in place in the return object, assuming the expression is an aggregate,
-   --  possibly qualified or a dependent expression of a conditional expression
-   --  (and possibly recursively). Such qualified and conditional expressions
-   --  are transparent for this purpose since an enclosing return is propagated
-   --  resp. distributed into these expressions by the expander.
-
    function Build_Record_Aggr_Code
      (N   : Node_Id;
       Typ : Entity_Id;
@@ -210,13 +213,6 @@ package body Exp_Aggr is
    --  defaults. An aggregate for a type with mutable components must be
    --  expanded into individual assignments.
 
-   function In_Place_Assign_OK
-     (N             : Node_Id;
-      Target_Object : Entity_Id := Empty) return Boolean;
-   --  Predicate to determine whether an aggregate assignment can be done in
-   --  place, because none of the new values can depend on the components of
-   --  the target of the assignment.
-
    procedure Initialize_Discriminants (N : Node_Id; Typ : Entity_Id);
    --  If the type of the aggregate is a type extension with renamed discrimi-
    --  nants, we must initialize the hidden discriminants of the parent.
@@ -310,8 +306,7 @@ package body Exp_Aggr is
    --  these are cases we handle in there.
 
    procedure Expand_Array_Aggregate (N : Node_Id);
-   --  This is the top-level routine for array aggregate expansion.
-   --  N is the N_Aggregate node to be expanded.
+   --  This is the top-level routine for array aggregate expansion
 
    procedure Expand_Delta_Array_Aggregate (N : Node_Id; Deltas : List_Id);
    --  This is the top-level routine for delta array aggregate expansion
@@ -351,8 +346,8 @@ package body Exp_Aggr is
    -- Aggr_Assignment_OK_For_Backend --
    ------------------------------------
 
-   --  Back-end processing by Gigi/gcc is possible only if all the following
-   --  conditions are met:
+   --  Back-end processing is possible only if all the following conditions
+   --  are met:
 
    --    1. N consists of a single OTHERS choice, possibly recursively, or
    --       of a single choice, possibly recursively, if it is surrounded by
@@ -806,8 +801,8 @@ package body Exp_Aggr is
    -- Backend_Processing_Possible --
    ---------------------------------
 
-   --  Backend processing by Gigi/gcc is possible only if all the following
-   --  conditions are met:
+   --  Back-end processing is possible only if all the following conditions
+   --  are met:
 
    --    1. N is fully positional
 
@@ -5830,6 +5825,8 @@ package body Exp_Aggr is
       then
          return;
 
+      --  Aggregates that require a two-pass expansion are handled separately
+
       elsif Is_Two_Pass_Aggregate (N) then
          Two_Pass_Aggregate_Expansion (N);
          return;
-- 
2.43.0

Reply via email to