aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2023-10-08 18:43:16 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2023-10-08 18:43:16 -0400
commit1f68a3e8727f36da80be8fe1c67ed6a4d9a568d9 (patch)
tree922b625640e0d50342b195af4afab81d6c8bc7b7 /gcc
parent25af7c1a806c0c2464d51fb395a88ced353be22d (diff)
downloadgcc-1f68a3e8727f36da80be8fe1c67ed6a4d9a568d9.zip
gcc-1f68a3e8727f36da80be8fe1c67ed6a4d9a568d9.tar.gz
gcc-1f68a3e8727f36da80be8fe1c67ed6a4d9a568d9.tar.bz2
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 <dmalcolm@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/module.cc3
-rw-r--r--gcc/genmatch.cc4
-rw-r--r--gcc/input.cc26
-rw-r--r--gcc/toplev.cc4
-rw-r--r--gcc/tree.cc12
5 files changed, 26 insertions, 23 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 77c9edc..e3fb229 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -15969,7 +15969,8 @@ module_state::read_location (bytes_in &sec) const
range.m_finish = read_location (sec);
unsigned discriminator = sec.u ();
if (locus != loc && range.m_start != loc && range.m_finish != loc)
- locus = get_combined_adhoc_loc (line_table, locus, range, NULL, discriminator);
+ locus = line_table->get_or_create_combined_loc (locus, range,
+ nullptr, discriminator);
}
break;
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
index 03d325e..e9d7afa 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -5458,8 +5458,8 @@ main (int argc, char **argv)
line_table = XCNEW (class line_maps);
linemap_init (line_table, 0);
- line_table->reallocator = xrealloc;
- line_table->round_alloc_size = round_alloc_size;
+ line_table->m_reallocator = xrealloc;
+ line_table->m_round_alloc_size = round_alloc_size;
r = cpp_create_reader (CLK_GNUC99, NULL, line_table);
cpp_callbacks *cb = cpp_get_callbacks (r);
diff --git a/gcc/input.cc b/gcc/input.cc
index a0e7cb1..fd09fcc 100644
--- a/gcc/input.cc
+++ b/gcc/input.cc
@@ -1231,7 +1231,8 @@ location_t
make_location (location_t caret, source_range src_range)
{
location_t pure_loc = get_pure_location (caret);
- return COMBINE_LOCATION_DATA (line_table, pure_loc, src_range, NULL, 0);
+ return line_table->get_or_create_combined_loc (pure_loc, src_range,
+ nullptr, 0);
}
/* An expanded_location stores the column in byte units. This function
@@ -1313,9 +1314,9 @@ dump_line_table_statistics (void)
fprintf (stderr, "Ad-hoc table entries used: " PRsa (5) "\n",
SIZE_AMOUNT (s.adhoc_table_entries_used));
fprintf (stderr, "optimized_ranges: " PRsa (5) "\n",
- SIZE_AMOUNT (line_table->num_optimized_ranges));
+ SIZE_AMOUNT (line_table->m_num_optimized_ranges));
fprintf (stderr, "unoptimized_ranges: " PRsa (5) "\n",
- SIZE_AMOUNT (line_table->num_unoptimized_ranges));
+ SIZE_AMOUNT (line_table->m_num_unoptimized_ranges));
fprintf (stderr, "\n");
}
@@ -1917,7 +1918,8 @@ location_with_discriminator (location_t locus, int discriminator)
if (locus == UNKNOWN_LOCATION)
return locus;
- return COMBINE_LOCATION_DATA (line_table, locus, src_range, block, discriminator);
+ return line_table->get_or_create_combined_loc (locus, src_range, block,
+ discriminator);
}
/* Return TRUE if LOCUS represents a location with a discriminator. */
@@ -2099,10 +2101,10 @@ line_table_test::line_table_test ()
saved_line_table = line_table;
line_table = ggc_alloc<line_maps> ();
linemap_init (line_table, BUILTINS_LOCATION);
- gcc_assert (saved_line_table->reallocator);
- line_table->reallocator = saved_line_table->reallocator;
- gcc_assert (saved_line_table->round_alloc_size);
- line_table->round_alloc_size = saved_line_table->round_alloc_size;
+ gcc_assert (saved_line_table->m_reallocator);
+ line_table->m_reallocator = saved_line_table->m_reallocator;
+ gcc_assert (saved_line_table->m_round_alloc_size);
+ line_table->m_round_alloc_size = saved_line_table->m_round_alloc_size;
line_table->default_range_bits = 0;
}
@@ -2115,10 +2117,10 @@ line_table_test::line_table_test (const line_table_case &case_)
saved_line_table = line_table;
line_table = ggc_alloc<line_maps> ();
linemap_init (line_table, BUILTINS_LOCATION);
- gcc_assert (saved_line_table->reallocator);
- line_table->reallocator = saved_line_table->reallocator;
- gcc_assert (saved_line_table->round_alloc_size);
- line_table->round_alloc_size = saved_line_table->round_alloc_size;
+ gcc_assert (saved_line_table->m_reallocator);
+ line_table->m_reallocator = saved_line_table->m_reallocator;
+ gcc_assert (saved_line_table->m_round_alloc_size);
+ line_table->m_round_alloc_size = saved_line_table->m_round_alloc_size;
line_table->default_range_bits = case_.m_default_range_bits;
if (case_.m_base_location)
{
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 626cc43..8af9bf5 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -1082,8 +1082,8 @@ general_init (const char *argv0, bool init_signals)
input_location = UNKNOWN_LOCATION;
line_table = ggc_alloc<line_maps> ();
linemap_init (line_table, BUILTINS_LOCATION);
- line_table->reallocator = realloc_for_line_map;
- line_table->round_alloc_size = ggc_round_alloc_size;
+ line_table->m_reallocator = realloc_for_line_map;
+ line_table->m_round_alloc_size = ggc_round_alloc_size;
line_table->default_range_bits = 5;
init_ttree ();
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 54ca5e7..850a4de 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -14505,7 +14505,8 @@ set_block (location_t loc, tree block)
location_t pure_loc = get_pure_location (loc);
source_range src_range = get_range_from_loc (line_table, loc);
unsigned discriminator = get_discriminator_from_loc (line_table, loc);
- return COMBINE_LOCATION_DATA (line_table, pure_loc, src_range, block, discriminator);
+ return line_table->get_or_create_combined_loc (pure_loc, src_range, block,
+ discriminator);
}
location_t
@@ -14526,11 +14527,10 @@ set_source_range (tree expr, source_range src_range)
location_t expr_location = EXPR_LOCATION (expr);
location_t pure_loc = get_pure_location (expr_location);
unsigned discriminator = get_discriminator_from_loc (expr_location);
- location_t adhoc = COMBINE_LOCATION_DATA (line_table,
- pure_loc,
- src_range,
- NULL,
- discriminator);
+ location_t adhoc = line_table->get_or_create_combined_loc (pure_loc,
+ src_range,
+ nullptr,
+ discriminator);
SET_EXPR_LOCATION (expr, adhoc);
return adhoc;
}