llgo/ssa: StringData/StringLen

This commit is contained in:
xushiwei
2024-05-12 15:42:50 +08:00
parent acecbf587d
commit 090149eab6
22 changed files with 71 additions and 72 deletions

View File

@@ -217,7 +217,7 @@ func buildAllPkgs(prog llssa.Program, initial []*packages.Package, mode Mode, ve
}
default:
buildPkg(prog, aPkg, mode, verbose)
setNeedRuntimeOrPyInit(pkg, prog.NeedRuntime(), prog.NeedPyInit())
setNeedRuntimeOrPyInit(pkg, prog.NeedRuntime, prog.NeedPyInit)
}
}
return

View File

@@ -79,7 +79,7 @@ func Gen(pkgPath, inFile string, src any) string {
ret, err := cl.NewPackage(prog, ssaPkg, files)
check(err)
if prog.NeedPyInit() { // call PyInit if needed
if prog.NeedPyInit { // call PyInit if needed
ret.PyInit()
}

View File

@@ -82,7 +82,7 @@ func GenFrom(fileOrPkg string) string {
ret, err := cl.NewPackage(prog, ssaPkg, pkg.Syntax)
check(err)
if prog.NeedPyInit() { // call PyInit if needed
if prog.NeedPyInit { // call PyInit if needed
ret.PyInit()
}

Binary file not shown.

View File

@@ -45,16 +45,6 @@ func NewString(data unsafe.Pointer, len int) String {
return String{data, len}
}
// StringLen returns the length of a string.
func StringLen(s String) int {
return s.len
}
// StringData returns the data pointer of a string.
func StringData(s String) unsafe.Pointer {
return s.data
}
// StringCat concatenates two strings.
func StringCat(a, b String) String {
n := a.len + b.len