diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-09-13 16:08:59 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-09-13 16:08:59 +0000 |
commit | 254830bab29913361ddd47358d3d90b7d4a49f3d (patch) | |
tree | f49ba2c7c6f8a048ee6c7db0ecc48ec1bbe3d897 /libcpp/ChangeLog | |
parent | c77b8713a77e9b30420fc8c594b9c35c95580daa (diff) | |
download | gcc-254830bab29913361ddd47358d3d90b7d4a49f3d.zip gcc-254830bab29913361ddd47358d3d90b7d4a49f3d.tar.gz gcc-254830bab29913361ddd47358d3d90b7d4a49f3d.tar.bz2 |
fix-it hints: insert_before vs insert_after
The API for adding "insert text" fix-it hints was unclear
about exactly where the text should be inserted relative
to the given insertion point.
This patch clarifies things by renaming the pertinent methods from
richloc.add_fixit_insert
to
richloc.add_fixit_insert_before
and adding:
richloc.add_fixit_insert_after
The latter allows us to consolidate some failure-handling into
class rich_location, rather than having to have every such diagnostic
check for it.
The patch also adds a description of how fix-it hints work to the
comment for class rich_location within libcpp/include/line-map.h.
gcc/c-family/ChangeLog:
* c-common.c (warn_logical_not_parentheses): Replace
rich_location::add_fixit_insert calls with add_fixit_insert_before
and add_fixit_insert_after, eliminating the "next_loc" calculation.
gcc/c/ChangeLog:
* c-parser.c (c_parser_declaration_or_fndef): Update for renaming
of add_fixit_insert to add_fixit_insert_before.
gcc/cp/ChangeLog:
* parser.c (cp_parser_class_specifier_1): Update for renaming of
add_fixit_insert to add_fixit_insert_before.
(cp_parser_class_head): Likewise.
gcc/ChangeLog:
* diagnostic-show-locus.c (selftest::test_one_liner_fixit_insert):
Rename to...
(selftest::test_one_liner_fixit_insert_before): ...this, and update
for renaming of add_fixit_insert to add_fixit_insert_before.
(selftest::test_one_liner_fixit_insert_after): New function.
(selftest::test_one_liner_fixit_validation_adhoc_locations):
Update for renaming of add_fixit_insert to
add_fixit_insert_before.
(selftest::test_one_liner_many_fixits): Likewise.
(selftest::test_diagnostic_show_locus_one_liner): Update for
renaming, call new test function.
(selftest::test_diagnostic_show_locus_fixit_lines): Update for
renaming of add_fixit_insert to add_fixit_insert_before.
(selftest::test_fixit_consolidation): Likewise.
* diagnostic.c (selftest::test_print_parseable_fixits_insert):
Likewise.
* edit-context.c (selftest::test_applying_fixits_insert): Rename
to...
(selftest::test_applying_fixits_insert_before): ...this.
(selftest::test_applying_fixits_insert): Update for renaming of
add_fixit_insert to add_fixit_insert_before.
(selftest::test_applying_fixits_insert_after): New function.
(selftest::test_applying_fixits_insert_after_at_line_end): New
function.
(selftest::test_applying_fixits_insert_after_failure): New
function.
(selftest::test_applying_fixits_multiple): Update for renaming of
add_fixit_insert to add_fixit_insert_before.
(selftest::change_line): Likewise.
(selftest::test_applying_fixits_unreadable_file): Likewise.
(selftest::test_applying_fixits_line_out_of_range): Likewise.
(selftest::test_applying_fixits_column_validation): Likewise.
(selftest::test_applying_fixits_column_validation): Likewise.
(selftest::edit_context_c_tests): Update for renamed test
function; call new test functions.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
(test_show_locus): Replace rich_location::add_fixit_insert calls
with add_fixit_insert_before and add_fixit_insert_after.
libcpp/ChangeLog:
* include/line-map.h (class rich_location): Add description of
fix-it hints to leading comment.
(rich_location::add_fixit_insert): Rename both overloaded methods
to..
(rich_location::add_fixit_insert_before): ...this, updating their
comments.
(rich_location::add_fixit_insert_after): Two new overloaded
methods.
(rich_location::stop_supporting_fixits): New method.
* line-map.c (rich_location::add_fixit_insert): Rename both
overloaded methods to..
(rich_location::add_fixit_insert_before): ...this, updating their
comments.
(rich_location::add_fixit_insert_after): Two new methods.
(rich_location::reject_impossible_fixit): Split out
failure-handling into...
(rich_location::stop_supporting_fixits): New method.
From-SVN: r240115
Diffstat (limited to 'libcpp/ChangeLog')
-rw-r--r-- | libcpp/ChangeLog | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 792f76a..95e12a9 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,23 @@ +2016-09-13 David Malcolm <dmalcolm@redhat.com> + + * include/line-map.h (class rich_location): Add description of + fix-it hints to leading comment. + (rich_location::add_fixit_insert): Rename both overloaded methods + to.. + (rich_location::add_fixit_insert_before): ...this, updating their + comments. + (rich_location::add_fixit_insert_after): Two new overloaded + methods. + (rich_location::stop_supporting_fixits): New method. + * line-map.c (rich_location::add_fixit_insert): Rename both + overloaded methods to.. + (rich_location::add_fixit_insert_before): ...this, updating their + comments. + (rich_location::add_fixit_insert_after): Two new methods. + (rich_location::reject_impossible_fixit): Split out + failure-handling into... + (rich_location::stop_supporting_fixits): New method. + 2016-09-02 David Malcolm <dmalcolm@redhat.com> * include/line-map.h (rich_location::seen_impossible_fixit_p): New |