aboutsummaryrefslogtreecommitdiff
path: root/vendor/honnef.co/go/tools/callgraph/static
diff options
context:
space:
mode:
authorJoseph Richey <joerichey@google.com>2018-08-30 13:41:49 -0700
committerGitHub <noreply@github.com>2018-08-30 13:41:49 -0700
commit0f451a722918f39fa07bd9337e4a14ca154b13ae (patch)
tree9868ffed8cb74357a06e63b88c56d71b13b415af /vendor/honnef.co/go/tools/callgraph/static
parent1e1b67dae6c3ae3b5acb5ce377b01b286c3e676b (diff)
parent1c9bafdec78b8f238a82314b6d9c566a951486c2 (diff)
Merge pull request #107 from google/mod
Use Go Modules and support Go 1.11 building
Diffstat (limited to 'vendor/honnef.co/go/tools/callgraph/static')
-rw-r--r--vendor/honnef.co/go/tools/callgraph/static/static.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/vendor/honnef.co/go/tools/callgraph/static/static.go b/vendor/honnef.co/go/tools/callgraph/static/static.go
deleted file mode 100644
index 5444e84..0000000
--- a/vendor/honnef.co/go/tools/callgraph/static/static.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Package static computes the call graph of a Go program containing
-// only static call edges.
-package static // import "honnef.co/go/tools/callgraph/static"
-
-import (
- "honnef.co/go/tools/callgraph"
- "honnef.co/go/tools/ssa"
- "honnef.co/go/tools/ssa/ssautil"
-)
-
-// CallGraph computes the call graph of the specified program
-// considering only static calls.
-//
-func CallGraph(prog *ssa.Program) *callgraph.Graph {
- cg := callgraph.New(nil) // TODO(adonovan) eliminate concept of rooted callgraph
-
- // TODO(adonovan): opt: use only a single pass over the ssa.Program.
- // TODO(adonovan): opt: this is slower than RTA (perhaps because
- // the lower precision means so many edges are allocated)!
- for f := range ssautil.AllFunctions(prog) {
- fnode := cg.CreateNode(f)
- for _, b := range f.Blocks {
- for _, instr := range b.Instrs {
- if site, ok := instr.(ssa.CallInstruction); ok {
- if g := site.Common().StaticCallee(); g != nil {
- gnode := cg.CreateNode(g)
- callgraph.AddEdge(fnode, site, gnode)
- }
- }
- }
- }
- }
-
- return cg
-}