diff options
author | David Malcolm <dmalcolm@redhat.com> | 2023-10-31 17:05:41 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2023-10-31 17:05:41 -0400 |
commit | b0f19336f247c63abbc08935f0c1efe16f22ac3a (patch) | |
tree | d4d286381a55e1118a6e487b54f8526b0801febf /libcpp | |
parent | 8b4ac021cd1f63125aaf8397479602b950438385 (diff) | |
download | gcc-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 'libcpp')
-rw-r--r-- | libcpp/include/line-map.h | 19 | ||||
-rw-r--r-- | libcpp/line-map.cc | 4 |
2 files changed, 12 insertions, 11 deletions
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index cb934e6..635d6d3 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -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. diff --git a/libcpp/line-map.cc b/libcpp/line-map.cc index cd17353..cc9e14a 100644 --- a/libcpp/line-map.cc +++ b/libcpp/line-map.cc @@ -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 |