diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-29 19:52:33 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-29 19:52:33 +0000 |
commit | cac1ceba51f1a6e418bf17719753a11cd23aebeb (patch) | |
tree | e098e4a02db951f24d600b0dfbec08c4612e15d1 /gcc/cgraphclones.c | |
parent | 60300738322430f55865f68e41b7d6b462eda160 (diff) | |
download | gcc-cac1ceba51f1a6e418bf17719753a11cd23aebeb.tar.gz |
* cgraphclones.c (cgraph_create_virtual_clone): Compute the DECL_NAME
of the clone from the DECL_NAME of the original function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphclones.c')
-rw-r--r-- | gcc/cgraphclones.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index ae26a026d64..54b97b91c78 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -252,7 +252,7 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq, return new_node; } -/* Create a new name for clone of DECL, add SUFFIX. Returns an identifier. */ +/* Return a new assembler name for a clone of DECL with SUFFIX. */ static GTY(()) unsigned int clone_fn_id_num; @@ -293,8 +293,9 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, tree old_decl = old_node->symbol.decl; struct cgraph_node *new_node = NULL; tree new_decl; - size_t i; + size_t len, i; struct ipa_replace_map *map; + char *name; if (!in_lto_p) gcc_checking_assert (tree_versionable_function_p (old_decl)); @@ -318,8 +319,13 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, sometimes storing only clone decl instead of original. */ /* Generate a new name for the new version. */ - DECL_NAME (new_decl) = clone_function_name (old_decl, suffix); - SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); + len = IDENTIFIER_LENGTH (DECL_NAME (old_decl)); + name = XALLOCAVEC (char, len + strlen (suffix) + 2); + memcpy (name, IDENTIFIER_POINTER (DECL_NAME (old_decl)), len); + strcpy (name + len + 1, suffix); + name[len] = '.'; + DECL_NAME (new_decl) = get_identifier (name); + SET_DECL_ASSEMBLER_NAME (new_decl, clone_function_name (old_decl, suffix)); SET_DECL_RTL (new_decl, NULL); new_node = cgraph_clone_node (old_node, new_decl, old_node->count, |