aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-06-18 10:59:54 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2024-06-18 10:59:54 -0400
commitf89f9c7ae7190c700d1b3727a3fd66e90cfb90ac (patch)
tree525700c09b5f314c45b32832dfc795656a2fca9c /gcc
parente4f938936867d8799775d1455e67bd3fb8711afd (diff)
downloadgcc-f89f9c7ae7190c700d1b3727a3fd66e90cfb90ac.zip
gcc-f89f9c7ae7190c700d1b3727a3fd66e90cfb90ac.tar.gz
gcc-f89f9c7ae7190c700d1b3727a3fd66e90cfb90ac.tar.bz2
diagnostics: move simple_diagnostic_{path,thread,event} to their own .h/cc
As work towards eliminating the dependency on "tree" from path-printing, move these classes to a new simple-diagnostic-path.h/cc. No functional change intended. gcc/analyzer/ChangeLog: * checker-path.h: Include "simple-diagnostic-path.h". gcc/ChangeLog: * Makefile.in (OBJS): Add simple-diagnostic-path.o. * diagnostic-path.h (class simple_diagnostic_event): Move to simple-diagnostic-path.h. (class simple_diagnostic_thread): Likewise. (class simple_diagnostic_path): Likewise. * diagnostic.cc (simple_diagnostic_path::simple_diagnostic_path): Move to simple-diagnostic-path.cc. (simple_diagnostic_path::num_events): Likewise. (simple_diagnostic_path::get_event): Likewise. (simple_diagnostic_path::num_threads): Likewise. (simple_diagnostic_path::get_thread): Likewise. (simple_diagnostic_path::add_thread): Likewise. (simple_diagnostic_path::add_event): Likewise. (simple_diagnostic_path::add_thread_event): Likewise. (simple_diagnostic_path::connect_to_next_event): Likewise. (simple_diagnostic_event::simple_diagnostic_event): Likewise. (simple_diagnostic_event::~simple_diagnostic_event): Likewise. * selftest-run-tests.cc (selftest::run_tests): Call selftest::simple_diagnostic_path_cc_tests. * selftest.h (selftest::simple_diagnostic_path_cc_tests): New decl. * simple-diagnostic-path.cc: New file, from the above material. * simple-diagnostic-path.h: New file, from the above material from diagnostic-path.h. * tree-diagnostic-path.cc: Include "simple-diagnostic-path.h". gcc/testsuite/ChangeLog * gcc.dg/plugin/diagnostic_plugin_test_paths.c: Include "simple-diagnostic-path.h". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/Makefile.in1
-rw-r--r--gcc/analyzer/checker-path.h1
-rw-r--r--gcc/diagnostic-path.h104
-rw-r--r--gcc/diagnostic.cc149
-rw-r--r--gcc/selftest-run-tests.cc1
-rw-r--r--gcc/selftest.h1
-rw-r--r--gcc/simple-diagnostic-path.cc228
-rw-r--r--gcc/simple-diagnostic-path.h130
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c1
-rw-r--r--gcc/tree-diagnostic-path.cc1
10 files changed, 366 insertions, 251 deletions
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f5adb64..35f259d 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1700,6 +1700,7 @@ OBJS = \
ubsan.o \
sanopt.o \
sancov.o \
+ simple-diagnostic-path.o \
tree-call-cdce.o \
tree-cfg.o \
tree-cfgcleanup.o \
diff --git a/gcc/analyzer/checker-path.h b/gcc/analyzer/checker-path.h
index 6b3e8a3..162ebb3 100644
--- a/gcc/analyzer/checker-path.h
+++ b/gcc/analyzer/checker-path.h
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#define GCC_ANALYZER_CHECKER_PATH_H
#include "analyzer/checker-event.h"
+#include "simple-diagnostic-path.h"
namespace ana {
diff --git a/gcc/diagnostic-path.h b/gcc/diagnostic-path.h
index 938bd58..958eb72 100644
--- a/gcc/diagnostic-path.h
+++ b/gcc/diagnostic-path.h
@@ -201,108 +201,8 @@ private:
bool get_first_event_in_a_function (unsigned *out_idx) const;
};
-/* Concrete subclasses. */
-
-/* A simple implementation of diagnostic_event. */
-
-class simple_diagnostic_event : public diagnostic_event
-{
- public:
- simple_diagnostic_event (location_t loc, tree fndecl, int depth,
- const char *desc,
- diagnostic_thread_id_t thread_id = 0);
- ~simple_diagnostic_event ();
-
- location_t get_location () const final override { return m_loc; }
- tree get_fndecl () const final override { return m_fndecl; }
- int get_stack_depth () const final override { return m_depth; }
- label_text get_desc (bool) const final override
- {
- return label_text::borrow (m_desc);
- }
- const logical_location *get_logical_location () const final override
- {
- return NULL;
- }
- meaning get_meaning () const final override
- {
- return meaning ();
- }
- bool connect_to_next_event_p () const final override
- {
- return m_connected_to_next_event;
- }
- diagnostic_thread_id_t get_thread_id () const final override
- {
- return m_thread_id;
- }
-
- void connect_to_next_event ()
- {
- m_connected_to_next_event = true;
- }
-
- private:
- location_t m_loc;
- tree m_fndecl;
- int m_depth;
- char *m_desc; // has been i18n-ed and formatted
- bool m_connected_to_next_event;
- diagnostic_thread_id_t m_thread_id;
-};
-
-/* A simple implementation of diagnostic_thread. */
-
-class simple_diagnostic_thread : public diagnostic_thread
-{
-public:
- simple_diagnostic_thread (const char *name) : m_name (name) {}
- label_text get_name (bool) const final override
- {
- return label_text::borrow (m_name);
- }
-
-private:
- const char *m_name; // has been i18n-ed and formatted
-};
-
-/* A simple implementation of diagnostic_path, as a vector of
- simple_diagnostic_event instances. */
-
-class simple_diagnostic_path : public diagnostic_path
-{
- public:
- simple_diagnostic_path (pretty_printer *event_pp);
-
- unsigned num_events () const final override;
- const diagnostic_event & get_event (int idx) const final override;
- unsigned num_threads () const final override;
- const diagnostic_thread &
- get_thread (diagnostic_thread_id_t) const final override;
-
- diagnostic_thread_id_t add_thread (const char *name);
-
- diagnostic_event_id_t add_event (location_t loc, tree fndecl, int depth,
- const char *fmt, ...)
- ATTRIBUTE_GCC_DIAG(5,6);
- diagnostic_event_id_t
- add_thread_event (diagnostic_thread_id_t thread_id,
- location_t loc, tree fndecl, int depth,
- const char *fmt, ...)
- ATTRIBUTE_GCC_DIAG(6,7);
-
- void connect_to_next_event ();
-
- void disable_event_localization () { m_localize_events = false; }
-
- private:
- auto_delete_vec<simple_diagnostic_thread> m_threads;
- auto_delete_vec<simple_diagnostic_event> m_events;
-
- /* (for use by add_event). */
- pretty_printer *m_event_pp;
- bool m_localize_events;
-};
+/* Concrete subclasses of the above can be found in
+ simple-diagnostic-path.h. */
extern void debug (diagnostic_path *path);
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 9d0cb8e..a7acde5 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -2517,155 +2517,6 @@ set_text_art_charset (enum diagnostic_text_art_charset charset)
}
}
-/* class simple_diagnostic_path : public diagnostic_path. */
-
-simple_diagnostic_path::simple_diagnostic_path (pretty_printer *event_pp)
-: m_event_pp (event_pp),
- m_localize_events (true)
-{
- add_thread ("main");
-}
-
-/* Implementation of diagnostic_path::num_events vfunc for
- simple_diagnostic_path: simply get the number of events in the vec. */
-
-unsigned
-simple_diagnostic_path::num_events () const
-{
- return m_events.length ();
-}
-
-/* Implementation of diagnostic_path::get_event vfunc for
- simple_diagnostic_path: simply return the event in the vec. */
-
-const diagnostic_event &
-simple_diagnostic_path::get_event (int idx) const
-{
- return *m_events[idx];
-}
-
-unsigned
-simple_diagnostic_path::num_threads () const
-{
- return m_threads.length ();
-}
-
-const diagnostic_thread &
-simple_diagnostic_path::get_thread (diagnostic_thread_id_t idx) const
-{
- return *m_threads[idx];
-}
-
-diagnostic_thread_id_t
-simple_diagnostic_path::add_thread (const char *name)
-{
- m_threads.safe_push (new simple_diagnostic_thread (name));
- return m_threads.length () - 1;
-}
-
-/* Add an event to this path at LOC within function FNDECL at
- stack depth DEPTH.
-
- Use m_context's printer to format FMT, as the text of the new
- event. Localize FMT iff m_localize_events is set.
-
- Return the id of the new event. */
-
-diagnostic_event_id_t
-simple_diagnostic_path::add_event (location_t loc, tree fndecl, int depth,
- const char *fmt, ...)
-{
- pretty_printer *pp = m_event_pp;
- pp_clear_output_area (pp);
-
- rich_location rich_loc (line_table, UNKNOWN_LOCATION);
-
- va_list ap;
-
- va_start (ap, fmt);
-
- text_info ti (m_localize_events ? _(fmt) : fmt,
- &ap, 0, nullptr, &rich_loc);
- pp_format (pp, &ti);
- pp_output_formatted_text (pp);
-
- va_end (ap);
-
- simple_diagnostic_event *new_event
- = new simple_diagnostic_event (loc, fndecl, depth, pp_formatted_text (pp));
- m_events.safe_push (new_event);
-
- pp_clear_output_area (pp);
-
- return diagnostic_event_id_t (m_events.length () - 1);
-}
-
-diagnostic_event_id_t
-simple_diagnostic_path::add_thread_event (diagnostic_thread_id_t thread_id,
- location_t loc,
- tree fndecl,
- int depth,
- const char *fmt, ...)
-{
- pretty_printer *pp = m_event_pp;
- pp_clear_output_area (pp);
-
- rich_location rich_loc (line_table, UNKNOWN_LOCATION);
-
- va_list ap;
-
- va_start (ap, fmt);
-
- text_info ti (_(fmt), &ap, 0, nullptr, &rich_loc);
-
- pp_format (pp, &ti);
- pp_output_formatted_text (pp);
-
- va_end (ap);
-
- simple_diagnostic_event *new_event
- = new simple_diagnostic_event (loc, fndecl, depth, pp_formatted_text (pp),
- thread_id);
- m_events.safe_push (new_event);
-
- pp_clear_output_area (pp);
-
- return diagnostic_event_id_t (m_events.length () - 1);
-}
-
-/* Mark the most recent event on this path (which must exist) as being
- connected to the next one to be added. */
-
-void
-simple_diagnostic_path::connect_to_next_event ()
-{
- gcc_assert (m_events.length () > 0);
- m_events[m_events.length () - 1]->connect_to_next_event ();
-}
-
-/* struct simple_diagnostic_event. */
-
-/* simple_diagnostic_event's ctor. */
-
-simple_diagnostic_event::
-simple_diagnostic_event (location_t loc,
- tree fndecl,
- int depth,
- const char *desc,
- diagnostic_thread_id_t thread_id)
-: m_loc (loc), m_fndecl (fndecl), m_depth (depth), m_desc (xstrdup (desc)),
- m_connected_to_next_event (false),
- m_thread_id (thread_id)
-{
-}
-
-/* simple_diagnostic_event's dtor. */
-
-simple_diagnostic_event::~simple_diagnostic_event ()
-{
- free (m_desc);
-}
-
/* Print PATH by emitting a dummy "note" associated with it. */
DEBUG_FUNCTION
diff --git a/gcc/selftest-run-tests.cc b/gcc/selftest-run-tests.cc
index d8f5e4b..3275db3 100644
--- a/gcc/selftest-run-tests.cc
+++ b/gcc/selftest-run-tests.cc
@@ -103,6 +103,7 @@ selftest::run_tests ()
spellcheck_tree_cc_tests ();
tree_cfg_cc_tests ();
tree_diagnostic_path_cc_tests ();
+ simple_diagnostic_path_cc_tests ();
attribs_cc_tests ();
/* This one relies on most of the above. */
diff --git a/gcc/selftest.h b/gcc/selftest.h
index 9e294ad..2d1aa91 100644
--- a/gcc/selftest.h
+++ b/gcc/selftest.h
@@ -250,6 +250,7 @@ extern void read_rtl_function_cc_tests ();
extern void rtl_tests_cc_tests ();
extern void sbitmap_cc_tests ();
extern void selftest_cc_tests ();
+extern void simple_diagnostic_path_cc_tests ();
extern void simplify_rtx_cc_tests ();
extern void spellcheck_cc_tests ();
extern void spellcheck_tree_cc_tests ();
diff --git a/gcc/simple-diagnostic-path.cc b/gcc/simple-diagnostic-path.cc
new file mode 100644
index 0000000..3ec0e85
--- /dev/null
+++ b/gcc/simple-diagnostic-path.cc
@@ -0,0 +1,228 @@
+/* Concrete classes for implementing diagnostic paths.
+ Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Contributed by David Malcolm <dmalcolm@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+
+#include "config.h"
+#define INCLUDE_MEMORY
+#define INCLUDE_VECTOR
+#include "system.h"
+#include "coretypes.h"
+#include "tree.h"
+#include "version.h"
+#include "demangle.h"
+#include "intl.h"
+#include "backtrace.h"
+#include "diagnostic.h"
+#include "simple-diagnostic-path.h"
+#include "selftest.h"
+
+/* class simple_diagnostic_path : public diagnostic_path. */
+
+simple_diagnostic_path::simple_diagnostic_path (pretty_printer *event_pp)
+: m_event_pp (event_pp),
+ m_localize_events (true)
+{
+ add_thread ("main");
+}
+
+/* Implementation of diagnostic_path::num_events vfunc for
+ simple_diagnostic_path: simply get the number of events in the vec. */
+
+unsigned
+simple_diagnostic_path::num_events () const
+{
+ return m_events.length ();
+}
+
+/* Implementation of diagnostic_path::get_event vfunc for
+ simple_diagnostic_path: simply return the event in the vec. */
+
+const diagnostic_event &
+simple_diagnostic_path::get_event (int idx) const
+{
+ return *m_events[idx];
+}
+
+unsigned
+simple_diagnostic_path::num_threads () const
+{
+ return m_threads.length ();
+}
+
+const diagnostic_thread &
+simple_diagnostic_path::get_thread (diagnostic_thread_id_t idx) const
+{
+ return *m_threads[idx];
+}
+
+diagnostic_thread_id_t
+simple_diagnostic_path::add_thread (const char *name)
+{
+ m_threads.safe_push (new simple_diagnostic_thread (name));
+ return m_threads.length () - 1;
+}
+
+/* Add an event to this path at LOC within function FNDECL at
+ stack depth DEPTH.
+
+ Use m_context's printer to format FMT, as the text of the new
+ event. Localize FMT iff m_localize_events is set.
+
+ Return the id of the new event. */
+
+diagnostic_event_id_t
+simple_diagnostic_path::add_event (location_t loc, tree fndecl, int depth,
+ const char *fmt, ...)
+{
+ pretty_printer *pp = m_event_pp;
+ pp_clear_output_area (pp);
+
+ rich_location rich_loc (line_table, UNKNOWN_LOCATION);
+
+ va_list ap;
+
+ va_start (ap, fmt);
+
+ text_info ti (m_localize_events ? _(fmt) : fmt,
+ &ap, 0, nullptr, &rich_loc);
+ pp_format (pp, &ti);
+ pp_output_formatted_text (pp);
+
+ va_end (ap);
+
+ simple_diagnostic_event *new_event
+ = new simple_diagnostic_event (loc, fndecl, depth, pp_formatted_text (pp));
+ m_events.safe_push (new_event);
+
+ pp_clear_output_area (pp);
+
+ return diagnostic_event_id_t (m_events.length () - 1);
+}
+
+diagnostic_event_id_t
+simple_diagnostic_path::add_thread_event (diagnostic_thread_id_t thread_id,
+ location_t loc,
+ tree fndecl,
+ int depth,
+ const char *fmt, ...)
+{
+ pretty_printer *pp = m_event_pp;
+ pp_clear_output_area (pp);
+
+ rich_location rich_loc (line_table, UNKNOWN_LOCATION);
+
+ va_list ap;
+
+ va_start (ap, fmt);
+
+ text_info ti (_(fmt), &ap, 0, nullptr, &rich_loc);
+
+ pp_format (pp, &ti);
+ pp_output_formatted_text (pp);
+
+ va_end (ap);
+
+ simple_diagnostic_event *new_event
+ = new simple_diagnostic_event (loc, fndecl, depth, pp_formatted_text (pp),
+ thread_id);
+ m_events.safe_push (new_event);
+
+ pp_clear_output_area (pp);
+
+ return diagnostic_event_id_t (m_events.length () - 1);
+}
+
+/* Mark the most recent event on this path (which must exist) as being
+ connected to the next one to be added. */
+
+void
+simple_diagnostic_path::connect_to_next_event ()
+{
+ gcc_assert (m_events.length () > 0);
+ m_events[m_events.length () - 1]->connect_to_next_event ();
+}
+
+/* struct simple_diagnostic_event. */
+
+/* simple_diagnostic_event's ctor. */
+
+simple_diagnostic_event::
+simple_diagnostic_event (location_t loc,
+ tree fndecl,
+ int depth,
+ const char *desc,
+ diagnostic_thread_id_t thread_id)
+: m_loc (loc), m_fndecl (fndecl), m_depth (depth), m_desc (xstrdup (desc)),
+ m_connected_to_next_event (false),
+ m_thread_id (thread_id)
+{
+}
+
+/* simple_diagnostic_event's dtor. */
+
+simple_diagnostic_event::~simple_diagnostic_event ()
+{
+ free (m_desc);
+}
+
+#if CHECKING_P
+
+namespace selftest {
+
+static void
+test_intraprocedural_path (pretty_printer *event_pp)
+{
+ tree fntype_void_void
+ = build_function_type_array (void_type_node, 0, NULL);
+ tree fndecl_foo = build_fn_decl ("foo", fntype_void_void);
+
+ simple_diagnostic_path path (event_pp);
+ path.add_event (UNKNOWN_LOCATION, fndecl_foo, 0, "first %qs", "free");
+ path.add_event (UNKNOWN_LOCATION, fndecl_foo, 0, "double %qs", "free");
+
+ ASSERT_EQ (path.num_events (), 2);
+ ASSERT_EQ (path.num_threads (), 1);
+ ASSERT_FALSE (path.interprocedural_p ());
+ ASSERT_STREQ (path.get_event (0).get_desc (false).get (), "first `free'");
+ ASSERT_STREQ (path.get_event (1).get_desc (false).get (), "double `free'");
+}
+
+/* Run all of the selftests within this file. */
+
+void
+simple_diagnostic_path_cc_tests ()
+{
+ /* In a few places we use the global dc's printer to determine
+ colorization so ensure this off during the tests. */
+ const bool saved_show_color = pp_show_color (global_dc->printer);
+ pp_show_color (global_dc->printer) = false;
+
+ auto_fix_quotes fix_quotes;
+ std::unique_ptr<pretty_printer> event_pp
+ = std::unique_ptr<pretty_printer> (global_dc->printer->clone ());
+
+ test_intraprocedural_path (event_pp.get ());
+
+ pp_show_color (global_dc->printer) = saved_show_color;
+}
+
+} // namespace selftest
+
+#endif /* #if CHECKING_P */
diff --git a/gcc/simple-diagnostic-path.h b/gcc/simple-diagnostic-path.h
new file mode 100644
index 0000000..5fbed15
--- /dev/null
+++ b/gcc/simple-diagnostic-path.h
@@ -0,0 +1,130 @@
+/* Concrete classes for implementing diagnostic paths.
+ Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Contributed by David Malcolm <dmalcolm@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_SIMPLE_DIAGNOSTIC_PATH_H
+#define GCC_SIMPLE_DIAGNOSTIC_PATH_H
+
+#include "diagnostic-path.h"
+
+/* Concrete subclasses of the abstract base classes
+ declared in diagnostic-path.h. */
+
+/* A simple implementation of diagnostic_event. */
+
+class simple_diagnostic_event : public diagnostic_event
+{
+ public:
+ simple_diagnostic_event (location_t loc, tree fndecl, int depth,
+ const char *desc,
+ diagnostic_thread_id_t thread_id = 0);
+ ~simple_diagnostic_event ();
+
+ location_t get_location () const final override { return m_loc; }
+ tree get_fndecl () const final override { return m_fndecl; }
+ int get_stack_depth () const final override { return m_depth; }
+ label_text get_desc (bool) const final override
+ {
+ return label_text::borrow (m_desc);
+ }
+ const logical_location *get_logical_location () const final override
+ {
+ return NULL;
+ }
+ meaning get_meaning () const final override
+ {
+ return meaning ();
+ }
+ bool connect_to_next_event_p () const final override
+ {
+ return m_connected_to_next_event;
+ }
+ diagnostic_thread_id_t get_thread_id () const final override
+ {
+ return m_thread_id;
+ }
+
+ void connect_to_next_event ()
+ {
+ m_connected_to_next_event = true;
+ }
+
+ private:
+ location_t m_loc;
+ tree m_fndecl;
+ int m_depth;
+ char *m_desc; // has been i18n-ed and formatted
+ bool m_connected_to_next_event;
+ diagnostic_thread_id_t m_thread_id;
+};
+
+/* A simple implementation of diagnostic_thread. */
+
+class simple_diagnostic_thread : public diagnostic_thread
+{
+public:
+ simple_diagnostic_thread (const char *name) : m_name (name) {}
+ label_text get_name (bool) const final override
+ {
+ return label_text::borrow (m_name);
+ }
+
+private:
+ const char *m_name; // has been i18n-ed and formatted
+};
+
+/* A simple implementation of diagnostic_path, as a vector of
+ simple_diagnostic_event instances. */
+
+class simple_diagnostic_path : public diagnostic_path
+{
+ public:
+ simple_diagnostic_path (pretty_printer *event_pp);
+
+ unsigned num_events () const final override;
+ const diagnostic_event & get_event (int idx) const final override;
+ unsigned num_threads () const final override;
+ const diagnostic_thread &
+ get_thread (diagnostic_thread_id_t) const final override;
+
+ diagnostic_thread_id_t add_thread (const char *name);
+
+ diagnostic_event_id_t add_event (location_t loc, tree fndecl, int depth,
+ const char *fmt, ...)
+ ATTRIBUTE_GCC_DIAG(5,6);
+ diagnostic_event_id_t
+ add_thread_event (diagnostic_thread_id_t thread_id,
+ location_t loc, tree fndecl, int depth,
+ const char *fmt, ...)
+ ATTRIBUTE_GCC_DIAG(6,7);
+
+ void connect_to_next_event ();
+
+ void disable_event_localization () { m_localize_events = false; }
+
+ private:
+ auto_delete_vec<simple_diagnostic_thread> m_threads;
+ auto_delete_vec<simple_diagnostic_event> m_events;
+
+ /* (for use by add_event). */
+ pretty_printer *m_event_pp;
+ bool m_localize_events;
+};
+
+#endif /* ! GCC_SIMPLE_DIAGNOSTIC_PATH_H */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c
index bf66500..efa4ec4 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_paths.c
@@ -38,6 +38,7 @@
#include "print-tree.h"
#include "gcc-rich-location.h"
#include "cgraph.h"
+#include "simple-diagnostic-path.h"
int plugin_is_GPL_compatible;
diff --git a/gcc/tree-diagnostic-path.cc b/gcc/tree-diagnostic-path.cc
index f82ef30..a9dd40c 100644
--- a/gcc/tree-diagnostic-path.cc
+++ b/gcc/tree-diagnostic-path.cc
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "intl.h"
#include "diagnostic-path.h"
+#include "simple-diagnostic-path.h"
#include "json.h"
#include "gcc-rich-location.h"
#include "diagnostic-color.h"