Back to godoc.org

Package ctrlflow

v0.0.0-...-c9a70fc
Latest Go to latest

The latest major version is .

Published: Sep 16, 2020 | License: BSD-3-Clause | Module: golang.org/x/tools

Overview

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

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

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

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

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

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier