From: Piotr Trojanek Date: Thu, 6 Aug 2020 20:19:18 +0000 (+0200) Subject: [Ada] Refactor repeated calls to Etype in aggregate expansion X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=74580e1b05a04184bd23ad115f10d09428535182;p=gcc.git [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. --- diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 7bdd11bf3a0..bbb4f889454 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