diff options
author | Strager Neds <strager.nds@gmail.com> | 2020-11-10 11:42:01 -0700 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 2020-11-10 11:44:15 -0700 |
commit | 8b9a92f794b8ad8011e6beb11a609efa635c4600 (patch) | |
tree | 015dae9357148c23ef517657a3b019656fd2ebd0 /gcc/symtab.c | |
parent | 5e41e7f0928de55d189475fc14f7e6c9737cd507 (diff) | |
download | gcc-8b9a92f794b8ad8011e6beb11a609efa635c4600.zip gcc-8b9a92f794b8ad8011e6beb11a609efa635c4600.tar.gz gcc-8b9a92f794b8ad8011e6beb11a609efa635c4600.tar.bz2 |
Refactor copying decl section names
gcc/
* cgraph.h (symtab_node::get_section): Constify.
(symtab_node::set_section): Declare new overload.
* symtab.c (symtab_node::set_section): Define new overload.
(symtab_node::copy_visibility_from): Use new overload of
symtab_node::set_section.
(symtab_node::resolve_alias): Same.
* tree.h (set_decl_section_name): Declare new overload.
* tree.c (set_decl_section_name): Define new overload.
* tree-emutls.c (get_emutls_init_templ_addr): Same.
* cgraphclones.c (cgraph_node::create_virtual_clone): Use new
overload of symtab_node::set_section.
(cgraph_node::create_version_clone_with_body): Same.
* trans-mem.c (ipa_tm_create_version): Same.
gcc/c
* c-decl.c (merge_decls): Use new overload of
set_decl_section_name.
gcc/cp
* decl.c (duplicate_decls): Use new overload of
set_decl_section_name.
* method.c (use_thunk): Same.
* optimize.c (maybe_clone_body): Same.
* coroutines.cc (act_des_fn): Same.
gcc/d
* decl.cc (finish_thunk): Use new overload of
set_decl_section_name
Diffstat (limited to 'gcc/symtab.c')
-rw-r--r-- | gcc/symtab.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c index 58b14f3..883cc3e 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1484,8 +1484,7 @@ symtab_node::copy_visibility_from (symtab_node *n) DECL_DLLIMPORT_P (decl) = DECL_DLLIMPORT_P (n->decl); resolution = n->resolution; set_comdat_group (n->get_comdat_group ()); - call_for_symbol_and_aliases (symtab_node::set_section, - const_cast<char *>(n->get_section ()), true); + set_section (*n); externally_visible = n->externally_visible; if (!DECL_RTL_SET_P (decl)) return; @@ -1671,6 +1670,14 @@ symtab_node::set_section (const char *section) (symtab_node::set_section, const_cast<char *>(section), true); } +void +symtab_node::set_section (const symtab_node &other) +{ + const char *section = other.get_section (); + call_for_symbol_and_aliases + (symtab_node::set_section, const_cast<char *>(section), true); +} + /* Return the initialization priority. */ priority_type @@ -1814,8 +1821,7 @@ symtab_node::resolve_alias (symtab_node *target, bool transparent) { error ("section of alias %q+D must match section of its target", decl); } - call_for_symbol_and_aliases (symtab_node::set_section, - const_cast<char *>(target->get_section ()), true); + set_section (*target); if (target->implicit_section) call_for_symbol_and_aliases (set_implicit_section, NULL, true); |