]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: show types for poisoned_svalue and compound_svalue
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 2 Jul 2021 19:19:44 +0000 (15:19 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 2 Jul 2021 19:19:44 +0000 (15:19 -0400)
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

index 897e84e8464d9543232a6521399b43056327997c..a16563d912a0eac910b25a2885d9c8f3cde190cc 100644 (file)
@@ -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, "})");
     }
 }