From afb1a1119e5951ad9ad9fb5f5531266c472d658f Mon Sep 17 00:00:00 2001 From: gdr Date: Fri, 29 Aug 2003 07:00:32 +0000 Subject: [PATCH] PR c++/11811 * cxx-pretty-print.c (pp_cxx_canonical_template_parameter): New function. * cxx-pretty-print.h: Declare. * error.c (dump_template_parameter): Use it. (dump_type): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70905 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/cxx-pretty-print.c | 21 +++++++++++++++++++++ gcc/cp/cxx-pretty-print.h | 1 + gcc/cp/error.c | 7 ++++--- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 402b1772090..60c81ab4fad 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2003-08-29 Gabriel Dos Reis + + PR c++/11811 + * cxx-pretty-print.c (pp_cxx_canonical_template_parameter): New + function. + * cxx-pretty-print.h: Declare. + * error.c (dump_template_parameter): Use it. + (dump_type): Likewise. + 2003-08-28 Mark Mitchell * init.c (decl_constant_value): Deal with COND_EXPR specially. diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 543cc322151..2efe0bc26bf 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -1538,6 +1538,27 @@ pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t) } } +/* Pretty-print a template parameter in the canonical form + "template-parameter--". */ + +void +pp_cxx_canonical_template_parameter (cxx_pretty_printer *pp, tree parm) +{ + const enum tree_code code = TREE_CODE (parm); + + /* Brings type template parameters to the canonical forms */ + if (code == TEMPLATE_TYPE_PARM || code == TEMPLATE_TEMPLATE_PARM + || code == BOUND_TEMPLATE_TEMPLATE_PARM) + parm = TEMPLATE_TYPE_PARM_INDEX (parm); + + pp_cxx_begin_template_argument_list (pp); + pp_cxx_identifier (pp, "template-parameter-"); + pp_wide_integer (pp, TEMPLATE_PARM_LEVEL (parm)); + pp_minus (pp); + pp_wide_integer (pp, TEMPLATE_PARM_IDX (parm) + 1); + pp_cxx_end_template_argument_list (pp); +} + /* template-declaration: export(opt) template < template-parameter-list > declaration */ diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h index 1fa0b99b6ff..d75c2827f95 100644 --- a/gcc/cp/cxx-pretty-print.h +++ b/gcc/cp/cxx-pretty-print.h @@ -47,6 +47,7 @@ void pp_cxx_pretty_printer_init (cxx_pretty_printer *); void pp_cxx_declaration (cxx_pretty_printer *, tree); void pp_cxx_function_definition (cxx_pretty_printer *, tree); +void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree); void pp_cxx_statement (cxx_pretty_printer *, tree); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 9aeb555c615..aa7534ed086 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -227,7 +227,7 @@ dump_template_parameter (tree parm, int flags) else if (DECL_NAME (p)) pp_tree_identifier (cxx_pp, DECL_NAME (p)); else - pp_identifier (cxx_pp, "