aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2023-10-31 17:05:41 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2023-10-31 17:05:41 -0400
commitb0f19336f247c63abbc08935f0c1efe16f22ac3a (patch)
treed4d286381a55e1118a6e487b54f8526b0801febf /gcc
parent8b4ac021cd1f63125aaf8397479602b950438385 (diff)
downloadgcc-b0f19336f247c63abbc08935f0c1efe16f22ac3a.zip
gcc-b0f19336f247c63abbc08935f0c1efe16f22ac3a.tar.gz
gcc-b0f19336f247c63abbc08935f0c1efe16f22ac3a.tar.bz2
libcpp: eliminate MACRO_MAP_EXPANSION_POINT_LOCATION
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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/c-warn.cc2
-rw-r--r--gcc/cp/module.cc6
-rw-r--r--gcc/input.cc4
-rw-r--r--gcc/tree-diagnostic.cc2
4 files changed, 7 insertions, 7 deletions
diff --git a/gcc/c-family/c-warn.cc b/gcc/c-family/c-warn.cc
index 9ab83a9..bc889ce 100644
--- a/gcc/c-family/c-warn.cc
+++ b/gcc/c-family/c-warn.cc
@@ -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;
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 539518d..c1c8c22 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -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;
diff --git a/gcc/input.cc b/gcc/input.cc
index fd09fcc..6256d81 100644
--- a/gcc/input.cc
+++ b/gcc/input.cc
@@ -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);
diff --git a/gcc/tree-diagnostic.cc b/gcc/tree-diagnostic.cc
index a600f0e..cae400c 100644
--- a/gcc/tree-diagnostic.cc
+++ b/gcc/tree-diagnostic.cc
@@ -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,