reachability

package
v0.3.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindReachable

func FindReachable(state *dataflow.AnalyzerState, excludeMain bool, excludeInit bool, graph DependencyGraph) map[*ssa.Function]bool

FindReachable traverses the call graph starting from the given entry points to find all reachable functions.

It takes a program, a flag for whether to exclude the main function, a flag for whether to exclude init functions, and an optional dependency graph to record cross-package function calls.

The return value is a map from reachable *ssa.Function values to true.

func ReachableFunctionsAnalysis

func ReachableFunctionsAnalysis(state *dataflow.AnalyzerState, excludeMain bool, excludeInit bool, jsonFlag bool)

ReachableFunctionsAnalysis runs the reachable function analysis. Main and Init can be excluded using the boolean flags. The analysis prints the reachable functions on standard output.

Types

type DependencyGraph

type DependencyGraph map[string]*Entry

A DependencyGraph records package dependencies

func NewDependencyGraph

func NewDependencyGraph() DependencyGraph

NewDependencyGraph returns a new DependencyGraph

func (DependencyGraph) Add

func (dg DependencyGraph) Add(depender string, dependee string)

Add adds a dependency to the graph

func (DependencyGraph) Cycles

func (dg DependencyGraph) Cycles() bool

Cycles returns a boolean indicating whether there is a cycle in the graph or not

func (DependencyGraph) DumpAsGraphviz

func (dg DependencyGraph) DumpAsGraphviz(filename string, includeStdlib bool)

DumpAsGraphviz dumps the graph in its graphviz format in the file with the name provided

type Entry

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

Entry is an entry of a dependency graph, containing the name of the package along with the packages its depends on and the packages that depend on it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL