Commit Graph

2035 Commits

Author SHA1 Message Date
Alex Lorenz
580ecd0893 [cxx-interop] fix Egor's review comments for move-only patch 2023-11-30 10:12:11 -08:00
Alex Lorenz
b7158ea486 [cxx-interop] add SWIFT_NONCOPYABLE annotation 2023-11-29 18:13:31 -08:00
Alex Lorenz
029644806d [cxx-interop] fix the use of '.pointee' with getter accessor for derived-to-base synthesized accessor 2023-11-29 15:42:11 -08:00
Alex Lorenz
16a8ae42ef [cxx-interop] fix the use of '.pointee' with address accessors for derived-to-base synthesized accessors 2023-11-29 15:10:27 -08:00
Alex Lorenz
6a47011b18 [cxx-interop] add IRGen test for field base accessors for non-copyable fields 2023-11-29 09:10:51 -08:00
Alex Lorenz
bacc58e0f7 [cxx-interop] provide correct referential access to non-copyable base fields from a derived value type 2023-11-28 20:10:07 -08:00
Alex Lorenz
51d0e84933 [cxx-interop] add a test to cover accessing non-copyable field 2023-11-28 14:07:44 -08:00
Egor Zhdan
bc4cffd699 [cxx-interop] Test more of stdlib with the upcoming compat version 2023-11-28 20:49:00 +00:00
Alex Lorenz
fd6a5a20ef [cxx-interop] test accessing fields of a move-only C++ type 2023-11-28 12:26:48 -08:00
Alex Lorenz
a913c4e10a [cxx-interop] fix support for value-only non-copyable type dereference 2023-11-27 14:04:26 -08:00
Hiroshi Yamauchi
897fae2b26 Merge pull request #69929 from hjyamauchi/methods-this-and-indirect-return-irgen-msvc
Fix test methods-this-and-indirect-return-irgen-msvc.swift for windows/aarch64
2023-11-27 10:54:05 -08:00
Alex Lorenz
5d2637a8fe [cxx-interop] add support for 'mutableAddress' pointee for non-copyable C++ types 2023-11-27 09:59:33 -08:00
Egor Zhdan
7218a831a2 [cxx-interop] Test stdlib with the upcoming compat version 2023-11-22 20:12:08 +00:00
Egor Zhdan
ece33a4d15 [cxx-interop] Import using decls that refer to member operators of a base class
This is required for proper support for `std::vector::iterator` on Windows.

rdar://118657936 / resolves https://github.com/apple/swift/issues/69990
2023-11-20 18:57:12 +00:00
Hiroshi Yamauchi
e59fcc46dd Fix test methods-this-and-indirect-return-irgen-msvc.swift for windows/aarch64
Handle a slight LLVM IR difference in the second parameter (inreg) of
a function between x86_64 and aarch64. These are how Clang on windows
emits the code.
2023-11-16 13:34:36 -08:00
Alex Lorenz
86e5556e91 [cxx-interop] add support for 'address' pointee for non-copyable C++ types 2023-11-16 10:08:30 -08:00
Alex Lorenz
3cdb4b1151 [cxx-interop] add some initial move only tests 2023-11-16 10:08:29 -08:00
Alex Lorenz
5d8db5cfa1 [cxx-interop] add a testcase for setting the pointee on unique_ptr 2023-11-16 10:08:28 -08:00
zoecarver
a78a7ec4aa [cxx-interop] Cleanup: remove debug printing, enable more tests. 2023-11-16 10:08:27 -08:00
zoecarver
70a353bd28 [tests][cxx-interop] Fix straggling test. 2023-11-16 10:08:26 -08:00
zoecarver
4ba62e1abe [cxx-interop] Add tests for std::unique_ptr. 2023-11-16 10:08:25 -08:00
Hiroshi Yamauchi
7b21ed1b38 Merge pull request #69836 from hjyamauchi/winarm64test
Fix test msvc-abi-return-indirect-trivial-record.swift for windows aarch64
2023-11-16 09:44:47 -08:00
Hiroshi Yamauchi
a8424a03c4 Fix test msvc-abi-return-indirect-trivial-record.swift for windows aarch64
The test msvc-abi-return-indirect-trivial-record.swift fails on
windows aarch64 because the type of the third argument of
@"??YLoadableIntWrapper@@qeaa?AU0@U0@@z"
(@LoadableIntWrapper::operator+=(LoadableIntWrapper)) is i64 which
differs from i32 for x86_64. Accommodate this as this is how Clang
generates code. See https://godbolt.org/z/G76aMr5M9.
2023-11-14 16:02:44 -08:00
Egor Zhdan
5e4e83e247 Revert "Revert "[cxx-interop] Partially disable a test on Linux""
This reverts commit 4cf34abe99.

Unfortunately still failing on Ubuntu 18.04 and Amazon Linux 2.

rdar://118401796
2023-11-14 18:41:52 +00:00
Egor Zhdan
efc008a2ca [cxx-interop] Import using decls that expose methods from private base classes
If a C++ type `Derived` inherits from `Base` privately, the public methods from `Base` should not be callable on an instance of `Derived`. However, C++ supports exposing such methods via a using declaration: `using MyPrivateBase::myPublicMethod;`.

MSVC started using this feature for `std::optional` which means Swift doesn't correctly import `var pointee: Pointee` for instantiations of `std::optional` on Windows. This prevents the automatic conformance to `CxxOptional` from being synthesized.

 rdar://114282353 / resolves https://github.com/apple/swift/issues/68068
