aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-10-08 23:55:49 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-24 05:16:07 -0500
commitbfe5f951ce9d7fb205aa08d5a6dad699398417d9 (patch)
tree3c1be01a834c087378917aa27e2804b3102b4fb9
parentcb9d41eb252c44feeda1b137aca593a521b2b1a7 (diff)
downloadgcc-bfe5f951ce9d7fb205aa08d5a6dad699398417d9.zip
gcc-bfe5f951ce9d7fb205aa08d5a6dad699398417d9.tar.gz
gcc-bfe5f951ce9d7fb205aa08d5a6dad699398417d9.tar.bz2
[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.
-rw-r--r--gcc/ada/exp_attr.adb10
-rw-r--r--gcc/ada/exp_ch4.adb3
-rw-r--r--gcc/ada/exp_intr.adb5
-rw-r--r--gcc/ada/sem_ch8.adb3
-rw-r--r--gcc/ada/sem_res.adb3
-rw-r--r--gcc/ada/sem_type.adb6
-rw-r--r--gcc/ada/sem_util.adb3
7 files changed, 12 insertions, 21 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 70e1335..cabe891 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -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));
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 076e0de..102f7ae 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -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');
diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb
index 78bde89..7fc00c7 100644
--- a/gcc/ada/exp_intr.adb
+++ b/gcc/ada/exp_intr.adb
@@ -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 :=
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 69430a6..9404d68 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -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
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index f2f0a12..f522da0 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -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)
diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb
index 4b52249..8dbfa18 100644
--- a/gcc/ada/sem_type.adb
+++ b/gcc/ada/sem_type.adb
@@ -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;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 3af4f3a..db348ec 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -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));