Documentation ¶
Index ¶
- Variables
- func AddLock(funcState *domain.BlockState, call *ssa.CallCommon, isUnlock bool)
- func Create(t *testing.T, path, fileName string) *ssa.Package
- func EqualDifferentOrder(a, b []*domain.GuardedAccess) bool
- func FindGA(GuardedAccesses []*domain.GuardedAccess, ...) *domain.GuardedAccess
- func FindGAWithFail(t *testing.T, GuardedAccesses []*domain.GuardedAccess, ...) *domain.GuardedAccess
- func FindMultipleGA(GuardedAccesses []*domain.GuardedAccess, ...) []*domain.GuardedAccess
- func FindMultipleGAWithFail(t *testing.T, GuardedAccesses []*domain.GuardedAccess, ...) []*domain.GuardedAccess
- func GetBlockSummary(context *domain.Context, block *ssa.BasicBlock) *domain.BlockState
- func GetConstString(v *ssa.Const) string
- func GetGlobalString(v *ssa.Global) string
- func GetMethodImplementations(recv types.Type, method *types.Func) []*ssa.Function
- func GetStackTrace(prog *ssa.Program, ga *domain.GuardedAccess) string
- func HandleBuiltin(functionState *domain.BlockState, context *domain.Context, ...)
- func HandleCallCommon(context *domain.Context, callCommon *ssa.CallCommon, pos token.Pos) *domain.BlockState
- func HandleFunction(context *domain.Context, fn *ssa.Function) *domain.BlockState
- func HandleInstruction(functionState *domain.BlockState, context *domain.Context, ins ssa.Instruction)
- func InitPreProcess(prog *ssa.Program, defaultModulePath string) error
- func IsGARead(ga *domain.GuardedAccess) bool
- func IsGAWrite(ga *domain.GuardedAccess) bool
- func LoadMain(t *testing.T, filePath string) (*ssa.Function, *ssa.Package)
- func LoadPackage(path, modulePath string) (*ssa.Program, *ssa.Package, error)
- type CFG
- type FunctionWithLocksPreprocess
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLoadPackages = errors.New("loading the following file contained errors")
View Source
var ErrNoPackages = errors.New("no packages in the path")
View Source
var GlobalModuleName string
View Source
var GlobalProgram *ssa.Program
Functions ¶
func AddLock ¶
func AddLock(funcState *domain.BlockState, call *ssa.CallCommon, isUnlock bool)
func EqualDifferentOrder ¶
func EqualDifferentOrder(a, b []*domain.GuardedAccess) bool
func FindGA ¶
func FindGA(GuardedAccesses []*domain.GuardedAccess, validationFunc func(value *domain.GuardedAccess) bool) *domain.GuardedAccess
func FindGAWithFail ¶
func FindGAWithFail(t *testing.T, GuardedAccesses []*domain.GuardedAccess, validationFunc func(value *domain.GuardedAccess) bool) *domain.GuardedAccess
func FindMultipleGA ¶
func FindMultipleGA(GuardedAccesses []*domain.GuardedAccess, validationFunc func(value *domain.GuardedAccess) bool) []*domain.GuardedAccess
func FindMultipleGAWithFail ¶
func FindMultipleGAWithFail(t *testing.T, GuardedAccesses []*domain.GuardedAccess, validationFunc func(value *domain.GuardedAccess) bool, expectedAmount int) []*domain.GuardedAccess
func GetBlockSummary ¶
func GetBlockSummary(context *domain.Context, block *ssa.BasicBlock) *domain.BlockState
func GetConstString ¶
func GetGlobalString ¶
func GetStackTrace ¶
func GetStackTrace(prog *ssa.Program, ga *domain.GuardedAccess) string
func HandleBuiltin ¶
func HandleBuiltin(functionState *domain.BlockState, context *domain.Context, call *ssa.CallCommon)
func HandleCallCommon ¶
func HandleCallCommon(context *domain.Context, callCommon *ssa.CallCommon, pos token.Pos) *domain.BlockState
func HandleFunction ¶
func HandleInstruction ¶
func HandleInstruction(functionState *domain.BlockState, context *domain.Context, ins ssa.Instruction)
func IsGARead ¶
func IsGARead(ga *domain.GuardedAccess) bool
func IsGAWrite ¶
func IsGAWrite(ga *domain.GuardedAccess) bool
Types ¶
type CFG ¶
type CFG struct { ComputedBlocks map[int]*domain.BlockState ComputedDeferBlocks map[int]*domain.BlockState // contains filtered or unexported fields }
func (*CFG) CalculateFunctionState ¶
func (cfg *CFG) CalculateFunctionState(context *domain.Context, block *ssa.BasicBlock) *domain.BlockState
CalculateFunctionState works by traversing the tree in a DFS way, similar to the flow of the function when it'll run. It calculates the state of the regular flow of block first, then adds the state of any succeeding blocks in the tree, and finally the block's defer state if exist. The function uses two way to aggregate the states between blocks. If the blocks are adjacent (siblings) to each other, (resulted from a branch) then a merge mechanism is used. If one block is below the other, then an append is performed.
Click to show internal directories.
Click to hide internal directories.