llgo/ssa: NewPyFunc fix

This commit is contained in:
xushiwei
2024-05-12 00:24:56 +08:00
parent 6c32fe87e6
commit 64c13fa9ae
6 changed files with 24 additions and 16 deletions

View File

@@ -298,7 +298,10 @@ func (p Package) NewPyFunc(name string, sig *types.Signature) PyFunction {
if v, ok := p.pyfns[name]; ok {
return v
}
obj := p.NewVar(name, p.Prog.PyObjectPtrPtr().RawType(), InC)
prog := p.Prog
obj := p.NewVar(name, prog.PyObjectPtrPtr().RawType(), InC)
obj.Init(prog.Null(obj.Type))
obj.impl.SetLinkage(llvm.LinkOnceAnyLinkage)
ty := &aType{obj.ll, rawType{sig}, vkPyFunc}
expr := Expr{obj.impl, ty}
ret := &aPyFunction{expr, obj}