Commit a1063153 by David Malcolm Committed by David Malcolm

diagnostics: support compact printing of secondary locations

gcc/ChangeLog:
	* diagnostic-show-locus.c: Include "gcc-rich-location.h".
	(layout::m_primary_loc): New field.
	(layout::layout): Initialize new field.  Move location filtering
	logic from here to...
	(layout::maybe_add_location_range): ...this new method.  Add
	support for filtering to just the lines already specified by other
	locations.
	(layout::will_show_line_p): New method.
	(selftest::test_add_location_if_nearby): New test function.
	(selftest::diagnostic_show_locus_c_tests): Call it.
	* gcc-rich-location.h (gcc_rich_location::add_location_if_nearby):
	New method.

From-SVN: r250133
parent d988b35c
2017-07-11 David Malcolm <dmalcolm@redhat.com>
* diagnostic-show-locus.c: Include "gcc-rich-location.h".
(layout::m_primary_loc): New field.
(layout::layout): Initialize new field. Move location filtering
logic from here to...
(layout::maybe_add_location_range): ...this new method. Add
support for filtering to just the lines already specified by other
locations.
(layout::will_show_line_p): New method.
(selftest::test_add_location_if_nearby): New test function.
(selftest::diagnostic_show_locus_c_tests): Call it.
* gcc-rich-location.h (gcc_rich_location::add_location_if_nearby):
New method.
2017-07-11 Tom de Vries <tom@codesourcery.com>
* config/nvptx/nvptx.c (WORKAROUND_PTXJIT_BUG): New macro.
......
......@@ -40,6 +40,27 @@ class gcc_rich_location : public rich_location
void add_fixit_misspelled_id (location_t misspelled_token_loc,
tree hint_id);
/* If LOC is within the spans of lines that will already be printed for
this gcc_rich_location, then add it as a secondary location
and return true.
Otherwise return false.
This allows for a diagnostic to compactly print secondary locations
in one diagnostic when these are near enough the primary locations for
diagnostics-show-locus.c to cope with them, and to fall back to
printing them via a note otherwise e.g.:
gcc_rich_location richloc (primary_loc);
bool added secondary = richloc.add_location_if_nearby (secondary_loc);
error_at_rich_loc (&richloc, "main message");
if (!added secondary)
inform (secondary_loc, "message for secondary");
Implemented in diagnostic-show-locus.c. */
bool add_location_if_nearby (location_t loc);
};
#endif /* GCC_RICH_LOCATION_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment