c-pretty-print.h (c_pretty_printer::primary_expression): Now a virtua member function.
c-family/ * c-pretty-print.h (c_pretty_printer::primary_expression): Now a virtua member function. (pp_primary_expression): Adjust. (pp_c_primary_expression): Remove. * c-pretty-print.c (c_pretty_printer::primary_expression): Rename from pp_c_primary_expression. Adjust. (pp_c_initializer_list): Use pp_primary_expression. (c_pretty_printer::c_pretty_printer): Do not assign to primary_expression. cp/ * cxx-pretty-print.h (cxx_pretty_printer::primary_expression): Now an overrider of c_pretty_printer::primary_expression. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression): Rename from pp_cxx_primary_expression. Adjust. (pp_cxx_postfix_expression): Use pp_primary_expression. (pp_cxx_ctor_initializer): Likewise. (cxx_pretty_printer::cxx_pretty_printer): Do not assign to primary_expression. From-SVN: r201978
This commit is contained in:
parent
d5c3d3ef54
commit
7ecc260031
@ -1,3 +1,15 @@
|
||||
2013-08-25 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* c-pretty-print.h (c_pretty_printer::primary_expression): Now a
|
||||
virtua member function.
|
||||
(pp_primary_expression): Adjust.
|
||||
(pp_c_primary_expression): Remove.
|
||||
* c-pretty-print.c (c_pretty_printer::primary_expression): Rename
|
||||
from pp_c_primary_expression. Adjust.
|
||||
(pp_c_initializer_list): Use pp_primary_expression.
|
||||
(c_pretty_printer::c_pretty_printer): Do not assign to
|
||||
primary_expression.
|
||||
|
||||
2013-08-25 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* c-pretty-print.h (c_pretty_printer::translate_string): Declare.
|
||||
|
@ -1212,7 +1212,7 @@ pp_c_identifier (c_pretty_printer *pp, const char *id)
|
||||
( expression ) */
|
||||
|
||||
void
|
||||
pp_c_primary_expression (c_pretty_printer *pp, tree e)
|
||||
c_pretty_printer::primary_expression (tree e)
|
||||
{
|
||||
switch (TREE_CODE (e))
|
||||
{
|
||||
@ -1222,49 +1222,49 @@ pp_c_primary_expression (c_pretty_printer *pp, tree e)
|
||||
case CONST_DECL:
|
||||
case FUNCTION_DECL:
|
||||
case LABEL_DECL:
|
||||
pp_c_tree_decl_identifier (pp, e);
|
||||
pp_c_tree_decl_identifier (this, e);
|
||||
break;
|
||||
|
||||
case IDENTIFIER_NODE:
|
||||
pp_c_tree_identifier (pp, e);
|
||||
pp_c_tree_identifier (this, e);
|
||||
break;
|
||||
|
||||
case ERROR_MARK:
|
||||
pp->translate_string ("<erroneous-expression>");
|
||||
translate_string ("<erroneous-expression>");
|
||||
break;
|
||||
|
||||
case RESULT_DECL:
|
||||
pp->translate_string ("<return-value>");
|
||||
translate_string ("<return-value>");
|
||||
break;
|
||||
|
||||
case INTEGER_CST:
|
||||
case REAL_CST:
|
||||
case FIXED_CST:
|
||||
case STRING_CST:
|
||||
pp_constant (pp, e);
|
||||
constant (e);
|
||||
break;
|
||||
|
||||
case TARGET_EXPR:
|
||||
pp_c_ws_string (pp, "__builtin_memcpy");
|
||||
pp_c_left_paren (pp);
|
||||
pp_ampersand (pp);
|
||||
pp_primary_expression (pp, TREE_OPERAND (e, 0));
|
||||
pp_separate_with (pp, ',');
|
||||
pp_ampersand (pp);
|
||||
pp_initializer (pp, TREE_OPERAND (e, 1));
|
||||
pp_c_ws_string (this, "__builtin_memcpy");
|
||||
pp_c_left_paren (this);
|
||||
pp_ampersand (this);
|
||||
primary_expression (TREE_OPERAND (e, 0));
|
||||
pp_separate_with (this, ',');
|
||||
pp_ampersand (this);
|
||||
pp_initializer (this, TREE_OPERAND (e, 1));
|
||||
if (TREE_OPERAND (e, 2))
|
||||
{
|
||||
pp_separate_with (pp, ',');
|
||||
pp_c_expression (pp, TREE_OPERAND (e, 2));
|
||||
pp_separate_with (this, ',');
|
||||
pp_c_expression (this, TREE_OPERAND (e, 2));
|
||||
}
|
||||
pp_c_right_paren (pp);
|
||||
pp_c_right_paren (this);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* FIXME: Make sure we won't get into an infinite loop. */
|
||||
pp_c_left_paren (pp);
|
||||
pp_expression (pp, e);
|
||||
pp_c_right_paren (pp);
|
||||
pp_c_left_paren (this);
|
||||
pp_expression (this, e);
|
||||
pp_c_right_paren (this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1356,7 +1356,7 @@ pp_c_initializer_list (c_pretty_printer *pp, tree e)
|
||||
if (code == RECORD_TYPE || code == UNION_TYPE)
|
||||
{
|
||||
pp_c_dot (pp);
|
||||
pp_c_primary_expression (pp, TREE_PURPOSE (init));
|
||||
pp_primary_expression (pp, TREE_PURPOSE (init));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2119,7 +2119,7 @@ pp_c_assignment_expression (c_pretty_printer *pp, tree e)
|
||||
Implementation note: instead of going through the usual recursion
|
||||
chain, I take the liberty of dispatching nodes to the appropriate
|
||||
functions. This makes some redundancy, but it worths it. That also
|
||||
prevents a possible infinite recursion between pp_c_primary_expression ()
|
||||
prevents a possible infinite recursion between pp_primary_expression ()
|
||||
and pp_c_expression (). */
|
||||
|
||||
void
|
||||
@ -2344,7 +2344,6 @@ c_pretty_printer::c_pretty_printer ()
|
||||
|
||||
statement = pp_c_statement;
|
||||
|
||||
primary_expression = pp_c_primary_expression;
|
||||
postfix_expression = pp_c_postfix_expression;
|
||||
unary_expression = pp_c_unary_expression;
|
||||
initializer = pp_c_initializer;
|
||||
|
@ -56,6 +56,7 @@ struct c_pretty_printer : pretty_printer
|
||||
|
||||
virtual void constant (tree);
|
||||
virtual void id_expression (tree);
|
||||
virtual void primary_expression (tree);
|
||||
/* Points to the first element of an array of offset-list.
|
||||
Not used yet. */
|
||||
int *offset_list;
|
||||
@ -81,7 +82,6 @@ struct c_pretty_printer : pretty_printer
|
||||
|
||||
c_pretty_print_fn statement;
|
||||
|
||||
c_pretty_print_fn primary_expression;
|
||||
c_pretty_print_fn postfix_expression;
|
||||
c_pretty_print_fn unary_expression;
|
||||
c_pretty_print_fn multiplicative_expression;
|
||||
@ -114,7 +114,7 @@ struct c_pretty_printer : pretty_printer
|
||||
|
||||
#define pp_constant(PP, E) (PP)->constant (E)
|
||||
#define pp_id_expression(PP, E) (PP)->id_expression (E)
|
||||
#define pp_primary_expression(PP, E) (PP)->primary_expression (PP, E)
|
||||
#define pp_primary_expression(PP, E) (PP)->primary_expression (E)
|
||||
#define pp_postfix_expression(PP, E) (PP)->postfix_expression (PP, E)
|
||||
#define pp_unary_expression(PP, E) (PP)->unary_expression (PP, E)
|
||||
#define pp_initializer(PP, E) (PP)->initializer (PP, E)
|
||||
@ -170,7 +170,6 @@ void pp_c_call_argument_list (c_pretty_printer *, tree);
|
||||
void pp_c_unary_expression (c_pretty_printer *, tree);
|
||||
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_ws_string (c_pretty_printer *, const char *);
|
||||
void pp_c_identifier (c_pretty_printer *, const char *);
|
||||
|
@ -1,3 +1,14 @@
|
||||
2013-08-25 Gabriel Dos Reis <gdr@cs.tamu.edu>
|
||||
|
||||
* cxx-pretty-print.h (cxx_pretty_printer::primary_expression): Now
|
||||
an overrider of c_pretty_printer::primary_expression.
|
||||
* cxx-pretty-print.c (cxx_pretty_printer::primary_expression):
|
||||
Rename from pp_cxx_primary_expression. Adjust.
|
||||
(pp_cxx_postfix_expression): Use pp_primary_expression.
|
||||
(pp_cxx_ctor_initializer): Likewise.
|
||||
(cxx_pretty_printer::cxx_pretty_printer): Do not assign to
|
||||
primary_expression.
|
||||
|
||||
2013-08-23 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* cp-tree.h (struct lang_type_class): Free is_final bit.
|
||||
|
@ -407,8 +407,8 @@ pp_cxx_userdef_literal (cxx_pretty_printer *pp, tree t)
|
||||
__is_trivial ( type-id )
|
||||
__is_union ( type-id ) */
|
||||
|
||||
static void
|
||||
pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
|
||||
void
|
||||
cxx_pretty_printer::primary_expression (tree t)
|
||||
{
|
||||
switch (TREE_CODE (t))
|
||||
{
|
||||
@ -416,11 +416,11 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
|
||||
case REAL_CST:
|
||||
case COMPLEX_CST:
|
||||
case STRING_CST:
|
||||
pp_constant (pp, t);
|
||||
constant (t);
|
||||
break;
|
||||
|
||||
case USERDEF_LITERAL:
|
||||
pp_cxx_userdef_literal (pp, t);
|
||||
pp_cxx_userdef_literal (this, t);
|
||||
break;
|
||||
|
||||
case BASELINK:
|
||||
@ -432,36 +432,36 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
|
||||
case OVERLOAD:
|
||||
case CONST_DECL:
|
||||
case TEMPLATE_DECL:
|
||||
pp_id_expression (pp, t);
|
||||
id_expression (t);
|
||||
break;
|
||||
|
||||
case RESULT_DECL:
|
||||
case TEMPLATE_TYPE_PARM:
|
||||
case TEMPLATE_TEMPLATE_PARM:
|
||||
case TEMPLATE_PARM_INDEX:
|
||||
pp_cxx_unqualified_id (pp, t);
|
||||
pp_cxx_unqualified_id (this, t);
|
||||
break;
|
||||
|
||||
case STMT_EXPR:
|
||||
pp_cxx_left_paren (pp);
|
||||
pp_cxx_statement (pp, STMT_EXPR_STMT (t));
|
||||
pp_cxx_right_paren (pp);
|
||||
pp_cxx_left_paren (this);
|
||||
pp_cxx_statement (this, STMT_EXPR_STMT (t));
|
||||
pp_cxx_right_paren (this);
|
||||
break;
|
||||
|
||||
case TRAIT_EXPR:
|
||||
pp_cxx_trait_expression (pp, t);
|
||||
pp_cxx_trait_expression (this, t);
|
||||
break;
|
||||
|
||||
case VA_ARG_EXPR:
|
||||
pp_cxx_va_arg_expression (pp, t);
|
||||
pp_cxx_va_arg_expression (this, t);
|
||||
break;
|
||||
|
||||
case OFFSETOF_EXPR:
|
||||
pp_cxx_offsetof_expression (pp, t);
|
||||
pp_cxx_offsetof_expression (this, t);
|
||||
break;
|
||||
|
||||
default:
|
||||
pp_c_primary_expression (pp, t);
|
||||
c_pretty_printer::primary_expression (t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -591,7 +591,7 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
|
||||
case CONST_DECL:
|
||||
case TEMPLATE_DECL:
|
||||
case RESULT_DECL:
|
||||
pp_cxx_primary_expression (pp, t);
|
||||
pp_primary_expression (pp, t);
|
||||
break;
|
||||
|
||||
case DYNAMIC_CAST_EXPR:
|
||||
@ -1069,7 +1069,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t)
|
||||
case TEMPLATE_PARM_INDEX:
|
||||
case TEMPLATE_TEMPLATE_PARM:
|
||||
case STMT_EXPR:
|
||||
pp_cxx_primary_expression (pp, t);
|
||||
pp_primary_expression (pp, t);
|
||||
break;
|
||||
|
||||
case CALL_EXPR:
|
||||
@ -1608,9 +1608,9 @@ pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t)
|
||||
bool is_pack = PACK_EXPANSION_P (purpose);
|
||||
|
||||
if (is_pack)
|
||||
pp_cxx_primary_expression (pp, PACK_EXPANSION_PATTERN (purpose));
|
||||
pp_primary_expression (pp, PACK_EXPANSION_PATTERN (purpose));
|
||||
else
|
||||
pp_cxx_primary_expression (pp, purpose);
|
||||
pp_primary_expression (pp, purpose);
|
||||
pp_cxx_call_argument_list (pp, TREE_VALUE (t));
|
||||
if (is_pack)
|
||||
pp_cxx_ws_string (pp, "...");
|
||||
@ -2448,7 +2448,6 @@ cxx_pretty_printer::cxx_pretty_printer ()
|
||||
|
||||
/* pp->statement = (pp_fun) pp_cxx_statement; */
|
||||
|
||||
primary_expression = (pp_fun) pp_cxx_primary_expression;
|
||||
postfix_expression = (pp_fun) pp_cxx_postfix_expression;
|
||||
unary_expression = (pp_fun) pp_cxx_unary_expression;
|
||||
multiplicative_expression = (pp_fun) pp_cxx_multiplicative_expression;
|
||||
|
@ -35,6 +35,7 @@ struct cxx_pretty_printer : c_pretty_printer
|
||||
|
||||
void constant (tree);
|
||||
void id_expression (tree);
|
||||
void primary_expression (tree);
|
||||
/* This is the enclosing scope of the entity being pretty-printed. */
|
||||
tree enclosing_scope;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user