diagnostics: tweak to line-insertion fix-it hints with line-numbering
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 16 Aug 2018 22:28:19 +0000 (22:28 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Thu, 16 Aug 2018 22:28:19 +0000 (22:28 +0000)
commit5218dafdc219eb49a0b8d776b99fd7a7afb5be0b
tree971a758dacf375f998eb1413885623dcb833a42b
parent4416420e14b7505355c2318a6bd09ae073551d36
diagnostics: tweak to line-insertion fix-it hints with line-numbering

This commit slightly tweaks line-insertion fix-it hints, so that
with line-numbering, rather than e.g.:

 99 |       x = a;
    |+      break;
110 |     case 'b':
    |     ^~~~~~~~

we fill the margin with "+":

 99 |       x = a;
+++ |+      break;
110 |     case 'b':
    |     ^~~~~~~~

to emphasize that this is a suggested new line, rather than the user's
source.

gcc/ChangeLog:
* diagnostic-show-locus.c (layout::start_annotation_line): Add
"margin_char" parameter, defaulting to space.  Use it in place
of pp_space for the initial part of the margin.
(layout::print_leading_fixits): Use '+' when filling the margin
of line-insertion fix-it hints.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
(test_fixit_insert_newline): Update expected output to show '+'
characters in margin of line-insertion fix-it hint.

From-SVN: r263605
gcc/ChangeLog
gcc/diagnostic-show-locus.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c