diagnostics: introduce namespace diagnostics::paths

Move more diagnostic-specific code from gcc/ to gcc/diagnostics/

No functional change intended.

contrib/ChangeLog:
	* filter-clang-warnings.py: Update for move of
	diagnostic-path-output.cc to diagnostics/paths-output.cc.

gcc/ChangeLog:
	* Makefile.in (OBJS): Replace lazy-diagnostic-path.o with
	diagnostics/lazy-paths.o.
	(OBJS-libcommon): Replace diagnostic-path.o with
	diagnostics/paths.o, diagnostic-path-output.o with
	diagnostics/paths-output.o, and selftest-diagnostic-path.o with
	diagnostics/selftest-paths.o.
	(EXTRA_BACKEND_OBJS): Replace lazy-diagnostic-path.o with
	diagnostics/lazy-paths.o.
	* diagnostic-format-html.cc: Update #include for
	"diagnostic-path.h" moving to "diagnostics/paths.h",
	diagnostic_thread_id_t to diagnostics::paths::thread_id_t,
	diagnostic_event_id_t to diagnostics::paths::event_id_t,
	diagnostic_path to diagnostics::paths::path, and
	diagnostic_thread to diagnostics::paths::thread, and
	diagnostic_event to diagnostics::paths::event.
	* diagnostic-format-html.h: Likewise.
	* diagnostic-format-sarif.cc: Likewise.  Update PROPERTY_PREFIX
	for threadFlowLocations from "gcc/diagnostic_event/" to
	"gcc/diagnostics/paths/event/".
	* diagnostic-format-text.cc: Likewise.
	* diagnostic-format-text.h: Likewise.
	* diagnostic.cc: Likewise.
	* diagnostic.h: Likewise.
	* diagnostic-event-id.h: Move to...
	* diagnostics/event-id.h: ...here, updating header guard.
	(diagnostics:paths:event_id_t): New typedef.
	(diagnostic_thread_id_t): Replace with...
	(diagnostics:paths:thread_id_t): New typedef.
	* lazy-diagnostic-path.cc: Move to...
	* diagnostics/lazy-paths.cc: ...here.  Update for above changes,
	lazy_diagnostic_path becomes diagnostics::paths::lazy_path.
	(lazy_diagnostic_path_cc_tests): Rename to...
	(diagnostics_lazy_paths_cc_tests): ...this.
	* lazy-diagnostic-path.h: Move to...
	* diagnostics/lazy-paths.h: ...here, updating header guard.
	Update for above changes.
	* diagnostic-path-output.cc: Move to...
	* diagnostics/paths-output.cc: ...here.  Update for above changes.
	(diagnostic_path_output_cc_tests): Rename to...
	(diagnostics_paths_output_cc_tests): ...this.
	* diagnostic-path.cc: Move to...
	* diagnostics/paths.cc: ...here.  Update for above changes.
	* diagnostic-path.h: Move to...
	* diagnostics/paths.h: ...here, updating header guard.
	Update #include for moving "diagnostic-event-id.h" to
	"diagnostics/event-id.h".
	(class diagnostic_event): Convert to...
	(class diagnostics::paths::event): ...this.
	(class diagnostic_thread): Convert to...
	(class diagnostics::paths::thread): ...this.
	(class diagnostic_path): Convert to...
	(class diagnostics::paths::path): ...this.
	* diagnostic-show-locus.cc: Update for above changes.
	* doc/analyzer.texi: Likewise.
	* selftest-diagnostic-path.cc: Move to...
	* diagnostics/selftest-paths.cc: ...here.  Update for
	above changes, and for "selftest-diagnostic-path.h" moving to
	"diagnostics/selftest-paths.h".
	* selftest-diagnostic-path.h: Move to...
	* diagnostics/selftest-paths.h: ...here, updating header guard.
	Update for above changes.
	* libgdiagnostics.cc: Update for above changes.
	* libsarifreplay.cc: Update property prefix for
	threadFlowLocations from "gcc/diagnostic_event/" to
	"gcc/diagnostics/paths/event/".
	* pretty-print-format-impl.h: Update for above changes.
	* pretty-print.cc: Likewise.
	* selftest-run-tests.cc (selftest::run_tests): Update for
	renaming of lazy_diagnostic_path_cc_tests to
	diagnostics_lazy_paths_cc_tests, and of
	diagnostic_path_output_cc_tests to
	diagnostics_paths_output_cc_tests.
	* selftest.h (lazy_diagnostic_path_cc_tests): Replace decl with...
	(diagnostics_lazy_paths_cc_tests): ...this.
	(diagnostic_path_output_cc_tests): Replace decl with...
	(diagnostics_paths_output_cc_tests): ...this.
	* simple-diagnostic-path.cc: Clarify that this relates to "tree"
	and thus shouldn't be in "diagnostics".  Update for above changes.
	* simple-diagnostic-path.h: Likewise.

