mirror of
https://github.com/golang/go
synced 2024-11-19 00:14:39 -07:00
go/callgraph: add "concurrent" or "deferred" prefix to (*Edge).Description
Fixes golang/go#11518 Change-Id: If6c86c1995c0b6a1226deedaa1713947baa6593a Reviewed-on: https://go-review.googlesource.com/12085 Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
This commit is contained in:
parent
4cd43f3077
commit
543085f0ec
@ -101,10 +101,16 @@ func (e Edge) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e Edge) Description() string {
|
func (e Edge) Description() string {
|
||||||
if e.Site == nil {
|
var prefix string
|
||||||
|
switch e.Site.(type) {
|
||||||
|
case nil:
|
||||||
return "synthetic call"
|
return "synthetic call"
|
||||||
|
case *ssa.Go:
|
||||||
|
prefix = "concurrent "
|
||||||
|
case *ssa.Defer:
|
||||||
|
prefix = "deferred "
|
||||||
}
|
}
|
||||||
return e.Site.Common().Description()
|
return prefix + e.Site.Common().Description()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e Edge) Pos() token.Pos {
|
func (e Edge) Pos() token.Pos {
|
||||||
|
4
oracle/testdata/src/calls/main.go
vendored
4
oracle/testdata/src/calls/main.go
vendored
@ -45,8 +45,8 @@ func call(f func() *int) {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var a, b int
|
var a, b int
|
||||||
apply(A, &a) // @callees callees-main-apply1 "app"
|
go apply(A, &a) // @callees callees-main-apply1 "app"
|
||||||
apply(B, &b)
|
defer apply(B, &b)
|
||||||
|
|
||||||
var c, d int
|
var c, d int
|
||||||
var pc, pd *int // @pointsto pointsto-pc "pc"
|
var pc, pd *int // @pointsto pointsto-pc "pc"
|
||||||
|
6
oracle/testdata/src/calls/main.golden
vendored
6
oracle/testdata/src/calls/main.golden
vendored
@ -7,7 +7,7 @@ this *int may point to these objects:
|
|||||||
Found a call path from root to main.A
|
Found a call path from root to main.A
|
||||||
main.A
|
main.A
|
||||||
dynamic function call from main.apply
|
dynamic function call from main.apply
|
||||||
static function call from main.main
|
concurrent static function call from main.main
|
||||||
|
|
||||||
-------- @pointsto pointsto-B-x --------
|
-------- @pointsto pointsto-B-x --------
|
||||||
this *int may point to these objects:
|
this *int may point to these objects:
|
||||||
@ -25,8 +25,8 @@ this dynamic function call dispatches to:
|
|||||||
|
|
||||||
-------- @callers callers-apply --------
|
-------- @callers callers-apply --------
|
||||||
main.apply is called from these 2 sites:
|
main.apply is called from these 2 sites:
|
||||||
static function call from main.main
|
concurrent static function call from main.main
|
||||||
static function call from main.main
|
deferred static function call from main.main
|
||||||
|
|
||||||
-------- @callers callers-store --------
|
-------- @callers callers-store --------
|
||||||
main.store is called from these 2 sites:
|
main.store is called from these 2 sites:
|
||||||
|
Loading…
Reference in New Issue
Block a user