[PATCH v2] c++: improve print_node of PTRMEM_CST

Jason Merrill jason@redhat.com
Tue Nov 16 15:14:55 GMT 2021


On 11/4/21 16:32, Jakub Jelinek wrote:
> On Thu, Nov 04, 2021 at 11:52:34AM -0400, Jason Merrill via Gcc-patches wrote:
>> 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.
>>
>> Tested x86_64-pc-linux-gnu.  OK for trunk, or should I add a new hook for
>> constants?
>>
>> gcc/cp/ChangeLog:
>>
>> 	* ptree.c (cxx_print_xnode): Handle PTRMEM_CST.
>>
>> gcc/ChangeLog:
>>
>> 	* print-tree.c (print_node): Also call print_xnode hook for
>> 	tcc_constant class.
> 
> I think using the same langhook is fine, but in that case certainly
>    /* Called by print_tree when there is a tree of class tcc_exceptional
>       that it doesn't know how to display.  */
> should be adjusted so that it mentions also tcc_constant.

Done.

> And maybe rename it from print_xnode to print_node?

I think changing the comment is enough, it's still just exceptional and 
constant.

This is what I'm pushing:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-c-improve-print_node-of-PTRMEM_CST.patch
Type: text/x-patch
Size: 2234 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211116/61f5dc7b/attachment.bin>


More information about the Gcc-patches mailing list