public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5306] c++: improve print_node of PTRMEM_CST
Date: Tue, 16 Nov 2021 15:21:04 +0000 (GMT)	[thread overview]
Message-ID: <20211116152104.52C313858D35@sourceware.org> (raw)

https://gcc.gnu.org/g:132f1c27770fa6dafdf14591878d301aedd5ae16

commit r12-5306-g132f1c27770fa6dafdf14591878d301aedd5ae16
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Oct 29 16:39:01 2021 -0400

    c++: improve print_node of PTRMEM_CST
    
    It's been inconvenient that pretty-printing of PTRMEM_CST didn't display
    what member the constant refers to.
    
    Adding that is complicated by the absence of a langhook for CONSTANT_CLASS_P
    nodes; the simplest fix for that is to use the tcc_exceptional hook for
    tcc_constant as well.
    
    gcc/cp/ChangeLog:
    
            * ptree.c (cxx_print_xnode): Handle PTRMEM_CST.
    
    gcc/ChangeLog:
    
            * langhooks.h (struct lang_hooks): Adjust comment.
            * print-tree.c (print_node): Also call print_xnode hook for
            tcc_constant class.

Diff:
---
 gcc/langhooks.h  | 2 +-
 gcc/cp/ptree.c   | 3 +++
 gcc/print-tree.c | 3 +--
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 3e89134e8b4..3db8f2a550d 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -477,7 +477,7 @@ struct lang_hooks
   void (*print_statistics) (void);
 
   /* Called by print_tree when there is a tree of class tcc_exceptional
-     that it doesn't know how to display.  */
+     or tcc_constant that it doesn't know how to display.  */
   lang_print_tree_hook print_xnode;
 
   /* Called to print language-dependent parts of tcc_decl, tcc_type,
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index ca7884db39b..d514aa2cad2 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -379,6 +379,9 @@ cxx_print_xnode (FILE *file, tree node, int indent)
       if (tree message = STATIC_ASSERT_MESSAGE (node))
 	print_node (file, "message", message, indent+4);
       break;
+    case PTRMEM_CST:
+      print_node (file, "member", PTRMEM_CST_MEMBER (node), indent+4);
+      break;
     default:
       break;
     }
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index d1fbd044c27..b5dc523fcb1 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -1004,8 +1004,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
 	  break;
 
 	default:
-	  if (EXCEPTIONAL_CLASS_P (node))
-	    lang_hooks.print_xnode (file, node, indent);
+	  lang_hooks.print_xnode (file, node, indent);
 	  break;
 	}


                 reply	other threads:[~2021-11-16 15:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211116152104.52C313858D35@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).