decl.c (grokmethod): Rename from start_method.

* decl.c (grokmethod): Rename from start_method.
	(finish_method): Remove.
	* cp-tree.h: Adjust.
	* parser.c (cp_parser_save_member_function_body): Adjust.

From-SVN: r151526
This commit is contained in:
Jason Merrill 2009-09-08 14:12:37 -04:00 committed by Jason Merrill
parent 3e54529c11
commit 02c5ff73d4
4 changed files with 12 additions and 62 deletions

View File

@ -1,3 +1,10 @@
2009-09-02 Jason Merrill <jason@redhat.com>
* decl.c (grokmethod): Rename from start_method.
(finish_method): Remove.
* cp-tree.h: Adjust.
* parser.c (cp_parser_save_member_function_body): Adjust.
2009-09-03 Doug Kwan <dougkwan@google.com>
* tree.c (cp_fix_function_decl_p): New.

View File

@ -4418,8 +4418,7 @@ extern tree begin_function_body (void);
extern void finish_function_body (tree);
extern tree outer_curly_brace_block (tree);
extern tree finish_function (int);
extern tree start_method (cp_decl_specifier_seq *, const cp_declarator *, tree);
extern tree finish_method (tree);
extern tree grokmethod (cp_decl_specifier_seq *, const cp_declarator *, tree);
extern void maybe_register_incomplete_var (tree);
extern void maybe_commonize_var (tree);
extern void complete_vars (tree);

View File

@ -12444,8 +12444,8 @@ finish_function (int flags)
CHANGES TO CODE IN `grokfield'. */
tree
start_method (cp_decl_specifier_seq *declspecs,
const cp_declarator *declarator, tree attrlist)
grokmethod (cp_decl_specifier_seq *declspecs,
const cp_declarator *declarator, tree attrlist)
{
tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0,
&attrlist);
@ -12499,62 +12499,9 @@ start_method (cp_decl_specifier_seq *declspecs,
cp_finish_decl (fndecl, NULL_TREE, false, NULL_TREE, 0);
/* Make a place for the parms. */
begin_scope (sk_function_parms, fndecl);
DECL_IN_AGGR_P (fndecl) = 1;
return fndecl;
}
/* Go through the motions of finishing a function definition.
We don't compile this method until after the whole class has
been processed.
FINISH_METHOD must return something that looks as though it
came from GROKFIELD (since we are defining a method, after all).
This is called after parsing the body of the function definition.
STMTS is the chain of statements that makes up the function body.
DECL is the ..._DECL that `start_method' provided. */
tree
finish_method (tree decl)
{
tree fndecl = decl;
tree old_initial;
tree link;
if (decl == void_type_node)
return decl;
old_initial = DECL_INITIAL (fndecl);
/* Undo the level for the parms (from start_method).
This is like poplevel, but it causes nothing to be
saved. Saving information here confuses symbol-table
output routines. Besides, this information will
be correctly output when this method is actually
compiled. */
/* Clear out the meanings of the local variables of this level;
also record in each decl which block it belongs to. */
for (link = current_binding_level->names; link; link = TREE_CHAIN (link))
{
if (DECL_NAME (link) != NULL_TREE)
pop_binding (DECL_NAME (link), link);
gcc_assert (TREE_CODE (link) != FUNCTION_DECL);
DECL_CONTEXT (link) = NULL_TREE;
}
poplevel (0, 0, 0);
DECL_INITIAL (fndecl) = old_initial;
return decl;
}
/* VAR is a VAR_DECL. If its type is incomplete, remember VAR so that

View File

@ -18172,8 +18172,8 @@ cp_parser_save_member_function_body (cp_parser* parser,
cp_token *last;
tree fn;
/* Create the function-declaration. */
fn = start_method (decl_specifiers, declarator, attributes);
/* Create the FUNCTION_DECL. */
fn = grokmethod (decl_specifiers, declarator, attributes);
/* If something went badly wrong, bail out now. */
if (fn == error_mark_node)
{
@ -18221,9 +18221,6 @@ cp_parser_save_member_function_body (cp_parser* parser,
friend templates are handled correctly. */
DECL_INITIALIZED_IN_CLASS_P (fn) = 1;
/* We're done with the inline definition. */
finish_method (fn);
/* Add FN to the queue of functions to be parsed later. */
TREE_VALUE (parser->unparsed_functions_queues)
= tree_cons (NULL_TREE, fn,