diagnostics: introduce diagnostics/source-printing.cc

Move diagnostic-show-locus.cc to diagnostics/source-printing.cc

Move diagnostic-label-effects.h to diagnostics/source-printing-effects.h

Move selftest-diagnostic-show-locus.h
  to diagnostics/selftest-source-printing.h

No functional change intended.

gcc/ChangeLog:
	* Makefile.in (OBJS): Replace diagnostic-show-locus.o with
	diagnostics/source-printing.o.
	* diagnostic.h (class diagnostic_source_effect_info): Replace
	with...
	(class diagnotics::source_effect_info): ...this.
	* diagnostics/paths-output.cc: Likewise.  Update for move of
	"diagnostic-label-effects.h" to
	"diagnostics/source-printing-effects.h".
	* diagnostics/sarif-sink.cc: Update for move of
	"selftest-diagnostic-show-locus.h" to
	"diagnostics/selftest-source-printing.h".
	* selftest-diagnostic-show-locus.h: Move to...
	* diagnostics/selftest-source-printing.h: ...here.
	* diagnostic-label-effects.h: Move to...
	* diagnostics/source-printing-effects.h: ...here, updating
	for above changes.
	* diagnostic-show-locus.cc: Move to...
	* diagnostics/source-printing.cc: ...here.
	* gcc-rich-location.h: Likewise.
	* selftest-run-tests.cc: Likewise.
	* selftest.h: Likewise.

gcc/testsuite/ChangeLog:
	* g++.dg/plugin/show-template-tree-color-labels.C: Update for
	moves to "source-printing".
	* gcc.dg/plugin/diagnostic-test-show-locus.py: Likewise.

libcpp/ChangeLog:
	* include/cpplib.h: Update for moves to "source-printing".
	* include/rich-location.h (class label_effects): Move to...
	(class diagnostics::label_effects): ...here.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This commit is contained in:
David Malcolm
2025-07-25 15:13:37 -04:00
parent 5ac3308484
commit e31ec9ee65
14 changed files with 55 additions and 46 deletions

View File

@@ -1610,7 +1610,8 @@ struct cpp_decoded_char
This is a tabstop value, along with a callback for getting the
widths of characters. Normally this callback is cpp_wcwidth, but we
support other schemes for escaping non-ASCII unicode as a series of
ASCII chars when printing the user's source code in diagnostic-show-locus.cc
ASCII chars when printing the user's source code in
gcc/diagnostics/source-printing.cc
For example, consider:
- the Unicode character U+03C0 "GREEK SMALL LETTER PI" (UTF-8: 0xCF 0x80)

View File

@@ -25,7 +25,7 @@ along with this program; see the file COPYING3. If not see
#include "label-text.h"
class range_label;
class label_effects;
namespace diagnostics { class label_effects; }
/* A hint to diagnostic_show_locus on how to print a source range within a
rich_location.
@@ -596,7 +596,8 @@ class range_label
virtual label_text get_text (unsigned range_idx) const = 0;
/* Get any special effects for the label (e.g. links to other labels). */
virtual const label_effects *get_effects (unsigned /*range_idx*/) const
virtual const diagnostics::label_effects *
get_effects (unsigned /*range_idx*/) const
{
return nullptr;
}