[Bug c++/85523] Add fix-it hint for missing return statement in assignment operators

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 1 00:10:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85523

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Tue May  1 00:10:10 2018
New Revision: 259783

URL: https://gcc.gnu.org/viewcvs?rev=259783&root=gcc&view=rev
Log:
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.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gcc-rich-location.c
    trunk/gcc/gcc-rich-location.h
    trunk/gcc/testsuite/ChangeLog
   
trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c


More information about the Gcc-bugs mailing list