From 66dfe4c4f83eb1a3f42083251c989f271fa3b5cf Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sun, 25 Aug 2013 00:24:27 +0000 Subject: [PATCH] c-pretty-print.h (c_pretty_printer::id_expression): Now a virtual function. c-family/ * c-pretty-print.h (c_pretty_printer::id_expression): Now a virtual function. (pp_c_id_expression): Remove. (pp_id_expression): Adjust. * c-pretty-print.c (c_pretty_printer::id_expression): Rename from pp_c_id_expression. Adjust. (pp_c_postfix_expression): Use pp_id_expression. (c_pretty_printer::c_pretty_printer): Do not assign to id_expression. cp/ * cxx-pretty-print.h (cxx_pretty_printer::id_expression): Declare. * cxx-pretty-print.c (cxx_pretty_printer::id_expression): Rename from pp_cxx_id_expression. Adjust. (pp_cxx_userdef_literal): Use pp_id_expression. (pp_cxx_primary_expression): Likewise. (pp_cxx_direct_declarator): Likewise. (cxx_pretty_printer::cxx_pretty_printer): Do not assign to id_expression. From-SVN: r201973 --- gcc/c-family/ChangeLog | 11 +++++++++++ gcc/c-family/c-pretty-print.c | 11 +++++------ gcc/c-family/c-pretty-print.h | 5 ++--- gcc/cp/ChangeLog | 11 +++++++++++ gcc/cp/cxx-pretty-print.c | 17 ++++++++--------- gcc/cp/cxx-pretty-print.h | 3 ++- 6 files changed, 39 insertions(+), 19 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index ffac4dd07aaf..c3d9ab7fcaff 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,14 @@ +2013-08-24 Gabriel Dos Reis + + * c-pretty-print.h (c_pretty_printer::id_expression): Now a + virtual function. + (pp_c_id_expression): Remove. + (pp_id_expression): Adjust. + * c-pretty-print.c (c_pretty_printer::id_expression): Rename from + pp_c_id_expression. Adjust. + (pp_c_postfix_expression): Use pp_id_expression. + (c_pretty_printer::c_pretty_printer): Do not assign to id_expression. + 2013-08-24 Gabriel Dos Reis * c-pretty-print.h (c_pretty_printer::constant): Now a virtual diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index 5291be775c2e..a5dc62e07c1e 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -1422,7 +1422,7 @@ pp_c_brace_enclosed_initializer_list (c_pretty_printer *pp, tree l) identifier */ void -pp_c_id_expression (c_pretty_printer *pp, tree t) +c_pretty_printer::id_expression (tree t) { switch (TREE_CODE (t)) { @@ -1433,15 +1433,15 @@ pp_c_id_expression (c_pretty_printer *pp, tree t) case FUNCTION_DECL: case FIELD_DECL: case LABEL_DECL: - pp_c_tree_decl_identifier (pp, t); + pp_c_tree_decl_identifier (this, t); break; case IDENTIFIER_NODE: - pp_c_tree_identifier (pp, t); + pp_c_tree_identifier (this, t); break; default: - pp_unsupported_tree (pp, t); + pp_unsupported_tree (this, t); break; } } @@ -1645,7 +1645,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e) case ADDR_EXPR: if (TREE_CODE (TREE_OPERAND (e, 0)) == FUNCTION_DECL) { - pp_c_id_expression (pp, TREE_OPERAND (e, 0)); + pp_id_expression (pp, TREE_OPERAND (e, 0)); break; } /* else fall through. */ @@ -2339,7 +2339,6 @@ c_pretty_printer::c_pretty_printer () statement = pp_c_statement; - id_expression = pp_c_id_expression; primary_expression = pp_c_primary_expression; postfix_expression = pp_c_postfix_expression; unary_expression = pp_c_unary_expression; diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h index 13b0fe55397a..91e635f56abb 100644 --- a/gcc/c-family/c-pretty-print.h +++ b/gcc/c-family/c-pretty-print.h @@ -52,6 +52,7 @@ struct c_pretty_printer : pretty_printer c_pretty_printer (); virtual void constant (tree); + virtual void id_expression (tree); /* Points to the first element of an array of offset-list. Not used yet. */ int *offset_list; @@ -77,7 +78,6 @@ struct c_pretty_printer : pretty_printer c_pretty_print_fn statement; - c_pretty_print_fn id_expression; c_pretty_print_fn primary_expression; c_pretty_print_fn postfix_expression; c_pretty_print_fn unary_expression; @@ -110,7 +110,7 @@ struct c_pretty_printer : pretty_printer #define pp_statement(PP, S) (PP)->statement (PP, S) #define pp_constant(PP, E) (PP)->constant (E) -#define pp_id_expression(PP, E) (PP)->id_expression (PP, E) +#define pp_id_expression(PP, E) (PP)->id_expression (E) #define pp_primary_expression(PP, E) (PP)->primary_expression (PP, E) #define pp_postfix_expression(PP, E) (PP)->postfix_expression (PP, E) #define pp_unary_expression(PP, E) (PP)->unary_expression (PP, E) @@ -169,7 +169,6 @@ void pp_c_cast_expression (c_pretty_printer *, tree); void pp_c_postfix_expression (c_pretty_printer *, tree); void pp_c_primary_expression (c_pretty_printer *, tree); void pp_c_init_declarator (c_pretty_printer *, tree); -void pp_c_id_expression (c_pretty_printer *, tree); void pp_c_ws_string (c_pretty_printer *, const char *); void pp_c_identifier (c_pretty_printer *, const char *); void pp_c_string_literal (c_pretty_printer *, tree); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 42db29561abc..830744826cfb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2013-08-24 Gabriel Dos Reis + + * cxx-pretty-print.h (cxx_pretty_printer::id_expression): Declare. + * cxx-pretty-print.c (cxx_pretty_printer::id_expression): Rename + from pp_cxx_id_expression. Adjust. + (pp_cxx_userdef_literal): Use pp_id_expression. + (pp_cxx_primary_expression): Likewise. + (pp_cxx_direct_declarator): Likewise. + (cxx_pretty_printer::cxx_pretty_printer): Do not assign to + id_expression. + 2013-08-24 Gabriel Dos Reis * cxx-pretty-print.h (cxx_pretty_printer::constant): Now a member diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index f83f31db2608..dcebe0bbcc64 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -355,15 +355,15 @@ cxx_pretty_printer::constant (tree t) unqualified-id qualified-id */ -static inline void -pp_cxx_id_expression (cxx_pretty_printer *pp, tree t) +void +cxx_pretty_printer::id_expression (tree t) { if (TREE_CODE (t) == OVERLOAD) t = OVL_CURRENT (t); if (DECL_P (t) && DECL_CONTEXT (t)) - pp_cxx_qualified_id (pp, t); + pp_cxx_qualified_id (this, t); else - pp_cxx_unqualified_id (pp, t); + pp_cxx_unqualified_id (this, t); } /* user-defined literal: @@ -373,7 +373,7 @@ void pp_cxx_userdef_literal (cxx_pretty_printer *pp, tree t) { pp_constant (pp, USERDEF_LITERAL_VALUE (t)); - pp_cxx_id_expression (pp, USERDEF_LITERAL_SUFFIX_ID (t)); + pp_id_expression (pp, USERDEF_LITERAL_SUFFIX_ID (t)); } @@ -436,7 +436,7 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t) case OVERLOAD: case CONST_DECL: case TEMPLATE_DECL: - pp_cxx_id_expression (pp, t); + pp_id_expression (pp, t); break; case RESULT_DECL: @@ -1543,14 +1543,14 @@ pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t) parameter pack. */ pp_cxx_ws_string (pp, "..."); - pp_cxx_id_expression (pp, DECL_NAME (t)); + pp_id_expression (pp, DECL_NAME (t)); } pp_cxx_abstract_declarator (pp, TREE_TYPE (t)); break; case FUNCTION_DECL: pp_cxx_space_for_pointer_operator (pp, TREE_TYPE (TREE_TYPE (t))); - pp_cxx_id_expression (pp, t); + pp_id_expression (pp, t); pp_cxx_parameter_declaration_clause (pp, t); if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t)) @@ -2452,7 +2452,6 @@ cxx_pretty_printer::cxx_pretty_printer () /* pp->statement = (pp_fun) pp_cxx_statement; */ - id_expression = (pp_fun) pp_cxx_id_expression; primary_expression = (pp_fun) pp_cxx_primary_expression; postfix_expression = (pp_fun) pp_cxx_postfix_expression; unary_expression = (pp_fun) pp_cxx_unary_expression; diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h index 3d82ecbf8b06..77447c30a1bf 100644 --- a/gcc/cp/cxx-pretty-print.h +++ b/gcc/cp/cxx-pretty-print.h @@ -33,7 +33,8 @@ struct cxx_pretty_printer : c_pretty_printer { cxx_pretty_printer (); - virtual void constant (tree); + void constant (tree); + void id_expression (tree); /* This is the enclosing scope of the entity being pretty-printed. */ tree enclosing_scope; }; -- 2.39.5