[Ada] Reuse Is_Packed_Array where possible
gcc/ada/ * exp_attr.adb, exp_ch4.adb, exp_intr.adb, sem_ch8.adb, sem_res.adb, sem_type.adb, sem_util.adb: Reuse Is_Packed_Array.
This commit is contained in:
parent
cb9d41eb25
commit
bfe5f951ce
@ -4235,7 +4235,7 @@ package body Exp_Attr is
|
||||
begin
|
||||
-- Processing for packed array types
|
||||
|
||||
if Is_Array_Type (Ptyp) and then Is_Packed (Ptyp) then
|
||||
if Is_Packed_Array (Ptyp) then
|
||||
Ityp := Get_Index_Subtype (N);
|
||||
|
||||
-- If the index type, Ityp, is an enumeration type with holes,
|
||||
@ -4333,7 +4333,7 @@ package body Exp_Attr is
|
||||
Xtyp : Entity_Id;
|
||||
|
||||
begin
|
||||
if Is_Array_Type (Dtyp) and then Is_Packed (Dtyp) then
|
||||
if Is_Packed_Array (Dtyp) then
|
||||
Xtyp := Get_Index_Subtype (N);
|
||||
|
||||
Rewrite (N,
|
||||
@ -7869,8 +7869,7 @@ package body Exp_Attr is
|
||||
|
||||
if Is_Entity_Name (Pref)
|
||||
and then Is_Formal (Entity (Pref))
|
||||
and then Is_Array_Type (Ptyp)
|
||||
and then Is_Packed (Ptyp)
|
||||
and then Is_Packed_Array (Ptyp)
|
||||
then
|
||||
Rewrite (N,
|
||||
Make_Attribute_Reference (Loc,
|
||||
@ -7884,9 +7883,8 @@ package body Exp_Attr is
|
||||
-- type, but also a hint to the actual constrained type.
|
||||
|
||||
elsif Nkind (Pref) = N_Explicit_Dereference
|
||||
and then Is_Array_Type (Ptyp)
|
||||
and then Is_Packed_Array (Ptyp)
|
||||
and then not Is_Constrained (Ptyp)
|
||||
and then Is_Packed (Ptyp)
|
||||
then
|
||||
Set_Actual_Designated_Subtype (Pref, Get_Actual_Subtype (Pref));
|
||||
|
||||
|
||||
@ -1268,9 +1268,8 @@ package body Exp_Ch4 is
|
||||
-- expression with a constrained subtype in order to compute the
|
||||
-- proper size for the allocator.
|
||||
|
||||
if Is_Array_Type (T)
|
||||
if Is_Packed_Array (T)
|
||||
and then not Is_Constrained (T)
|
||||
and then Is_Packed (T)
|
||||
then
|
||||
declare
|
||||
ConstrT : constant Entity_Id := Make_Temporary (Loc, 'A');
|
||||
|
||||
@ -1229,9 +1229,8 @@ package body Exp_Intr is
|
||||
|
||||
if Is_Class_Wide_Type (Desig_Typ)
|
||||
or else
|
||||
(Is_Array_Type (Desig_Typ)
|
||||
and then not Is_Constrained (Desig_Typ)
|
||||
and then Is_Packed (Desig_Typ))
|
||||
(Is_Packed_Array (Desig_Typ)
|
||||
and then not Is_Constrained (Desig_Typ))
|
||||
then
|
||||
declare
|
||||
Deref : constant Node_Id :=
|
||||
|
||||
@ -5659,8 +5659,7 @@ package body Sem_Ch8 is
|
||||
-- happens for trees generated from Exp_Pakd, where expressions
|
||||
-- can be deliberately "mis-typed" to the packed array type.
|
||||
|
||||
if Is_Array_Type (Entyp)
|
||||
and then Is_Packed (Entyp)
|
||||
if Is_Packed_Array (Entyp)
|
||||
and then Present (Etype (N))
|
||||
and then Etype (N) = Packed_Array_Impl_Type (Entyp)
|
||||
then
|
||||
|
||||
@ -8849,8 +8849,7 @@ package body Sem_Res is
|
||||
-- actual subtype. We also exclude generated code (which builds actual
|
||||
-- subtypes directly if they are needed).
|
||||
|
||||
if Is_Array_Type (Etype (N))
|
||||
and then Is_Packed (Etype (N))
|
||||
if Is_Packed_Array (Etype (N))
|
||||
and then not Is_Constrained (Etype (N))
|
||||
and then Nkind (Parent (N)) /= N_Attribute_Reference
|
||||
and then Comes_From_Source (N)
|
||||
|
||||
@ -1167,16 +1167,14 @@ package body Sem_Type is
|
||||
-- useless unchecked conversions, and since this can only arise in
|
||||
-- (known correct) expanded code, no harm is done.
|
||||
|
||||
elsif Is_Array_Type (T2)
|
||||
and then Is_Packed (T2)
|
||||
elsif Is_Packed_Array (T2)
|
||||
and then T1 = Packed_Array_Impl_Type (T2)
|
||||
then
|
||||
return True;
|
||||
|
||||
-- Similarly an array type covers its corresponding packed array type
|
||||
|
||||
elsif Is_Array_Type (T1)
|
||||
and then Is_Packed (T1)
|
||||
elsif Is_Packed_Array (T1)
|
||||
and then T2 = Packed_Array_Impl_Type (T1)
|
||||
then
|
||||
return True;
|
||||
|
||||
@ -20450,8 +20450,7 @@ package body Sem_Util is
|
||||
|
||||
elsif Nkind (P) = N_Type_Conversion
|
||||
and then not Comes_From_Source (P)
|
||||
and then Is_Array_Type (Etype (P))
|
||||
and then Is_Packed (Etype (P))
|
||||
and then Is_Packed_Array (Etype (P))
|
||||
then
|
||||
return Is_Variable (Expression (P));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user