aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-06-14 23:08:34 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-06-14 23:08:34 +0000
commit264757fb054a1f3639eafddb72e87c57004c6aaa (patch)
tree7f70847fe1c3fb731deac7600fe4baa87c0b3c8f /gcc/c
parent4eb24e010993b2d9152c2038566f0114fd65fac7 (diff)
downloadgcc-264757fb054a1f3639eafddb72e87c57004c6aaa.zip
gcc-264757fb054a1f3639eafddb72e87c57004c6aaa.tar.gz
gcc-264757fb054a1f3639eafddb72e87c57004c6aaa.tar.bz2
Introduce gcc_rich_location::add_fixit_misspelled_id
gcc/c/ChangeLog: * c-typeck.c (build_component_ref): Simplify fixit code by using gcc_rich_location::add_fixit_misspelled_id. (set_init_label): Likewise. gcc/cp/ChangeLog: * typeck.c: Include "gcc-rich-location.h". (finish_class_member_access_expr): Simplify fixit code by using gcc_rich_location::add_fixit_misspelled_id. gcc/ChangeLog: * gcc-rich-location.c (gcc_rich_location::add_fixit_misspelled_id): New method. * gcc-rich-location.h (gcc_rich_location::add_fixit_misspelled_id): Add decl. From-SVN: r237463
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.c16
2 files changed, 10 insertions, 12 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 08fc250..85fe5e3 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-14 David Malcolm <dmalcolm@redhat.com>
+
+ * c-typeck.c (build_component_ref): Simplify fixit code by
+ using gcc_rich_location::add_fixit_misspelled_id.
+ (set_init_label): Likewise.
+
2016-06-13 David Malcolm <dmalcolm@redhat.com>
* c-parser.c (c_parser_initelt): Provide location of name for new
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index ea04d5e..f987508 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -2371,14 +2371,9 @@ build_component_ref (location_t loc, tree datum, tree component,
we have a valid range for the component. */
location_t reported_loc
= (component_loc != UNKNOWN_LOCATION) ? component_loc : loc;
- rich_location rich_loc (line_table, reported_loc);
+ gcc_rich_location rich_loc (reported_loc);
if (component_loc != UNKNOWN_LOCATION)
- {
- source_range component_range =
- get_range_from_loc (line_table, component_loc);
- rich_loc.add_fixit_replace (component_range,
- IDENTIFIER_POINTER (guessed_id));
- }
+ rich_loc.add_fixit_misspelled_id (component_loc, guessed_id);
error_at_rich_loc
(&rich_loc,
"%qT has no member named %qE; did you mean %qE?",
@@ -8234,11 +8229,8 @@ set_init_label (location_t loc, tree fieldname, location_t fieldname_loc,
tree guessed_id = lookup_field_fuzzy (constructor_type, fieldname);
if (guessed_id)
{
- rich_location rich_loc (line_table, fieldname_loc);
- source_range component_range =
- get_range_from_loc (line_table, fieldname_loc);
- rich_loc.add_fixit_replace (component_range,
- IDENTIFIER_POINTER (guessed_id));
+ gcc_rich_location rich_loc (fieldname_loc);
+ rich_loc.add_fixit_misspelled_id (fieldname_loc, guessed_id);
error_at_rich_loc
(&rich_loc,
"%qT has no member named %qE; did you mean %qE?",