1
0
mirror of https://github.com/golang/go synced 2024-11-26 13:38:20 -07:00

cmd/compile: extend GOSSAFUNC match to well-formed package suffix match.

e.g., LeadingZeros, bits.LeadingZeros, math/bits.LeadingZeros
but not its.LeadingZeros

Change-Id: Ib9a57e4db0af03c55bf5b5027aa6f8a5a84f2134
Reviewed-on: https://go-review.googlesource.com/c/go/+/312291
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
David Chase 2021-04-21 10:30:25 -04:00
parent e7db792fc5
commit 70deaa33eb

View File

@ -399,8 +399,10 @@ func okOffset(offset int64) int64 {
func buildssa(fn *ir.Func, worker int) *ssa.Func {
name := ir.FuncName(fn)
printssa := false
if ssaDump != "" { // match either a simple name e.g. "(*Reader).Reset", or a package.name e.g. "compress/gzip.(*Reader).Reset"
printssa = name == ssaDump || base.Ctxt.Pkgpath+"."+name == ssaDump
if ssaDump != "" { // match either a simple name e.g. "(*Reader).Reset", package.name e.g. "compress/gzip.(*Reader).Reset", or subpackage name "gzip.(*Reader).Reset"
pkgDotName := base.Ctxt.Pkgpath+"."+name
printssa = name == ssaDump ||
strings.HasSuffix(pkgDotName, ssaDump) && (pkgDotName == ssaDump || strings.HasSuffix(pkgDotName, "/"+ssaDump))
}
var astBuf *bytes.Buffer
if printssa {