tools: golang.org/x/tools/go/analysis/passes/ctrlflow Index | Files

package ctrlflow

import "golang.org/x/tools/go/analysis/passes/ctrlflow"

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.

Index

Package Files

ctrlflow.go

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 Uses

type CFGs struct {
    // contains filtered or unexported fields
}

A CFGs holds the control-flow graphs for all the functions of the current package.

func (*CFGs) FuncDecl Uses

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 (*CFGs) FuncLit Uses

func (c *CFGs) FuncLit(lit *ast.FuncLit) *cfg.CFG

FuncLit returns the control-flow graph for a literal function.

Package ctrlflow imports 9 packages (graph) and is imported by 2 packages. Updated 2019-07-19. Refresh now. Tools for package owners.