Commit a14bbbb4 by Arnaud Charlet

[multiple changes]

2016-04-21  Javier Miranda  <miranda@adacore.com>

	* exp_util.adb (Build_Procedure_Form): No action needed for
	subprogram renamings since the backend can generate the call
	using the renamed subprogram. This leaves the tree more clean
	to the backend.
	* exp_ch6.adb (Expand_Call): Extend previous patch for
	rewritten-for-c entities to handle subprogram renamings.
	(Rewrite_Function_Call_For_C): Handle subprogram renamings.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb: Code cleanup.

From-SVN: r235307
parent 17fd72ce
2016-04-21 Javier Miranda <miranda@adacore.com>
* exp_util.adb (Build_Procedure_Form): No action needed for
subprogram renamings since the backend can generate the call
using the renamed subprogram. This leaves the tree more clean
to the backend.
* exp_ch6.adb (Expand_Call): Extend previous patch for
rewritten-for-c entities to handle subprogram renamings.
(Rewrite_Function_Call_For_C): Handle subprogram renamings.
2016-04-21 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb: Code cleanup.
2016-04-21 Ed Schonberg <schonberg@adacore.com> 2016-04-21 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): If the body is * sem_ch6.adb (Analyze_Subprogram_Body_Helper): If the body is
......
...@@ -703,10 +703,18 @@ package body Exp_Ch6 is ...@@ -703,10 +703,18 @@ package body Exp_Ch6 is
New_Occurrence_Of (Param_Id, Loc), New_Occurrence_Of (Param_Id, Loc),
Expression => Expression =>
New_Occurrence_Of (Ret_Obj, Sloc (Stmt))); New_Occurrence_Of (Ret_Obj, Sloc (Stmt)));
Stmts : constant List_Id := Stmts : List_Id;
Statements (Handled_Statement_Sequence (Stmt));
begin begin
-- The extended return may just contain the declaration.
if Present (Handled_Statement_Sequence (Stmt)) then
Stmts := Statements (Handled_Statement_Sequence (Stmt));
else
Stmts := New_List;
end if;
Set_Assignment_OK (Name (Assign)); Set_Assignment_OK (Name (Assign));
Rewrite (Stmt, Rewrite (Stmt,
...@@ -715,8 +723,7 @@ package body Exp_Ch6 is ...@@ -715,8 +723,7 @@ package body Exp_Ch6 is
Return_Object_Declarations (Stmt), Return_Object_Declarations (Stmt),
Handled_Statement_Sequence => Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc, Make_Handled_Sequence_Of_Statements (Loc,
Statements => Statements => Stmts)));
Statements (Handled_Statement_Sequence (Stmt)))));
Replace_Returns (Param_Id, Stmts); Replace_Returns (Param_Id, Stmts);
...@@ -2682,7 +2689,7 @@ package body Exp_Ch6 is ...@@ -2682,7 +2689,7 @@ package body Exp_Ch6 is
if Modify_Tree_For_C if Modify_Tree_For_C
and then Nkind (Call_Node) = N_Function_Call and then Nkind (Call_Node) = N_Function_Call
and then Is_Entity_Name (Name (Call_Node)) and then Is_Entity_Name (Name (Call_Node))
and then Rewritten_For_C (Entity (Name (Call_Node))) and then Rewritten_For_C (Ultimate_Alias (Entity (Name (Call_Node))))
then then
-- For internally generated calls ensure that they reference the -- For internally generated calls ensure that they reference the
-- entity of the spec of the called function (needed since the -- entity of the spec of the called function (needed since the
...@@ -2690,11 +2697,14 @@ package body Exp_Ch6 is ...@@ -2690,11 +2697,14 @@ package body Exp_Ch6 is
-- See for example Expand_Boolean_Operator(). -- See for example Expand_Boolean_Operator().
if not (Comes_From_Source (Call_Node)) if not (Comes_From_Source (Call_Node))
and then Nkind (Unit_Declaration_Node (Entity (Name (Call_Node)))) and then Nkind
(Unit_Declaration_Node
(Ultimate_Alias (Entity (Name (Call_Node)))))
= N_Subprogram_Body = N_Subprogram_Body
then then
Set_Entity (Name (Call_Node), Set_Entity (Name (Call_Node),
Rewritten_For_C_Func_Id (Entity (Name (Call_Node)))); Rewritten_For_C_Func_Id
(Ultimate_Alias (Entity (Name (Call_Node)))));
end if; end if;
Rewrite_Function_Call_For_C (Call_Node); Rewrite_Function_Call_For_C (Call_Node);
...@@ -8419,7 +8429,7 @@ package body Exp_Ch6 is ...@@ -8419,7 +8429,7 @@ package body Exp_Ch6 is
-- Local variables -- Local variables
Func_Id : constant Entity_Id := Entity (Name (N)); Func_Id : constant Entity_Id := Ultimate_Alias (Entity (Name (N)));
Par : constant Node_Id := Parent (N); Par : constant Node_Id := Parent (N);
Proc_Id : constant Entity_Id := Rewritten_For_C_Proc_Id (Func_Id); Proc_Id : constant Entity_Id := Rewritten_For_C_Proc_Id (Func_Id);
Loc : constant Source_Ptr := Sloc (Par); Loc : constant Source_Ptr := Sloc (Par);
......
...@@ -932,9 +932,12 @@ package body Exp_Util is ...@@ -932,9 +932,12 @@ package body Exp_Util is
Proc_Decl : Node_Id; Proc_Decl : Node_Id;
begin begin
-- No action needed if this transformation was already done -- No action needed if this transformation was already done or in case
-- of subprogram renaming declarations
if Nkind (Specification (N)) = N_Procedure_Specification then if Nkind (Specification (N)) = N_Procedure_Specification
or else Nkind (N) = N_Subprogram_Renaming_Declaration
then
return; return;
end if; end if;
......
...@@ -12613,7 +12613,7 @@ package body Sem_Ch13 is ...@@ -12613,7 +12613,7 @@ package body Sem_Ch13 is
if Nkind (Prefix (N)) = N_Identifier if Nkind (Prefix (N)) = N_Identifier
and then Chars (Prefix (N)) /= Chars (E) and then Chars (Prefix (N)) /= Chars (E)
then then
Find_Selected_Component (Parent (N)); Find_Selected_Component (N);
end if; end if;
return Skip; return Skip;
......
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