From 6ffd47b70a4553b621a124ce2632cb2d39a8008f Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 7 Jun 2016 15:04:22 +0000 Subject: 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. From-SVN: r237176 --- gcc/objc/ChangeLog | 5 +++++ gcc/objc/objc-act.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'gcc/objc') diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 3b3f0f5..ddc670a 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-07 David Malcolm + + * objc-act.c (objc_build_component_ref): Update call + to build_component_ref for added param, passing UNKNOWN_LOCATION. + 2016-04-18 Michael Matz * objc-act.c (objc_build_struct): Use SET_DECL_ALIGN. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 4856457..44f01d2 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -2654,7 +2654,8 @@ objc_build_component_ref (tree datum, tree component) return finish_class_member_access_expr (datum, component, false, tf_warning_or_error); #else - return build_component_ref (input_location, datum, component); + return build_component_ref (input_location, datum, component, + UNKNOWN_LOCATION); #endif } -- cgit v1.1