Documentation
¶
Overview ¶
Package ssautil contains shared helpers for SSA-backed analyzers. Its API is unsupported and may change without notice.
Index ¶
- func AliasesValue(value, target ssa.Value) bool
- func CallName(common *ssa.CallCommon) string
- func CallPackage(common *ssa.CallCommon) string
- func CallReceiver(common *ssa.CallCommon) ssa.Value
- func CallReturnsDeferredCleanup(instruction ssa.Instruction, value ssa.Value) bool
- func CallTransfersValueToField(instruction ssa.Instruction, value ssa.Value) bool
- func CapturedBindingAliases(binding, target ssa.Value) bool
- func CapturedBindingValue(binding ssa.Value) ssa.Value
- func ChannelType(value ssa.Value) bool
- func ClosureCallsMethod(instruction ssa.Instruction, method string, target ssa.Value) bool
- func ClosureCallsMethodBeforeBranch(instruction ssa.Instruction, method string, target ssa.Value) bool
- func ClosureCallsValue(instruction ssa.Instruction, target ssa.Value) bool
- func ClosureCapturesValue(instruction ssa.Instruction, value ssa.Value) bool
- func ClosureOwnsValue(instruction ssa.Instruction, value ssa.Value) bool
- func DeferredClosureCalls(instruction ssa.Instruction, method string, target ssa.Value) bool
- func DeferredClosureCallsValue(instruction ssa.Instruction, target ssa.Value) bool
- func DefinitelyNil(value ssa.Value) bool
- func ExternallyOwnedValue(value ssa.Value) bool
- func FeasibleSuccessors(block, predecessor *ssa.BasicBlock) []*ssa.BasicBlock
- func FunctionFile(pass *analysis.Pass, function *ssa.Function) *ast.File
- func InstructionCall(instruction ssa.Instruction) *ssa.CallCommon
- func InstructionIndex(instruction ssa.Instruction) int
- func ReachableReturns(start ssa.Instruction) []*ssa.Return
- func ReturnedValueOwnsValue(returned *ssa.Return, value ssa.Value) bool
- func SourceSSAFunctions(pass *analysis.Pass) ([]*ssa.Function, error)
- func StoresOwnerOfValueInField(instruction ssa.Instruction, value ssa.Value) bool
- func StoresValueInField(instruction ssa.Instruction, value ssa.Value) bool
- func StoresValueInGlobal(instruction ssa.Instruction, value ssa.Value) bool
- func StoresValueInOwnedMap(instruction ssa.Instruction, value ssa.Value) bool
- func UnownedReturn(start ssa.Instruction, owns func(ssa.Instruction) bool, ...) bool
- func UnownedReturnFromEntry(function *ssa.Function, owns func(ssa.Instruction) bool) bool
- func ValueCallsMethod(value ssa.Value, method string, target ssa.Value) bool
- func ValueCallsValue(value, target ssa.Value) bool
- func ValueSources(value ssa.Value) map[ssa.Value]bool
- func ValuesShareErrorSource(left, right ssa.Value) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AliasesValue ¶
AliasesValue reports conservative SSA identity through common conversion and storage forms.
func CallName ¶
func CallName(common *ssa.CallCommon) string
CallName returns statically known method, function, or builtin name.
func CallPackage ¶
func CallPackage(common *ssa.CallCommon) string
CallPackage returns statically known package path for a call.
func CallReceiver ¶
func CallReceiver(common *ssa.CallCommon) ssa.Value
CallReceiver returns receiver value for method calls and invocations.
func CallReturnsDeferredCleanup ¶
func CallReturnsDeferredCleanup(instruction ssa.Instruction, value ssa.Value) bool
CallReturnsDeferredCleanup reports whether a call consumes value and one of its function results is subsequently deferred by the caller.
func CallTransfersValueToField ¶
func CallTransfersValueToField(instruction ssa.Instruction, value ssa.Value) bool
CallTransfersValueToField reports whether a call consumes value and stores its result in a struct field, transferring cleanup to the receiving owner.
func CapturedBindingAliases ¶
CapturedBindingAliases reports whether a closure binding directly contains target or refers to an addressable local that has contained target. Unlike CapturedBindingValue, it handles variables reassigned before a callback is installed without depending on referrer iteration order.
func CapturedBindingValue ¶
CapturedBindingValue recovers value stored through an addressable closure binding.
func ChannelType ¶
ChannelType reports whether value has channel type.
func ClosureCallsMethod ¶
ClosureCallsMethod reports whether a call-like closure calls method on target. It maps both captured free variables and explicit closure parameters back to the values supplied by the enclosing function.
func ClosureCallsMethodBeforeBranch ¶
func ClosureCallsMethodBeforeBranch(instruction ssa.Instruction, method string, target ssa.Value) bool
ClosureCallsMethodBeforeBranch reports whether a called function invokes method on target along an unconditional path from its entry block.
func ClosureCallsValue ¶
func ClosureCallsValue(instruction ssa.Instruction, target ssa.Value) bool
ClosureCallsValue reports whether a call-like closure or created callback calls target.
func ClosureCapturesValue ¶
func ClosureCapturesValue(instruction ssa.Instruction, value ssa.Value) bool
ClosureCapturesValue reports whether instruction creates a closure that owns value.
func ClosureOwnsValue ¶
func ClosureOwnsValue(instruction ssa.Instruction, value ssa.Value) bool
ClosureOwnsValue reports whether a started closure captures value.
func DeferredClosureCalls ¶
DeferredClosureCalls reports whether deferred closure calls method on target.
func DeferredClosureCallsValue ¶
func DeferredClosureCallsValue(instruction ssa.Instruction, target ssa.Value) bool
DeferredClosureCallsValue reports whether a deferred closure calls target.
func DefinitelyNil ¶
DefinitelyNil reports whether every represented SSA value is nil.
func ExternallyOwnedValue ¶
ExternallyOwnedValue reports whether value comes from storage that outlives the current function invocation.
func FeasibleSuccessors ¶
func FeasibleSuccessors(block, predecessor *ssa.BasicBlock) []*ssa.BasicBlock
FeasibleSuccessors preserves constants selected by predecessor-sensitive phis. This prevents impossible first-iteration loop exits from faking leaks.
func FunctionFile ¶
FunctionFile returns source file containing function.
func InstructionCall ¶
func InstructionCall(instruction ssa.Instruction) *ssa.CallCommon
InstructionCall returns call metadata carried by call-like SSA instructions.
func InstructionIndex ¶
func InstructionIndex(instruction ssa.Instruction) int
InstructionIndex returns instruction position within its basic block.
func ReachableReturns ¶
func ReachableReturns(start ssa.Instruction) []*ssa.Return
ReachableReturns returns normal returns reachable after start.
func ReturnedValueOwnsValue ¶
ReturnedValueOwnsValue reports whether a returned aggregate contains value in one of its fields. This recognizes constructors that transfer cleanup to a newly returned owner instead of returning the resource itself.
func SourceSSAFunctions ¶
SourceSSAFunctions returns non-generated source functions from buildssa results.
func StoresOwnerOfValueInField ¶
func StoresOwnerOfValueInField(instruction ssa.Instruction, value ssa.Value) bool
StoresOwnerOfValueInField reports whether instruction stores a callback or aggregate that transitively captures value into a struct field.
func StoresValueInField ¶
func StoresValueInField(instruction ssa.Instruction, value ssa.Value) bool
StoresValueInField reports whether instruction transfers value into a struct field.
func StoresValueInGlobal ¶
func StoresValueInGlobal(instruction ssa.Instruction, value ssa.Value) bool
StoresValueInGlobal reports whether instruction transfers value into package-owned storage.
func StoresValueInOwnedMap ¶
func StoresValueInOwnedMap(instruction ssa.Instruction, value ssa.Value) bool
StoresValueInOwnedMap reports whether instruction transfers value into a map that belongs to a caller, receiver, closure, or package owner.
func UnownedReturn ¶
func UnownedReturn( start ssa.Instruction, owns func(ssa.Instruction) bool, allowReturn func(*ssa.Return) bool, ) bool
UnownedReturn reports whether any normal return reachable after start lacks an ownership action. Tracking owned state through CFG makes conditional cleanup visible without pretending infeasible branches are impossible.
func UnownedReturnFromEntry ¶
UnownedReturnFromEntry reports whether any normal return lacks an ownership action.
func ValueCallsMethod ¶
ValueCallsMethod reports whether value is, or wraps, a callback that invokes method on target.
func ValueCallsValue ¶
ValueCallsValue reports whether value is, or wraps, a callback that invokes target. It follows common callback wrappers and addressable locals so callers can recognize cleanup registered through higher-order APIs.
func ValueSources ¶
ValueSources returns error-bearing SSA values contributing to value.
func ValuesShareErrorSource ¶
ValuesShareErrorSource reports whether values derive from one error-bearing SSA value.
Types ¶
This section is empty.