C: add fixit hint to misspelled field names
commit7cfde92a11da0c2b840404c20c8bf840c02d6682
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Jun 2016 15:04:22 +0000 (7 15:04 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Jun 2016 15:04:22 +0000 (7 15:04 +0000)
tree71a730994243919c88c4e269b3d48b4000eb9529
parentcab1ab5087c33e1823546f40e7d3c449d33d280e
C: add fixit hint to misspelled field names

gcc/c/ChangeLog:
* c-parser.c (c_parser_postfix_expression): In __builtin_offsetof
and structure element reference, capture the location of the
element name token and pass it to build_component_ref.
(c_parser_postfix_expression_after_primary): Likewise for
structure element dereference.
(c_parser_omp_variable_list): Likewise for
OMP_CLAUSE_{_CACHE, MAP, FROM, TO},
* c-tree.h (build_component_ref): Add location_t param.
* c-typeck.c (build_component_ref): Add location_t param
COMPONENT_LOC.  Use it, if available, when issuing hints about
mispelled member names to provide a fixit replacement hint.

gcc/objc/ChangeLog:
* objc-act.c (objc_build_component_ref): Update call
to build_component_ref for added param, passing UNKNOWN_LOCATION.

gcc/testsuite/ChangeLog:
* gcc.dg/spellcheck-fields-2.c: New test case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237176 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/c/c-tree.h
gcc/c/c-typeck.c
gcc/objc/ChangeLog
gcc/objc/objc-act.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/spellcheck-fields-2.c [new file with mode: 0644]