From d3e88495d5a54c57ef80caffe232c6b3eed96a04 Mon Sep 17 00:00:00 2001 From: aoliva Date: Wed, 15 Nov 2017 03:11:48 +0000 Subject: introduce TDF_compare_debug, omit OBJ_TYPE_REF casts with it for gcc/ChangeLog * dumpfile.h (TDF_COMPARE_DEBUG): New. * final.c (rest_of_clean_state): Set it for the -fcompare-debug dump. * tree-pretty-print.c (dump_generic_node): Omit OBJ_TYPE_REF class when TDF_COMPARE_DEBUG is set. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254751 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-pretty-print.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'gcc/tree-pretty-print.c') diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 61a28c6757f..80d45f96d67 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -2760,7 +2760,15 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags, pp_string (pp, "OBJ_TYPE_REF("); dump_generic_node (pp, OBJ_TYPE_REF_EXPR (node), spc, flags, false); pp_semicolon (pp); - if (!(flags & TDF_SLIM) && virtual_method_call_p (node)) + /* We omit the class type for -fcompare-debug because we may + drop TYPE_BINFO early depending on debug info, and then + virtual_method_call_p would return false, whereas when + TYPE_BINFO is preserved it may still return true and then + we'd print the class type. Compare tree and rtl dumps for + libstdc++-prettyprinters/shared_ptr.cc with and without -g, + for example, at occurrences of OBJ_TYPE_REF. */ + if (!(flags & (TDF_SLIM | TDF_COMPARE_DEBUG)) + && virtual_method_call_p (node)) { pp_string (pp, "("); dump_generic_node (pp, obj_type_ref_class (node), spc, flags, false); -- cgit v1.2.1