fix-it hints can't contain newlines
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 15 Sep 2016 23:57:01 +0000 (23:57 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Thu, 15 Sep 2016 23:57:01 +0000 (23:57 +0000)
commit31316208638e76c2273a82864d32457a9cb9806d
tree802052306a708cf70c39ab01f29991c7f405d639
parent902d624f45c2be8ca865017539f0c224c913f146
fix-it hints can't contain newlines

I hope to implement newline support within fix-it hints at some point,
but currently it's not supported, and leads to misleading diagnostic
output, so for now, fail gracefully.

gcc/ChangeLog:
* diagnostic-show-locus.c
(selftest::test_fixit_insert_containing_newline): New function.
(selftest::test_fixit_replace_containing_newline): New function.
(selftest::diagnostic_show_locus_c_tests): Call the above.

libcpp/ChangeLog:
* include/line-map.h (class rich_location): Note that newlines
aren't supported in fix-it text.
* line-map.c (rich_location::add_fixit_insert_before): Reject
attempts to add fix-its containing newlines.
(rich_location::add_fixit_replace): Likewise.

From-SVN: r240169
gcc/ChangeLog
gcc/diagnostic-show-locus.c
libcpp/ChangeLog
libcpp/include/line-map.h
libcpp/line-map.c