aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/exp_disp.adb19
2 files changed, 16 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a076730..d078d6b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-17 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_disp.adb (Gen_Parameters_Profile): Make the _Init parameter an
+ In/Out parameter.
+ (Set_CPP_Constructors): Adjust comment accordingly.
+
2018-07-17 Bob Duff <duff@adacore.com>
* exp_disp.adb (Build_Class_Wide_Check): Return early if the
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index b022815..298265a 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -8181,7 +8181,8 @@ package body Exp_Disp is
function Gen_Parameters_Profile (E : Entity_Id) return List_Id;
-- Duplicate the parameters profile of the imported C++ constructor
- -- adding an access to the object as an additional parameter.
+ -- adding the "this" pointer to the object as the additional first
+ -- parameter under the usual form _Init : in out Typ.
----------------------------
-- Gen_Parameters_Profile --
@@ -8198,6 +8199,8 @@ package body Exp_Disp is
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Name_uInit),
+ In_Present => True,
+ Out_Present => True,
Parameter_Type => New_Occurrence_Of (Typ, Loc)));
if Present (Parameter_Specifications (Parent (E))) then
@@ -8244,9 +8247,7 @@ package body Exp_Disp is
Found := True;
Loc := Sloc (E);
Parms := Gen_Parameters_Profile (E);
- IP :=
- Make_Defining_Identifier (Loc,
- Chars => Make_Init_Proc_Name (Typ));
+ IP := Make_Defining_Identifier (Loc, Make_Init_Proc_Name (Typ));
-- Case 1: Constructor of untagged type
@@ -8273,14 +8274,14 @@ package body Exp_Disp is
-- Case 2: Constructor of a tagged type
- -- In this case we generate the IP as a wrapper of the the
- -- C++ constructor because IP must also save copy of the _tag
+ -- In this case we generate the IP routine as a wrapper of the
+ -- C++ constructor because IP must also save a copy of the _tag
-- generated in the C++ side. The copy of the _tag is used by
-- Build_CPP_Init_Procedure to elaborate derivations of C++ types.
-- Generate:
- -- procedure IP (_init : Typ; ...) is
- -- procedure ConstructorP (_init : Typ; ...);
+ -- procedure IP (_init : in out Typ; ...) is
+ -- procedure ConstructorP (_init : in out Typ; ...);
-- pragma Import (ConstructorP);
-- begin
-- ConstructorP (_init, ...);
@@ -8352,7 +8353,7 @@ package body Exp_Disp is
loop
-- Skip the following assertion with primary tags
-- because Related_Type is not set on primary tag
- -- components
+ -- components.
pragma Assert
(Tag_Comp = First_Tag_Component (Typ)