Use the object's package to mangle method names, rather than the receiver's package
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 16 Dec 2014 20:04:55 +0000 (20:04 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 16 Dec 2014 20:04:55 +0000 (20:04 +0000)
commit545e7276a870c60d4d289b72b38e1529dae2acd7
treecfeafd7b8751eac4d296b85e50cd1fad1f33ed1c
parenta4a94f1b552a725ffdbc86b73c8939ea521552f7
Use the object's package to mangle method names, rather than the receiver's package

If we use the receiver's package, we can end up with identical manglings
for different functions. Consider:

package p
type U struct{}
func (U) f()

package q
import "p"
type T struct { p.U }
func (T) f()

The method set of *T has two synthetic methods named (*T).f(); one forwards to
(T).f(), and the other to (U).f(). Previously, we were distinguishing them
by the receiver's package, and in this case because both methods have the
same receiver, they received the same name.

The methods are correctly distinguished by the package owning the identifier
"f", which is available via f.Object().Pkg().

Differential Revision: http://reviews.llvm.org/D6673

llvm-svn: 224357
llgo/irgen/typemap.go
llgo/test/irgen/Inputs/mangling-synthetic-p.go [new file with mode: 0644]
llgo/test/irgen/mangling-dot.go [moved from llgo/test/irgen/mangling.go with 100% similarity]
llgo/test/irgen/mangling-synthetic.go [new file with mode: 0644]