analysis

package
v0.3.5-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "v0.3.5-alpha"

Version is the last tagged version of the analysis tool

Variables

This section is empty.

Functions

func ClosureLocationsStats

func ClosureLocationsStats(log *log.Logger, functions *map[*ssa.Function]bool, withPkgPrefix string)

ClosureLocationsStats logs information about the number of closures in each function in the map, focusing on those functions whose package name starts with interestPrefix

Types

type ClosureUsageStatistics

type ClosureUsageStatistics struct {
	// AnonsCapturingChannels is the set of anonymous functions capturing channels
	AnonsCapturingChannels map[*ssa.Function]bool
	// TotalAnonCalls is the total number of anonymous functions called
	TotalAnonCalls int
	// TotalAnonFunctions is the total number of anonymous functions defined
	TotalAnonFunctions int
	// TotalMakeClosures is the total number of closure creations
	TotalMakeClosures int
	// ClosuresCalled maps call instructions to the instruction where the closure is created
	ClosuresCalled map[ssa.CallInstruction]ssa.Instruction
	// ClosuresImmediatelyCalled is the set of instructions where a closure is immediately called
	ClosuresImmediatelyCalled map[ssa.Instruction]bool
	// ClosuresNoClass is the set of closures that have not been classified in ClosuresImmediatelyCalled,
	// ClosuresPassedAsArgs or ClosuresReturned
	ClosuresNoClass map[ssa.Instruction]bool
	// ClosuresPassedAsArgs is the set of call instructions where a closure is passed as an argument
	ClosuresPassedAsArgs map[ssa.CallInstruction]ssa.Instruction
	// ClosuresReturned is the set of instructions where a closure is being returned by a function
	ClosuresReturned map[ssa.Instruction]bool
}

ClosureUsageStatistics is a simple record that contains information about usage of closures in a program

func ComputeClosureUsageStats

func ComputeClosureUsageStats(state *dataflow.State) (ClosureUsageStatistics, error)

ComputeClosureUsageStats computes statistics about the usage of closures in the program contained in the state. This requires the pointer analysis to have been computed in the state.

type DeferStat

type DeferStat struct {
	NumDefers    int
	NumRunDefers int
}

DeferStat is a statistic for a single function

type DeferStatsResult

type DeferStatsResult struct {
	NumFunctionsWithDefers  int
	NumDefers               int
	NumRunDefers            int
	FunctionsWithManyDefers map[string]DeferStat
}

DeferStatsResult holds the information gathered by DeferStats on defers

func DeferStats

func DeferStats(functions *map[*ssa.Function]bool) DeferStatsResult

DeferStats logs information about the number of defers in each functions in the map

type Result

type Result struct {
	NumberOfFunctions         uint
	NumberOfNonemptyFunctions uint
	NumberOfBlocks            uint
	NumberOfInstructions      uint
}

Result contains the simple statistics returned by running the SSAStatistics function

func SSAStatistics

func SSAStatistics(functions *map[*ssa.Function]bool, exclude []string) Result

SSAStatistics returns a Result with general statistics about the SSA representation of the functions. The exclude parameter is currently ignored.

Directories

Path Synopsis
Package backtrace defines a dataflow analysis that finds all the backwards dataflow paths from an entrypoint.
Package backtrace defines a dataflow analysis that finds all the backwards dataflow paths from an entrypoint.
Package config provides a simple way to manage configuration files.
Package config provides a simple way to manage configuration files.
Package dataflow implements the core of the dataflow analysis.
Package dataflow implements the core of the dataflow analysis.
Package defers implements an analysis that determines which set of defer instructions can reach each program point.
Package defers implements an analysis that determines which set of defer instructions can reach each program point.
Package escape provides an escape analysis which computes a representation of which references in the program are to objects that are local to the current function and goroutine.
Package escape provides an escape analysis which computes a representation of which references in the program are to objects that are local to the current function and goroutine.
Package lang contains functions to help manipulate different objects representing elements of the Go language and the ssa.
Package lang contains functions to help manipulate different objects representing elements of the Go language and the ssa.
Package render provides functions to build a inter-procedural dataflow graph.
Package render provides functions to build a inter-procedural dataflow graph.
Package summaries defines how data flow information can be summarized for a given function.
Package summaries defines how data flow information can be summarized for a given function.
Package syntactic contains syntactic analyses.
Package syntactic contains syntactic analyses.
structinit
Package structinit implements the struct initialization syntactic analysis.
Package structinit implements the struct initialization syntactic analysis.
Package taint implements most of the taint analysis functionality.
Package taint implements most of the taint analysis functionality.

Jump to

Keyboard shortcuts

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