From ca43e9d547182a1eb1ba29e170f95ece16fcfe6c Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sat, 24 Aug 2013 22:29:37 +0000 Subject: c-pretty-print.h (c_pretty_printer::constant): Now a virtual member function. * c-pretty-print.h (c_pretty_printer::constant): Now a virtual member function. (pp_constant): Adjust. (pp_c_constant): Remove. * c-pretty-print.c (c_pretty_printer::constant): Rename from pp_c_constant. Adjust. (pp_c_constant) (pp_c_primary_expression): Call pp_constant in lieu of pp_c_constant. (c_pretty_printer::c_pretty_printer): Remove assignment to constant. cp/ * cxx-pretty-print.h (cxx_pretty_printer::constant): Now a member function, overriding c_pretty_printer::constant. * cxx-pretty-print.c (cxx_pretty_printer::constant): Rename from pp_cxx_constant. Adjust. (cxx_pretty_printer::cxx_pretty_printer): Do not assign to constant. From-SVN: r201969 --- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/cxx-pretty-print.c | 21 ++++++++++----------- gcc/cp/cxx-pretty-print.h | 2 ++ 3 files changed, 20 insertions(+), 11 deletions(-) (limited to 'gcc/cp') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6972868..42db295 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2013-08-24 Gabriel Dos Reis + + * cxx-pretty-print.h (cxx_pretty_printer::constant): Now a member + function, overriding c_pretty_printer::constant. + * cxx-pretty-print.c (cxx_pretty_printer::constant): Rename from + pp_cxx_constant. Adjust. + (cxx_pretty_printer::cxx_pretty_printer): Do not assign to constant. + 2013-08-23 Gabriel Dos Reis * cp-objcp-common.c (cxx_initialize_diagnostics): Call a diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 6c32365..f83f31d 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -321,8 +321,8 @@ pp_cxx_qualified_id (cxx_pretty_printer *pp, tree t) } -static void -pp_cxx_constant (cxx_pretty_printer *pp, tree t) +void +cxx_pretty_printer::constant (tree t) { switch (TREE_CODE (t)) { @@ -330,23 +330,23 @@ pp_cxx_constant (cxx_pretty_printer *pp, tree t) { const bool in_parens = PAREN_STRING_LITERAL_P (t); if (in_parens) - pp_cxx_left_paren (pp); - pp_c_constant (pp, t); + pp_cxx_left_paren (this); + c_pretty_printer::constant (t); if (in_parens) - pp_cxx_right_paren (pp); + pp_cxx_right_paren (this); } break; case INTEGER_CST: if (NULLPTR_TYPE_P (TREE_TYPE (t))) { - pp_string (pp, "nullptr"); + pp_string (this, "nullptr"); break; } /* else fall through. */ default: - pp_c_constant (pp, t); + c_pretty_printer::constant (t); break; } } @@ -372,7 +372,7 @@ pp_cxx_id_expression (cxx_pretty_printer *pp, tree t) void pp_cxx_userdef_literal (cxx_pretty_printer *pp, tree t) { - pp_cxx_constant (pp, USERDEF_LITERAL_VALUE (t)); + pp_constant (pp, USERDEF_LITERAL_VALUE (t)); pp_cxx_id_expression (pp, USERDEF_LITERAL_SUFFIX_ID (t)); } @@ -420,7 +420,7 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t) case REAL_CST: case COMPLEX_CST: case STRING_CST: - pp_cxx_constant (pp, t); + pp_constant (pp, t); break; case USERDEF_LITERAL: @@ -1041,7 +1041,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t) case INTEGER_CST: case REAL_CST: case COMPLEX_CST: - pp_cxx_constant (pp, t); + pp_constant (pp, t); break; case USERDEF_LITERAL: @@ -2452,7 +2452,6 @@ cxx_pretty_printer::cxx_pretty_printer () /* pp->statement = (pp_fun) pp_cxx_statement; */ - constant = (pp_fun) pp_cxx_constant; id_expression = (pp_fun) pp_cxx_id_expression; primary_expression = (pp_fun) pp_cxx_primary_expression; postfix_expression = (pp_fun) pp_cxx_postfix_expression; diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h index c4611e2..3d82ecb 100644 --- a/gcc/cp/cxx-pretty-print.h +++ b/gcc/cp/cxx-pretty-print.h @@ -32,6 +32,8 @@ enum cxx_pretty_printer_flags struct cxx_pretty_printer : c_pretty_printer { cxx_pretty_printer (); + + virtual void constant (tree); /* This is the enclosing scope of the entity being pretty-printed. */ tree enclosing_scope; }; -- cgit v1.1