In reviewing Patrick Marlier's last patch I noticed that the tree dump
files for C++ objects were all convoluted when it came to displaying
certain clones.
It turns out C++'s dump_function_name() needs the DECL_LANG_SPECIFIC
bits to properly display the demangled names. However,
ipa_tm_create_version_alias() does not copy over DECL_LANG_SPECIFIC and
obliterates DECL_CONTEXT which is also needed.
The following patch fixes both of these problems.
[Jason, I am not sure whether I am supposed to make an acutal copy of
DECL_LANG_SPECIFIC (even if the clones live in tandem), since I see
cxx_dup_lang_specific_decl making a copy.]
No testcase because the only template code I can get to test is
segfaulting until Patrick's patch gets reviewed:
http://gcc.gnu.org/ml/gcc-patches/2011-12/msg00225.html
OK for trunk? (This is independent of Patrick's patch, it should only
affect the dumps).
* trans-mem.c (ipa_tm_create_version_alias): Set DECL_CONTEXT and
DECL_LANG_SPECIFIC.
Index: trans-mem.c
===================================================================
--- trans-mem.c (revision 182188)
+++ trans-mem.c (working copy)
@@ -4204,7 +4215,8 @@ ipa_tm_create_version_alias (struct cgra
/* Based loosely on C++'s make_alias_for(). */
TREE_PUBLIC (new_decl) = TREE_PUBLIC (old_decl);
- DECL_CONTEXT (new_decl) = NULL;
+ DECL_CONTEXT (new_decl) = DECL_CONTEXT (old_decl);
+ DECL_LANG_SPECIFIC (new_decl) = DECL_LANG_SPECIFIC (old_decl);
TREE_READONLY (new_decl) = TREE_READONLY (old_decl);
DECL_EXTERNAL (new_decl) = 0;
DECL_ARTIFICIAL (new_decl) = 1;