gcc/libcpp/include
David Malcolm c7a980b80b Prevent fix-it hints from affecting more than one line
Attempts to apply a removal or replacement fix-it hint to a source
range that covers multiple lines currently lead to nonsensical
results from the printing code in diagnostic-show-locus.c.

We were already filtering them out in edit-context.c (leading
to -fdiagnostics-generate-patch not generating any output for
the whole TU).

Reject attempts to add such fix-it hints within rich_location,
fixing the diagnostic-show-locus.c issue.

gcc/ChangeLog:
	* diagnostic-show-locus.c
	(selftest::test_fixit_deletion_affecting_newline): New function.
	(selftest::diagnostic_show_locus_c_tests): Call it.

libcpp/ChangeLog:
	* include/line-map.h (class rich_location): Document that attempts
	to delete or replace a range *affecting* multiple lines will fail.
	* line-map.c (rich_location::maybe_add_fixit): Implement this
	restriction.

From-SVN: r249403
2017-06-20 10:40:38 +00:00
..
cpp-id-data.h Update copyright years. 2017-01-01 13:07:43 +01:00
cpplib.h libcpp: add callback for comment-handling 2017-06-05 20:53:06 +00:00
line-map.h Prevent fix-it hints from affecting more than one line 2017-06-20 10:40:38 +00:00
mkdeps.h Update copyright years. 2017-01-01 13:07:43 +01:00
symtab.h Update copyright years. 2017-01-01 13:07:43 +01:00