diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2018-05-21 14:51:30 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-05-21 14:51:30 +0000 |
commit | a2fcf1e02c7809a14e2bde3a26fec86b4cbd9ab3 (patch) | |
tree | 965e9eecd1c483c226fab310bb3af99a96c626a4 /gcc/ada/sem_eval.adb | |
parent | 663afa9fac474647f69f242deab6bdc0bcaf1bf8 (diff) | |
download | gcc-a2fcf1e02c7809a14e2bde3a26fec86b4cbd9ab3.zip gcc-a2fcf1e02c7809a14e2bde3a26fec86b4cbd9ab3.tar.gz gcc-a2fcf1e02c7809a14e2bde3a26fec86b4cbd9ab3.tar.bz2 |
[Ada] Clarify code for accessing full view of a type
2018-05-21 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_eval.adb (Is_Null_Range): Clarify access to the full view of a
type.
(Not_Null_Range): Same as above.
From-SVN: r260460
Diffstat (limited to 'gcc/ada/sem_eval.adb')
-rw-r--r-- | gcc/ada/sem_eval.adb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index ca51626..48e141d 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -4767,8 +4767,7 @@ package body Sem_Eval is and then Compile_Time_Known_Value (Hi) then declare - Typ : Entity_Id := Etype (Lo); - Full_Typ : constant Entity_Id := Full_View (Typ); + Typ : Entity_Id := Etype (Lo); begin -- When called from the frontend, as part of the analysis of -- potentially static expressions, Typ will be the full view of a @@ -4777,8 +4776,10 @@ package body Sem_Eval is -- is null, Typ might be a private type and we need to explicitly -- switch to its corresponding full view to access the same info. - if Present (Full_Typ) then - Typ := Full_Typ; + if Is_Incomplete_Or_Private_Type (Typ) + and then Present (Full_View (Typ)) + then + Typ := Full_View (Typ); end if; if Is_Discrete_Type (Typ) then @@ -5356,8 +5357,7 @@ package body Sem_Eval is and then Compile_Time_Known_Value (Hi) then declare - Typ : Entity_Id := Etype (Lo); - Full_Typ : constant Entity_Id := Full_View (Typ); + Typ : Entity_Id := Etype (Lo); begin -- When called from the frontend, as part of the analysis of -- potentially static expressions, Typ will be the full view of a @@ -5366,8 +5366,10 @@ package body Sem_Eval is -- is null, Typ might be a private type and we need to explicitly -- switch to its corresponding full view to access the same info. - if Present (Full_Typ) then - Typ := Full_Typ; + if Is_Incomplete_Or_Private_Type (Typ) + and then Present (Full_View (Typ)) + then + Typ := Full_View (Typ); end if; if Is_Discrete_Type (Typ) then |