...
Package ctrlflow
import "cmd/vendor/golang.org/x/tools/go/analysis/passes/ctrlflow"
- Overview
- Index
Package ctrlflow is an analysis that provides a syntactic
control-flow graph (CFG) for the body of a function.
It records whether a function cannot return.
By itself, it does not report any diagnostics.
In the call graph viewer below, each node
is a function belonging to this package
and its children are the functions it
calls—perhaps dynamically.
The root nodes are the entry points of the
package: functions that may be called from
outside the package.
There may be non-exported or anonymous
functions among them if they are called
dynamically from another package.
Click a node to visit that function's source code.
From there you can visit its callers by
clicking its declaring func
token.
Functions may be omitted if they were
determined to be unreachable in the
particular programs or tests that were
analyzed.
Variables
var Analyzer = &analysis.Analyzer{
Name: "ctrlflow",
Doc: "build a control-flow graph",
Run: run,
ResultType: reflect.TypeOf(new(CFGs)),
FactTypes: []analysis.Fact{new(noReturn)},
Requires: []*analysis.Analyzer{inspect.Analyzer},
}
type CFGs struct {
}
A CFGs holds the control-flow graphs
for all the functions of the current package.
func (c *CFGs) FuncDecl(decl *ast.FuncDecl) *cfg.CFG
FuncDecl returns the control-flow graph for a named function.
It returns nil if decl.Body==nil.
func (c *CFGs) FuncLit(lit *ast.FuncLit) *cfg.CFG
FuncLit returns the control-flow graph for a literal function.