aboutsummaryrefslogtreecommitdiff
path: root/gcc/input.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-08-29 20:42:57 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-08-29 20:42:57 +0000
commit2aa514130a99ffeaff6ae3cdddf609be358022be (patch)
tree6d574e6eb977268815029f2ec08618e51a518b9a /gcc/input.c
parentadfa1e6b37f5b18570a6200a0784bd8074c5f1e0 (diff)
downloadgcc-2aa514130a99ffeaff6ae3cdddf609be358022be.zip
gcc-2aa514130a99ffeaff6ae3cdddf609be358022be.tar.gz
gcc-2aa514130a99ffeaff6ae3cdddf609be358022be.tar.bz2
Allow the use of ad-hoc locations for fix-it hints
Currently the fix-it validator rejects ad-hoc locations. Fix this by calling get_pure_location on the input locations to add_fixit_insert/replace. Doing so requires moving get_pure_location from gcc to libcpp. gcc/ChangeLog: * diagnostic-show-locus.c (selftest::test_one_liner_fixit_validation_adhoc_locations): New function. (selftest::test_diagnostic_show_locus_one_liner): Call it. * input.c (get_pure_location): Move to libcpp/line-map.c. * input.h (get_pure_location): Convert decl to an inline function calling implementation in libcpp. libcpp/ChangeLog: * include/line-map.h (get_pure_location): New decl. * line-map.c (get_pure_location): Move here, from gcc/input.c, adding a line_maps * param. (rich_location::add_fixit_insert): Call get_pure_location on "where". (rich_location::add_fixit_replace): Call get_pure_location on the end-points. From-SVN: r239843
Diffstat (limited to 'gcc/input.c')
-rw-r--r--gcc/input.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/gcc/input.c b/gcc/input.c
index 4ec218d..a3fe542 100644
--- a/gcc/input.c
+++ b/gcc/input.c
@@ -838,28 +838,6 @@ expansion_point_location (source_location location)
LRK_MACRO_EXPANSION_POINT, NULL);
}
-/* Given location LOC, strip away any packed range information
- or ad-hoc information. */
-
-location_t
-get_pure_location (location_t loc)
-{
- if (IS_ADHOC_LOC (loc))
- loc
- = line_table->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
-
- if (loc >= LINEMAPS_MACRO_LOWEST_LOCATION (line_table))
- return loc;
-
- if (loc < RESERVED_LOCATION_COUNT)
- return loc;
-
- const line_map *map = linemap_lookup (line_table, loc);
- const line_map_ordinary *ordmap = linemap_check_ordinary (map);
-
- return loc & ~((1 << ordmap->m_range_bits) - 1);
-}
-
/* Construct a location with caret at CARET, ranging from START to
finish e.g.