summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_disp.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-22 13:53:38 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-22 13:53:38 +0000
commitbb5dfaccd5c5b5a7a076eb0a38b5e39109927600 (patch)
tree9d3cd5354532e22661edf93adecd2d4c5dd8f3c5 /gcc/ada/exp_disp.adb
parenta58d632fec5eeb337f0c9464a053533103d1fc52 (diff)
downloadgcc-bb5dfaccd5c5b5a7a076eb0a38b5e39109927600.tar.gz
2012-02-22 Vincent Pucci <pucci@adacore.com>
* rtsfind.adb (Get_Unit_Name): Ada_Numerics_Child and System_Dim_Child cases added. * rtsfind.ads: Ada_Numerics, Ada_Numerics_Generic_Elementary_Functions, System_Dim, System_Dim_Float_IO and System_Dim_Integer_IO added to the list of RTU_Id. Ada_Numerics_Child and System_Dim_Child added as new RTU_Id subtypes. * sem_dim.adb (Is_Dim_IO_Package_Entity): Use of Rtsfind to verify the package entity is located either in System.Dim.Integer_IO or in System.Dim.Float_IO. (Is_Dim_IO_Package_Instantiation): Minor changes. (Is_Elementary_Function_Call): Removed. (Is_Elementary_Function_Entity): New routine. (Is_Procedure_Put_Call): Is_Dim_IO_Package_Entity call added. * snames.ads-tmpl: Name_Dim and Name_Generic_Elementary_Functions removed. 2012-02-22 Vincent Pucci <pucci@adacore.com> * sem_prag.adb: Minor reformatting. 2012-02-22 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Find_Type_Name): When analyzing a private type declaration that is the completion of a tagged incomplete type, do not associate the class-wide type already created with the private type to prevent order-of-elaboration issues in the back-end. * exp_disp.adb (Find_Specific_Type): Find specific type of a class-wide type, and handle the case of an incomplete type coming either from a limited_with clause or from an incomplete type declaration. Used when expanding a dispatchin call and generating tag checks (minor refactoring). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184473 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_disp.adb')
-rw-r--r--gcc/ada/exp_disp.adb38
1 files changed, 27 insertions, 11 deletions
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index 23ffe90c5fd..314862b49fa 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -75,6 +75,11 @@ package body Exp_Disp is
-- Ada 2005 (AI-251): Returns the fixed position in the dispatch table
-- of the default primitive operations.
+ function Find_Specific_Type (CW : Entity_Id) return Entity_Id;
+ -- Find specific type of a class-wide type, and handle the case of an
+ -- incomplete type coming either from a limited_with clause or from an
+ -- incomplete type declaration.
+
function Has_DT (Typ : Entity_Id) return Boolean;
pragma Inline (Has_DT);
-- Returns true if we generate a dispatch table for tagged type Typ
@@ -178,11 +183,7 @@ package body Exp_Disp is
CW_Typ := Class_Wide_Type (Ctrl_Typ);
end if;
- Typ := Root_Type (CW_Typ);
-
- if Ekind (Typ) = E_Incomplete_Type then
- Typ := Non_Limited_View (Typ);
- end if;
+ Typ := Find_Specific_Type (CW_Typ);
if not Is_Limited_Type (Typ) then
Eq_Prim_Op := Find_Prim_Op (Typ, Name_Op_Eq);
@@ -746,11 +747,7 @@ package body Exp_Disp is
CW_Typ := Class_Wide_Type (Ctrl_Typ);
end if;
- Typ := Root_Type (CW_Typ);
-
- if Ekind (Typ) = E_Incomplete_Type then
- Typ := Non_Limited_View (Typ);
- end if;
+ Typ := Find_Specific_Type (CW_Typ);
if not Is_Limited_Type (Typ) then
Eq_Prim_Op := Find_Prim_Op (Typ, Name_Op_Eq);
@@ -1884,6 +1881,25 @@ package body Exp_Disp is
end if;
end Expand_Interface_Thunk;
+ ------------------------
+ -- Find_Specific_Type --
+ ------------------------
+
+ function Find_Specific_Type (CW : Entity_Id) return Entity_Id is
+ Typ : Entity_Id := Root_Type (CW);
+
+ begin
+ if Ekind (Typ) = E_Incomplete_Type then
+ if From_With_Type (Typ) then
+ Typ := Non_Limited_View (Typ);
+ else
+ Typ := Full_View (Typ);
+ end if;
+ end if;
+
+ return Typ;
+ end Find_Specific_Type;
+
--------------------------
-- Has_CPP_Constructors --
--------------------------