OSDN Git Service

* decl.c (grokmethod): Rename from start_method.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Sep 2009 18:12:37 +0000 (18:12 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Sep 2009 18:12:37 +0000 (18:12 +0000)
(finish_method): Remove.
* cp-tree.h: Adjust.
* parser.c (cp_parser_save_member_function_body): Adjust.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151526 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/parser.c

index bac7098..69eb476 100644 (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.
index 23b41d3..4f03868 100644 (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);
index cad0fc5..99ae9f1 100644 (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;
-}
 \f
 
 /* VAR is a VAR_DECL.  If its type is incomplete, remember VAR so that
index 64869cd..14733b8 100644 (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,