diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-08-06 22:19:18 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-21 03:22:48 -0400 |
commit | 74580e1b05a04184bd23ad115f10d09428535182 (patch) | |
tree | b71dda127b29b1107da045046d32c4852dc44e7c | |
parent | 3c2d338129a5c77a95b1b6d165db0ec328fb1938 (diff) | |
download | gcc-74580e1b05a04184bd23ad115f10d09428535182.zip gcc-74580e1b05a04184bd23ad115f10d09428535182.tar.gz gcc-74580e1b05a04184bd23ad115f10d09428535182.tar.bz2 |
[Ada] Refactor repeated calls to Etype in aggregate expansion
gcc/ada/
* exp_aggr.adb (Expand_N_Aggregate): Refactor repeated calls to
Etype (N).
(Build_Array_Aggr_Code): Fix whitespace.
-rw-r--r-- | gcc/ada/exp_aggr.adb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 7bdd11b..bbb4f88 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -2334,7 +2334,7 @@ package body Exp_Aggr is Sort_Case_Table (Table); end if; - -- STEP 1 (b): take care of the whole set of discrete choices + -- STEP 1 (b): take care of the whole set of discrete choices for J in 1 .. Nb_Choices loop Low := Table (J).Choice_Lo; @@ -6755,15 +6755,16 @@ package body Exp_Aggr is ------------------------ procedure Expand_N_Aggregate (N : Node_Id) is + T : constant Entity_Id := Etype (N); begin -- Record aggregate case - if Is_Record_Type (Etype (N)) - and then not Is_Private_Type (Etype (N)) + if Is_Record_Type (T) + and then not Is_Private_Type (T) then Expand_Record_Aggregate (N); - elsif Has_Aspect (Etype (N), Aspect_Aggregate) then + elsif Has_Aspect (T, Aspect_Aggregate) then Expand_Container_Aggregate (N); -- Array aggregate case @@ -6811,11 +6812,10 @@ package body Exp_Aggr is and then No (Expressions (N)) then declare - T : constant Entity_Id := Etype (N); - X : constant Node_Id := First_Index (T); - EC : constant Node_Id := Expression (CA); - CV : constant Uint := Char_Literal_Value (EC); - CC : constant Int := UI_To_Int (CV); + X : constant Node_Id := First_Index (T); + EC : constant Node_Id := Expression (CA); + CV : constant Uint := Char_Literal_Value (EC); + CC : constant Int := UI_To_Int (CV); begin if Nkind (X) = N_Range |