analyzer: add diagnostics to output of -fdump-analyzer-exploded-graph
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 11 Feb 2020 22:13:44 +0000 (17:13 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 17 Feb 2020 07:11:50 +0000 (02:11 -0500)
gcc/analyzer/ChangeLog:
* diagnostic-manager.h (diagnostic_manager::get_saved_diagnostic):
Add const overload.
* engine.cc (exploded_node::dump_dot): Dump saved_diagnostics.
* exploded-graph.h (exploded_graph::get_diagnostic_manager): Add
const overload.

gcc/analyzer/ChangeLog
gcc/analyzer/diagnostic-manager.h
gcc/analyzer/engine.cc
gcc/analyzer/exploded-graph.h

index eda1052e4ff3d3c9eb324d2be1d5862cce99eb43..9f1e25d1e90d91a6f8580d333939a9a36ce5d9c4 100644 (file)
@@ -1,3 +1,11 @@
+2020-02-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * diagnostic-manager.h (diagnostic_manager::get_saved_diagnostic):
+       Add const overload.
+       * engine.cc (exploded_node::dump_dot): Dump saved_diagnostics.
+       * exploded-graph.h (exploded_graph::get_diagnostic_manager): Add
+       const overload.
+
 2020-02-11  David Malcolm  <dmalcolm@redhat.com>
 
        PR analyzer/93288
index 0c1d9766a10a78edbb69adb79586d6aff99afe0a..171d2792c00f30c3d4bf2509e80f92ccabb1a167 100644 (file)
@@ -95,6 +95,10 @@ public:
   {
     return m_saved_diagnostics[idx];
   }
+  const saved_diagnostic *get_saved_diagnostic (unsigned idx) const
+  {
+    return m_saved_diagnostics[idx];
+  }
 
 private:
   void build_emission_path (const exploded_graph &eg,
index 7860da0572a1b320ca3bf5e648057757b33494b4..17507c7c08ea23a200cb5219bcd411e08354458a 100644 (file)
@@ -854,6 +854,20 @@ exploded_node::dump_dot (graphviz_out *gv, const dump_args_t &args) const
       }
   }
 
+  /* Dump any saved_diagnostics at this enode.  */
+  {
+    const diagnostic_manager &dm = args.m_eg.get_diagnostic_manager ();
+    for (unsigned i = 0; i < dm.get_num_diagnostics (); i++)
+      {
+       const saved_diagnostic *sd = dm.get_saved_diagnostic (i);
+       if (sd->m_enode == this)
+         {
+           pp_printf (pp, "DIAGNOSTIC: %s", sd->m_d->get_kind ());
+           pp_newline (pp);
+         }
+      }
+  }
+
   pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
 
   pp_string (pp, "\"];\n\n");
index 5d69bffddddde3083cbae64d560eeb402b2a36bd..bb1f3ccff1ad9c535eea1c7366800ae2f8cdb6ff 100644 (file)
@@ -768,6 +768,10 @@ public:
   {
     return m_diagnostic_manager;
   }
+  const diagnostic_manager &get_diagnostic_manager () const
+  {
+    return m_diagnostic_manager;
+  }
 
   stats *get_global_stats () { return &m_global_stats; }
   stats *get_or_create_function_stats (function *fn);