cmd/compile: trim more unnecessary escape analysis messages

"leaking closure reference" is redundant for similar reasons as "&x
escapes to heap" for OADDR nodes: the reference itself does not
allocate, and we already report when the referenced variable is moved
to heap.

"mark escaped content" is redundant with "leaking param content".

Updates #23109.

Change-Id: I1ab599cb1e8434f1918dd80596a70cba7dc8a0cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/170321
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Matthew Dempsky 2019-04-01 14:01:58 -07:00
parent e29f74efb9
commit 131eb8fbf8
4 changed files with 28 additions and 36 deletions

View file

@ -26,7 +26,7 @@ func bff(a, b *string) U { // ERROR "leaking param: a to result ~r2 level=0$" "l
func tbff1() *string {
a := "cat"
b := "dog" // ERROR "moved to heap: b$"
b := "dog" // ERROR "moved to heap: b$"
u := bff(&a, &b)
_ = u[0]
return &b
@ -34,8 +34,8 @@ func tbff1() *string {
// BAD: need fine-grained analysis to track u[0] and u[1] differently.
func tbff2() *string {
a := "cat" // ERROR "moved to heap: a$"
b := "dog" // ERROR "moved to heap: b$"
a := "cat" // ERROR "moved to heap: a$"
b := "dog" // ERROR "moved to heap: b$"
u := bff(&a, &b)
_ = u[0]
return u[1]
@ -71,7 +71,7 @@ func fuo(x *U, y *U) *string { // ERROR "leaking param: x to result ~r2 level=1$
// pointers stored in small array literals do not escape;
// large array literals are heap allocated;
// pointers stored in large array literals escape.
func hugeLeaks1(x **string, y **string) { // ERROR "leaking param content: x" "hugeLeaks1 y does not escape" "mark escaped content: x"
func hugeLeaks1(x **string, y **string) { // ERROR "leaking param content: x" "hugeLeaks1 y does not escape"
a := [10]*string{*y}
_ = a
// 4 x 4,000,000 exceeds MaxStackVarSize, therefore it must be heap allocated if pointers are 4 bytes or larger.