]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: trim function name prefix from escape diagnostics
authorMatthew Dempsky <mdempsky@google.com>
Thu, 12 Sep 2019 17:18:03 +0000 (10:18 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 16 Sep 2019 15:30:51 +0000 (15:30 +0000)
commit606019cb4b1c8fb57e5a83747ee0aff1054291d8
tree04ff2c4bbf57c97d339663d2d46999702983121d
parent4ae25ff1405f9d6b25f40141f42196e8f142f207
cmd/compile: trim function name prefix from escape diagnostics

This information is redundant with the position information already
provided. Also, no other -m diagnostics print out function name.

While here, report parameter leak diagnostics against the parameter
declaration position rather than the function, and use Warnl for
"moved to heap" messages.

Test cases updated programmatically by removing the first word from
every "no match for" error emitted by run.go:

go run run.go |& \
  sed -E -n 's/^(.*):(.*): no match for `([^ ]* (.*))` in:$/\1!\2!\3!\4/p' | \
  while IFS='!' read -r fn line before after; do
    before=$(echo "$before" | sed 's/[.[\*^$()+?{|]/\\&/g')
    after=$(echo "$after" | sed -E 's/(\&|\\)/\\&/g')
    fn=$(find . -name "${fn}" | head -1)
    sed -i -E -e "${line}s/\"${before}\"/\"${after}\"/" "${fn}"
  done

Passes toolstash-check.

Change-Id: I6e02486b1409e4a8dbb2b9b816d22095835426b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/195040
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
23 files changed:
src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/escape.go
test/escape2.go
test/escape2n.go
test/escape_array.go
test/escape_calls.go
test/escape_closure.go
test/escape_field.go
test/escape_iface.go
test/escape_indir.go
test/escape_param.go
test/escape_struct_param1.go
test/escape_struct_param2.go
test/fixedbugs/issue12006.go
test/fixedbugs/issue12588.go
test/fixedbugs/issue13799.go
test/fixedbugs/issue17318.go
test/fixedbugs/issue21709.go
test/fixedbugs/issue7921.go
test/inline.go
test/inline_big.go
test/linkname.dir/linkname1.go
test/live_syscall.go