hylo-lang / Swifty-LLVM

Swifty interface for the LLVM compiler infrastructure.
Apache License 2.0
27 stars 5 forks source link

Consider removing the `XXXRef` wrappers #56

Open kyouko-taiga opened 6 months ago

kyouko-taiga commented 6 months ago

I suspect we can rework the API to avoid exposing any of the reference wrappers defined in Refs.swift. Those are completely useless unless one can access the value of the LLVM pointer or enum being wrapped and use it to call the C API directly. As the intent of the current setup is to keep llvmc internal, using that API outside of SwiftyLLVM is not possible.

dabrahams commented 5 months ago

I thought they would provide a layer of type safety if we only unwrap them at the boundary with LLVM. Having our clients pass us raw OpaquePointers means they can easily give us the wrong kind of thing and we'll never know. That's the reason for the pointer-to-incomplete type trick in C, whose value is erased by import into Swift.