Commit Graph

6 Commits

Author SHA1 Message Date
Gabor Horvath
e79e04c0a6 [cxx-interop] Mark C++ reference parameters @addressable
C++ code can return values that depend on the storage that backs the
references that were passed in as argument. Thus, swift should not
introdue temporary copies of that storage before invoking those
functions as they could result in lifetime issues.
2025-02-11 11:10:51 +00:00
Gabor Horvath
d17d17e96e [cxx-interop] Fix inadvertently renaming static method to Mutating
When we have both const and non-const version of a function, we import
the non-cont version with the "Mutating" suffix. This logic, however, is
redundant for static member functions as those can never be marked as
"const" since they don't have a "self" or "this" to mutate.

rdar://120858502
2024-06-18 16:19:23 +01:00
Alex Lorenz
c09135b8f3 [cxx-interop] Fix the windows ABI for returning indirect values out of methods
Fixes https://github.com/apple/swift/issues/66326

This allows us to reneable Windows method tests. Note that Windows still has
a broken convention for non-trivial record with non-trivial destructor but
trivial copy-constructor, so classes in the methods.swift test need an explicit
copy constructor.

Fixes rdar://88391102
2023-07-14 15:56:05 -07:00
zoecarver
4f72147279 [cxx-interop] Use "c function conventions" for static methods and ctors (not "cxx method conventions").
Otherwise we will incorrectly use the "self" type's conventions when lowering the parameters (off-by-one).
2023-02-09 17:10:16 -08:00
zoecarver
6acffbbee6 [cxx-interop] Flip the switch: only import safe APIs. 2022-07-18 17:15:15 -04:00
zoecarver
1429cf3d29 [nfc][cxx-interop] Add some tests for calling C++ methods.
Finally 😅
2022-02-02 11:09:36 -08:00