gcc/libcpp
David Malcolm 8625aa2466 diagnostics: cleanups to diagnostic-show-locus.cc
Reduce implicit usage of line_table global, and move source printing to
within diagnostic_context.

gcc/ChangeLog:
	* diagnostic-show-locus.cc (layout::m_line_table): New field.
	(compatible_locations_p): Convert to...
	(layout::compatible_locations_p): ...this, replacing uses of
	line_table global with m_line_table.
	(layout::layout): Convert "richloc" param from a pointer to a
	const reference.  Initialize m_line_table member.
	(layout::maybe_add_location_range):  Replace uses of line_table
	global with m_line_table.  Pass the latter to
	linemap_client_expand_location_to_spelling_point.
	(layout::print_leading_fixits): Pass m_line_table to
	affects_line_p.
	(layout::print_trailing_fixits): Likewise.
	(gcc_rich_location::add_location_if_nearby): Update for change
	to layout ctor params.
	(diagnostic_show_locus): Convert to...
	(diagnostic_context::maybe_show_locus): ...this, converting
	richloc param from a pointer to a const reference.  Make "loc"
	const.  Split out printing part of function to...
	(diagnostic_context::show_locus): ...this.
	(selftest::test_offset_impl): Update for change to layout ctor
	params.
	(selftest::test_layout_x_offset_display_utf8): Likewise.
	(selftest::test_layout_x_offset_display_tab): Likewise.
	(selftest::test_tab_expansion): Likewise.
	* diagnostic.h (diagnostic_context::maybe_show_locus): New decl.
	(diagnostic_context::show_locus): New decl.
	(diagnostic_show_locus): Convert from a decl to an inline function.
	* gdbinit.in (break-on-diagnostic): Update from a breakpoint
	on diagnostic_show_locus to one on
	diagnostic_context::maybe_show_locus.
	* genmatch.cc (linemap_client_expand_location_to_spelling_point):
	Add "set" param and use it in place of line_table global.
	* input.cc (expand_location_1): Likewise.
	(expand_location): Update for new param of expand_location_1.
	(expand_location_to_spelling_point): Likewise.
	(linemap_client_expand_location_to_spelling_point): Add "set"
	param and use it in place of line_table global.
	* tree-diagnostic-path.cc (event_range::print): Pass line_table
	for new param of linemap_client_expand_location_to_spelling_point.

libcpp/ChangeLog:
	* include/line-map.h (rich_location::get_expanded_location): Make
	const.
	(rich_location::get_line_table): New accessor.
	(rich_location::m_line_table): Make the pointer be const.
	(rich_location::m_have_expanded_location): Make mutable.
	(rich_location::m_expanded_location): Likewise.
	(fixit_hint::affects_line_p): Add const line_maps * param.
	(linemap_client_expand_location_to_spelling_point): Likewise.
	* line-map.cc (rich_location::get_expanded_location): Make const.
	Pass m_line_table to
	linemap_client_expand_location_to_spelling_point.
	(rich_location::maybe_add_fixit): Likewise.
	(fixit_hint::affects_line_p): Add set param and pass to
	linemap_client_expand_location_to_spelling_point.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-11-09 17:22:52 -05:00
..
include diagnostics: cleanups to diagnostic-show-locus.cc 2023-11-09 17:22:52 -05:00
po Daily bump. 2023-05-10 00:17:49 +00:00
aclocal.m4
ChangeLog Daily bump. 2023-11-08 00:17:35 +00:00
ChangeLog.jit
charset.cc c++: Implement C++26 P2361R6 - Unevaluated strings [PR110342] 2023-11-02 07:44:24 +01:00
combining-chars.inc diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
config.in build: re-configure 2 files 2022-11-21 09:03:35 +01:00
configure egrep in binutils 2023-08-07 22:59:40 +02:00
configure.ac configure: Implement --enable-host-pie 2023-06-15 16:51:27 -04:00
directives.cc c: Refer more consistently to C23 not C2X 2023-11-07 14:20:30 +00:00
errors.cc Update copyright years. 2023-01-16 11:52:17 +01:00
expr.cc c: Refer more consistently to C23 not C2X 2023-11-07 14:20:30 +00:00
files.cc libcpp: Fix ICE on #include after a line marker directive [PR61474] 2023-09-20 16:44:24 -04:00
generated_cpp_wcwidth.h libcpp: Update cpp_wcwidth() to Unicode 15 2023-03-13 07:40:50 -04:00
identifiers.cc libcpp: Improve the diagnostic for poisoned identifiers [PR36887] 2023-10-23 18:35:26 -04:00
init.cc c: Refer more consistently to C23 not C2X 2023-11-07 14:20:30 +00:00
internal.h libcpp: Improve the diagnostic for poisoned identifiers [PR36887] 2023-10-23 18:35:26 -04:00
lex.cc c: Refer more consistently to C23 not C2X 2023-11-07 14:20:30 +00:00
line-map.cc diagnostics: cleanups to diagnostic-show-locus.cc 2023-11-09 17:22:52 -05:00
location-example.txt
macro.cc c: Refer more consistently to C23 not C2X 2023-11-07 14:20:30 +00:00
Makefile.in Update copyright years. 2023-01-16 11:52:17 +01:00
makeucnid.cc libcpp: Update Unicode copyright years 2023-03-16 10:19:04 +01:00
makeuname2c.cc libcpp: Update Unicode copyright years 2023-03-16 10:19:04 +01:00
mkdeps.cc p1689r5: initial support 2023-09-19 17:32:23 -04:00
pch.cc libcpp: Improve location for macro names [PR66290] 2023-06-20 16:58:12 -04:00
printable-chars.inc diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
symtab.cc Update copyright years. 2023-01-16 11:52:17 +01:00
system.h Update copyright years. 2023-01-16 11:52:17 +01:00
traditional.cc Update copyright years. 2023-01-16 11:52:17 +01:00
ucnid.h libcpp: Update Unicode copyright years 2023-03-16 10:19:04 +01:00
ucnid.tab Update copyright years. 2023-01-16 11:52:17 +01:00
uname2c.h libcpp: Update Unicode copyright years 2023-03-16 10:19:04 +01:00