public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [committed] analyzer: show types for poisoned_svalue and compound_svalue
Date: Thu,  3 Jun 2021 10:43:20 -0400	[thread overview]
Message-ID: <20210603144320.684493-1-dmalcolm@redhat.com> (raw)

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as e84fe25f6386666efe1ead4304693d91d7555e7a.

gcc/analyzer/ChangeLog:
	* svalue.cc (poisoned_svalue::dump_to_pp): Dump type.
	(compound_svalue::dump_to_pp): Dump any type.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
 gcc/analyzer/svalue.cc | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/gcc/analyzer/svalue.cc b/gcc/analyzer/svalue.cc
index 897e84e8464..a16563d912a 100644
--- a/gcc/analyzer/svalue.cc
+++ b/gcc/analyzer/svalue.cc
@@ -735,9 +735,17 @@ void
 poisoned_svalue::dump_to_pp (pretty_printer *pp, bool simple) const
 {
   if (simple)
-    pp_printf (pp, "POISONED(%s)", poison_kind_to_str (m_kind));
+    {
+      pp_string (pp, "POISONED(");
+      print_quoted_type (pp, get_type ());
+      pp_printf (pp, ", %s)", poison_kind_to_str (m_kind));
+    }
   else
-    pp_printf (pp, "poisoned_svalue(%s)", poison_kind_to_str (m_kind));
+    {
+      pp_string (pp, "poisoned_svalue(");
+      print_quoted_type (pp, get_type ());
+      pp_printf (pp, ", %s)", poison_kind_to_str (m_kind));
+    }
 }
 
 /* Implementation of svalue::accept vfunc for poisoned_svalue.  */
@@ -1228,17 +1236,26 @@ compound_svalue::dump_to_pp (pretty_printer *pp, bool simple) const
   if (simple)
     {
       pp_string (pp, "COMPOUND(");
+      if (get_type ())
+	{
+	  print_quoted_type (pp, get_type ());
+	  pp_string (pp, ", ");
+	}
+      pp_character (pp, '{');
       m_map.dump_to_pp (pp, simple, false);
-      pp_character (pp, ')');
+      pp_string (pp, "})");
     }
   else
     {
       pp_string (pp, "compound_svalue (");
-      pp_string (pp, ", ");
+      if (get_type ())
+	{
+	  print_quoted_type (pp, get_type ());
+	  pp_string (pp, ", ");
+	}
       pp_character (pp, '{');
       m_map.dump_to_pp (pp, simple, false);
-      pp_string (pp, "}, ");
-      pp_character (pp, ')');
+      pp_string (pp, "})");
     }
 }
 
-- 
2.26.3


                 reply	other threads:[~2021-06-03 14:43 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=20210603144320.684493-1-dmalcolm@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@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).