aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_smem.adb
diff options
context:
space:
mode:
authorThomas Quinot <quinot@adacore.com>2009-04-15 08:47:44 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-15 10:47:44 +0200
commita808ba1bfb211375b09524976ce1d92950b45411 (patch)
treecf2a92ab785cc7f4190fc90e7a56c84979299bfa /gcc/ada/exp_smem.adb
parente0568eecc317ac33f2e1e63c8cecafb82783fed2 (diff)
downloadgcc-a808ba1bfb211375b09524976ce1d92950b45411.zip
gcc-a808ba1bfb211375b09524976ce1d92950b45411.tar.gz
gcc-a808ba1bfb211375b09524976ce1d92950b45411.tar.bz2
exp_smem.adb (Make_Shared_Var_Procs): For a protected type...
2009-04-15 Thomas Quinot <quinot@adacore.com> * exp_smem.adb (Make_Shared_Var_Procs): For a protected type, instantiate generic shared object package with the corresponding record type. From-SVN: r146083
Diffstat (limited to 'gcc/ada/exp_smem.adb')
-rw-r--r--gcc/ada/exp_smem.adb34
1 files changed, 23 insertions, 11 deletions
diff --git a/gcc/ada/exp_smem.adb b/gcc/ada/exp_smem.adb
index c685b7b..6cbca26 100644
--- a/gcc/ada/exp_smem.adb
+++ b/gcc/ada/exp_smem.adb
@@ -25,6 +25,7 @@
with Atree; use Atree;
with Einfo; use Einfo;
+with Exp_Ch9; use Exp_Ch9;
with Exp_Util; use Exp_Util;
with Nmake; use Nmake;
with Namet; use Namet;
@@ -286,10 +287,12 @@ package body Exp_Smem is
---------------------------
function Make_Shared_Var_Procs (N : Node_Id) return Node_Id is
- Loc : constant Source_Ptr := Sloc (N);
- Ent : constant Entity_Id := Defining_Identifier (N);
- Typ : constant Entity_Id := Etype (Ent);
- Vnm : String_Id;
+ Loc : constant Source_Ptr := Sloc (N);
+ Ent : constant Entity_Id := Defining_Identifier (N);
+ Typ : constant Entity_Id := Etype (Ent);
+ Vnm : String_Id;
+ Obj : Node_Id;
+ Obj_Typ : Entity_Id;
After : constant Node_Id := Next (N);
-- Node located right after N originally (after insertion of the SV
@@ -316,7 +319,14 @@ package body Exp_Smem is
-- Construct generic package instantiation
- -- package varG is new Shared_Var_Procs (Typ, var, "pkg.var");
+ -- package varG is new Shared_Var_Procs (typ, var, "pkg.var");
+
+ Obj := New_Occurrence_Of (Ent, Loc);
+ Obj_Typ := Typ;
+ if Is_Concurrent_Type (Typ) then
+ Obj := Convert_Concurrent (N => Obj, Typ => Typ);
+ Obj_Typ := Corresponding_Record_Type (Typ);
+ end if;
Instantiation :=
Make_Package_Instantiation (Loc,
@@ -324,12 +334,14 @@ package body Exp_Smem is
Name =>
New_Occurrence_Of (RTE (RE_Shared_Var_Procs), Loc),
Generic_Associations => New_List (
- Make_Generic_Association (Loc, Explicit_Generic_Actual_Parameter =>
- New_Occurrence_Of (Typ, Loc)),
- Make_Generic_Association (Loc, Explicit_Generic_Actual_Parameter =>
- New_Occurrence_Of (Ent, Loc)),
- Make_Generic_Association (Loc, Explicit_Generic_Actual_Parameter =>
- Make_String_Literal (Loc, Vnm))));
+ Make_Generic_Association (Loc,
+ Explicit_Generic_Actual_Parameter =>
+ New_Occurrence_Of (Obj_Typ, Loc)),
+ Make_Generic_Association (Loc,
+ Explicit_Generic_Actual_Parameter => Obj),
+ Make_Generic_Association (Loc,
+ Explicit_Generic_Actual_Parameter =>
+ Make_String_Literal (Loc, Vnm))));
Insert_After_And_Analyze (N, Instantiation);