aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-03-13 21:07:56 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-11 05:53:45 -0400
commit428d49a5a8d3f39b14519ada0ab46c4193581684 (patch)
tree560af0eceb2fb3319bb9bb1ee2dfe2110a9d7436
parentc5b55e683cace7be98536c413a70f854a70faaa7 (diff)
downloadgcc-428d49a5a8d3f39b14519ada0ab46c4193581684.zip
gcc-428d49a5a8d3f39b14519ada0ab46c4193581684.tar.gz
gcc-428d49a5a8d3f39b14519ada0ab46c4193581684.tar.bz2
[Ada] Skip unnecessary iterations over constraint expressions
2020-06-11 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * sem_ch3.adb (Build_Constrained_Array_Type, Build_Constrained_Discriminated_Type): Skip unnecessary loop iterations.
-rw-r--r--gcc/ada/sem_ch3.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 026bcef..ccb0ea9 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -13093,7 +13093,7 @@ package body Sem_Ch3 is
Scop : Entity_Id;
begin
- -- if the original access type was not embedded in the enclosing
+ -- If the original access type was not embedded in the enclosing
-- type definition, there is no need to produce a new access
-- subtype. In fact every access type with an explicit constraint
-- generates an itype whose scope is the enclosing record.
@@ -13192,6 +13192,7 @@ package body Sem_Ch3 is
Is_Discriminant (Hi_Expr)
then
Need_To_Create_Itype := True;
+ exit;
end if;
Next_Index (Old_Index);
@@ -13248,6 +13249,7 @@ package body Sem_Ch3 is
if Is_Discriminant (Expr) then
Need_To_Create_Itype := True;
+ exit;
-- After expansion of discriminated task types, the value
-- of the discriminant may be converted to a run-time type
@@ -13259,6 +13261,7 @@ package body Sem_Ch3 is
and then Is_Discriminant (Expression (Expr))
then
Need_To_Create_Itype := True;
+ exit;
end if;
Next_Elmt (Old_Constraint);