Commit 8b4261b3 by Arnaud Charlet

2008-08-20 Gary Dismukes <dismukes@adacore.com>

	* exp_ch11.adb:
	(Expand_Exception_Handlers): Call Make_Exception_Handler instead of
	Make_Implicit_Exception_Handler when rewriting an exception handler with
	a choice parameter, and pass the handler's Sloc instead of that of the
	handled sequence of statements. Make_Implicit_Exception_Handler sets the
	Sloc to No_Location (unless debugging generated code), which we don't
	want for the case of a user handler.

From-SVN: r139291
parent b2c4d56d
2008-08-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Inherit Is_Imported flag.
2008-08-20 Gary Dismukes <dismukes@adacore.com>
* exp_ch11.adb:
(Expand_Exception_Handlers): Call Make_Exception_Handler instead of
Make_Implicit_Exception_Handler when rewriting an exception handler with
a choice parameter, and pass the handler's Sloc instead of that of the
handled sequence of statements. Make_Implicit_Exception_Handler sets the
Sloc to No_Location (unless debugging generated code), which we don't
want for the case of a user handler.
2008-08-20 Robert Dewar <dewar@adacore.com>
* freeze.adb (Freeze_Record_Type): Improve msg for non-contiguous field
......@@ -1011,7 +1011,8 @@ package body Exp_Ch11 is
if Present (Choice_Parameter (Handler)) then
declare
Cparm : constant Entity_Id := Choice_Parameter (Handler);
Clc : constant Source_Ptr := Sloc (Cparm);
Cloc : constant Source_Ptr := Sloc (Cparm);
Hloc : constant Source_Ptr := Sloc (Handler);
Save : Node_Id;
begin
......@@ -1020,7 +1021,7 @@ package body Exp_Ch11 is
Name =>
New_Occurrence_Of (RTE (RE_Save_Occurrence), Loc),
Parameter_Associations => New_List (
New_Occurrence_Of (Cparm, Clc),
New_Occurrence_Of (Cparm, Cloc),
Make_Explicit_Dereference (Loc,
Make_Function_Call (Loc,
Name => Make_Explicit_Dereference (Loc,
......@@ -1032,24 +1033,33 @@ package body Exp_Ch11 is
Obj_Decl :=
Make_Object_Declaration
(Clc,
(Cloc,
Defining_Identifier => Cparm,
Object_Definition =>
New_Occurrence_Of
(RTE (RE_Exception_Occurrence), Clc));
(RTE (RE_Exception_Occurrence), Cloc));
Set_No_Initialization (Obj_Decl, True);
Rewrite (Handler,
Make_Implicit_Exception_Handler (Loc,
Make_Exception_Handler (Hloc,
Choice_Parameter => Empty,
Exception_Choices => Exception_Choices (Handler),
Statements => New_List (
Make_Block_Statement (Loc,
Make_Block_Statement (Hloc,
Declarations => New_List (Obj_Decl),
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Make_Handled_Sequence_Of_Statements (Hloc,
Statements => Statements (Handler))))));
-- Local raise statements can't occur, since exception
-- handlers with choice parameters are not allowed when
-- No_Exception_Propagation applies, so set attributes
-- accordingly.
Set_Local_Raise_Statements (Handler, No_Elist);
Set_Local_Raise_Not_OK (Handler);
Analyze_List
(Statements (Handler), Suppress => All_Checks);
end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment