From: Piotr Trojanek Date: Mon, 21 May 2018 14:51:30 +0000 (+0000) Subject: [Ada] Clarify code for accessing full view of a type X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a2fcf1e02c7809a14e2bde3a26fec86b4cbd9ab3;p=gcc.git [Ada] Clarify code for accessing full view of a type 2018-05-21 Piotr Trojanek 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0720a9c34ea..10661df9e5e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-04-04 Piotr Trojanek + + * sem_eval.adb (Is_Null_Range): Clarify access to the full view of a + type. + (Not_Null_Range): Same as above. + 2018-04-04 Hristian Kirtchev * exp_ch3.adb: Minor reformatting. diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index ca516262c36..48e141d64a6 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