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/include | |
| parent | a73c80d99736f03ba5a7a74853bcd415bbdc4c32 (diff) | |
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/include')
| -rw-r--r-- | libcpp/include/line-map.h | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 7a172f4c846..30f2284b5d1 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -733,7 +733,9 @@ struct GTY(()) maps_info_ordinary { or equal to ALLOCATED. */ unsigned int used; - mutable unsigned int cache; + /* The index of the last ordinary map that was looked up with + linemap_lookup. */ + mutable unsigned int m_cache; }; struct GTY(()) maps_info_macro { @@ -748,7 +750,9 @@ struct GTY(()) maps_info_macro { or equal to ALLOCATED. */ unsigned int used; - mutable unsigned int cache; + /* The index of the last macro map that was looked up with + linemap_lookup. */ + mutable unsigned int m_cache; }; /* Data structure to associate a source_range together with an arbitrary @@ -904,18 +908,6 @@ LINEMAPS_USED (line_maps *set, bool map_kind) return set->info_ordinary.used; } -/* Returns the index of the last map that was looked up with - linemap_lookup. MAP_KIND shall be TRUE if we are interested in - macro maps, FALSE otherwise. */ -inline unsigned int & -LINEMAPS_CACHE (const line_maps *set, bool map_kind) -{ - if (map_kind) - return set->info_macro.cache; - else - return set->info_ordinary.cache; -} - /* Return the map at a given index. */ inline line_map * LINEMAPS_MAP_AT (const line_maps *set, bool map_kind, int index) @@ -968,14 +960,6 @@ LINEMAPS_ORDINARY_USED (const line_maps *set) return LINEMAPS_USED (set, false); } -/* Return the index of the last ordinary map that was looked up with - linemap_lookup. */ -inline unsigned int & -LINEMAPS_ORDINARY_CACHE (const line_maps *set) -{ - return LINEMAPS_CACHE (set, false); -} - /* Returns a pointer to the last ordinary map used in the line table SET. */ inline line_map_ordinary * @@ -1016,14 +1000,6 @@ LINEMAPS_MACRO_USED (const line_maps *set) return LINEMAPS_USED (set, true); } -/* Return the index of the last macro map that was looked up with - linemap_lookup. */ -inline unsigned int & -LINEMAPS_MACRO_CACHE (const line_maps *set) -{ - return LINEMAPS_CACHE (set, true); -} - /* Returns the last macro map used in the line table SET. */ inline line_map_macro * LINEMAPS_LAST_MACRO_MAP (const line_maps *set) |
