aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-01-06 02:27:02 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-01-06 02:27:02 +0000
commit5e731d2d164d8d31646d44d61a10e9150e090809 (patch)
tree8ac20b6a5361978137e8458af8f60f82153cd3cb
parent2f42e5de44255be86141a2d2468d0dd575981dc4 (diff)
downloadgcc-5e731d2d164d8d31646d44d61a10e9150e090809.zip
gcc-5e731d2d164d8d31646d44d61a10e9150e090809.tar.gz
gcc-5e731d2d164d8d31646d44d61a10e9150e090809.tar.bz2
compiler: Use function receiver name in mangled named type descriptor.
If named types with similar names are defined inside of methods with similar names, it was possible that the mangled type names would be the same, leading to multiple definitions of type descriptor and garbage collection info variables. This can only occur with similarly named methods across different receivers, so we use the receiver name to distinguish. Fixes issue 33. From-SVN: r219214
-rw-r--r--gcc/go/gofrontend/types.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index fbcce7f..f9877fa 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -1296,6 +1296,14 @@ Type::type_descriptor_var_name(Gogo* gogo, Named_type* nt)
ret.append(1, '.');
if (in_function != NULL)
{
+ const Typed_identifier* rcvr =
+ in_function->func_value()->type()->receiver();
+ if (rcvr != NULL)
+ {
+ Named_type* rcvr_type = rcvr->type()->deref()->named_type();
+ ret.append(Gogo::unpack_hidden_name(rcvr_type->name()));
+ ret.append(1, '.');
+ }
ret.append(Gogo::unpack_hidden_name(in_function->name()));
ret.append(1, '.');
if (index > 0)
@@ -9170,6 +9178,14 @@ Named_type::do_mangled_name(Gogo* gogo, std::string* ret) const
name.append(1, '.');
if (this->in_function_ != NULL)
{
+ const Typed_identifier* rcvr =
+ this->in_function_->func_value()->type()->receiver();
+ if (rcvr != NULL)
+ {
+ Named_type* rcvr_type = rcvr->type()->deref()->named_type();
+ name.append(Gogo::unpack_hidden_name(rcvr_type->name()));
+ name.append(1, '.');
+ }
name.append(Gogo::unpack_hidden_name(this->in_function_->name()));
name.append(1, '$');
if (this->in_function_index_ > 0)