aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-10-14 15:10:22 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-10-14 15:10:22 +0200
commit0247964def38159afff19aeeb79880d8aaa63a05 (patch)
tree50af03992c889d882bb312b0e60314f61ad05e27 /gcc/ada/exp_ch4.adb
parente443f142047e2a9f67dd859e77d26d94fa3241e8 (diff)
downloadgcc-0247964def38159afff19aeeb79880d8aaa63a05.zip
gcc-0247964def38159afff19aeeb79880d8aaa63a05.tar.gz
gcc-0247964def38159afff19aeeb79880d8aaa63a05.tar.bz2
[multiple changes]
2013-10-14 Robert Dewar <dewar@adacore.com> * exp_prag.adb, exp_ch11.adb, s-exctab.adb: Minor reformatting. * usage.adb: Add line for -gnateu switch. 2013-10-14 Vincent Celier <celier@adacore.com> * lib-writ.ads: Add comments to indicate that a path name in D lines may be quoted if the path name includes directories with spaces. 2013-10-14 Robert Dewar <dewar@adacore.com> * debug.adb: Document -gnatd.E. * gnat1drv.adb (Adjust_Global_Switches): Set Error_To_Warning if -gnatd.E set. * opt.ads (Error_To_Warning): New switch. * osint.adb: Minor reformatting. * sem_warn.adb (Warn_On_Overlapping_Actuals): Overlap is error in some cases in Ada 2012 mode (unless Error_To_Warning) is set. * sem_warn.ads (Warn_On_Overlapping_Actuals): Document error in Ada 2012 mode. 2013-10-14 Tristan Gingold <gingold@adacore.com> * cstand.adb: Add a comment for Standard_Exception_Type. 2013-10-14 Ed Schonberg <schonberg@adacore.com> * exp_ch4.adb (Process_Transient_Object): If a transient scope has already been created, use the corresponding Node_To_Be_Wrapped as the insertion point for the controlled actions. From-SVN: r203539
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 8d6dfc4..163363e 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -12159,11 +12159,22 @@ package body Exp_Ch4 is
Top : Node_Id;
begin
+ -- In most cases an expression that creates a controlled object
+ -- generates a transient scope around it. If this is the case then
+ -- other controlled values can reuse it.
+
+ if Scope_Is_Transient then
+ return Node_To_Be_Wrapped;
+
+ -- In some cases, such as return statements, no transient scope is
+ -- generated, in which case we have to look up in the tree to find
+ -- the proper list on which to place the transient.
+
-- When the node is inside a case/if expression, the lifetime of any
-- temporary controlled object is extended. Find a suitable insertion
-- node by locating the topmost case or if expressions.
- if Within_Case_Or_If_Expression (N) then
+ elsif Within_Case_Or_If_Expression (N) then
Par := N;
Top := N;
while Present (Par) loop