From 1f68a3e8727f36da80be8fe1c67ed6a4d9a568d9 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Sun, 8 Oct 2023 18:43:16 -0400 Subject: libcpp: eliminate COMBINE_LOCATION_DATA This patch eliminates the function "COMBINE_LOCATION_DATA" (which hasn't been a macro since r6-739-g0501dbd932a7e9) and the function "get_combined_adhoc_loc" in favor of a new line_maps::get_or_create_combined_loc member function. No functional change intended. gcc/cp/ChangeLog: * module.cc (module_state::read_location): Update for renaming of get_combined_adhoc_loc. gcc/ChangeLog: * genmatch.cc (main): Update for "m_" prefix of some fields of line_maps. * input.cc (make_location): Update for removal of COMBINE_LOCATION_DATA. (dump_line_table_statistics): Update for "m_" prefix of some fields of line_maps. (location_with_discriminator): Update for removal of COMBINE_LOCATION_DATA. (line_table_test::line_table_test): Update for "m_" prefix of some fields of line_maps. * toplev.cc (general_init): Likewise. * tree.cc (set_block): Update for removal of COMBINE_LOCATION_DATA. (set_source_range): Likewise. libcpp/ChangeLog: * include/line-map.h (line_maps::reallocator): Rename to... (line_maps::m_reallocator): ...this. (line_maps::round_alloc_size): Rename to... (line_maps::m_round_alloc_size): ...this. (line_maps::location_adhoc_data_map): Rename to... (line_maps::m_location_adhoc_data_map): ...this. (line_maps::num_optimized_ranges): Rename to... (line_maps::m_num_optimized_ranges): ..this. (line_maps::num_unoptimized_ranges): Rename to... (line_maps::m_num_unoptimized_ranges): ...this. (get_combined_adhoc_loc): Delete decl. (COMBINE_LOCATION_DATA): Delete. * lex.cc (get_location_for_byte_range_in_cur_line): Update for removal of COMBINE_LOCATION_DATA. (warn_about_normalization): Likewise. (_cpp_lex_direct): Likewise. * line-map.cc (line_maps::~line_maps): Update for "m_" prefix of some fields of line_maps. (rebuild_location_adhoc_htab): Likewise. (can_be_stored_compactly_p): Convert to... (line_maps::can_be_stored_compactly_p): ...this private member function. (get_combined_adhoc_loc): Convert to... (line_maps::get_or_create_combined_loc): ...this public member function. (line_maps::make_location): Update for removal of COMBINE_LOCATION_DATA. (get_data_from_adhoc_loc): Update for "m_" prefix of some fields of line_maps. (get_discriminator_from_adhoc_loc): Likewise. (get_location_from_adhoc_loc): Likewise. (get_range_from_adhoc_loc): Convert to... (line_maps::get_range_from_adhoc_loc): ...this private member function. (line_maps::get_range_from_loc): Update for conversion of get_range_from_adhoc_loc to a member function. (linemap_init): Update for "m_" prefix of some fields of line_maps. (line_map_new_raw): Likewise. (linemap_enter_macro): Likewise. (linemap_get_statistics): Likewise. Signed-off-by: David Malcolm --- libcpp/include/line-map.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'libcpp/include') diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 9e1b11d..b353df4 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -802,7 +802,21 @@ public: location_t make_location (location_t caret, location_t start, location_t finish); - + + location_t + get_or_create_combined_loc (location_t locus, + source_range src_range, + void *data, + unsigned discriminator); + + private: + bool can_be_stored_compactly_p (location_t locus, + source_range src_range, + void *data, + unsigned discriminator) const; + source_range get_range_from_adhoc_loc (location_t loc) const; + + public: maps_info_ordinary info_ordinary; maps_info_macro info_macro; @@ -827,13 +841,13 @@ public: unsigned int max_column_hint; /* The allocator to use when resizing 'maps', defaults to xrealloc. */ - line_map_realloc GTY((callback)) reallocator; + line_map_realloc GTY((callback)) m_reallocator; /* The allocators' function used to know the actual size it allocated, for a certain allocation size requested. */ - line_map_round_alloc_size_func GTY((callback)) round_alloc_size; + line_map_round_alloc_size_func GTY((callback)) m_round_alloc_size; - struct location_adhoc_data_map location_adhoc_data_map; + struct location_adhoc_data_map m_location_adhoc_data_map; /* The special location value that is used as spelling location for built-in tokens. */ @@ -842,8 +856,8 @@ public: /* The default value of range_bits in ordinary line maps. */ unsigned int default_range_bits; - unsigned int num_optimized_ranges; - unsigned int num_unoptimized_ranges; + unsigned int m_num_optimized_ranges; + unsigned int m_num_unoptimized_ranges; }; /* Returns the number of allocated maps so far. MAP_KIND shall be TRUE @@ -1052,8 +1066,6 @@ LINEMAPS_LAST_ALLOCATED_MACRO_MAP (const line_maps *set) return (line_map_macro *)LINEMAPS_LAST_ALLOCATED_MAP (set, true); } -extern location_t get_combined_adhoc_loc (line_maps *, location_t, - source_range, void *, unsigned); extern void *get_data_from_adhoc_loc (const line_maps *, location_t); extern unsigned get_discriminator_from_adhoc_loc (const line_maps *, location_t); extern location_t get_location_from_adhoc_loc (const line_maps *, @@ -1073,18 +1085,6 @@ pure_location_p (const line_maps *set, location_t loc); extern location_t get_pure_location (const line_maps *set, location_t loc); -/* Combine LOC and BLOCK, giving a combined adhoc location. */ - -inline location_t -COMBINE_LOCATION_DATA (class line_maps *set, - location_t loc, - source_range src_range, - void *block, - unsigned discriminator) -{ - return get_combined_adhoc_loc (set, loc, src_range, block, discriminator); -} - extern void rebuild_location_adhoc_htab (class line_maps *); /* Initialize a line map set. SET is the line map set to initialize -- cgit v1.1