* [committed] analyzer: add diagnostics to output of -fdump-analyzer-exploded-graph
@ 2020-02-17 7:24 David Malcolm
0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2020-02-17 7:24 UTC (permalink / raw)
To: gcc-patches; +Cc: David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to master as 670987874d2aa043a454e112291931e32f4ca8cc.
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/diagnostic-manager.h | 4 ++++
gcc/analyzer/engine.cc | 14 ++++++++++++++
gcc/analyzer/exploded-graph.h | 4 ++++
3 files changed, 22 insertions(+)
diff --git a/gcc/analyzer/diagnostic-manager.h b/gcc/analyzer/diagnostic-manager.h
index 0c1d9766a10..171d2792c00 100644
--- a/gcc/analyzer/diagnostic-manager.h
+++ b/gcc/analyzer/diagnostic-manager.h
@@ -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,
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index 7860da0572a..17507c7c08e 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -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");
diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h
index 5d69bffdddd..bb1f3ccff1a 100644
--- a/gcc/analyzer/exploded-graph.h
+++ b/gcc/analyzer/exploded-graph.h
@@ -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);
--
2.21.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-02-17 7:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 7:24 [committed] analyzer: add diagnostics to output of -fdump-analyzer-exploded-graph David Malcolm
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).