gcc/analyzer/ChangeLog:
	* access-diagram.cc: Update for changes to diagnostic paths:
	"diagnostic-path.h" moving to "diagnostics/paths.h",
	"diagnostic-event-id.h" moving to "diagnostics/event-id.h",
	diagnostic_event_id_t to diagnostics::paths::event_id_t,
	diagnostic_path to diagnostics::paths::path, and
	diagnostic_event to diagnostics::paths::event.
	* access-diagram.h: Likewise.
	* analyzer.cc: Likewise.
	* bounds-checking.cc: Likewise.
	* call-info.cc: Likewise.
	* checker-event.cc: Likewise.
	* checker-event.h: Likewise.
	* checker-path.cc: Likewise.
	* checker-path.h: Likewise.
	* common.h: Likewise.
	* diagnostic-manager.cc: Likewise.
	* pending-diagnostic.cc: Likewise.
	* pending-diagnostic.h: Likewise.
	* program-point.cc: Likewise.
	* program-state.cc: Likewise.
	* region-model.cc: Likewise.
	* sm-fd.cc: Likewise.
	* sm-file.cc: Likewise.
	* sm-malloc.cc: Likewise.
	* sm-pattern-test.cc: Likewise.
	* sm-sensitive.cc: Likewise.
	* sm-signal.cc: Likewise.
	* sm-taint.cc: Likewise.
	* varargs.cc: Likewise.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/analyzer_gil_plugin.cc: Update #include for
	"diagnostic-path.h" moving to "diagnostics/paths.h",
	diagnostic_thread_id_t to diagnostics::paths::thread_id_t,
	diagnostic_event_id_t to diagnostics::paths::event_id_t,
	diagnostic_path to diagnostics::paths::path, and
	diagnostic_thread to diagnostics::paths::thread, and
	diagnostic_event to diagnostics::paths::event.
	* gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise.
	* lib/sarif.py (get_state_graph): Update property prefix for
	threadFlowLocations from "gcc/diagnostic_event/" to
	"gcc/diagnostics/paths/event/".
	* gcc.dg/sarif-output/include-chain-2.h: Update comment.

libcpp/ChangeLog:
	* include/rich-location.h: Replace diagnostic_path with
	diagnostics::paths::path.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This commit is contained in:
David Malcolm
2025-07-25 15:13:36 -04:00
parent c9c996d3f0
commit 5b64ba693f
56 changed files with 573 additions and 514 deletions

View File

@@ -213,7 +213,7 @@ semi_embedded_vec<T, NUM_EMBEDDED>::truncate (int len)
}
class fixit_hint;
class diagnostic_path;
namespace diagnostics { namespace paths { class path; }}
/* A "rich" source code location, for use when printing diagnostics.
A rich_location has one or more carets&ranges, where the carets
@@ -520,8 +520,8 @@ class rich_location
}
/* An optional path through the code. */
const diagnostic_path *get_path () const { return m_path; }
void set_path (const diagnostic_path *path) { m_path = path; }
const diagnostics::paths::path *get_path () const { return m_path; }
void set_path (const diagnostics::paths::path *path) { m_path = path; }
/* A flag for hinting that the diagnostic involves character encoding
issues, and thus that it will be helpful to the user if we show some
@@ -567,7 +567,7 @@ protected:
static const int MAX_STATIC_FIXIT_HINTS = 2;
semi_embedded_vec <fixit_hint *, MAX_STATIC_FIXIT_HINTS> m_fixit_hints;
const diagnostic_path *m_path;
const diagnostics::paths::path *m_path;
};
/* Abstract base class for labelling a range within a rich_location