Allow the use of ad-hoc locations for fix-it hints
commita02b4eaefbd72ca7bbe26b9c8aad90ee18f9c506
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Aug 2016 20:42:57 +0000 (29 20:42 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Aug 2016 20:42:57 +0000 (29 20:42 +0000)
tree6d574e6eb977268815029f2ec08618e51a518b9a
parent2db6ea891ce7ea8147948e48a9f45145bfcdeb5d
Allow the use of ad-hoc locations for fix-it hints

Currently the fix-it validator rejects ad-hoc locations.
Fix this by calling get_pure_location on the input locations to
add_fixit_insert/replace.  Doing so requires moving get_pure_location
from gcc to libcpp.

gcc/ChangeLog:
* diagnostic-show-locus.c
(selftest::test_one_liner_fixit_validation_adhoc_locations): New
function.
(selftest::test_diagnostic_show_locus_one_liner): Call it.
* input.c (get_pure_location): Move to libcpp/line-map.c.
* input.h (get_pure_location): Convert decl to an inline function
calling implementation in libcpp.

libcpp/ChangeLog:
* include/line-map.h (get_pure_location): New decl.
* line-map.c (get_pure_location): Move here, from gcc/input.c, adding
a line_maps * param.
(rich_location::add_fixit_insert): Call get_pure_location on "where".
(rich_location::add_fixit_replace): Call get_pure_location on the
end-points.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239843 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/diagnostic-show-locus.c
gcc/input.c
gcc/input.h
libcpp/ChangeLog
libcpp/include/line-map.h
libcpp/line-map.c