FreeBSD/contrib/gcc/cp/error.c
/* Dump a template declaration T under control of FLAGS. This means the
   'template <...> leaders plus the 'class X' or 'void fn(...)' part.  */
Dump a template declaration T under control of FLAGS.
Dump a template declaration T under control of FLAGS .
static void
dump_template_decl (tree t, int flags)
{
  tree orig_parms = DECL_TEMPLATE_PARMS (t);
  tree parms;
  int i;
  if (flags & TFF_TEMPLATE_HEADER)
    {
      for (parms = orig_parms = nreverse (orig_parms);
	   parms;
	   parms = TREE_CHAIN (parms))
	{
	  tree inner_parms = INNERMOST_TEMPLATE_PARMS (parms);
	  int len = TREE_VEC_LENGTH (inner_parms);
	  pp_cxx_identifier (cxx_pp, "template");
	  pp_cxx_begin_template_argument_list (cxx_pp);
	    flags |= TFF_DECL_SPECIFIERS;
	  for (i = 0; i < len; i++)
	    {
	      if (i)
		pp_separate_with_comma (cxx_pp);
	      dump_template_parameter (TREE_VEC_ELT (inner_parms, i), flags);
	    }
	  pp_cxx_end_template_argument_list (cxx_pp);
	  pp_cxx_whitespace (cxx_pp);
	}
      nreverse(orig_parms);
      if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
	pp_cxx_identifier (cxx_pp, "class");
    }
  if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
    dump_type (TREE_TYPE (t),
	       ((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
		| (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0)));
  else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL)
    dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME);
  else
    {
      gcc_assert (TREE_TYPE (t));
      switch (NEXT_CODE (t))
	{
	case METHOD_TYPE:
	case FUNCTION_TYPE:
	  dump_function_decl (t, flags | TFF_TEMPLATE_NAME);
	  break;
	default:
	  dump_type (TREE_TYPE (t),
		     (flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
		     | (flags & TFF_DECL_SPECIFIERS
			? TFF_CLASS_KEY_OR_ENUM : 0));
	}
    }
}
static void dump_template_decl ( tree t , int flags ) { tree orig_parms = DECL_TEMPLATE_PARMS ( t ) ; tree parms ; int i ; if ( flags & TFF_TEMPLATE_HEADER ) { for ( parms = orig_parms = nreverse ( orig_parms ) ; parms ; parms = TREE_CHAIN ( parms ) ) { tree inner_parms = INNERMOST_TEMPLATE_PARMS ( parms ) ; int len = TREE_VEC_LENGTH ( inner_parms ) ; pp_cxx_identifier ( cxx_pp , " " ) ; pp_cxx_begin_template_argument_list ( cxx_pp ) ; flags |= TFF_DECL_SPECIFIERS ; for ( i = 0 ; i < len ; i ++ ) { if ( i ) pp_separate_with_comma ( cxx_pp ) ; dump_template_parameter ( TREE_VEC_ELT ( inner_parms , i ) , flags ) ; } pp_cxx_end_template_argument_list ( cxx_pp ) ; pp_cxx_whitespace ( cxx_pp ) ; } nreverse ( orig_parms ) ; if ( DECL_TEMPLATE_TEMPLATE_PARM_P ( t ) ) pp_cxx_identifier ( cxx_pp , " " ) ; } if ( TREE_CODE ( DECL_TEMPLATE_RESULT ( t ) ) == TYPE_DECL ) dump_type ( TREE_TYPE ( t ) , ( ( flags & ~ TFF_CLASS_KEY_OR_ENUM ) | TFF_TEMPLATE_NAME | ( flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0 ) ) ) ; else if ( TREE_CODE ( DECL_TEMPLATE_RESULT ( t ) ) == VAR_DECL ) dump_decl ( DECL_TEMPLATE_RESULT ( t ) , flags | TFF_TEMPLATE_NAME ) ; else { gcc_assert ( TREE_TYPE ( t ) ) ; switch ( NEXT_CODE ( t ) ) { case METHOD_TYPE : case FUNCTION_TYPE : dump_function_decl ( t , flags | TFF_TEMPLATE_NAME ) ; break ; default : dump_type ( TREE_TYPE ( t ) , ( flags & ~ TFF_CLASS_KEY_OR_ENUM ) | TFF_TEMPLATE_NAME | ( flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0 ) ) ; } } }
Dump a template declaration T under control of FLAGS.
Dump a template declaration T under control of FLAGS .
/* If we've shown the template prefix, we'd better show the
	     parameters' and decl's type too.  */ /* Say `template<arg> class TT' not just `template<arg> TT'.  */ /* This case can occur with some invalid code.  */