diff options
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 93 |
1 files changed, 42 insertions, 51 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index f6088af..adbe0ce 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -990,17 +990,14 @@ package body Sem_Util is Disc : Entity_Id) is Loc : constant Source_Ptr := Sloc (Expr); - begin Set_Is_Overloaded (Expr, False); Rewrite (Expr, Make_Explicit_Dereference (Loc, Prefix => Make_Selected_Component (Loc, - Prefix => Relocate_Node (Expr), - Selector_Name => - New_Occurrence_Of (Disc, Loc)))); - + Prefix => Relocate_Node (Expr), + Selector_Name => New_Occurrence_Of (Disc, Loc)))); Set_Etype (Prefix (Expr), Etype (Disc)); Set_Etype (Expr, Designated_Type (Etype (Disc))); end Build_Explicit_Dereference; @@ -7178,9 +7175,7 @@ package body Sem_Util is Iface : Entity_Id; begin - if not Is_Tagged_Type (Typ) - or else not Is_Derived_Type (Typ) - then + if not Is_Tagged_Type (Typ) or else not Is_Derived_Type (Typ) then return False; else @@ -7202,45 +7197,7 @@ package body Sem_Util is return False; end if; - end Is_Iterator; - - ---------------------------- - -- Is_Reversible_Iterator -- - ---------------------------- - - function Is_Reversible_Iterator (Typ : Entity_Id) return Boolean is - Ifaces_List : Elist_Id; - Iface_Elmt : Elmt_Id; - Iface : Entity_Id; - - begin - if not Is_Tagged_Type (Typ) - or else not Is_Derived_Type (Typ) - then - return False; - else - - Collect_Interfaces (Typ, Ifaces_List); - - Iface_Elmt := First_Elmt (Ifaces_List); - while Present (Iface_Elmt) loop - Iface := Node (Iface_Elmt); - if Chars (Iface) = Name_Reversible_Iterator - and then - Is_Predefined_File_Name - (Unit_File_Name (Get_Source_Unit (Iface))) - then - return True; - end if; - - Next_Elmt (Iface_Elmt); - end loop; - - end if; - return False; - end Is_Reversible_Iterator; - ------------ -- Is_LHS -- ------------ @@ -7466,15 +7423,15 @@ package body Sem_Util is -- original node is a conversion, then Is_Variable will not be true -- but we still want to allow the conversion if it converts a variable). - -- In Ada2012, the explicit dereference may be a rewritten call - -- to a Reference function. - elsif Original_Node (AV) /= AV then + + -- In Ada2012, the explicit dereference may be a rewritten call to a + -- Reference function. + if Ada_Version >= Ada_2012 and then Nkind (Original_Node (AV)) = N_Function_Call and then - Has_Implicit_Dereference - (Etype (Name (Original_Node (AV)))) + Has_Implicit_Dereference (Etype (Name (Original_Node (AV)))) then return True; @@ -7884,6 +7841,40 @@ package body Sem_Util is return False; end Is_Renamed_Entry; + ---------------------------- + -- Is_Reversible_Iterator -- + ---------------------------- + + function Is_Reversible_Iterator (Typ : Entity_Id) return Boolean is + Ifaces_List : Elist_Id; + Iface_Elmt : Elmt_Id; + Iface : Entity_Id; + + begin + if not Is_Tagged_Type (Typ) or else not Is_Derived_Type (Typ) then + return False; + + else + Collect_Interfaces (Typ, Ifaces_List); + + Iface_Elmt := First_Elmt (Ifaces_List); + while Present (Iface_Elmt) loop + Iface := Node (Iface_Elmt); + if Chars (Iface) = Name_Reversible_Iterator + and then + Is_Predefined_File_Name + (Unit_File_Name (Get_Source_Unit (Iface))) + then + return True; + end if; + + Next_Elmt (Iface_Elmt); + end loop; + end if; + + return False; + end Is_Reversible_Iterator; + ---------------------- -- Is_Selector_Name -- ---------------------- |