[gcc r11-5417] [Ada] Avoid potentially repeated calls to Prefix in Eval_Slice
Pierre-Marie de Rodat
pmderodat@gcc.gnu.org
Thu Nov 26 08:42:26 GMT 2020
https://gcc.gnu.org/g:bc0c82e99485589937789888e4bd7275c236b3be
commit r11-5417-gbc0c82e99485589937789888e4bd7275c236b3be
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Tue Sep 29 12:40:39 2020 +0200
[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:
---
gcc/ada/sem_eval.adb | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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
More information about the Gcc-cvs
mailing list