c.AllocaCStrs; cl/_testlibc: allocacstrs

This commit is contained in:
xushiwei
2024-07-13 12:24:06 +08:00
parent e138951e9e
commit 022e46ae38
4 changed files with 144 additions and 3 deletions

View File

@@ -176,7 +176,8 @@ func (b Builder) AllocaCStrs(strs Expr, endWithNil bool) (cstrs Expr) {
tcstr := prog.CStr()
cstrs = b.ArrayAlloca(tcstr, n1)
b.Times(n, func(i Expr) {
s := b.Index(strs, i, nil)
pstr := b.IndexAddr(strs, i)
s := b.Load(pstr)
b.Store(b.Advance(cstrs, i), b.AllocaCStr(s))
})
if endWithNil {