aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-07-08 23:33:44 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-07-08 23:33:44 -0400
commit2fda8e144a7db5ba6025cfe643da0c6111cc2b0f (patch)
tree91cf7e9a3eeaae34dd4f07d9086f498096305f0d /gcc/cgraph.c
parente8f8774a901e9645bfadc23d4e72be552b0e9b72 (diff)
downloadgcc-2fda8e144a7db5ba6025cfe643da0c6111cc2b0f.zip
gcc-2fda8e144a7db5ba6025cfe643da0c6111cc2b0f.tar.gz
gcc-2fda8e144a7db5ba6025cfe643da0c6111cc2b0f.tar.bz2
cgraph.c (cgraph_add_to_same_comdat_group): New.
gcc/ * cgraph.c (cgraph_add_to_same_comdat_group): New. * cgraph.h: Declare it. * ipa.c (function_and_variable_visibility): Make sure thunks have the right visibility. gcc/cp/ * method.c (use_thunk): Use cgraph_add_to_same_comdat_group. * optimize.c (maybe_clone_body): Likewise. * semantics.c (maybe_add_lambda_conv_op): Likewise. From-SVN: r176071
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 86e7207..09aad60 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1630,6 +1630,31 @@ cgraph_remove_node (struct cgraph_node *node)
free_nodes = node;
}
+/* Add NEW_ to the same comdat group that OLD is in. */
+
+void
+cgraph_add_to_same_comdat_group (struct cgraph_node *new_,
+ struct cgraph_node *old)
+{
+ gcc_assert (DECL_ONE_ONLY (old->decl));
+ gcc_assert (!new_->same_comdat_group);
+ gcc_assert (new_ != old);
+
+ DECL_COMDAT_GROUP (new_->decl) = DECL_COMDAT_GROUP (old->decl);
+ new_->same_comdat_group = old;
+ if (!old->same_comdat_group)
+ old->same_comdat_group = new_;
+ else
+ {
+ struct cgraph_node *n;
+ for (n = old->same_comdat_group;
+ n->same_comdat_group != old;
+ n = n->same_comdat_group)
+ ;
+ n->same_comdat_group = new_;
+ }
+}
+
/* Remove the node from cgraph. */
void