return false
}
- // TODO: Use memclrHasPointers if there are pointers.
-
// Convert to
// if len(a) != 0 {
// hp = &a[0]
// hn = len(a)*sizeof(elem(a))
- // memclrNoHeapPointers(hp, hn)
+ // memclr{NoHeap,Has}Pointers(hp, hn)
// i = len(a) - 1
// }
n.Op = OIF
tmp = conv(tmp, Types[TUINTPTR])
n.Nbody.Append(nod(OAS, hn, tmp))
- // memclrNoHeapPointers(hp, hn)
- fn := mkcall("memclrNoHeapPointers", nil, nil, hp, hn)
+ var fn *Node
+ if haspointers(a.Type.Elem()) {
+ // memclrHasPointers(hp, hn)
+ fn = mkcall("memclrHasPointers", nil, nil, hp, hn)
+ } else {
+ // memclrNoHeapPointers(hp, hn)
+ fn = mkcall("memclrNoHeapPointers", nil, nil, hp, hn)
+ }
n.Nbody.Append(fn)