mirror of
https://github.com/golang/go
synced 2024-11-26 18:06:55 -07:00
cmd/link: add ReflectMethod flag to -dumpdep output
Adds ReflectMethod flag to the output of -dumpdep. Fixes #60221 Change-Id: I631d72ee21b819a3a629780317ff4d962cc121e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/495715 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
d0c72c23dc
commit
0bbb54a02d
@ -325,15 +325,11 @@ func (d *deadcodePass) mark(symIdx, parent loader.Sym) {
|
||||
if *flagDumpDep {
|
||||
to := d.ldr.SymName(symIdx)
|
||||
if to != "" {
|
||||
if d.ldr.AttrUsedInIface(symIdx) {
|
||||
to += " <UsedInIface>"
|
||||
}
|
||||
to = d.dumpDepAddFlags(to, symIdx)
|
||||
from := "_"
|
||||
if parent != 0 {
|
||||
from = d.ldr.SymName(parent)
|
||||
if d.ldr.AttrUsedInIface(parent) {
|
||||
from += " <UsedInIface>"
|
||||
}
|
||||
from = d.dumpDepAddFlags(from, parent)
|
||||
}
|
||||
fmt.Printf("%s -> %s\n", from, to)
|
||||
}
|
||||
@ -341,6 +337,20 @@ func (d *deadcodePass) mark(symIdx, parent loader.Sym) {
|
||||
}
|
||||
}
|
||||
|
||||
func (d *deadcodePass) dumpDepAddFlags(name string, symIdx loader.Sym) string {
|
||||
var flags strings.Builder
|
||||
if d.ldr.AttrUsedInIface(symIdx) {
|
||||
flags.WriteString("<UsedInIface>")
|
||||
}
|
||||
if d.ldr.IsReflectMethod(symIdx) {
|
||||
flags.WriteString("<ReflectMethod>")
|
||||
}
|
||||
if flags.Len() > 0 {
|
||||
return name + " " + flags.String()
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
func (d *deadcodePass) markMethod(m methodref) {
|
||||
relocs := d.ldr.Relocs(m.src)
|
||||
d.mark(relocs.At(m.r).Sym(), m.src)
|
||||
|
Loading…
Reference in New Issue
Block a user