jimingham wrote:

> > Swift doesn't have pointers really. It does pass some things by value 
> > (called structs) and others by reference (called classes), but it doesn't 
> > let you know how. So this ambiguity between "pointer to object" and 
> > "pointer to contiguous buffer of objects" doesn't come up.
> 
> So what happens if I use `ArrayToPointerConversion` function I added on a 
> Swift array?

Swift has an out for dealing with pointers of classes (for instance to help 
pass objects back and forth between swift & C-based languages).  So asking for 
the pointer type for a class type doesn't get None (which you would expect for 
a language that doesn't have the notion of pointers.)  Instead you get 
`Swift.UnsafePointer<module.class_name>`.  But that's a pointer to the swift 
object, not to some buffer containing the array objects.  I don't think 
indexing that will get what you want.

We probably need to ask the language "Are Arrays contiguous buffers of objects 
for you", and return an error from here if they are not.

https://github.com/llvm/llvm-project/pull/138551
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to