2009-07-10 Javier Miranda <miranda@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Jul 2009 09:10:43 +0000 (09:10 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Jul 2009 09:10:43 +0000 (09:10 +0000)
* exp_util.adb (Find_Interface_Tag): Reorder processing of incoming
Typ argument to ensure proper management of access types.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149461 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/exp_util.adb

index af7d0aa..97aa765 100644 (file)
@@ -1600,28 +1600,24 @@ package body Exp_Util is
    begin
       pragma Assert (Is_Interface (Iface));
 
-      --  Handle private types
-
-      if Has_Private_Declaration (Typ)
-        and then Present (Full_View (Typ))
-      then
-         Typ := Full_View (Typ);
-      end if;
-
       --  Handle access types
 
       if Is_Access_Type (Typ) then
          Typ := Directly_Designated_Type (Typ);
       end if;
 
-      --  Handle task and protected types implementing interfaces
+      --  Handle class-wide types
 
-      if Is_Concurrent_Type (Typ) then
-         Typ := Corresponding_Record_Type (Typ);
+      if Is_Class_Wide_Type (Typ) then
+         Typ := Root_Type (Typ);
       end if;
 
-      if Is_Class_Wide_Type (Typ) then
-         Typ := Etype (Typ);
+      --  Handle private types
+
+      if Has_Private_Declaration (Typ)
+        and then Present (Full_View (Typ))
+      then
+         Typ := Full_View (Typ);
       end if;
 
       --  Handle entities from the limited view
@@ -1631,6 +1627,12 @@ package body Exp_Util is
          Typ := Non_Limited_View (Typ);
       end if;
 
+      --  Handle task and protected types implementing interfaces
+
+      if Is_Concurrent_Type (Typ) then
+         Typ := Corresponding_Record_Type (Typ);
+      end if;
+
       Find_Tag (Typ);
       pragma Assert (Found);
       return AI_Tag;