From: Piotr Trojanek Date: Tue, 29 Sep 2020 10:40:39 +0000 (+0200) Subject: [Ada] Avoid potentially repeated calls to Prefix in Eval_Slice X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc0c82e99485589937789888e4bd7275c236b3be;p=gcc.git [Ada] Avoid potentially repeated calls to Prefix in Eval_Slice gcc/ada/ * sem_eval.adb (Eval_Slice): Refactor repeated calls to Prefix with a local constant (named just like in Resolve_Slice). --- diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index e453bc1676b..4dc524817b6 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -3944,6 +3944,7 @@ package body Sem_Eval is procedure Eval_Slice (N : Node_Id) is Drange : constant Node_Id := Discrete_Range (N); + Name : constant Node_Id := Prefix (N); begin if Nkind (Drange) = N_Range then @@ -3955,9 +3956,9 @@ package body Sem_Eval is -- the type of A, is redundant, the slice can be replaced with A, and -- this is worth a warning. - if Is_Entity_Name (Prefix (N)) then + if Is_Entity_Name (Name) then declare - E : constant Entity_Id := Entity (Prefix (N)); + E : constant Entity_Id := Entity (Name); T : constant Entity_Id := Etype (E); begin