diff options
author | David Malcolm <dmalcolm@redhat.com> | 2023-10-08 18:43:17 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2023-10-08 18:43:17 -0400 |
commit | 45bae1809c3919ae3b77b59fd5502c2ab8340418 (patch) | |
tree | 3e70d43c00bd4d384c78317a46e3ed4f5f99c27a /libcpp/line-map.cc | |
parent | a73c80d99736f03ba5a7a74853bcd415bbdc4c32 (diff) | |
download | gcc-45bae1809c3919ae3b77b59fd5502c2ab8340418.zip gcc-45bae1809c3919ae3b77b59fd5502c2ab8340418.tar.gz gcc-45bae1809c3919ae3b77b59fd5502c2ab8340418.tar.bz2 |
libcpp: eliminate LINEMAPS_{,ORDINARY_,MACRO_}CACHE
It's simpler to use field access than to go through these inline
functions that look as if they are macros.
No functional change intended.
libcpp/ChangeLog:
* include/line-map.h (maps_info_ordinary::cache): Rename to...
(maps_info_ordinary::m_cache): ...this.
(maps_info_macro::cache): Rename to...
(maps_info_macro::m_cache): ...this.
(LINEMAPS_CACHE): Delete.
(LINEMAPS_ORDINARY_CACHE): Delete.
(LINEMAPS_MACRO_CACHE): Delete.
* init.cc (read_original_filename): Update for adding "m_" prefix.
* line-map.cc (linemap_add): Eliminate LINEMAPS_ORDINARY_CACHE in
favor of a simple field access.
(linemap_enter_macro): Likewise for LINEMAPS_MACRO_CACHE.
(linemap_ordinary_map_lookup): Likewise for
LINEMAPS_ORDINARY_CACHE, twice.
(linemap_lookup_macro_index): Likewise for LINEMAPS_MACRO_CACHE.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'libcpp/line-map.cc')
-rw-r--r-- | libcpp/line-map.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libcpp/line-map.cc b/libcpp/line-map.cc index 5b67a70..385d54c 100644 --- a/libcpp/line-map.cc +++ b/libcpp/line-map.cc @@ -638,7 +638,7 @@ linemap_add (line_maps *set, enum lc_reason reason, map->sysp = sysp; map->to_file = to_file; map->to_line = to_line; - LINEMAPS_ORDINARY_CACHE (set) = LINEMAPS_ORDINARY_USED (set) - 1; + set->info_ordinary.m_cache = LINEMAPS_ORDINARY_USED (set) - 1; /* Do not store range_bits here. That's readjusted in linemap_line_start. */ map->m_range_bits = map->m_column_and_range_bits = 0; @@ -786,7 +786,7 @@ linemap_enter_macro (class line_maps *set, struct cpp_hashnode *macro_node, memset (MACRO_MAP_LOCATIONS (map), 0, 2 * num_tokens * sizeof (location_t)); - LINEMAPS_MACRO_CACHE (set) = LINEMAPS_MACRO_USED (set) - 1; + set->info_macro.m_cache = LINEMAPS_MACRO_USED (set) - 1; return map; } @@ -1116,7 +1116,7 @@ linemap_ordinary_map_lookup (const line_maps *set, location_t line) if (set == NULL || line < RESERVED_LOCATION_COUNT) return NULL; - unsigned mn = LINEMAPS_ORDINARY_CACHE (set); + unsigned mn = set->info_ordinary.m_cache; unsigned mx = LINEMAPS_ORDINARY_USED (set); const line_map_ordinary *cached = LINEMAPS_ORDINARY_MAP_AT (set, mn); @@ -1141,7 +1141,7 @@ linemap_ordinary_map_lookup (const line_maps *set, location_t line) mn = md; } - LINEMAPS_ORDINARY_CACHE (set) = mn; + set->info_ordinary.m_cache = mn; const line_map_ordinary *result = LINEMAPS_ORDINARY_MAP_AT (set, mn); linemap_assert (line >= MAP_START_LOCATION (result)); return result; @@ -1173,7 +1173,7 @@ linemap_macro_map_lookup (const line_maps *set, location_t line) unsigned linemap_lookup_macro_index (const line_maps *set, location_t line) { - unsigned mn = LINEMAPS_MACRO_CACHE (set); + unsigned mn = set->info_macro.m_cache; unsigned mx = LINEMAPS_MACRO_USED (set); const struct line_map_macro *cached = LINEMAPS_MACRO_MAP_AT (set, mn); @@ -1195,7 +1195,7 @@ linemap_lookup_macro_index (const line_maps *set, location_t line) mx = md; } - LINEMAPS_MACRO_CACHE (set) = mx; + set->info_macro.m_cache = mx; return mx; } |