diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2021-01-13 22:53:32 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-05-05 04:19:05 -0400 |
commit | c3870f3bcf02c780d73639080d5195f4be4ef1ac (patch) | |
tree | 9e55a42ec7c318d30e34b036ba5fed8df5574331 | |
parent | 43f69ac8b2d08a18497e124422cbb6031539421c (diff) | |
download | gcc-c3870f3bcf02c780d73639080d5195f4be4ef1ac.zip gcc-c3870f3bcf02c780d73639080d5195f4be4ef1ac.tar.gz gcc-c3870f3bcf02c780d73639080d5195f4be4ef1ac.tar.bz2 |
[Ada] Refine types of variables with call to Scope as their initial values
gcc/ada/
* exp_ch4.adb (User_Defined_Primitive_Equality_Op): Refine type
of a local variable.
* exp_dbug.adb (Scope_Contains): Refine all types from Node_Id
to Entity_Id; rename parameters to match those of the
Scope_Within routine (which is similar but not the same); also,
simplify an OR ELSE into a membership test.
-rw-r--r-- | gcc/ada/exp_ch4.adb | 2 | ||||
-rw-r--r-- | gcc/ada/exp_dbug.adb | 20 |
2 files changed, 14 insertions, 8 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index e8fa5a8..e29535e 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -8082,7 +8082,7 @@ package body Exp_Ch4 is function User_Defined_Primitive_Equality_Op (Typ : Entity_Id) return Entity_Id is - Enclosing_Scope : constant Node_Id := Scope (Typ); + Enclosing_Scope : constant Entity_Id := Scope (Typ); E : Entity_Id; begin for Private_Entities in Boolean loop diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb index a74157c..8a75367 100644 --- a/gcc/ada/exp_dbug.adb +++ b/gcc/ada/exp_dbug.adb @@ -315,8 +315,11 @@ package body Exp_Dbug is -- output in one of these two forms. The result is prepended to the -- name stored in Name_Buffer. - function Scope_Contains (Sc : Node_Id; Ent : Entity_Id) return Boolean; - -- Return whether Ent belong to the Sc scope + function Scope_Contains + (Outer : Entity_Id; + Inner : Entity_Id) + return Boolean; + -- Return whether Inner belongs to the Outer scope ---------------------------- -- Enable_If_Packed_Array -- @@ -344,8 +347,7 @@ package body Exp_Dbug is elsif Nkind (N) = N_Identifier and then Scope_Contains (Scope (Entity (N)), Ent) - and then (Ekind (Entity (N)) = E_Constant - or else Ekind (Entity (N)) = E_In_Parameter) + and then Ekind (Entity (N)) in E_Constant | E_In_Parameter then Prepend_String_To_Buffer (Get_Name_String (Chars (Entity (N)))); @@ -361,12 +363,16 @@ package body Exp_Dbug is -- Scope_Contains -- -------------------- - function Scope_Contains (Sc : Node_Id; Ent : Entity_Id) return Boolean is - Cur : Node_Id := Scope (Ent); + function Scope_Contains + (Outer : Entity_Id; + Inner : Entity_Id) + return Boolean + is + Cur : Entity_Id := Scope (Inner); begin while Present (Cur) loop - if Cur = Sc then + if Cur = Outer then return True; end if; |