mirror of
https://github.com/golang/go
synced 2024-11-21 17:24:42 -07:00
gc: treat DOTMETH like DOT in escape analysis.
Fixes #2225 R=rsc, nigeltao, dave CC=bradfitz, golang-dev, mikioh.mikioh https://golang.org/cl/4972056
This commit is contained in:
parent
e85fb2137b
commit
f2460a8c57
@ -398,6 +398,8 @@ escassign(Node *dst, Node *src)
|
|||||||
case OCONVIFACE:
|
case OCONVIFACE:
|
||||||
case OCONVNOP:
|
case OCONVNOP:
|
||||||
case ODOT:
|
case ODOT:
|
||||||
|
case ODOTMETH: // treat recv.meth as a value with recv in it, only happens in ODEFER and OPROC
|
||||||
|
// iface.method already leaks iface in esccall, no need to put in extra ODOTINTER edge here
|
||||||
case ODOTTYPE:
|
case ODOTTYPE:
|
||||||
case ODOTTYPE2:
|
case ODOTTYPE2:
|
||||||
case OSLICE:
|
case OSLICE:
|
||||||
|
@ -127,6 +127,10 @@ func (b *Bar) AlsoNoLeak() *int { // ERROR "b does not escape"
|
|||||||
return b.ii
|
return b.ii
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func goLeak(b *Bar) { // ERROR "leaking param: NAME-b"
|
||||||
|
go b.NoLeak()
|
||||||
|
}
|
||||||
|
|
||||||
type Bar2 struct {
|
type Bar2 struct {
|
||||||
i [12]int
|
i [12]int
|
||||||
ii []int
|
ii []int
|
||||||
@ -395,6 +399,10 @@ func foo64(m M) { // ERROR "leaking param: NAME-m"
|
|||||||
m.M()
|
m.M()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func foo64b(m M) { // ERROR "leaking param: NAME-m"
|
||||||
|
defer m.M()
|
||||||
|
}
|
||||||
|
|
||||||
type MV int
|
type MV int
|
||||||
|
|
||||||
func (MV) M() {}
|
func (MV) M() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user