@@ -2951,7 +2951,7 @@ warn_for_multistatement_macros (location_t body_loc, location_t next_loc,
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;
@@ -13937,7 +13937,7 @@ ordinary_loc_of (line_maps *lmaps, location_t from)
/* 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;
@@ -15779,7 +15779,7 @@ module_state::note_location (location_t loc)
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--;)
@@ -16375,7 +16375,7 @@ module_state::write_macro_maps (elf_out *to, range_t &info, unsigned *crc_p)
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;
@@ -1530,9 +1530,9 @@ dump_location_info (FILE *stream)
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);
@@ -217,7 +217,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
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,
@@ -461,6 +461,15 @@ struct cpp_hashnode;
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. */
@@ -535,7 +544,7 @@ struct GTY((tag ("2"))) line_map_macro : public line_map {
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). */
};
@@ -705,14 +714,6 @@ MACRO_MAP_LOCATIONS (const line_map_macro *macro_map)
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.
@@ -782,7 +782,7 @@ linemap_enter_macro (class line_maps *set, struct cpp_hashnode *macro_node,
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));
@@ -1225,7 +1225,7 @@ linemap_macro_map_loc_to_exp_point (const line_map_macro *map,
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