FreeBSD/contrib/gcc/cp/decl.c
/* Create the FUNCTION_DECL for a function definition.
   DECLSPECS and DECLARATOR are the parts of the declaration;
   they describe the return type and the name of the function,
   but twisted together in a fashion that parallels the syntax of C.

   This function creates a binding context for the function body
   as well as setting up the FUNCTION_DECL in current_function_decl.

   Returns a FUNCTION_DECL on success.

   If the DECLARATOR is not suitable for a function (it defines a datum
   instead), we return 0, which tells yyparse to report a parse error.

   May return void_type_node indicating that this method is actually
   a friend.  See grokfield for more details.

   Came here with a `.pushlevel' .

   DO NOT MAKE ANY CHANGES TO THIS CODE WITHOUT MAKING CORRESPONDING
   CHANGES TO CODE IN `grokfield'.  */
Create the FUNCTION_DECL for a function definition.
DECLSPECS and DECLARATOR are the parts of the declaration;
they describe the return type and the name of the function,
but twisted together in a fashion that parallels the syntax of C.

This function creates a binding context for the function body
as well as setting up the FUNCTION_DECL in current_function_decl.

Returns a FUNCTION_DECL on success.

If the DECLARATOR is not suitable for a function (it defines a datum
instead), we return 0, which tells yyparse to report a parse error.

May return void_type_node indicating that this method is actually
a friend.  See grokfield for more details.

Came here with a `.pushlevel' .


Create the FUNCTION_DECL for a function definition . DECLSPECS and DECLARATOR are the parts of the declaration ; they describe the return type and the name of the function but twisted together in a fashion that parallels the syntax of C . This function creates a binding context for the function body as well as setting up the FUNCTION_DECL in current_function_decl . Returns a FUNCTION_DECL on success . If the DECLARATOR is not suitable for a function ( it defines a datum instead ) we return 0 which tells yyparse to report a parse error . May return void_type_node indicating that this method is actually a friend . See grokfield for more details . Came here with a ` . pushlevel ' .
tree
start_method (cp_decl_specifier_seq *declspecs,
	      const cp_declarator *declarator, tree attrlist)
{
  tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0,
				&attrlist);
  if (fndecl == error_mark_node)
    return error_mark_node;
  if (fndecl == NULL || TREE_CODE (fndecl) != FUNCTION_DECL)
    {
      error ("invalid member function declaration");
      return error_mark_node;
    }
  if (attrlist)
    cplus_decl_attributes (&fndecl, attrlist, 0);
  if (fndecl == void_type_node)
    return fndecl;
  if (DECL_IN_AGGR_P (fndecl))
    {
      if (DECL_CONTEXT (fndecl)
	  && TREE_CODE (DECL_CONTEXT (fndecl)) != NAMESPACE_DECL)
	error ("%qD is already defined in class %qT", fndecl,
	       DECL_CONTEXT (fndecl));
      return error_mark_node;
    }
  check_template_shadow (fndecl);
  DECL_DECLARED_INLINE_P (fndecl) = 1;
  if (flag_default_inline)
    DECL_INLINE (fndecl) = 1;
  if (processing_template_decl && !DECL_TEMPLATE_SPECIALIZATION (fndecl))
    {
      fndecl = push_template_decl (fndecl);
      if (fndecl == error_mark_node)
	return fndecl;
    }
  if (! DECL_FRIEND_P (fndecl))
    {
      if (TREE_CHAIN (fndecl))
	{
	  fndecl = copy_node (fndecl);
	  TREE_CHAIN (fndecl) = NULL_TREE;
	}
    }
  finish_decl (fndecl, NULL_TREE, NULL_TREE);
  begin_scope (sk_function_parms, fndecl);
  DECL_IN_AGGR_P (fndecl) = 1;
  return fndecl;
}
tree start_method ( cp_decl_specifier_seq * declspecs , const cp_declarator * declarator , tree attrlist ) { tree fndecl = grokdeclarator ( declarator , declspecs , MEMFUNCDEF , 0 , & attrlist ) ; if ( fndecl == error_mark_node ) return error_mark_node ; if ( fndecl == NULL || TREE_CODE ( fndecl ) != FUNCTION_DECL ) { error ( " " ) ; return error_mark_node ; } if ( attrlist ) cplus_decl_attributes ( & fndecl , attrlist , 0 ) ; if ( fndecl == void_type_node ) return fndecl ; if ( DECL_IN_AGGR_P ( fndecl ) ) { if ( DECL_CONTEXT ( fndecl ) && TREE_CODE ( DECL_CONTEXT ( fndecl ) ) != NAMESPACE_DECL ) error ( " " , fndecl , DECL_CONTEXT ( fndecl ) ) ; return error_mark_node ; } check_template_shadow ( fndecl ) ; DECL_DECLARED_INLINE_P ( fndecl ) = 1 ; if ( flag_default_inline ) DECL_INLINE ( fndecl ) = 1 ; if ( processing_template_decl && ! DECL_TEMPLATE_SPECIALIZATION ( fndecl ) ) { fndecl = push_template_decl ( fndecl ) ; if ( fndecl == error_mark_node ) return fndecl ; } if ( ! DECL_FRIEND_P ( fndecl ) ) { if ( TREE_CHAIN ( fndecl ) ) { fndecl = copy_node ( fndecl ) ; TREE_CHAIN ( fndecl ) = NULL_TREE ; } } finish_decl ( fndecl , NULL_TREE , NULL_TREE ) ; begin_scope ( sk_function_parms , fndecl ) ; DECL_IN_AGGR_P ( fndecl ) = 1 ; return fndecl ; }
Create the FUNCTION_DECL for a function definition.
Create the FUNCTION_DECL for a function definition .
/* Pass friends other than inline friend functions back.  */ /* We process method specializations in finish_struct_1.  */ /* Make a place for the parms.  */