FreeBSD/contrib/gcc/cp/error.c
/* Pretty print a function decl. There are several ways we want to print a
   function declaration. The TFF_ bits in FLAGS tells us how to behave.
   As error can only apply the '#' flag once to give 0 and 1 for V, there
   is %D which doesn't print the throw specs, and %F which does.  */
Pretty print a function decl. There are several ways we want to print a
function declaration. The TFF_ bits in FLAGS tells us how to behave.
As error can only apply the '#' flag once to give 0 and 1 for V, there
is %D which doesn't print the throw specs, and %F which does.
Pretty print a function decl . There are several ways we want to print a function declaration . The TFF_ bits in FLAGS tells us how to behave . As error can only apply the ' # ' flag once to give 0 and 1 for V there is %D which doesn ' t print the throw specs and %F which does .
static void
dump_function_decl (tree t, int flags)
{
  tree fntype;
  tree parmtypes;
  tree cname = NULL_TREE;
  tree template_args = NULL_TREE;
  tree template_parms = NULL_TREE;
  int show_return = flags & TFF_RETURN_TYPE || flags & TFF_DECL_SPECIFIERS;
  if (TREE_CODE (t) == TEMPLATE_DECL)
    t = DECL_TEMPLATE_RESULT (t);
  if (DECL_USE_TEMPLATE (t) && DECL_TEMPLATE_INFO (t))
    {
      tree tmpl;
      template_args = DECL_TI_ARGS (t);
      tmpl = most_general_template (t);
      if (tmpl && TREE_CODE (tmpl) == TEMPLATE_DECL)
	{
	  template_parms = DECL_TEMPLATE_PARMS (tmpl);
	  t = tmpl;
	}
    }
  fntype = TREE_TYPE (t);
  parmtypes = FUNCTION_FIRST_USER_PARMTYPE (t);
  if (DECL_CLASS_SCOPE_P (t))
    cname = DECL_CONTEXT (t);
  else if (TREE_CODE (fntype) == METHOD_TYPE)
    cname = TREE_TYPE (TREE_VALUE (parmtypes));
  if (!(flags & TFF_DECL_SPECIFIERS))
    ;
  else if (DECL_STATIC_FUNCTION_P (t))
    pp_cxx_identifier (cxx_pp, "static");
  else if (DECL_VIRTUAL_P (t))
    pp_cxx_identifier (cxx_pp, "virtual");
  if (show_return)
    show_return = !DECL_CONV_FN_P (t)  && !DECL_CONSTRUCTOR_P (t)
		  && !DECL_DESTRUCTOR_P (t);
  if (show_return)
    dump_type_prefix (TREE_TYPE (fntype), flags);
  if (cname)
    {
      dump_type (cname, flags);
      pp_cxx_colon_colon (cxx_pp);
    }
  else
    dump_scope (CP_DECL_CONTEXT (t), flags);
  dump_function_name (t, flags);
  if (!(flags & TFF_NO_FUNCTION_ARGUMENTS))
    {
      dump_parameters (parmtypes, flags);
      if (TREE_CODE (fntype) == METHOD_TYPE)
	{
	  pp_base (cxx_pp)->padding = pp_before;
	  pp_cxx_cv_qualifier_seq
	    (cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))));
	}
      if (flags & TFF_EXCEPTION_SPECIFICATION)
	{
	  pp_base (cxx_pp)->padding = pp_before;
	  dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags);
	}
      if (show_return)
	dump_type_suffix (TREE_TYPE (fntype), flags);
    }
  if (template_parms != NULL_TREE && template_args != NULL_TREE)
    {
      pp_cxx_whitespace (cxx_pp);
      pp_cxx_left_bracket (cxx_pp);
      pp_cxx_identifier (cxx_pp, "with");
      pp_cxx_whitespace (cxx_pp);
      dump_template_bindings (template_parms, template_args);
      pp_cxx_right_bracket (cxx_pp);
    }
}
static void dump_function_decl ( tree t , int flags ) { tree fntype ; tree parmtypes ; tree cname = NULL_TREE ; tree template_args = NULL_TREE ; tree template_parms = NULL_TREE ; int show_return = flags & TFF_RETURN_TYPE || flags & TFF_DECL_SPECIFIERS ; if ( TREE_CODE ( t ) == TEMPLATE_DECL ) t = DECL_TEMPLATE_RESULT ( t ) ; if ( DECL_USE_TEMPLATE ( t ) && DECL_TEMPLATE_INFO ( t ) ) { tree tmpl ; template_args = DECL_TI_ARGS ( t ) ; tmpl = most_general_template ( t ) ; if ( tmpl && TREE_CODE ( tmpl ) == TEMPLATE_DECL ) { template_parms = DECL_TEMPLATE_PARMS ( tmpl ) ; t = tmpl ; } } fntype = TREE_TYPE ( t ) ; parmtypes = FUNCTION_FIRST_USER_PARMTYPE ( t ) ; if ( DECL_CLASS_SCOPE_P ( t ) ) cname = DECL_CONTEXT ( t ) ; else if ( TREE_CODE ( fntype ) == METHOD_TYPE ) cname = TREE_TYPE ( TREE_VALUE ( parmtypes ) ) ; if ( ! ( flags & TFF_DECL_SPECIFIERS ) ) ; else if ( DECL_STATIC_FUNCTION_P ( t ) ) pp_cxx_identifier ( cxx_pp , " " ) ; else if ( DECL_VIRTUAL_P ( t ) ) pp_cxx_identifier ( cxx_pp , " " ) ; if ( show_return ) show_return = ! DECL_CONV_FN_P ( t ) && ! DECL_CONSTRUCTOR_P ( t ) && ! DECL_DESTRUCTOR_P ( t ) ; if ( show_return ) dump_type_prefix ( TREE_TYPE ( fntype ) , flags ) ; if ( cname ) { dump_type ( cname , flags ) ; pp_cxx_colon_colon ( cxx_pp ) ; } else dump_scope ( CP_DECL_CONTEXT ( t ) , flags ) ; dump_function_name ( t , flags ) ; if ( ! ( flags & TFF_NO_FUNCTION_ARGUMENTS ) ) { dump_parameters ( parmtypes , flags ) ; if ( TREE_CODE ( fntype ) == METHOD_TYPE ) { pp_base ( cxx_pp ) -> padding = pp_before ; pp_cxx_cv_qualifier_seq ( cxx_pp , TREE_TYPE ( TREE_VALUE ( TYPE_ARG_TYPES ( fntype ) ) ) ) ; } if ( flags & TFF_EXCEPTION_SPECIFICATION ) { pp_base ( cxx_pp ) -> padding = pp_before ; dump_exception_spec ( TYPE_RAISES_EXCEPTIONS ( fntype ) , flags ) ; } if ( show_return ) dump_type_suffix ( TREE_TYPE ( fntype ) , flags ) ; } if ( template_parms != NULL_TREE && template_args != NULL_TREE ) { pp_cxx_whitespace ( cxx_pp ) ; pp_cxx_left_bracket ( cxx_pp ) ; pp_cxx_identifier ( cxx_pp , " " ) ; pp_cxx_whitespace ( cxx_pp ) ; dump_template_bindings ( template_parms , template_args ) ; pp_cxx_right_bracket ( cxx_pp ) ; } }
Pretty print a function decl.
Pretty print a function decl .
/* Pretty print template instantiations only.  */ /* This is for partially instantiated template methods.  */ /* OK */ /* Print the return type?  */ /* Print the function name.  */ /* If T is a template instantiation, dump the parameter binding.  */