aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2015-09-01 22:25:08 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-09-01 22:25:08 +0000
commit6b4d4e7bb3634f332ef0126f9a98cc3201422409 (patch)
treebe4b44baa81fcd5a86d59d89541be78b917d51c5
parentbc8f94bf85cf8ecc1b651e7d97030c3dac8df670 (diff)
parent543085f0ecbe65f1dd183883c76b604564d740ab (diff)
downloadtools-6b4d4e7bb3634f332ef0126f9a98cc3201422409.tar.gz
go/callgraph: add "concurrent" or "deferred" prefix to (*Edge).Description
automerge: 543085f * commit '543085f0ecbe65f1dd183883c76b604564d740ab': go/callgraph: add "concurrent" or "deferred" prefix to (*Edge).Description
-rw-r--r--go/callgraph/callgraph.go10
-rw-r--r--oracle/testdata/src/calls/main.go4
-rw-r--r--oracle/testdata/src/calls/main.golden6
3 files changed, 13 insertions, 7 deletions
diff --git a/go/callgraph/callgraph.go b/go/callgraph/callgraph.go
index dad8c22..707a319 100644
--- a/go/callgraph/callgraph.go
+++ b/go/callgraph/callgraph.go
@@ -101,10 +101,16 @@ func (e Edge) String() string {
}
func (e Edge) Description() string {
- if e.Site == nil {
+ var prefix string
+ switch e.Site.(type) {
+ case nil:
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 {
diff --git a/oracle/testdata/src/calls/main.go b/oracle/testdata/src/calls/main.go
index 6fdff95..54bb895 100644
--- a/oracle/testdata/src/calls/main.go
+++ b/oracle/testdata/src/calls/main.go
@@ -45,8 +45,8 @@ func call(f func() *int) {
func main() {
var a, b int
- apply(A, &a) // @callees callees-main-apply1 "app"
- apply(B, &b)
+ go apply(A, &a) // @callees callees-main-apply1 "app"
+ defer apply(B, &b)
var c, d int
var pc, pd *int // @pointsto pointsto-pc "pc"
diff --git a/oracle/testdata/src/calls/main.golden b/oracle/testdata/src/calls/main.golden
index f6bfb0e..b5e6547 100644
--- a/oracle/testdata/src/calls/main.golden
+++ b/oracle/testdata/src/calls/main.golden
@@ -7,7 +7,7 @@ this *int may point to these objects:
Found a call path from root to main.A
main.A
dynamic function call from main.apply
-static function call from main.main
+concurrent static function call from main.main
-------- @pointsto pointsto-B-x --------
this *int may point to these objects:
@@ -25,8 +25,8 @@ this dynamic function call dispatches to:
-------- @callers callers-apply --------
main.apply is called from these 2 sites:
- static function call from main.main
- static function call from main.main
+ concurrent static function call from main.main
+ deferred static function call from main.main
-------- @callers callers-store --------
main.store is called from these 2 sites: