cl: call llgo/ssa.CType/CFuncDecl
This commit is contained in:
@@ -177,15 +177,18 @@ func (p *context) compileMethods(pkg llssa.Package, typ types.Type) {
|
||||
// Global variable.
|
||||
func (p *context) compileGlobal(pkg llssa.Package, gbl *ssa.Global) {
|
||||
typ := gbl.Type()
|
||||
name, isDef := p.varName(gbl.Pkg.Pkg, gbl)
|
||||
name, vtype := p.varName(gbl.Pkg.Pkg, gbl)
|
||||
if ignoreName(name) || checkCgo(gbl.Name()) {
|
||||
return
|
||||
}
|
||||
if debugInstr {
|
||||
log.Println("==> NewVar", name, typ)
|
||||
}
|
||||
if vtype == cVar {
|
||||
typ = llssa.CType(typ)
|
||||
}
|
||||
g := pkg.NewVar(name, typ)
|
||||
if isDef {
|
||||
if vtype == goVar {
|
||||
g.Init(p.prog.Null(g.Type))
|
||||
}
|
||||
}
|
||||
@@ -200,6 +203,9 @@ func (p *context) compileFunc(pkg llssa.Package, pkgTypes *types.Package, f *ssa
|
||||
if debugInstr {
|
||||
log.Println("==> NewFunc", name, "type:", sig.Recv(), sig)
|
||||
}
|
||||
if ftype == cFunc {
|
||||
sig = llssa.CFuncDecl(sig)
|
||||
}
|
||||
fn := pkg.NewFunc(name, sig)
|
||||
p.inits = append(p.inits, func() {
|
||||
p.fn = fn
|
||||
|
||||
Reference in New Issue
Block a user