diff mbox

Clean up pretty printers [14/n]

Message ID 874naelipm.fsf@euclid.axiomatics.org
State New
Headers show

Commit Message

Gabriel Dos Reis Aug. 25, 2013, 12:25 a.m. UTC
Same as previous topic; for id_expression.

-- Gaby

2013-08-24  Gabriel Dos Reis  <gdr@integrable-solutions.net>
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.
diff mbox

Patch

Index: c-family/c-pretty-print.c
===================================================================
--- c-family/c-pretty-print.c	(revision 201969)
+++ c-family/c-pretty-print.c	(working copy)
@@ -1422,7 +1422,7 @@ 
        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 @@ 
     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 @@ 
     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 @@ 
 
   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;
Index: c-family/c-pretty-print.h
===================================================================
--- c-family/c-pretty-print.h	(revision 201969)
+++ c-family/c-pretty-print.h	(working copy)
@@ -52,6 +52,7 @@ 
   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 @@ 
 
   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 @@ 
 #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_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);
Index: cp/cxx-pretty-print.c
===================================================================
--- cp/cxx-pretty-print.c	(revision 201969)
+++ cp/cxx-pretty-print.c	(working copy)
@@ -355,15 +355,15 @@ 
       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 @@ 
 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 @@ 
     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 @@ 
 	       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 @@ 
 
   /* 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;
Index: cp/cxx-pretty-print.h
===================================================================
--- cp/cxx-pretty-print.h	(revision 201969)
+++ cp/cxx-pretty-print.h	(working copy)
@@ -33,7 +33,8 @@ 
 {
   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;
 };