2023-11-14 00:30:54 +00:00
Alex Lorenz
4115bd6861 Merge pull request #69781 from hyp/eng/const-setter-opsub
[cxx-interop] make sure a const `operator []` is imported as a mutabl…
2023-11-13 10:16:48 -08:00
Alex Lorenz
baf06a1f80 Merge pull request #69548 from Genaro-Chris/main
Import custom c++ types as unchecked sendable types
2023-11-10 18:19:23 -08:00
Alex Lorenz
1d53ecedfd [cxx-interop] make sure a const operator [] is imported as a mutable setter 2023-11-10 14:21:03 -08:00
Egor Zhdan
be24236bea Revert "Revert "[cxx-interop] Look up NSNotificationName in C++ language mode properly""
This reverts commit 80448d2f1c.
2023-11-10 13:26:00 +00:00
Alex Lorenz
588a35195d [interop][SwiftToCxx] fix a CHECK line in string-to-nsstring.mm
rdar://118139534
2023-11-09 13:42:45 -08:00
Alex Lorenz
405ffed2cc Merge pull request #69702 from hyp/eng/117805261
[interop] fix consuming-parameter-in-cxx.swift failure
2023-11-09 10:10:02 -08:00
Alex Lorenz
511c46ff62 Merge pull request #69708 from hyp/eng/102393950
[interop][SwiftToCxx] dispatch 'class' methods directly to avoid brok…
2023-11-09 10:08:09 -08:00
Egor Zhdan
f9bf957594 [cxx-interop] Do not import inherited methods with rvalue this
We do not synthesize the inheritance thunks correctly for such methods. Do not try to synthesize them, as that causes issues when there are two overloads of the same method, one with rvalue this and one without.

The proper solution is tracked as https://github.com/apple/swift/issues/69745

Unblocks rdar://114282353
2023-11-09 13:42:59 +00:00
Genaro-Chris
f715d99727 Merge branch 'apple:main' into main 2023-11-08 19:27:11 +01:00
Alex Lorenz
bcdfb8da28 [interop][SwiftToCxx] dispatch 'class' methods directly to avoid broken header generation
rdar://102393950
2023-11-07 14:33:54 -08:00
Egor Zhdan
5561f1ae9a Merge pull request #69692 from apple/egorzhdan/reenable-pointee-test-linux
Revert "[cxx-interop] Partially disable a test on Linux"
2023-11-07 23:26:55 +01:00
Alex Lorenz
86338c9f3b [interop] fix consuming-parameter-in-cxx.swift failure
rdar://117805261
2023-11-07 11:36:22 -08:00
Egor Zhdan
4cf34abe99 Revert "[cxx-interop] Partially disable a test on Linux"
This reverts commit ff5b698602.
2023-11-07 13:43:27 +00:00
Yuta Saito
79b3d2d626 Add underscore prefix to extern attribute
It's already guarded by a feature flag, but it would be nice to signal
users that it's not stable yet by adding an underscore prefix.
2023-11-07 02:01:02 +00:00
Genaro-Chris
2ec4ad3df0 Merge branch 'apple:main' into main 2023-11-06 19:31:28 +01:00
Alex Lorenz
67c67a0c78 Merge pull request #69648 from hyp/eng/namespace-completion
[cxx-interop] code-complete namespace members
2023-11-04 11:56:52 -07:00
Genaro-Chris
6e5a083720 added test for unchecked sendable 2023-11-04 13:33:01 +01:00
Alex Lorenz
358c688cda [cxx-interop] code-complete namespace members
Fixes https://github.com/apple/swift/issues/65736

rdar://109714059
2023-11-03 15:53:14 -07:00
Michael Gottesman
7e7eb60044 Merge pull request #69579 from meg-gupta/bulkdisable
Disable failing tests in CI
2023-11-01 17:12:29 -07:00
Meghana Gupta
bb138a14b7 Disable consuming-parameter-in-cxx.swift 2023-11-01 13:13:55 -07:00
Alex Lorenz
ea38d57485 Merge pull request #69519 from hyp/eng/get-type-metadata-helper-inline
[interop][SwiftToCxx] Use 'SWIFT_INLINE_PRIVATE_HELPER' for getTypeMetadata helper to avoid emitting a reference to it when 'DEBUG' macro is set
2023-11-01 10:26:36 -07:00
Alex Lorenz
261f41e973 Merge pull request #69507 from finagolfin/droid
[android][test] Disable a C++ Interop test that doesn't work with clang 14 from LTS NDK 25
2023-10-31 09:23:29 -07:00
Alex Lorenz
b1d63d0938 [interop][SwiftToCxx] Use 'SWIFT_INLINE_PRIVATE_HELPER' for getTypeMetadata helper to avoid emitting a reference to it when 'DEBUG' macro is set
This is needed as the metadata for C++ types might not be actually emitted and thus we can't always reference it

Fixes https://github.com/apple/swift/issues/69234

rdar://117089662
2023-10-31 09:21:01 -07:00
Alex Lorenz
ca95860530 [interop][SwiftToCxx] ensure Swift generic types can be used as template parameters to other Swift generic types in C++
rdar://117015962
2023-10-30 12:17:29 -07:00
Alex Lorenz
645073de55 [interop][SwiftToCxx] do not expose Swift APIs with shared FRTs as their ownership is not yet managed at the language boundary 2023-10-30 10:54:25 -07:00