This patch eliminates the function "MACRO_MAP_EXPANSION_POINT_LOCATION"
(which hasn't been a macro since
r6-739-g0501dbd932a7e9) in favor of
a new line_map_macro::get_expansion_point_location accessor.
No functional change intended.
gcc/c-family/ChangeLog:
* c-warn.cc (warn_for_multistatement_macros): Update for removal
of MACRO_MAP_EXPANSION_POINT_LOCATION.
gcc/cp/ChangeLog:
* module.cc (ordinary_loc_of): Update for removal of
MACRO_MAP_EXPANSION_POINT_LOCATION.
(module_state::note_location): Update for renaming of field.
(module_state::write_macro_maps): Likewise.
gcc/ChangeLog:
* input.cc (dump_location_info): Update for removal of
MACRO_MAP_EXPANSION_POINT_LOCATION.
* tree-diagnostic.cc (maybe_unwind_expanded_macro_loc):
Likewise.
libcpp/ChangeLog:
* include/line-map.h
(line_map_macro::get_expansion_point_location): New accessor.
(line_map_macro::expansion): Rename field to...
(line_map_macro::mexpansion): Rename field to...
(MACRO_MAP_EXPANSION_POINT_LOCATION): Delete this function.
* line-map.cc (linemap_enter_macro): Update for renaming of field.
(linemap_macro_map_loc_to_exp_point): Update for removal of
MACRO_MAP_EXPANSION_POINT_LOCATION.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
while (linemap_macro_expansion_map_p (guard_map))
{
const line_map_macro *mm = linemap_check_macro (guard_map);
- guard_loc_exp = MACRO_MAP_EXPANSION_POINT_LOCATION (mm);
+ guard_loc_exp = mm->get_expansion_point_location ();
guard_map = linemap_lookup (line_table, guard_loc_exp);
if (guard_map == body_map)
return;
/* Find the ordinary location nearest FROM. */
const line_map *map = linemap_lookup (lmaps, from);
const line_map_macro *mac_map = linemap_check_macro (map);
- from = MACRO_MAP_EXPANSION_POINT_LOCATION (mac_map);
+ from = mac_map->get_expansion_point_location ();
}
}
return from;
slot->remap = 0;
// Expansion locations could themselves be from a
// macro, we need to note them all.
- note_location (mac_map->expansion);
+ note_location (mac_map->m_expansion);
gcc_checking_assert (mac_map->n_tokens);
location_t tloc = UNKNOWN_LOCATION;
for (unsigned ix = mac_map->n_tokens * 2; ix--;)
sec.u (iter->remap);
sec.u (mac->n_tokens);
sec.cpp_node (mac->macro);
- write_location (sec, mac->expansion);
+ write_location (sec, mac->m_expansion);
const location_t *locs = mac->macro_locations;
/* There are lots of identical runs. */
location_t prev = UNKNOWN_LOCATION;
map->start_location,
(map->start_location
+ MACRO_MAP_NUM_MACRO_TOKENS (map)));
- inform (MACRO_MAP_EXPANSION_POINT_LOCATION (map),
+ inform (map->get_expansion_point_location (),
"expansion point is location %i",
- MACRO_MAP_EXPANSION_POINT_LOCATION (map));
+ map->get_expansion_point_location ());
fprintf (stream, " map->start_location: %u\n",
map->start_location);
This is the locus 2/ of the earlier comment. */
location_t resolved_exp_loc =
linemap_resolve_location (line_table,
- MACRO_MAP_EXPANSION_POINT_LOCATION (iter->map),
+ iter->map->get_expansion_point_location (),
LRK_MACRO_DEFINITION_LOCATION, NULL);
diagnostic_append_note (context, resolved_exp_loc,
The offset from START_LOCATION is used to index into
MACRO_LOCATIONS; this holds the original location of the token. */
struct GTY((tag ("2"))) line_map_macro : public line_map {
+
+ /* Get the location of the expansion point of this macro map. */
+
+ location_t
+ get_expansion_point_location () const
+ {
+ return m_expansion;
+ }
+
/* Base is 4 bytes. */
/* The number of tokens inside the replacement-list of MACRO. */
by the map that was current right before the current one. It
could have been either a macro or an ordinary map, depending on
if we are in a nested expansion context not. */
- location_t expansion;
+ location_t m_expansion;
/* Size is 20 or 32 (4 bytes padding on 64-bit). */
};
return macro_map->macro_locations;
}
-/* Get the location of the expansion point of the macro map MAP. */
-
-inline location_t
-MACRO_MAP_EXPANSION_POINT_LOCATION (const line_map_macro *macro_map)
-{
- return macro_map->expansion;
-}
-
/* The abstraction of a set of location maps. There can be several
types of location maps. This abstraction contains the attributes
that are independent from the type of the map.
map->macro_locations
= (location_t*) set->m_reallocator (nullptr,
2 * num_tokens * sizeof (location_t));
- map->expansion = expansion;
+ map->m_expansion = expansion;
memset (MACRO_MAP_LOCATIONS (map), 0,
2 * num_tokens * sizeof (location_t));
linemap_assert ((location - MAP_START_LOCATION (map))
< MACRO_MAP_NUM_MACRO_TOKENS (map));
- return MACRO_MAP_EXPANSION_POINT_LOCATION (map);
+ return map->get_expansion_point_location ();
}
/* LOCATION is the source location of a token that belongs to a macro