diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2022-03-08 17:46:26 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-05-16 08:42:03 +0000 |
commit | 9a39b25f6f52f6eab159a096551e2576fa0890cd (patch) | |
tree | 3a8549c4b34f9c102287a9fe7c49b43c6edf8e27 /gcc/ada | |
parent | 90fadb50df34d11348ec67a1cbbaeac8a28c2da3 (diff) | |
download | gcc-9a39b25f6f52f6eab159a096551e2576fa0890cd.zip gcc-9a39b25f6f52f6eab159a096551e2576fa0890cd.tar.gz gcc-9a39b25f6f52f6eab159a096551e2576fa0890cd.tar.bz2 |
[Ada] Remove duplicated detection of user-defined equality
Cleanup related to handling of user-defined equality in GNATprove.
gcc/ada/
* exp_ch3.adb (User_Defined_Eq): Replace duplicated code with a
call to Get_User_Defined_Eq.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/exp_ch3.adb | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index dfbbc62..ef53591 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -4500,32 +4500,14 @@ package body Exp_Ch3 is --------------------- function User_Defined_Eq (T : Entity_Id) return Entity_Id is - Prim : Elmt_Id; - Op : Entity_Id; + Op : constant Entity_Id := TSS (T, TSS_Composite_Equality); begin - Op := TSS (T, TSS_Composite_Equality); - if Present (Op) then return Op; + else + return Get_User_Defined_Eq (T); end if; - - Prim := First_Elmt (Collect_Primitive_Operations (T)); - while Present (Prim) loop - Op := Node (Prim); - - if Chars (Op) = Name_Op_Eq - and then Etype (Op) = Standard_Boolean - and then Etype (First_Formal (Op)) = T - and then Etype (Next_Formal (First_Formal (Op))) = T - then - return Op; - end if; - - Next_Elmt (Prim); - end loop; - - return Empty; end User_Defined_Eq; -- Start of processing for Build_Untagged_Equality |