Closed edsko closed 2 months ago
Critical changes are:
packCXString
wrapForeignPtr
(in IsForeignPtr
instance for DeriveIsForeignPtr
)clang_visitChildren
Perhaps we should instead of masking async exceptions preallocate the buffer Haskell side. Especially during the traversal (maybe only there?) that might be easier. I need to think about this some more.
Perhaps we should instead of masking async exceptions preallocate the buffer Haskell side.
Yes, one could have newtype CXCursor = CXCursor ByteArray
. I do something like that e.g. in hashable
's xxhash
bindings for hash state (https://github.com/haskell-unordered-containers/hashable/blob/57e0d06623d9f2c8a0c5ff13e04b5a4002d699f5/src/Data/Hashable/XXH3.hs#L72), though there state is mutable, the approach is similar.
(EDIT: allocating before hand is closer to actually machine code generated: though the space for result value in C is reserved on stack, and that is not possible in Haskell).
@phadej I'd appreciate your eyes on this.
Closes #136.