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>
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): If the body is
......
......@@ -703,10 +703,18 @@ package body Exp_Ch6 is
New_Occurrence_Of (Param_Id, Loc),
Expression =>
New_Occurrence_Of (Ret_Obj, Sloc (Stmt)));
Stmts : constant List_Id :=
Statements (Handled_Statement_Sequence (Stmt));
Stmts : List_Id;
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));
Rewrite (Stmt,
......@@ -715,8 +723,7 @@ package body Exp_Ch6 is
Return_Object_Declarations (Stmt),
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements =>
Statements (Handled_Statement_Sequence (Stmt)))));
Statements => Stmts)));
Replace_Returns (Param_Id, Stmts);
......@@ -2682,7 +2689,7 @@ package body Exp_Ch6 is
if Modify_Tree_For_C
and then Nkind (Call_Node) = N_Function_Call
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
-- For internally generated calls ensure that they reference the
-- entity of the spec of the called function (needed since the
......@@ -2690,11 +2697,14 @@ package body Exp_Ch6 is
-- See for example Expand_Boolean_Operator().
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
then
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;
Rewrite_Function_Call_For_C (Call_Node);
......@@ -8419,7 +8429,7 @@ package body Exp_Ch6 is
-- 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);
Proc_Id : constant Entity_Id := Rewritten_For_C_Proc_Id (Func_Id);
Loc : constant Source_Ptr := Sloc (Par);
......
......@@ -932,9 +932,12 @@ package body Exp_Util is
Proc_Decl : Node_Id;
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;
end if;
......
......@@ -12613,7 +12613,7 @@ package body Sem_Ch13 is
if Nkind (Prefix (N)) = N_Identifier
and then Chars (Prefix (N)) /= Chars (E)
then
Find_Selected_Component (Parent (N));
Find_Selected_Component (N);
end if;
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