diff options
Diffstat (limited to 'gcc/ada/einfo-utils.adb')
| -rw-r--r-- | gcc/ada/einfo-utils.adb | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb index b0acb25..22f5022 100644 --- a/gcc/ada/einfo-utils.adb +++ b/gcc/ada/einfo-utils.adb @@ -333,8 +333,7 @@ package body Einfo.Utils is function Is_Modular_Integer_Type (Id : E) return B is begin - return Ekind (Id) in Modular_Integer_Kind - and then not Has_Unsigned_Base_Range_Aspect (Base_Type (Id)); + return Ekind (Id) in Modular_Integer_Kind; end Is_Modular_Integer_Type; function Is_Named_Access_Type (Id : E) return B is @@ -394,10 +393,7 @@ package body Einfo.Utils is function Is_Signed_Integer_Type (Id : E) return B is begin - return Ekind (Id) in Signed_Integer_Kind - or else - (Ekind (Id) in Modular_Integer_Kind - and then Has_Unsigned_Base_Range_Aspect (Base_Type (Id))); + return Ekind (Id) in Signed_Integer_Kind; end Is_Signed_Integer_Type; function Is_Subprogram (Id : E) return B is @@ -1260,6 +1256,16 @@ package body Einfo.Utils is and then Present (Limited_View (Id)); end Has_Limited_View; + ---------------------------- + -- Has_Modular_Operations -- + ---------------------------- + + function Has_Modular_Operations (Id : E) return B is + begin + return Is_Modular_Integer_Type (Id) + and then not Has_Unsigned_Base_Range_Aspect (Base_Type (Id)); + end Has_Modular_Operations; + -------------------------- -- Has_Non_Limited_View -- -------------------------- @@ -1349,6 +1355,17 @@ package body Einfo.Utils is and then Nkind (Node (First_Elmt (Constits))) = N_Null; end Has_Null_Visible_Refinement; + ----------------------------- + -- Has_Overflow_Operations -- + ----------------------------- + + function Has_Overflow_Operations (Id : E) return B is + begin + return Is_Signed_Integer_Type (Id) + or else (Is_Modular_Integer_Type (Id) + and then Has_Unsigned_Base_Range_Aspect (Base_Type (Id))); + end Has_Overflow_Operations; + -------------------- -- Has_Unmodified -- -------------------- @@ -2622,13 +2639,20 @@ package body Einfo.Utils is begin return T : Opt_N_Entity_Id := Base_Type_If_Set (Id) do - if Ekind (T) = E_Class_Wide_Type then + if No (T) then + null; + elsif Ekind (T) = E_Class_Wide_Type then T := Etype (T); else loop Etyp := Etype (T); - exit when No (Etyp) or else T = Etyp + if No (Etyp) then + T := Empty; + exit; + end if; + + exit when T = Etyp or else (Is_Private_Type (T) and then Etyp = Full_View (T)) or else @@ -3086,7 +3110,7 @@ package body Einfo.Utils is elsif Ekind (Id) = E_Class_Wide_Type and then From_Limited_With (Id) - and then Present (Non_Limited_View (Id)) + and then Has_Non_Limited_View (Id) then return Underlying_Type (Non_Limited_View (Id)); @@ -3118,7 +3142,7 @@ package body Einfo.Utils is -- then we return the Underlying_Type of its nonlimited view. elsif From_Limited_With (Id) - and then Present (Non_Limited_View (Id)) + and then Has_Non_Limited_View (Id) then return Underlying_Type (Non_Limited_View (Id)); |
