AfterInit bugfix: add param Builder

This commit is contained in:
xushiwei
2024-05-24 02:42:10 +08:00
parent b66827998d
commit 418c37dd52
4 changed files with 15 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ import (
"go/token"
"go/types"
"log"
"unsafe"
"github.com/goplus/llgo/ssa/abi"
"github.com/goplus/llvm"
@@ -44,7 +45,8 @@ func (b Builder) abiStruct(t *types.Struct) Expr {
g = pkg.doNewVar(name, prog.AbiTypePtrPtr())
g.Init(prog.Null(g.Type))
g.impl.SetLinkage(llvm.LinkOnceAnyLinkage)
pkg.ainits = append(pkg.ainits, func() {
pkg.ainits = append(pkg.ainits, func(param unsafe.Pointer) {
b := Builder(param)
tabi := b.structOf(t)
b.Store(g.Expr, tabi)
})