Add gcc_rich_location::add_fixit_insert_formatted
commit80213470b390069a01017a5f8756f3dcdbfeef24
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 1 May 2018 00:10:10 +0000 (1 00:10 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 1 May 2018 00:10:10 +0000 (1 00:10 +0000)
treeea1a9a931bb387718caee06b1c2785faf6296e9c
parent1f9995dc47e37635647afbcf433b89a809e101fb
Add gcc_rich_location::add_fixit_insert_formatted

This patch adds a support function to class gcc_rich_location
to make it easier for fix-it hints to use idiomatic C/C++
indentation, for use by the patch for PR c++/85523.

gcc/ChangeLog:
PR c++/85523
* gcc-rich-location.c (blank_line_before_p): New function.
(use_new_line): New function.
(gcc_rich_location::add_fixit_insert_formatted): New function.
* gcc-rich-location.h
(gcc_rich_location::add_fixit_insert_formatted): New function.

gcc/testsuite/ChangeLog:
PR c++/85523
* gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c
(test_add_fixit_insert_formatted_single_line): New function.
(test_add_fixit_insert_formatted_multiline): New function.
Extend expected output of generated patch to include fix-it hints
for these.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Include
"gcc-rich-location.h".  Add test coverage for
gcc_rich_location::add_fixit_insert_formatted.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259783 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/gcc-rich-location.c
gcc/gcc-rich-location.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c
gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c