diagnostics: tweak to line-insertion fix-it hints with line-numbering
commit87c50f508acf5301d02fa38afa1709742a2b4d7d
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Aug 2018 22:28:19 +0000 (16 22:28 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Aug 2018 22:28:19 +0000 (16 22:28 +0000)
tree971a758dacf375f998eb1413885623dcb833a42b
parent66bbd82f205161a3576b83fc67f03eb84f53e152
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263605 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/diagnostic-show-locus.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c