diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-23 12:24:22 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-23 12:24:22 +0000 |
commit | 92974b1344824f67d4219cb38db9049485f73913 (patch) | |
tree | eba1ce95890c8b8d569f9435de42036be9b79836 /gcc/ada/sem_util.adb | |
parent | e1458cf8d179035643d1fe0d45e3c763967b157c (diff) | |
download | gcc-92974b1344824f67d4219cb38db9049485f73913.tar.gz |
2015-10-23 Hristian Kirtchev <kirtchev@adacore.com>
* sem_util.adb (Denotes_Iterator): New routine.
(Is_Iterator): Code cleanup. Factor out the detection of a
predefined iterator. As a result this fixes a missing case
where a tagged type implements interface Reversible_Iterator.
2015-10-23 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Eval_Attribute): Constant-fold 'Enabled if
not within a generic unit, even if expander is not active, so
that instances of container packages remain preelaborable in
-gnatc mode.
2015-10-23 Tristan Gingold <gingold@adacore.com>
* init.c (__gnat_sigtramp): New assembly function for arm64-darwin.
(__gnat_error_handler): Use trampoline for arm64.
2015-10-23 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb (Expand_N_Object_Declaration): if the type of the
object is a class-wide limited interface type, the expression
is not restricted to the forms specified for limited types.
2015-10-23 Vincent Celier <celier@adacore.com>
* gnatname.adb: Code clean up.
* s-taasde.ads: Fix comment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229240 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 325e3c58499..a8052000b31 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -12114,21 +12114,37 @@ package body Sem_Util is ----------------- function Is_Iterator (Typ : Entity_Id) return Boolean is - Ifaces_List : Elist_Id; - Iface_Elmt : Elmt_Id; - Iface : Entity_Id; + function Denotes_Iterator (Iter_Typ : Entity_Id) return Boolean; + -- Determine whether type Iter_Typ is a predefined forward or reversible + -- iterator. + + ---------------------- + -- Denotes_Iterator -- + ---------------------- + + function Denotes_Iterator (Iter_Typ : Entity_Id) return Boolean is + begin + return + Nam_In (Chars (Iter_Typ), Name_Forward_Iterator, + Name_Reversible_Iterator) + and then Is_Predefined_File_Name + (Unit_File_Name (Get_Source_Unit (Iter_Typ))); + end Denotes_Iterator; + + -- Local variables + + Iface_Elmt : Elmt_Id; + Ifaces : Elist_Id; + + -- Start of processing for Is_Iterator begin -- The type may be a subtype of a descendant of the proper instance of -- the predefined interface type, so we must use the root type of the - -- given type. The same us done for Is_Reversible_Iterator. + -- given type. The same is done for Is_Reversible_Iterator. if Is_Class_Wide_Type (Typ) - and then Nam_In (Chars (Root_Type (Typ)), Name_Forward_Iterator, - Name_Reversible_Iterator) - and then - Is_Predefined_File_Name - (Unit_File_Name (Get_Source_Unit (Root_Type (Typ)))) + and then Denotes_Iterator (Root_Type (Typ)) then return True; @@ -12139,16 +12155,11 @@ package body Sem_Util is return True; else - Collect_Interfaces (Typ, Ifaces_List); + Collect_Interfaces (Typ, Ifaces); - Iface_Elmt := First_Elmt (Ifaces_List); + Iface_Elmt := First_Elmt (Ifaces); while Present (Iface_Elmt) loop - Iface := Node (Iface_Elmt); - if Chars (Iface) = Name_Forward_Iterator - and then - Is_Predefined_File_Name - (Unit_File_Name (Get_Source_Unit (Iface))) - then + if Denotes_Iterator (Node (Iface_Elmt)) then return True; end if; |