ClangWrapper causes Swift compiler crash too frequently and randomly.
You may see Swift compiler crash very frequently and randomly under certain circumstances when using this framework. I tried to figure out specific condition, but failed. When it starts to crash, it just crashes regardless of anything.
I am assuming this is somewhat relative to Unmanaged<T>, but not clear. I couldn't reproduce crash reliably, so I failed to clarify specific reason. Of course, a bug in my code may cause some crash like case of recursive enum data member. But anyway direct reason of compiler crash is simply a compiler bug.
Here're some probable workarounds to avoid crashes.
- Try to avoid
struct. - Try to wrap
CursorandTypeinto a box class. - Add at multiple methods on the box class.
- Write more code. Sometimes this crash disappears if you add more methods to the box class.
Yes, some crashes disappear when code scales "larger" or by adding more complexity. To me, the only thing can explain this is silent state corruption...
Actually Current version (1.1) of Swift compiler is very well known for its unreliability, so I would not try to fix this until Apple release improved version.