exp_util.adb (Find_Interface_Tag): Reorder processing of incoming Typ argument to...
authorJavier Miranda <miranda@adacore.com>
Fri, 10 Jul 2009 09:10:43 +0000 (11:10 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 10 Jul 2009 09:10:43 +0000 (11:10 +0200)
2009-07-10  Javier Miranda  <miranda@adacore.com>

* exp_util.adb (Find_Interface_Tag): Reorder processing of incoming
Typ argument to ensure proper management of access types.

From-SVN: r149461

gcc/ada/exp_util.adb

index af7d0aa0d2d3f98f190cecde4db5423330f60d84..97aa7655330e1c8bdc48c4259d270e11808771a4 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;