diff options
author | Ghjuvan Lacambre <lacambre@adacore.com> | 2021-01-13 18:03:15 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-05-06 03:51:38 -0400 |
commit | 1075946d061f01d767cf42f437be99aefe02ea97 (patch) | |
tree | ddadaeb10d6411ba86fc9f05a981eea76e7032a0 /gcc | |
parent | a86fbc250c5a6c6d5ae408166ef440f6c0f65df7 (diff) | |
download | gcc-1075946d061f01d767cf42f437be99aefe02ea97.zip gcc-1075946d061f01d767cf42f437be99aefe02ea97.tar.gz gcc-1075946d061f01d767cf42f437be99aefe02ea97.tar.bz2 |
[Ada] Make Is_OK_Static_Subtype use Is_Static_Subtype
gcc/ada/
* sem_eval.adb (Is_OK_Static_Subtype): Call Is_Static_Subtype,
remove redundant checks.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_eval.adb | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 9b272d2..7931015 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -5549,23 +5549,16 @@ package body Sem_Eval is return False; end if; - Anc_Subt := Ancestor_Subtype (Typ); - - if Anc_Subt = Empty then - Anc_Subt := Base_T; - end if; + -- Then, check if the subtype is strictly static. This takes care of + -- checking for generics and predicates. - if Is_Generic_Type (Root_Type (Base_T)) - or else Is_Generic_Actual_Type (Base_T) - then - return False; - - elsif Has_Dynamic_Predicate_Aspect (Typ) then + if not Is_Static_Subtype (Typ) then return False; + end if; -- String types - elsif Is_String_Type (Typ) then + if Is_String_Type (Typ) then return Ekind (Typ) = E_String_Literal_Subtype or else @@ -5579,6 +5572,12 @@ package body Sem_Eval is return True; else + Anc_Subt := Ancestor_Subtype (Typ); + + if No (Anc_Subt) then + Anc_Subt := Base_T; + end if; + -- Scalar_Range (Typ) might be an N_Subtype_Indication, so use -- Get_Type_{Low,High}_Bound. |