Commit Graph

5 Commits

Author SHA1 Message Date
Hiroshi Yamauchi
fcc1f6b65e Fix the IR gen for C++ method calls and refactor around CGFunctionInfo
In GenCall, fix the IR gen for C++ method calls as under MSVC as the
calling conventions for free functions and C++ methods can be
different. This also fixes the missing inreg (on sret arguments)
issues on Windows ARM64. Also refactor to use CGFunctionInfo
returnInfo isSretAfterThis to detect when to reorder the sret and the
this arguments under MSVC.

In ClagImporter, don't drop the return type for the compound
assignment operators such as operator+= when the return value is a
reference so that the CGFunctionInfo will be correctly indicate an
indirect return for the compound assignment operators.
2024-10-24 15:40:21 -07:00
Hiroshi Yamauchi
f815e1429e Ensure that BridgedTypeArray is indirectly returned
On Windows ARM64, how a struct value type is returned is sensitive to
conditions including whether a user-defined constructor exists,
etc. See

https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#return-values

That caused a calling convention mismatch between the
non-USED_IN_CPP_SOURCE (Swift) side and the USE_IN_CPP_SOURCE (C++)
side and a crash.

Add this constructor so that the calling convention matches.

This is a fix for the OnoneSimplification crash in

https://github.com/swiftlang/swift/issues/74866#issuecomment-2319618579

and is a partial fix for

https://github.com/swiftlang/swift/issues/74866#issuecomment-2319618579
2024-09-12 10:46:55 -07:00
zoecarver
474a7cd834 [cxx-interop] Only mark projections of self-contained types as unsafe.
Projections of trivial types and view types aren't unsafe. This matches what was described in the vision document.
2023-07-18 17:42:05 -07:00
Ehud Adler
18c6bdd212 [Cxx iterop] Disambiguate between methods with the same name but different constness 2022-02-09 19:49:02 -05:00
zoecarver
1429cf3d29 [nfc][cxx-interop] Add some tests for calling C++ methods.
Finally 😅
2022-02-02 11:09:36 -08:00