summaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-09 03:33:44 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-09 03:33:44 +0000
commitdabebf7ecc90b59b0603d2428cf465fe1f0d642b (patch)
tree91cf7e9a3eeaae34dd4f07d9086f498096305f0d /gcc/cgraph.c
parent63aa3890e81a12aaac274e04e4967bb4abfb7d7a (diff)
downloadgcc-dabebf7ecc90b59b0603d2428cf465fe1f0d642b.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176071 138bc75d-0d04-0410-961f-82ee72b054a4
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 86e72072eab..09aad60c4d2 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