本文整理汇总了Golang中github.com/fzipp/pythia/internal/tools/go/ssa.CallInstruction.Value方法的典型用法代码示例。如果您正苦于以下问题:Golang CallInstruction.Value方法的具体用法?Golang CallInstruction.Value怎么用?Golang CallInstruction.Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/fzipp/pythia/internal/tools/go/ssa.CallInstruction
的用法示例。
在下文中一共展示了CallInstruction.Value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: genCall
// genCall generates constraints for call instruction instr.
func (a *analysis) genCall(caller *cgnode, instr ssa.CallInstruction) {
call := instr.Common()
// Intrinsic implementations of built-in functions.
if _, ok := call.Value.(*ssa.Builtin); ok {
a.genBuiltinCall(instr, caller)
return
}
var result nodeid
if v := instr.Value(); v != nil {
result = a.valueNode(v)
}
site := &callsite{instr: instr}
if call.StaticCallee() != nil {
a.genStaticCall(caller, site, call, result)
} else if call.IsInvoke() {
a.genInvoke(caller, site, call, result)
} else {
a.genDynamicCall(caller, site, call, result)
}
caller.sites = append(caller.sites, site)
if a.log != nil {
// TODO(adonovan): debug: improve log message.
fmt.Fprintf(a.log, "\t%s to targets %s from %s\n", site, site.targets, caller)
}
}
示例2: genBuiltinCall
// genBuiltinCall generates contraints for a call to a built-in.
func (a *analysis) genBuiltinCall(instr ssa.CallInstruction, cgn *cgnode) {
call := instr.Common()
switch call.Value.(*ssa.Builtin).Name() {
case "append":
// Safe cast: append cannot appear in a go or defer statement.
a.genAppend(instr.(*ssa.Call), cgn)
case "copy":
tElem := call.Args[0].Type().Underlying().(*types.Slice).Elem()
a.copyElems(cgn, tElem, call.Args[0], call.Args[1])
case "panic":
a.copy(a.panicNode, a.valueNode(call.Args[0]), 1)
case "recover":
if v := instr.Value(); v != nil {
a.copy(a.valueNode(v), a.panicNode, 1)
}
case "print":
// In the tests, the probe might be the sole reference
// to its arg, so make sure we create nodes for it.
if len(call.Args) > 0 {
a.valueNode(call.Args[0])
}
case "ssa:wrapnilchk":
a.copy(a.valueNode(instr.Value()), a.valueNode(call.Args[0]), 1)
default:
// No-ops: close len cap real imag complex print println delete.
}
}