+2019-05-14 Martin Liska <mliska@suse.cz>
+
+ PR preprocessor/90382
+ * include/line-map.h (get_data_from_adhoc_loc): Add const to
+ the first argument.
+ (get_location_from_adhoc_loc): Likewise.
+ * line-map.c(get_data_from_adhoc_loc): Add const to
+ the first argument.
+ (get_location_from_adhoc_loc): Likewise.
+ (get_combined_adhoc_loc): Use get_location_from_adhoc_loc
+ (or get_data_from_adhoc_loc).
+ (get_range_from_adhoc_loc): Likewise.
+ (get_pure_location): Likewise.
+ (linemap_position_for_loc_and_offset): Likewise.
+ (linemap_lookup): Likewise.
+ (linemap_ordinary_map_lookup): Likewise.
+ (linemap_macro_map_lookup): Likewise.
+ (linemap_get_expansion_line): Likewise.
+ (linemap_get_expansion_filename): Likewise.
+ (linemap_location_in_system_header_p): Likewise.
+ (linemap_location_from_macro_expansion_p): Likewise.
+ (linemap_macro_loc_to_exp_point): Likewise.
+ (linemap_resolve_location): Likewise.
+ (linemap_unwind_toward_expansion): Likewise.
+ (linemap_unwind_to_first_non_reserved_loc): Likewise.
+ (linemap_expand_location): Likewise.
+ (linemap_dump_location): Likewise.
+
2019-05-07 Nathan Sidwell <nathan@acm.org>
* files.c (_cpp_stack_file): Empty filenames aren't dependencies.
struct location_adhoc_data **slot;
if (IS_ADHOC_LOC (locus))
- locus
- = set->location_adhoc_data_map.data[locus & MAX_LOCATION_T].locus;
+ locus = get_location_from_adhoc_loc (set, locus);
if (locus == 0 && data == NULL)
return 0;
/* Return the data for the adhoc loc. */
void *
-get_data_from_adhoc_loc (struct line_maps *set, location_t loc)
+get_data_from_adhoc_loc (const struct line_maps *set, location_t loc)
{
linemap_assert (IS_ADHOC_LOC (loc));
return set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].data;
/* Return the location for the adhoc loc. */
location_t
-get_location_from_adhoc_loc (struct line_maps *set, location_t loc)
+get_location_from_adhoc_loc (const struct line_maps *set, location_t loc)
{
linemap_assert (IS_ADHOC_LOC (loc));
return set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
/* Return the source_range for adhoc location LOC. */
static source_range
-get_range_from_adhoc_loc (struct line_maps *set, location_t loc)
+get_range_from_adhoc_loc (const struct line_maps *set, location_t loc)
{
linemap_assert (IS_ADHOC_LOC (loc));
return set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].src_range;
get_pure_location (line_maps *set, location_t loc)
{
if (IS_ADHOC_LOC (loc))
- loc
- = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
+ loc = get_location_from_adhoc_loc (set, loc);
if (loc >= LINEMAPS_MACRO_LOWEST_LOCATION (set))
return loc;
const line_map_ordinary * map = NULL;
if (IS_ADHOC_LOC (loc))
- loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
+ loc = get_location_from_adhoc_loc (set, loc);
/* This function does not support virtual locations yet. */
if (linemap_location_from_macro_expansion_p (set, loc))
linemap_lookup (struct line_maps *set, location_t line)
{
if (IS_ADHOC_LOC (line))
- line = set->location_adhoc_data_map.data[line & MAX_LOCATION_T].locus;
+ line = get_location_from_adhoc_loc (set, line);
if (linemap_location_from_macro_expansion_p (set, line))
return linemap_macro_map_lookup (set, line);
return linemap_ordinary_map_lookup (set, line);
const line_map_ordinary *cached, *result;
if (IS_ADHOC_LOC (line))
- line = set->location_adhoc_data_map.data[line & MAX_LOCATION_T].locus;
+ line = get_location_from_adhoc_loc (set, line);
if (set == NULL || line < RESERVED_LOCATION_COUNT)
return NULL;
const struct line_map_macro *cached, *result;
if (IS_ADHOC_LOC (line))
- line = set->location_adhoc_data_map.data[line & MAX_LOCATION_T].locus;
+ line = get_location_from_adhoc_loc (set, line);
linemap_assert (line >= LINEMAPS_MACRO_LOWEST_LOCATION (set));
const line_map_ordinary *map = NULL;
if (IS_ADHOC_LOC (location))
- location = set->location_adhoc_data_map.data[location
- & MAX_LOCATION_T].locus;
+ location = get_location_from_adhoc_loc (set, location);
if (location < RESERVED_LOCATION_COUNT)
return 0;
const struct line_map_ordinary *map = NULL;
if (IS_ADHOC_LOC (location))
- location = set->location_adhoc_data_map.data[location
- & MAX_LOCATION_T].locus;
+ location = get_location_from_adhoc_loc (set, location);
if (location < RESERVED_LOCATION_COUNT)
return NULL;
const struct line_map *map = NULL;
if (IS_ADHOC_LOC (location))
- location = set->location_adhoc_data_map.data[location
- & MAX_LOCATION_T].locus;
+ location = get_location_from_adhoc_loc (set, location);
if (location < RESERVED_LOCATION_COUNT)
return false;
location_t location)
{
if (IS_ADHOC_LOC (location))
- location = set->location_adhoc_data_map.data[location
- & MAX_LOCATION_T].locus;
+ location = get_location_from_adhoc_loc (set, location);
return IS_MACRO_LOC (location);
}
struct line_map *map;
if (IS_ADHOC_LOC (location))
- location = set->location_adhoc_data_map.data[location
- & MAX_LOCATION_T].locus;
+ location = get_location_from_adhoc_loc (set, location);
linemap_assert (set && location >= RESERVED_LOCATION_COUNT);
{
location_t locus = loc;
if (IS_ADHOC_LOC (loc))
- locus = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
+ locus = get_location_from_adhoc_loc (set, loc);
if (locus < RESERVED_LOCATION_COUNT)
{
const struct line_map *resolved_map;
if (IS_ADHOC_LOC (loc))
- loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
+ loc = get_location_from_adhoc_loc (set, loc);
resolved_location =
linemap_macro_map_loc_unwind_toward_spelling (set, macro_map, loc);
const line_map_ordinary *map1 = NULL;
if (IS_ADHOC_LOC (loc))
- loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
+ loc = get_location_from_adhoc_loc (set, loc);
map0 = linemap_lookup (set, loc);
if (!linemap_macro_expansion_map_p (map0))
memset (&xloc, 0, sizeof (xloc));
if (IS_ADHOC_LOC (loc))
{
- xloc.data
- = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].data;
- loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
+ xloc.data = get_data_from_adhoc_loc (set, loc);
+ loc = get_location_from_adhoc_loc (set, loc);
}
if (loc < RESERVED_LOCATION_COUNT)
int l = -1, c = -1, s = -1, e = -1;
if (IS_ADHOC_LOC (loc))
- loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
+ loc = get_location_from_adhoc_loc (set, loc);
if (loc == 0)
return;