diff options
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 21e16ac..522ea3c 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -3169,14 +3169,15 @@ package body Sem_Util is -- Enclosing_Lib_Unit_Entity -- ------------------------------- - function Enclosing_Lib_Unit_Entity return Entity_Id is - Unit_Entity : Entity_Id; + function Enclosing_Lib_Unit_Entity + (E : Entity_Id := Current_Scope) return Entity_Id + is + Unit_Entity : Entity_Id := E; begin -- Look for enclosing library unit entity by following scope links. -- Equivalent to, but faster than indexing through the scope stack. - Unit_Entity := Current_Scope; while (Present (Scope (Unit_Entity)) and then Scope (Unit_Entity) /= Standard_Standard) and not Is_Child_Unit (Unit_Entity) @@ -6267,6 +6268,37 @@ package body Sem_Util is return False; end In_Parameter_Specification; + ------------------------------------- + -- In_Reverse_Storage_Order_Record -- + ------------------------------------- + + function In_Reverse_Storage_Order_Record (N : Node_Id) return Boolean is + Pref : Node_Id; + begin + Pref := N; + + -- Climb up indexed components + + loop + case Nkind (Pref) is + when N_Selected_Component => + Pref := Prefix (Pref); + exit; + + when N_Indexed_Component => + Pref := Prefix (Pref); + + when others => + Pref := Empty; + exit; + end case; + end loop; + + return Present (Pref) + and then Is_Record_Type (Etype (Pref)) + and then Reverse_Storage_Order (Etype (Pref)); + end In_Reverse_Storage_Order_Record; + -------------------------------------- -- In_Subprogram_Or_Concurrent_Unit -- -------------------------------------- |