diff mbox

Go patch committed: Fix names for types defined in functions

Message ID mcrobpp0y1i.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor May 16, 2012, 12:28 a.m. UTC
This patch to the Go frontend fixes the names used for types defined in
functions.  Without this patch the names would use whatever appeared in
the -fgo-pkgpath or -fgo-prefix strings, which were not required to be
valid assembler identifier characters.  There is no need to use the
pkgpath/prefix string in the function name, because it will already
appear before the type name anyhow.  Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r 0b6f2cebf185 go/gogo-tree.cc
--- a/go/gogo-tree.cc	Tue May 15 15:53:45 2012 -0700
+++ b/go/gogo-tree.cc	Tue May 15 17:22:41 2012 -0700
@@ -1003,7 +1003,7 @@ 
     {
       const Named_object* in_function = this->type_value()->in_function();
       if (in_function != NULL)
-	decl_name += '$' + in_function->name();
+	decl_name += '$' + Gogo::unpack_hidden_name(in_function->name());
     }
   return get_identifier_from_string(decl_name);
 }
diff -r 0b6f2cebf185 go/types.cc
--- a/go/types.cc	Tue May 15 15:53:45 2012 -0700
+++ b/go/types.cc	Tue May 15 17:22:41 2012 -0700
@@ -1748,7 +1748,7 @@ 
       base_name = name->name();
       const Named_object* in_function = name->in_function();
       if (in_function != NULL)
-	base_name += '$' + in_function->name();
+	base_name += '$' + Gogo::unpack_hidden_name(in_function->name());
     }
   std::string hash_name = base_name + "$hash";
   std::string equal_name = base_name + "$equal";