summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch11.adb
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2013-04-11 13:01:09 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2013-04-11 15:01:09 +0200
commitf6f4d8d407733c8f274b4cb5a998cf1a9548d3bf (patch)
treefa2d9ffd11568e840f3d65a5a1be065762b60a33 /gcc/ada/exp_ch11.adb
parent03eb6036fc6eb40d6e114121920e3093e49dfc18 (diff)
downloadgcc-f6f4d8d407733c8f274b4cb5a998cf1a9548d3bf.tar.gz
exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Do not add cleanup actions in thunks associated with interface types.
2013-04-11 Javier Miranda <miranda@adacore.com> * exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Do not add cleanup actions in thunks associated with interface types. * exp_ch3.ad[sb] (Is_Variable_Size_Record): Move declaration to the package spec. * exp_ch4.adb (Tagged_Conversion): Update call to Expand_Interface_Conversion since the parameter Is_Static is no longer needed. * exp_ch6.adb (Expand_N_Extended_Return_Statement): Adding assertion to ensure that interface thunks are never handled by this routine. (Expand_N_Simple_Function_Return): Do not rewrite this statement as an extended return statement in interface thunks, and do not perform copy in the secondary stack if the return statement is located in a thunk. * exp_disp.adb (Expand_Dispatching_Call): No longer displace the pointer to the returned object in functions returning interface types. (Expand_Interface_Thunk): For functions returning interface types displace the pointer to the returned object. (Expand_Interface_Conversion): Remove formal Is_Static since this subprogram can now evaluate it locally. * sem_ch3.adb (Add_Internal_Interface_Entities): For functions propagate the type returned by the covered interface primitive to the internal interface entity. Needed by the thunk to generate the code which displaces "this" to reference the corresponding secondary dispatch table. * sem_disp.adb (Propagate_Tag): Update call to Expand_Interface_Conversion since the parameter Is_Static is no longer needed. * sem_res.adb (Resolve_Type_Conversion): Update calls to Expand_Interface_Conversion since the parameter Is_Static is no longer needed plus code cleanup. From-SVN: r197786
Diffstat (limited to 'gcc/ada/exp_ch11.adb')
-rw-r--r--gcc/ada/exp_ch11.adb12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb
index 981cd2ad767..7378885c7c2 100644
--- a/gcc/ada/exp_ch11.adb
+++ b/gcc/ada/exp_ch11.adb
@@ -1402,10 +1402,16 @@ package body Exp_Ch11 is
-- Add clean up actions if required
- if Nkind (Parent (N)) /= N_Package_Body
- and then Nkind (Parent (N)) /= N_Accept_Statement
- and then Nkind (Parent (N)) /= N_Extended_Return_Statement
+ if not Nkind_In (Parent (N), N_Package_Body,
+ N_Accept_Statement,
+ N_Extended_Return_Statement)
and then not Delay_Cleanups (Current_Scope)
+
+ -- No cleanup action needed in thunks associated with interfaces
+ -- because they only displace the pointer to the object.
+
+ and then not (Is_Subprogram (Current_Scope)
+ and then Is_Thunk (Current_Scope))
then
Expand_Cleanup_Actions (Parent (N));
else