utils.c (gnat_pushdecl): Remove test for PARM_DECLs.

* gcc-interface/utils.c (gnat_pushdecl): Remove test for PARM_DECLs.
	Attach fake PARM_DECLs to the topmost block of the function.

From-SVN: r163651
This commit is contained in:
Eric Botcazou 2010-08-30 16:30:41 +00:00 committed by Eric Botcazou
parent fc26dab30f
commit bd9c7fb909
2 changed files with 16 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2010-08-30 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (gnat_pushdecl): Remove test for PARM_DECLs.
Attach fake PARM_DECLs to the topmost block of the function.
2010-08-30 Eric Botcazou <ebotcazou@adacore.com> 2010-08-30 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (call_to_gnu): Also force the return slot opt * gcc-interface/trans.c (call_to_gnu): Also force the return slot opt

View File

@ -418,11 +418,8 @@ gnat_poplevel (void)
void void
gnat_pushdecl (tree decl, Node_Id gnat_node) gnat_pushdecl (tree decl, Node_Id gnat_node)
{ {
/* If this decl is public external or at toplevel, there is no context. /* If this decl is public external or at toplevel, there is no context. */
But PARM_DECLs always go in the level of its function. */ if ((TREE_PUBLIC (decl) && DECL_EXTERNAL (decl)) || global_bindings_p ())
if (TREE_CODE (decl) != PARM_DECL
&& ((DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
|| global_bindings_p ()))
DECL_CONTEXT (decl) = 0; DECL_CONTEXT (decl) = 0;
else else
{ {
@ -461,8 +458,14 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
} }
else else
{ {
DECL_CHAIN (decl) = BLOCK_VARS (current_binding_level->block); tree block;
BLOCK_VARS (current_binding_level->block) = decl; /* Fake PARM_DECLs go into the topmost block of the function. */
if (TREE_CODE (decl) == PARM_DECL)
block = BLOCK_SUPERCONTEXT (current_binding_level->block);
else
block = current_binding_level->block;
DECL_CHAIN (decl) = BLOCK_VARS (block);
BLOCK_VARS (block) = decl;
} }
} }
@ -1878,9 +1881,7 @@ end_subprog_body (tree body)
{ {
tree fndecl = current_function_decl; tree fndecl = current_function_decl;
/* Mark the BLOCK for this level as being for this function and pop the /* Attach the BLOCK for this level to the function and pop the level. */
level. Since the vars in it are the parameters, clear them. */
BLOCK_VARS (current_binding_level->block) = NULL_TREE;
BLOCK_SUPERCONTEXT (current_binding_level->block) = fndecl; BLOCK_SUPERCONTEXT (current_binding_level->block) = fndecl;
DECL_INITIAL (fndecl) = current_binding_level->block; DECL_INITIAL (fndecl) = current_binding_level->block;
gnat_poplevel (); gnat_poplevel ();