Commit Graph

3 Commits

Author SHA1 Message Date
Gabor Horvath
26e672e4e0 [cxx-interop] Fix runtime crash passing FRTs as const FRT*
We should pass foreign references as Direct_Unowned calling convention,
this happened for non-const pointers. Unfortunately, we passed the const
variants as Indirect_In. This resulted in SILGen trying to insert a
non-sensical conversion. This triggered an assertion failure or a
miscompilation depending on how the compiler was compiled.

rdar://149398905
2025-04-24 14:32:58 +01:00
Akira Hatanaka
42bc49d3fe Add a new parameter convention @in_cxx for non-trivial C++ classes that are passed indirectly and destructed by the caller (#73019)
This corresponds to the parameter-passing convention of the Itanium C++
ABI, in which the argument is passed indirectly and possibly modified,
but not destroyed, by the callee.

@in_cxx is handled the same way as @in in callers and @in_guaranteed in
callees. OwnershipModelEliminator emits the call to destroy_addr that is
needed to destroy the argument in the caller.

rdar://122707697
2024-06-27 09:44:04 -07:00
Akira Hatanaka
d76dbb1a64 [SILGen] Fix a bug where the wrong convention was being used for lowering a closure to a C++ function pointer (#73039)
Use the C function pointer convention instead of the block convention.

rdar://122977380
2024-04-16 15:18:50 -07:00