aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@gcc.gnu.org>2013-08-25 18:05:29 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2013-08-25 18:05:29 +0000
commit7ecc260031bb303b3fb04895f1951d8914ac7f73 (patch)
treee3e822c597db970f5994f185079de90625e74346 /gcc/c-family
parentd5c3d3ef5464dd5a89a8158ffe8b38df5a4c1708 (diff)
downloadgcc-7ecc260031bb303b3fb04895f1951d8914ac7f73.zip
gcc-7ecc260031bb303b3fb04895f1951d8914ac7f73.tar.gz
gcc-7ecc260031bb303b3fb04895f1951d8914ac7f73.tar.bz2
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
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog12
-rw-r--r--gcc/c-family/c-pretty-print.c43
-rw-r--r--gcc/c-family/c-pretty-print.h5
3 files changed, 35 insertions, 25 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index cf2dc3f..28c6ff0 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,5 +1,17 @@
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.
* c-pretty-print.c (M_): Remove.
(c_pretty_printer::translate_string): Define.
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index ecc0173..870a5c7 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -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;
diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h
index f347bc5..9e95e14 100644
--- a/gcc/c-family/c-pretty-print.h
+++ b/gcc/c-family/c-pretty-print.h
@@ -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 *);