Documentation
¶
Index ¶
- Variables
- func ClearCache()
- func GetBareNode(v *Value) ssa.Value
- func GetBareType(typ *Type) ssa.Type
- func GetFreeValue(v *Value) *ssa.Parameter
- func TypeCompare(t1, t2 *Type) bool
- func ValueCompare(v1, v2 *Value) bool
- func WithSyntaxFlowResult(expected string, handler func(*Value) error) sfvm.Option
- type AnalyzeContext
- func (g *AnalyzeContext) GetCurrentCall() *Value
- func (g *AnalyzeContext) GetCurrentObject() (*Value, *Value, *Value)
- func (a *AnalyzeContext) IsExistedInCallStack(i *Value) bool
- func (a *AnalyzeContext) PopCall() *Value
- func (g *AnalyzeContext) PopObject() (*Value, *Value, *Value)
- func (a *AnalyzeContext) PushCall(i *Value) error
- func (g *AnalyzeContext) PushObject(obj, key, member *Value) error
- func (a *AnalyzeContext) TheCallShouldBeVisited(i *Value) bool
- func (g *AnalyzeContext) TheMemberShouldBeVisited(member *Value) bool
- func (a *AnalyzeContext) ThePhiShouldBeVisited(i *Value) bool
- func (a *AnalyzeContext) VisitPhi(i *Value)
- type Builder
- type ContextID
- type DominatorForest
- type DominatorTree
- type Language
- type OperationConfig
- type OperationOption
- func WithAllowCallStack(allowCallStack bool) OperationOption
- func WithDepthLimit(depth int) OperationOption
- func WithHookEveryNode(hookNode func(*Value) error) OperationOption
- func WithMaxDepth(maxDepth int) OperationOption
- func WithMinDepth(minDepth int) OperationOption
- func WithSyntaxFlowConfig(opts ...sf.RecursiveConfigItem) OperationOption
- type Option
- func WithDatabaseProgramCacheHitter(h func(i any)) Option
- func WithDatabaseProgramName(name string) Option
- func WithDefineFunc(table map[string]any) Option
- func WithExternInfo(info string) Option
- func WithExternLib(name string, table map[string]any) Option
- func WithExternMethod(b ssa.MethodBuilder) Option
- func WithExternValue(table map[string]any) Option
- func WithFeedCode(b ...bool) Option
- func WithFileSystemEntry(files ...string) Option
- func WithIgnoreSyntaxError(b ...bool) Option
- func WithLanguage(language Language) Option
- type Program
- func FromDatabase(programName string, opts ...Option) (*Program, error)
- func NewProgram(prog *ssa.Program, config *config) *Program
- func Parse(code string, opts ...Option) (*Program, error)
- func ParseFromReader(input io.Reader, opts ...Option) (*Program, error)
- func ParseProject(fs filesys.FileSystem, opts ...Option) ([]*Program, error)
- func ParseProjectFromPath(path string, opts ...Option) ([]*Program, error)
- func (p *Program) ExactMatch(isMember bool, s string) (bool, sfvm.ValueOperator, error)
- func (p *Program) Feed(code io.Reader) error
- func (p *Program) GetAllCallActualParams() (sfvm.ValueOperator, error)
- func (p *Program) GetAllOffsetItemsBefore(offset int) []*ssa.OffsetItem
- func (p *Program) GetCallActualParams(int) (sfvm.ValueOperator, error)
- func (p *Program) GetCalled() (sfvm.ValueOperator, error)
- func (p *Program) GetClassMember(className string, key string) *Value
- func (p *Program) GetErrors() ssa.SSAErrors
- func (p *Program) GetInstructionById(id int64) ssa.Instruction
- func (p *Program) GetNames() []string
- func (p *Program) GetSyntaxFlowBottomUse(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
- func (p *Program) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
- func (p *Program) GetSyntaxFlowTopDef(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
- func (p *Program) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
- func (p *Program) GetValueById(id int64) (*Value, error)
- func (p *Program) GetValueByIdMust(id int64) *Value
- func (p *Program) GlobMatch(isMember bool, g sfvm.Glob) (bool, sfvm.ValueOperator, error)
- func (p *Program) IsList() bool
- func (p *Program) IsMap() bool
- func (p *Program) IsNil() bool
- func (p *Program) ListIndex(i int) (sfvm.ValueOperator, error)
- func (p *Program) NewValue(n ssa.Value) *Value
- func (p *Program) Recursive(func(operator sfvm.ValueOperator) error) error
- func (p *Program) Ref(name string) Values
- func (p *Program) RegexpMatch(isMember bool, re *regexp.Regexp) (bool, sfvm.ValueOperator, error)
- func (p *Program) Show() *Program
- func (p *Program) String() string
- func (p *Program) SyntaxFlow(i string, opts ...sfvm.Option) map[string]Values
- func (p *Program) SyntaxFlowChain(i string, opts ...sfvm.Option) Values
- func (p *Program) SyntaxFlowWithError(i string, opts ...sfvm.Option) (map[string]Values, error)
- type Type
- type Value
- func (v *Value) AnalyzeDepth() int
- func (v *Value) AppendDependOn(i *Value) *Value
- func (v *Value) AppendEffectOn(i *Value) *Value
- func (v *Value) Backtrack() *omap.OrderedMap[string, *Value]
- func (v *Value) Compare(other *Value) bool
- func (v *Value) Dot() string
- func (v *Value) ExactMatch(isMember bool, want string) (bool, sfvm.ValueOperator, error)
- func (v *Value) FlexibleDepends() *Value
- func (v *Value) GetAllCallActualParams() (sfvm.ValueOperator, error)
- func (v *Value) GetAllMember() Values
- func (v *Value) GetAllVariables() map[string]*ssa.Variable
- func (v *Value) GetBlock() *Value
- func (v *Value) GetBottomUses(opt ...OperationOption) Values
- func (v *Value) GetCallActualParams(i int) (sfvm.ValueOperator, error)
- func (v *Value) GetCallArgs() Values
- func (v *Value) GetCallReturns() Values
- func (v *Value) GetCalled() (sfvm.ValueOperator, error)
- func (v *Value) GetCalledBy() Values
- func (v *Value) GetCallee() *Value
- func (v *Value) GetConst() *ssa.Const
- func (v *Value) GetConstValue() any
- func (v *Value) GetContextValue(i ContextID) (*Value, bool)
- func (v *Value) GetDepth() int
- func (v *Value) GetFunction() *Value
- func (v *Value) GetFunctionObjectType() ssa.Type
- func (v *Value) GetId() int64
- func (v *Value) GetKey() *Value
- func (v *Value) GetMember(value *Value) *Value
- func (v *Value) GetMembersByString(key string) (sfvm.ValueOperator, error)
- func (v *Value) GetName() string
- func (v *Value) GetObject() *Value
- func (v *Value) GetOpcode() ssa.Opcode
- func (v *Value) GetOperand(index int) *Value
- func (v *Value) GetOperands() Values
- func (v *Value) GetParameter(i int) *Value
- func (v *Value) GetParameters() Values
- func (v *Value) GetRange() *ssa.Range
- func (v *Value) GetReachable() *Value
- func (v *Value) GetReturn() Values
- func (v *Value) GetSelf() *Value
- func (v *Value) GetSyntaxFlowBottomUse(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
- func (v *Value) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
- func (v *Value) GetSyntaxFlowTopDef(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
- func (v *Value) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
- func (i *Value) GetTopDefs(opt ...OperationOption) Values
- func (v *Value) GetType() *Type
- func (v *Value) GetTypeKind() ssa.TypeKind
- func (v *Value) GetUser(index int) *Value
- func (v *Value) GetUsers() Values
- func (v *Value) GetVariable(name string) *ssa.Variable
- func (v *Value) GetVerboseName() string
- func (v *Value) GlobMatch(isMember bool, g sfvm.Glob) (bool, sfvm.ValueOperator, error)
- func (v *Value) HasOperands() bool
- func (v *Value) HasUsers() bool
- func (v *Value) InMainFunction() bool
- func (v *Value) IsAssert() bool
- func (v *Value) IsBasicBlock() bool
- func (v *Value) IsBinOp() bool
- func (v *Value) IsCall() bool
- func (v *Value) IsCalled() bool
- func (v *Value) IsConstInst() bool
- func (v *Value) IsErrorHandler() bool
- func (v *Value) IsExtern() bool
- func (v *Value) IsExternLib() bool
- func (v *Value) IsFreeValue() bool
- func (v *Value) IsFunction() bool
- func (v *Value) IsIf() bool
- func (v *Value) IsJump() bool
- func (v *Value) IsList() bool
- func (v *Value) IsLoop() bool
- func (v *Value) IsMake() bool
- func (v *Value) IsMap() bool
- func (v *Value) IsMember() bool
- func (v *Value) IsMethod() bool
- func (v *Value) IsModifySelf() bool
- func (v *Value) IsNext() bool
- func (v *Value) IsNil() bool
- func (v *Value) IsObject() bool
- func (v *Value) IsPanic() bool
- func (v *Value) IsParameter() bool
- func (v *Value) IsParameterMember() bool
- func (v *Value) IsPhi() bool
- func (v *Value) IsReachable() int
- func (v *Value) IsRecover() bool
- func (v *Value) IsReturn() bool
- func (v *Value) IsSwitch() bool
- func (v *Value) IsTypeCast() bool
- func (v *Value) IsTypeValue() bool
- func (v *Value) IsUnOp() bool
- func (v *Value) IsUndefined() bool
- func (v *Value) ListIndex(i int) (sfvm.ValueOperator, error)
- func (v *Value) LoadFullUseDefChain() *Value
- func (v *Value) NewError(tag, msg string)
- func (v *Value) NewValue(value ssa.Value) *Value
- func (v *Value) NewWarn(tag, msg string)
- func (v *Value) Recursive(f func(operator sfvm.ValueOperator) error) error
- func (v *Value) RecursiveDepends(h func(value *Value) error)
- func (v *Value) RecursiveDependsAndEffects(h func(value *Value) error)
- func (v *Value) RecursiveEffects(h func(value *Value) error)
- func (v *Value) RegexpMatch(isMember bool, regexp *regexp.Regexp) (bool, sfvm.ValueOperator, error)
- func (v *Value) SetContextValue(i ContextID, values *Value) *Value
- func (v *Value) SetDepth(i int)
- func (v *Value) ShortString() string
- func (i *Value) Show()
- func (v *Value) ShowBacktrack()
- func (v *Value) ShowDot() *Value
- func (v *Value) ShowUseDefChain()
- func (i *Value) ShowWithSource()
- func (v *Value) String() string
- func (v *Value) StringWithSource() string
- type Values
- func (i Values) AppendDependOn(v *Value) Values
- func (i Values) AppendEffectOn(v *Value) Values
- func (values Values) ExactMatch(isMember bool, want string) (bool, sfvm.ValueOperator, error)
- func (value Values) ExtractTopDefsIntersection(targets Values, opts ...OperationOption) Values
- func (v Values) Filter(f func(*Value) bool) Values
- func (v Values) Flat(f func(*Value) Values) Values
- func (v Values) FlexibleDepends() Values
- func (v Values) ForEach(f func(*Value)) Values
- func (v Values) FullUseDefChain(h func(*Value))
- func (v Values) Get(i int) *Value
- func (value Values) GetAllCallActualParams() (sfvm.ValueOperator, error)
- func (v Values) GetBottomUses() Values
- func (value Values) GetCallActualParams(index int) (sfvm.ValueOperator, error)
- func (value Values) GetCalled() (sfvm.ValueOperator, error)
- func (value Values) GetMembersByString(key string) (sfvm.ValueOperator, error)
- func (v Values) GetOperands() Values
- func (value Values) GetSyntaxFlowBottomUse(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
- func (value Values) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
- func (value Values) GetSyntaxFlowTopDef(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
- func (value Values) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
- func (v Values) GetTopDefs(opts ...OperationOption) Values
- func (v Values) GetUsers() Values
- func (values Values) GlobMatch(isMember bool, glob sfvm.Glob) (bool, sfvm.ValueOperator, error)
- func (value Values) IsList() bool
- func (value Values) IsMap() bool
- func (value Values) Len() int
- func (value Values) ListIndex(i int) (sfvm.ValueOperator, error)
- func (v Values) NewValue(ssaVal ssa.Value) *Value
- func (value Values) Recursive(f func(operator sfvm.ValueOperator) error) error
- func (value Values) Ref(name string) Values
- func (values Values) RegexpMatch(isMember bool, regexp *regexp.Regexp) (bool, sfvm.ValueOperator, error)
- func (v Values) Show(b ...bool) Values
- func (V Values) ShowDot() Values
- func (v Values) ShowWithSource(b ...bool) Values
- func (v Values) String() string
- func (v Values) StringEx(flag int) string
Constants ¶
This section is empty.
Variables ¶
var ( Number = NewType(ssa.BasicTypes[ssa.NumberTypeKind]) String = NewType(ssa.BasicTypes[ssa.StringTypeKind]) Bytes = NewType(ssa.BasicTypes[ssa.BytesTypeKind]) Boolean = NewType(ssa.BasicTypes[ssa.BooleanTypeKind]) UndefinedType = NewType(ssa.BasicTypes[ssa.UndefinedTypeKind]) Null = NewType(ssa.BasicTypes[ssa.NullTypeKind]) Any = NewType(ssa.BasicTypes[ssa.AnyTypeKind]) ErrorType = NewType(ssa.BasicTypes[ssa.ErrorTypeKind]) )
var Exports = map[string]any{ "Parse": Parse, "withLanguage": WithLanguage, "withExternLib": WithExternLib, "withExternValue": WithExternValue, "withDatabaseProgramName": WithDatabaseProgramName, "Javascript": JS, "Yak": Yak, "PHP": PHP, "Java": JAVA, }
Functions ¶
func ClearCache ¶ added in v1.3.3
func ClearCache()
func GetBareNode ¶ added in v1.2.9
GetBareNode get ssa.Value from ssaapi.Value only use this function in golang
func GetBareType ¶ added in v1.2.9
func GetFreeValue ¶ added in v1.3.3
func TypeCompare ¶ added in v1.2.9
func ValueCompare ¶ added in v1.2.9
Types ¶
type AnalyzeContext ¶ added in v1.3.0
type AnalyzeContext struct { // Self Self *Value // contains filtered or unexported fields }
func NewAnalyzeContext ¶ added in v1.3.0
func NewAnalyzeContext(opt ...OperationOption) *AnalyzeContext
func (*AnalyzeContext) GetCurrentCall ¶ added in v1.3.0
func (g *AnalyzeContext) GetCurrentCall() *Value
func (*AnalyzeContext) GetCurrentObject ¶ added in v1.3.2
func (g *AnalyzeContext) GetCurrentObject() (*Value, *Value, *Value)
func (*AnalyzeContext) IsExistedInCallStack ¶ added in v1.3.0
func (a *AnalyzeContext) IsExistedInCallStack(i *Value) bool
func (*AnalyzeContext) PopCall ¶ added in v1.3.0
func (a *AnalyzeContext) PopCall() *Value
func (*AnalyzeContext) PopObject ¶ added in v1.3.2
func (g *AnalyzeContext) PopObject() (*Value, *Value, *Value)
func (*AnalyzeContext) PushCall ¶ added in v1.3.0
func (a *AnalyzeContext) PushCall(i *Value) error
func (*AnalyzeContext) PushObject ¶ added in v1.3.2
func (g *AnalyzeContext) PushObject(obj, key, member *Value) error
func (*AnalyzeContext) TheCallShouldBeVisited ¶ added in v1.3.0
func (a *AnalyzeContext) TheCallShouldBeVisited(i *Value) bool
func (*AnalyzeContext) TheMemberShouldBeVisited ¶ added in v1.3.2
func (g *AnalyzeContext) TheMemberShouldBeVisited(member *Value) bool
func (*AnalyzeContext) ThePhiShouldBeVisited ¶ added in v1.3.0
func (a *AnalyzeContext) ThePhiShouldBeVisited(i *Value) bool
ThePhiShouldBeVisited is used to check whether the phi should be visited
func (*AnalyzeContext) VisitPhi ¶ added in v1.3.0
func (a *AnalyzeContext) VisitPhi(i *Value)
type DominatorForest ¶ added in v1.3.1
type DominatorForest struct {
Trees []*DominatorTree
}
type DominatorTree ¶ added in v1.3.1
type DominatorTree *omap.OrderedMap[int, *Value]
type OperationConfig ¶ added in v1.3.1
type OperationConfig struct { // 限制递归深度,每一次递归核心函数,计数器都会加一 // 上下文计数器受到这个限制 MaxDepth int MinDepth int // Hook HookEveryNode []func(*Value) error AllowIgnoreCallStack bool }
func NewOperations ¶ added in v1.3.1
func NewOperations(opt ...OperationOption) *OperationConfig
type OperationOption ¶ added in v1.3.1
type OperationOption func(*OperationConfig)
func WithAllowCallStack ¶ added in v1.3.3
func WithAllowCallStack(allowCallStack bool) OperationOption
func WithDepthLimit ¶ added in v1.3.1
func WithDepthLimit(depth int) OperationOption
func WithHookEveryNode ¶ added in v1.3.1
func WithHookEveryNode(hookNode func(*Value) error) OperationOption
func WithMaxDepth ¶ added in v1.3.1
func WithMaxDepth(maxDepth int) OperationOption
func WithMinDepth ¶ added in v1.3.1
func WithMinDepth(minDepth int) OperationOption
func WithSyntaxFlowConfig ¶ added in v1.3.3
func WithSyntaxFlowConfig(opts ...sf.RecursiveConfigItem) OperationOption
type Option ¶
type Option func(*config)
func WithDatabaseProgramCacheHitter ¶ added in v1.3.3
func WithDatabaseProgramName ¶ added in v1.3.3
save to database, please set the program name
func WithDefineFunc ¶ added in v1.3.1
func WithExternInfo ¶ added in v1.3.0
func WithExternMethod ¶ added in v1.2.9
func WithExternMethod(b ssa.MethodBuilder) Option
func WithExternValue ¶
func WithFeedCode ¶ added in v1.3.1
func WithFileSystemEntry ¶ added in v1.3.3
func WithIgnoreSyntaxError ¶ added in v1.3.0
func WithLanguage ¶
type Program ¶
type Program struct { Program *ssa.Program DBCache *ssa.Cache // contains filtered or unexported fields }
func FromDatabase ¶ added in v1.3.3
func NewProgram ¶
func ParseFromReader ¶ added in v1.3.3
ParseFromReader parse simple file to ssa.Program
func ParseProject ¶ added in v1.3.3
func ParseProject(fs filesys.FileSystem, opts ...Option) ([]*Program, error)
func ParseProjectFromPath ¶ added in v1.3.3
func (*Program) ExactMatch ¶ added in v1.3.3
func (*Program) GetAllCallActualParams ¶ added in v1.3.3
func (p *Program) GetAllCallActualParams() (sfvm.ValueOperator, error)
func (*Program) GetAllOffsetItemsBefore ¶ added in v1.3.3
func (p *Program) GetAllOffsetItemsBefore(offset int) []*ssa.OffsetItem
func (*Program) GetCallActualParams ¶ added in v1.3.3
func (p *Program) GetCallActualParams(int) (sfvm.ValueOperator, error)
func (*Program) GetCalled ¶ added in v1.3.3
func (p *Program) GetCalled() (sfvm.ValueOperator, error)
func (*Program) GetClassMember ¶ added in v1.3.2
func (*Program) GetInstructionById ¶ added in v1.3.0
func (p *Program) GetInstructionById(id int64) ssa.Instruction
func (*Program) GetSyntaxFlowBottomUse ¶ added in v1.3.3
func (p *Program) GetSyntaxFlowBottomUse(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (*Program) GetSyntaxFlowDef ¶ added in v1.3.3
func (p *Program) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
func (*Program) GetSyntaxFlowTopDef ¶ added in v1.3.3
func (p *Program) GetSyntaxFlowTopDef(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (*Program) GetSyntaxFlowUse ¶ added in v1.3.3
func (p *Program) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
func (*Program) GetValueById ¶ added in v1.3.0
func (*Program) GetValueByIdMust ¶ added in v1.3.0
func (*Program) ListIndex ¶ added in v1.3.3
func (p *Program) ListIndex(i int) (sfvm.ValueOperator, error)
func (*Program) Recursive ¶ added in v1.3.3
func (p *Program) Recursive(func(operator sfvm.ValueOperator) error) error
func (*Program) RegexpMatch ¶ added in v1.3.3
func (*Program) SyntaxFlow ¶ added in v1.3.3
func (*Program) SyntaxFlowChain ¶ added in v1.3.3
type Value ¶
type Value struct { ParentProgram *Program EffectOn Values DependOn Values // contains filtered or unexported fields }
func FullUseDefChain ¶ added in v1.3.1
func FullUseDefChain(value *Value, opts ...OperationOption) *Value
func (*Value) AnalyzeDepth ¶ added in v1.3.1
func (*Value) AppendDependOn ¶ added in v1.3.1
func (*Value) AppendEffectOn ¶ added in v1.3.1
func (*Value) Backtrack ¶ added in v1.3.1
func (v *Value) Backtrack() *omap.OrderedMap[string, *Value]
func (*Value) ExactMatch ¶ added in v1.3.3
func (*Value) FlexibleDepends ¶ added in v1.3.1
FlexibleDepends is used to get all the dependencies of the value e.g: a = b + c; d = a + e; the e is not filled in the depends of a, but call FlexibleDepends will get it
func (*Value) GetAllCallActualParams ¶ added in v1.3.3
func (v *Value) GetAllCallActualParams() (sfvm.ValueOperator, error)
func (*Value) GetAllMember ¶ added in v1.3.1
GetAllMember get all member of object
func (*Value) GetAllVariables ¶ added in v1.3.3
func (*Value) GetBottomUses ¶ added in v1.3.0
func (v *Value) GetBottomUses(opt ...OperationOption) Values
func (*Value) GetCallActualParams ¶ added in v1.3.3
func (v *Value) GetCallActualParams(i int) (sfvm.ValueOperator, error)
func (*Value) GetCallArgs ¶ added in v1.3.0
func (*Value) GetCallReturns ¶ added in v1.3.0
func (*Value) GetCalledBy ¶ added in v1.3.0
GetCalledBy desc all of 'Users' is Call
func (*Value) GetConstValue ¶ added in v1.2.9
for const instruction
func (*Value) GetContextValue ¶ added in v1.3.0
GetContextValue can handle context
func (*Value) GetFunction ¶
func (*Value) GetFunctionObjectType ¶ added in v1.3.3
func (*Value) GetMembersByString ¶ added in v1.3.3
func (v *Value) GetMembersByString(key string) (sfvm.ValueOperator, error)
func (*Value) GetOperand ¶
func (*Value) GetOperands ¶
func (*Value) GetParameter ¶
func (*Value) GetParameters ¶ added in v1.2.9
func (*Value) GetReachable ¶
func (*Value) GetSyntaxFlowBottomUse ¶ added in v1.3.3
func (v *Value) GetSyntaxFlowBottomUse(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (*Value) GetSyntaxFlowDef ¶ added in v1.3.3
func (v *Value) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
func (*Value) GetSyntaxFlowTopDef ¶ added in v1.3.3
func (v *Value) GetSyntaxFlowTopDef(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (*Value) GetSyntaxFlowUse ¶ added in v1.3.3
func (v *Value) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
func (*Value) GetTopDefs ¶ added in v1.3.0
func (i *Value) GetTopDefs(opt ...OperationOption) Values
GetTopDefs desc all of 'Defs' is not used by any other value
func (*Value) GetTypeKind ¶ added in v1.2.9
func (*Value) GetVariable ¶ added in v1.3.3
for variable
func (*Value) GetVerboseName ¶ added in v1.3.1
func (*Value) HasOperands ¶
func (*Value) InMainFunction ¶
func (*Value) IsBasicBlock ¶
func (*Value) IsConstInst ¶
func (*Value) IsErrorHandler ¶
func (*Value) IsExternLib ¶ added in v1.3.1
IsExternLib desc if the value is extern lib
extern-lib is a special value that is used to represent the external library
code := `a = fmt.Println` fmt := prog.Ref("fmt") // extern-lib fmt.GetOperands() // Values // [Function-Println]
func (*Value) IsFreeValue ¶ added in v1.3.3
func (*Value) IsFunction ¶
func (*Value) IsModifySelf ¶ added in v1.2.9
func (*Value) IsParameter ¶ added in v1.2.9
func (*Value) IsParameterMember ¶ added in v1.3.3
func (*Value) IsReachable ¶
if condition is true : 1 reach if condition is false : -1 unreachable if condition need calc: 0 unknown
func (*Value) IsTypeCast ¶
func (*Value) IsTypeValue ¶
func (*Value) IsUndefined ¶
func (*Value) ListIndex ¶ added in v1.3.3
func (v *Value) ListIndex(i int) (sfvm.ValueOperator, error)
func (*Value) LoadFullUseDefChain ¶ added in v1.3.1
func (*Value) Recursive ¶ added in v1.3.3
func (v *Value) Recursive(f func(operator sfvm.ValueOperator) error) error
func (*Value) RecursiveDepends ¶ added in v1.3.1
RecursiveDepends is used to get all the dependencies of the value
func (*Value) RecursiveDependsAndEffects ¶ added in v1.3.1
func (*Value) RecursiveEffects ¶ added in v1.3.1
RecursiveEffects is used to get all the effects of the value
func (*Value) RegexpMatch ¶ added in v1.3.3
func (*Value) SetContextValue ¶ added in v1.3.0
func (*Value) ShortString ¶ added in v1.3.1
func (*Value) ShowBacktrack ¶ added in v1.3.1
func (v *Value) ShowBacktrack()
func (*Value) ShowUseDefChain ¶
func (v *Value) ShowUseDefChain()
func (*Value) ShowWithSource ¶
func (i *Value) ShowWithSource()
func (*Value) StringWithSource ¶
type Values ¶
type Values []*Value
func FindFlexibleCommonDepends ¶ added in v1.3.1
FindFlexibleCommonDepends 在给定的值集合中查找具有灵活共同依赖的值。
FindFlexibleCommonDepends searches for values with flexible common dependencies in the given collection of values.
它与 FindStrictCommonDepends 类似,但在查找共同依赖时,会尝试重新构建值的顶层定义。
It is similar to FindStrictCommonDepends, but when searching for common dependencies, it attempts to rebuild the top-level definition of values.
具有灵活共同依赖的值是指通过重新构建顶层定义,从而可能包括更多的依赖关系。
Values with flexible common dependencies are those that may include more dependencies by rebuilding the top-level definition.
func FindFlexibleDependsIntersection ¶ added in v1.3.3
func FindFlexibleDependsIntersection(root Values, element Values, opts ...OperationOption) Values
FindFlexibleDependsIntersection searches for intersections between flexible dependencies of the root collection and elements from the target collection, returning matched elements.
FindFlexibleDependsIntersection 搜索根集合中的灵活依赖与目标集合中元素的交集,并返回匹配的元素。
这个函数是 ExtractTopDefsIntersection 的一个封装,专门用于处理灵活依赖关系。 This function is a wrapper around ExtractTopDefsIntersection, specifically tailored for handling flexible dependencies.
它接收三个参数:root(根集合),element(目标集合),以及可选的 opts(操作选项)。 It takes three parameters: root (the root collection), element (the target collection), and optionally opts (operation options).
通过将灵活依赖的特定处理逻辑传递给 ExtractTopDefsIntersection,该函数利用已有的逻辑 来检查和返回交集元素。 By passing specific handling logic for flexible dependencies to ExtractTopDefsIntersection, this function leverages existing logic to check and return intersecting elements.
使用此函数可以灵活地处理不同类型的依赖关系,如在计算或数据分析场景中常见的依赖查找。 Using this function allows flexible handling of different types of dependencies, commonly seen in computing or data analysis scenarios.
func FindStrictCommonDepends ¶ added in v1.3.1
FindStrictCommonDepends 在给定的值集合中查找具有严格共同依赖的值。
FindStrictCommonDepends searches for values with strictly common dependencies in the given collection of values.
它遍历给定的值集合,比较每对值之间的依赖关系,并返回所有具有严格共同依赖的值的集合。
It iterates over the given collection of values, compares the dependencies between each pair of values, and returns a collection of all values with strictly common dependencies.
严格共同依赖是指只有当值 A 依赖于值 B,而值 B 也依赖于值 A 时,这两个值才被认为具有严格共同依赖。
Strict common dependencies refer to the scenario where value A depends on value B, and value B depends on value A for them to be considered to have strict common dependencies.
func SFValueListToValues ¶ added in v1.3.3
func (Values) AppendDependOn ¶ added in v1.3.1
func (Values) AppendEffectOn ¶ added in v1.3.1
func (Values) ExactMatch ¶ added in v1.3.3
func (Values) ExtractTopDefsIntersection ¶ added in v1.3.3
func (value Values) ExtractTopDefsIntersection(targets Values, opts ...OperationOption) Values
ExtractTopDefsIntersection explores the possibility of top-level definitions in the caller's elements including elements from the target collection and returns them if found.
ExtractTopDefsIntersection 寻找调用者中的顶级定义过程包含目标元素的可能性,如果找到则直接返回。
该函数通过遍历调用者集合中的每一个元素,检查其顶级定义是否与目标集合中的某个元素匹配。 This function iterates through each element in the caller's collection to check if its top-level definitions match any of the elements in the target collection.
func (Values) FlexibleDepends ¶ added in v1.3.1
func (Values) FullUseDefChain ¶ added in v1.3.1
func (Values) GetAllCallActualParams ¶ added in v1.3.3
func (value Values) GetAllCallActualParams() (sfvm.ValueOperator, error)
func (Values) GetBottomUses ¶ added in v1.3.1
func (Values) GetCallActualParams ¶ added in v1.3.3
func (value Values) GetCallActualParams(index int) (sfvm.ValueOperator, error)
func (Values) GetCalled ¶ added in v1.3.3
func (value Values) GetCalled() (sfvm.ValueOperator, error)
func (Values) GetMembersByString ¶ added in v1.3.3
func (value Values) GetMembersByString(key string) (sfvm.ValueOperator, error)
func (Values) GetOperands ¶ added in v1.3.1
func (Values) GetSyntaxFlowBottomUse ¶ added in v1.3.3
func (value Values) GetSyntaxFlowBottomUse(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (Values) GetSyntaxFlowDef ¶ added in v1.3.3
func (value Values) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
func (Values) GetSyntaxFlowTopDef ¶ added in v1.3.3
func (value Values) GetSyntaxFlowTopDef(config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (Values) GetSyntaxFlowUse ¶ added in v1.3.3
func (value Values) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
func (Values) GetTopDefs ¶ added in v1.3.0
func (v Values) GetTopDefs(opts ...OperationOption) Values
func (Values) ListIndex ¶ added in v1.3.3
func (value Values) ListIndex(i int) (sfvm.ValueOperator, error)
func (Values) Recursive ¶ added in v1.3.3
func (value Values) Recursive(f func(operator sfvm.ValueOperator) error) error
func (Values) RegexpMatch ¶ added in v1.3.3
func (Values) ShowWithSource ¶
Source Files
¶
- analyze_context.go
- database.go
- doc.go
- dominator_tree.go
- exclusive_config.go
- exclusive_z_bottom_use.go
- exclusive_z_misc.go
- exclusive_z_top_defs.go
- language_parser.go
- misc.go
- position.go
- program.go
- sf_config.go
- sf_prog.go
- sf_utils.go
- sf_value.go
- sf_values.go
- ssa_exports.go
- type.go
- use_def_chain.go
- values.go
- values_backtrack.go
- values_contains.go
- values_dot.go