aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-06-09 00:24:34 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-07-05 08:28:20 +0000
commitd2672ffea0a478b265f5ed0239723c8ba54e8d24 (patch)
treeecab2b7dfc2956851a398b4ed7639cd73d5e7f27
parenta2eaf87ffeaee689e431a3c85b001208d6705421 (diff)
downloadgcc-d2672ffea0a478b265f5ed0239723c8ba54e8d24.zip
gcc-d2672ffea0a478b265f5ed0239723c8ba54e8d24.tar.gz
gcc-d2672ffea0a478b265f5ed0239723c8ba54e8d24.tar.bz2
[Ada] Couple of small cleanups for Cloned_Subtype
No functional changes. gcc/ada/ * exp_util.adb (Make_Subtype_From_Expr): Do not set field to Empty. * sem_util.adb (Visit_Itype): Remove ??? comment.
-rw-r--r--gcc/ada/exp_util.adb9
-rw-r--r--gcc/ada/sem_util.adb3
2 files changed, 5 insertions, 7 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index eaf7ebf..8557e4b 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -10213,8 +10213,8 @@ package body Exp_Util is
elsif Is_Class_Wide_Type (Unc_Typ) then
declare
- CW_Subtype : Entity_Id;
- EQ_Typ : Entity_Id := Empty;
+ CW_Subtype : constant Entity_Id :=
+ New_Class_Wide_Subtype (Unc_Typ, E);
begin
-- A class-wide equivalent type is not needed on VM targets
@@ -10237,11 +10237,10 @@ package body Exp_Util is
Set_Etype (Unc_Typ, Base_Type (Full_View (Etype (Unc_Typ))));
end if;
- EQ_Typ := Make_CW_Equivalent_Type (Unc_Typ, E);
+ Set_Equivalent_Type
+ (CW_Subtype, Make_CW_Equivalent_Type (Unc_Typ, E));
end if;
- CW_Subtype := New_Class_Wide_Subtype (Unc_Typ, E);
- Set_Equivalent_Type (CW_Subtype, EQ_Typ);
Set_Cloned_Subtype (CW_Subtype, Base_Type (Unc_Typ));
return New_Occurrence_Of (CW_Subtype, Loc);
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index df9fed1..edb9482 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -25146,8 +25146,7 @@ package body Sem_Util is
end if;
-- If a record subtype is simply copied, the entity list will be
- -- shared. Thus cloned_Subtype must be set to indicate the sharing.
- -- ??? What does this do?
+ -- shared, so Cloned_Subtype must be set to indicate this.
if Ekind (Itype) in E_Class_Wide_Subtype | E_Record_Subtype then
Set_Cloned_Subtype (New_Itype, Itype);