mirror of
https://github.com/golang/go.git
synced 2025-10-26 14:24:14 +00:00
[dev.regabi] all: merge master (ff0e93e) into dev.regabi
Conflicts: - src/cmd/compile/internal/gc/walk.go gc/walk.go is changed in CL 290950 on the master branch but deleted in the dev.regabi branch and moved over to the walk package. This CL includes porting CL 290950 over to the new walk. Merge List: + 2021-02-12ff0e93ea31doc/go1.16: note that package path elements beginning with '.' are disallowed + 2021-02-11249da7ec02CONTRIBUTORS: update for the Go 1.16 release + 2021-02-11864d4f1c6bcmd/go: multiple small 'go help' fixes + 2021-02-1126ceae85a8spec: More precise wording in section on function calls. + 2021-02-11930c2c9a68cmd/go: reject embedded files that can't be packed into modules + 2021-02-11e5b08e6d5cio/fs: allow backslash in ValidPath, reject in os.DirFS.Open + 2021-02-10ed8079096fcmd/compile: mark concrete call of reflect.(*rtype).Method as REFLECTMETHOD + 2021-02-09e9c9683597cmd/go: suppress errors from 'go get -d' for packages that only conditionally exist + 2021-02-09e0ac989cf3archive/tar: detect out of bounds accesses in PAX records resulting from padded lengths + 2021-02-09c9d6f45fecruntime/metrics: fix a couple of documentation typpos + 2021-02-09cea4e21b52io/fs: backslash is always a glob meta character + 2021-02-08dc725bfb3cdoc/go1.16: mention new vet check for asn1.Unmarshal Change-Id: Ib28fffa7dfbff7f6cdbfaf4a304757fead7bbf19
This commit is contained in:
commit
d1fd9a8863
22 changed files with 499 additions and 56 deletions
|
|
@ -480,8 +480,12 @@ func walkAddString(n *ir.AddStringExpr, init *ir.Nodes) ir.Node {
|
|||
|
||||
// walkCall walks an OCALLFUNC, OCALLINTER, or OCALLMETH node.
|
||||
func walkCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {
|
||||
if n.Op() == ir.OCALLINTER {
|
||||
if n.Op() == ir.OCALLINTER || n.Op() == ir.OCALLMETH {
|
||||
// We expect both interface call reflect.Type.Method and concrete
|
||||
// call reflect.(*rtype).Method.
|
||||
usemethod(n)
|
||||
}
|
||||
if n.Op() == ir.OCALLINTER {
|
||||
reflectdata.MarkUsedIfaceMethod(n)
|
||||
}
|
||||
|
||||
|
|
@ -899,6 +903,16 @@ func usemethod(n *ir.CallExpr) {
|
|||
}
|
||||
}
|
||||
|
||||
// Don't mark reflect.(*rtype).Method, etc. themselves in the reflect package.
|
||||
// Those functions may be alive via the itab, which should not cause all methods
|
||||
// alive. We only want to mark their callers.
|
||||
if base.Ctxt.Pkgpath == "reflect" {
|
||||
switch ir.CurFunc.Nname.Sym().Name { // TODO: is there a better way than hardcoding the names?
|
||||
case "(*rtype).Method", "(*rtype).MethodByName", "(*interfaceType).Method", "(*interfaceType).MethodByName":
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Note: Don't rely on res0.Type.String() since its formatting depends on multiple factors
|
||||
// (including global variables such as numImports - was issue #19028).
|
||||
// Also need to check for reflect package itself (see Issue #38515).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue