Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r16-3959-g423d7b24e7cff2.
gcc/ChangeLog:
* diagnostics/client-data-hooks.h (client_data_hooks::dump): New.
* diagnostics/context.cc (context::dump): Dump
m_client_data_hooks.
(client_data_hooks::dump): New.
* diagnostics/logical-locations.h
(logical_locations::manager::dump): New.
* diagnostics/selftest-logical-locations.cc: Include
"diagnostics/dumping.h".
(test_manager::dump): New.
* diagnostics/selftest-logical-locations.h (test_manager::dump):
New decl.
* libgdiagnostics.cc: Include "diagnostics/dumping.h".
(impl_logical_location_manager::dump): New.
* tree-logical-location.cc: Include "diagnostics/dumping.h".
(tree_logical_location_manager::dump): New.
* tree-logical-location.h (tree_logical_location_manager::dump):
New decl.
---
gcc/diagnostics/client-data-hooks.h | 3 +++
gcc/diagnostics/context.cc | 17 +++++++++++++++++
gcc/diagnostics/logical-locations.h | 3 +++
gcc/diagnostics/selftest-logical-locations.cc | 7 +++++++
gcc/diagnostics/selftest-logical-locations.h | 2 ++
gcc/libgdiagnostics.cc | 7 +++++++
gcc/tree-logical-location.cc | 8 ++++++++
gcc/tree-logical-location.h | 2 ++
8 files changed, 49 insertions(+)
diff --git a/gcc/diagnostics/client-data-hooks.h
b/gcc/diagnostics/client-data-hooks.h
index 94c51b28190a..2926e94de05f 100644
--- a/gcc/diagnostics/client-data-hooks.h
+++ b/gcc/diagnostics/client-data-hooks.h
@@ -36,6 +36,9 @@ class client_data_hooks
public:
virtual ~client_data_hooks () {}
+ void dump (FILE *out, int indent) const;
+ void DEBUG_FUNCTION dump () const { dump (stderr, 0); }
+
/* Get version info for this client, or NULL. */
virtual const client_version_info *get_any_version_info () const = 0;
diff --git a/gcc/diagnostics/context.cc b/gcc/diagnostics/context.cc
index 139c022a6027..cd14977d5425 100644
--- a/gcc/diagnostics/context.cc
+++ b/gcc/diagnostics/context.cc
@@ -455,6 +455,11 @@ context::dump (FILE *outfile, int indent) const
m_file_cache->dump (outfile, indent + 4);
else
dumping::emit_none (outfile, indent + 4);
+ dumping::emit_heading (outfile, indent + 2, "client data hooks");
+ if (m_client_data_hooks)
+ m_client_data_hooks->dump (outfile, indent + 4);
+ else
+ dumping::emit_none (outfile, indent + 4);
}
/* Return true if sufficiently severe diagnostics have been seen that
@@ -654,6 +659,18 @@ context::initialize_fixits_change_set ()
m_fixits_change_set = new changes::change_set (*m_file_cache);
}
+// class client_data_hooks
+
+void
+client_data_hooks::dump (FILE *outfile, int indent) const
+{
+ dumping::emit_heading (outfile, indent, "logical location manager");
+ if (auto mgr = get_logical_location_manager ())
+ mgr->dump (outfile, indent + 2);
+ else
+ dumping::emit_none (outfile, indent + 2);
+}
+
} // namespace diagnostics
/* Initialize DIAGNOSTIC, where the message MSG has already been
diff --git a/gcc/diagnostics/logical-locations.h
b/gcc/diagnostics/logical-locations.h
index b52a9b4f3b98..ba787bd3e3e1 100644
--- a/gcc/diagnostics/logical-locations.h
+++ b/gcc/diagnostics/logical-locations.h
@@ -148,6 +148,9 @@ class manager
public:
virtual ~manager () {}
+ virtual void dump (FILE *out, int indent) const = 0;
+ void DEBUG_FUNCTION dump () const { dump (stderr, 0); }
+
/* vfuncs for interpreting keys. */
/* Get a string (or NULL) for K suitable for use by the SARIF logicalLocation
diff --git a/gcc/diagnostics/selftest-logical-locations.cc
b/gcc/diagnostics/selftest-logical-locations.cc
index 8ba423389f20..f8d5b75f7478 100644
--- a/gcc/diagnostics/selftest-logical-locations.cc
+++ b/gcc/diagnostics/selftest-logical-locations.cc
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "selftest.h"
#include "diagnostics/selftest-logical-locations.h"
+#include "diagnostics/dumping.h"
#if CHECKING_P
@@ -38,6 +39,12 @@ test_manager::~test_manager ()
delete iter.second;
}
+void
+test_manager::dump (FILE *outfile, int indent) const
+{
+ dumping::emit_heading (outfile, indent, "test_manager");
+}
+
const char *
test_manager::get_short_name (key k) const
{
diff --git a/gcc/diagnostics/selftest-logical-locations.h
b/gcc/diagnostics/selftest-logical-locations.h
index c14a28282dab..e630382d38ef 100644
--- a/gcc/diagnostics/selftest-logical-locations.h
+++ b/gcc/diagnostics/selftest-logical-locations.h
@@ -39,6 +39,8 @@ class test_manager : public manager
public:
~test_manager ();
+ void dump (FILE *out, int indent) const final override;
+
const char *get_short_name (key) const final override;
const char *get_name_with_scope (key) const final override;
const char *get_internal_name (key) const final override;
diff --git a/gcc/libgdiagnostics.cc b/gcc/libgdiagnostics.cc
index d87dd46cb5c1..cceddff9d690 100644
--- a/gcc/libgdiagnostics.cc
+++ b/gcc/libgdiagnostics.cc
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostics/digraphs.h"
#include "diagnostics/state-graphs.h"
#include "diagnostics/logical-locations.h"
+#include "diagnostics/dumping.h"
#include "diagnostics/changes.h"
#include "libgdiagnostics.h"
#include "libgdiagnostics-private.h"
@@ -478,6 +479,12 @@ public:
return key::from_ptr (ptr);
}
+ void dump (FILE *outfile, int indent) const final override
+ {
+ diagnostics::dumping::emit_heading
+ (outfile, indent, "impl_logical_location_manager");
+ }
+
const char *get_short_name (key k) const final override
{
if (auto loc = ptr_from_key (k))
diff --git a/gcc/tree-logical-location.cc b/gcc/tree-logical-location.cc
index 19bccd1a7060..b39327feca5e 100644
--- a/gcc/tree-logical-location.cc
+++ b/gcc/tree-logical-location.cc
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-logical-location.h"
#include "langhooks.h"
#include "intl.h"
+#include "diagnostics/dumping.h"
using namespace diagnostics::logical_locations;
@@ -40,6 +41,13 @@ assert_valid_tree (const_tree node)
/* class tree_logical_location_manager
: public diagnostics::logical_locations::manager. */
+void
+tree_logical_location_manager::dump (FILE *outfile, int indent) const
+{
+ diagnostics::dumping::emit_heading (outfile, indent,
+ "tree_logical_location_manager");
+}
+
const char *
tree_logical_location_manager::get_short_name (key k) const
{
diff --git a/gcc/tree-logical-location.h b/gcc/tree-logical-location.h
index 2a7de37ade78..b7e0da8d6ff1 100644
--- a/gcc/tree-logical-location.h
+++ b/gcc/tree-logical-location.h
@@ -34,6 +34,8 @@ public:
using key = diagnostics::logical_locations::key;
using kind = diagnostics::logical_locations::kind;
+ void dump (FILE *out, int indent) const final override;
+
const char *get_short_name (key) const final override;
const char *get_name_with_scope (key) const final override;
const char *get_internal_name (key) const final override;
--
2.26.3