c-pretty-print.h (c_pretty_printer::id_expression): Now a virtual function.
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Sun, 25 Aug 2013 00:24:27 +0000 (00:24 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Sun, 25 Aug 2013 00:24:27 +0000 (00:24 +0000)
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
gcc/c-family/c-pretty-print.c
gcc/c-family/c-pretty-print.h
gcc/cp/ChangeLog
gcc/cp/cxx-pretty-print.c
gcc/cp/cxx-pretty-print.h

index ffac4dd..c3d9ab7 100644 (file)
@@ -1,5 +1,16 @@
 2013-08-24  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
+       * 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  <gdr@integrable-solutions.net>
+
        * c-pretty-print.h (c_pretty_printer::constant): Now a virtual
        member function.
        (pp_constant): Adjust.
index 5291be7..a5dc62e 100644 (file)
@@ -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;
index 13b0fe5..91e635f 100644 (file)
@@ -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);
index 42db295..8307448 100644 (file)
@@ -1,5 +1,16 @@
 2013-08-24  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
+       * 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  <gdr@integrable-solutions.net>
+
        * 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
index f83f31d..dcebe0b 100644 (file)
@@ -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;
index 3d82ecb..77447c3 100644 (file)
@@ -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;
 };