aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_util.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_util.adb')
-rw-r--r--gcc/ada/exp_util.adb37
1 files changed, 29 insertions, 8 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index c5e565b..b06e91a 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -10701,7 +10701,9 @@ package body Exp_Util is
and then not Is_Empty_List (Then_Statements (N))
and then not Are_Wrapped (Then_Statements (N))
and then Requires_Cleanup_Actions
- (Then_Statements (N), False, False)
+ (Then_Statements (N),
+ Lib_Level => False,
+ Nested_Constructs => False)
then
Block := Wrap_Statements_In_Block (Then_Statements (N));
Set_Then_Statements (N, New_List (Block));
@@ -10718,7 +10720,9 @@ package body Exp_Util is
and then not Is_Empty_List (Else_Statements (N))
and then not Are_Wrapped (Else_Statements (N))
and then Requires_Cleanup_Actions
- (Else_Statements (N), False, False)
+ (Else_Statements (N),
+ Lib_Level => False,
+ Nested_Constructs => False)
then
Block := Wrap_Statements_In_Block (Else_Statements (N));
Set_Else_Statements (N, New_List (Block));
@@ -10737,7 +10741,10 @@ package body Exp_Util is
=>
if not Is_Empty_List (Statements (N))
and then not Are_Wrapped (Statements (N))
- and then Requires_Cleanup_Actions (Statements (N), False, False)
+ and then Requires_Cleanup_Actions
+ (Statements (N),
+ Lib_Level => False,
+ Nested_Constructs => False)
then
if Nkind (N) = N_Loop_Statement
and then Present (Identifier (N))
@@ -11815,24 +11822,38 @@ package body Exp_Util is
| N_Task_Body
=>
return
- Requires_Cleanup_Actions (Declarations (N), At_Lib_Level, True)
+ Requires_Cleanup_Actions
+ (Declarations (N), At_Lib_Level, Nested_Constructs => True)
or else
(Present (Handled_Statement_Sequence (N))
and then
Requires_Cleanup_Actions
(Statements (Handled_Statement_Sequence (N)),
- At_Lib_Level, True));
+ At_Lib_Level, Nested_Constructs => True));
+
+ -- Extended return statements are the same as the above, except that
+ -- there is no Declarations field. We do not want to clean up the
+ -- Return_Object_Declarations.
+
+ when N_Extended_Return_Statement =>
+ return
+ Present (Handled_Statement_Sequence (N))
+ and then Requires_Cleanup_Actions
+ (Statements (Handled_Statement_Sequence (N)),
+ At_Lib_Level, Nested_Constructs => True);
when N_Package_Specification =>
return
Requires_Cleanup_Actions
- (Visible_Declarations (N), At_Lib_Level, True)
+ (Visible_Declarations (N), At_Lib_Level,
+ Nested_Constructs => True)
or else
Requires_Cleanup_Actions
- (Private_Declarations (N), At_Lib_Level, True);
+ (Private_Declarations (N), At_Lib_Level,
+ Nested_Constructs => True);
when others =>
- return False;
+ raise Program_Error;
end case;
end Requires_Cleanup_Actions;