Commit Graph

17 Commits

Author SHA1 Message Date
Egor Zhdan
b330376a43 [cxx-interop] Pull changes from swift-6 compat mode into swift-5.9
This gives projects using C++ interop compat mode 5.9 access to the new features such as virtual methods and move-only types.

rdar://126485814
2024-04-24 11:53:31 +01:00
Egor Zhdan
1be7230876 [cxx-interop] Use C++17 standard by default
Clang is using C++17 standard version by default since Clang 16.

Swift’s ClangImporter should do the same, to make sure that clients who run clang and then swiftc without explicit std version see consistent behavior.

rdar://125777068
2024-04-02 16:23:32 +01:00
Egor Zhdan
19a257b36b [cxx-interop] Test stdlib support with newer C++ standards 2024-03-21 16:44:38 +00:00
Egor Zhdan
78b9de1391 [cxx-interop] Run tests with swift-6 compat mode 2024-02-23 16:24:14 +00: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
Egor Zhdan
4cf34abe99 Revert "[cxx-interop] Partially disable a test on Linux"
This reverts commit ff5b698602.
2023-11-07 13:43:27 +00:00
Saleem Abdulrasool
8f0129b777 test: disable test pending #68068 2023-09-01 10:58:43 -07:00
Egor Zhdan
c167f4045b [cxx-interop] Conform std::optional to ExpressibleByNilLiteral
This will allow passing `nil` as a parameter to a C++ function that takes a `std::optional<T>`.

rdar://114194600
2023-08-21 19:21:40 +01:00
Egor Zhdan
ff5b698602 [cxx-interop] Partially disable a test on Linux
It crashes on Ubuntu 18.04 and Amazon Linux 2.

rdar://113414160
2023-08-08 15:28:19 +01:00
Egor Zhdan
399e5b469d [cxx-interop] Add test for mutable std.optional.pointee
See https://github.com/apple/swift/pull/67648
2023-08-03 14:48:11 +01:00
Alex Lorenz
cf943661ca [cxx-interop] test, enable more tests on windows
These tests require the C++ standard library
2023-07-28 16:02:43 -07:00
Egor Zhdan
7d7825591d [cxx-interop] Make std.optional.value nullable
rdar://109356566 / resolves https://github.com/apple/swift/issues/65918
2023-05-15 17:30:59 +01:00
Egor Zhdan
8f58eafbd3 [cxx-interop] Make sure interop does not trigger TBD validation errors
This disables TBD validation when C++ interop is enabled, unless an explicit `-validate-tbd-against-ir=` flag was passed.

rdar://83405989 / https://github.com/apple/swift/issues/56458
2023-04-05 16:06:09 +01:00
Egor Zhdan
5520a49ed6 [cxx-interop] Enable use-std-optional test on Linux 2023-04-04 17:10:28 +01:00
Egor Zhdan
a12986ade4 [cxx-interop] Add CxxOptional protocol for std::optional ergonomics
This adds a protocol to the C++ standard library overlay which will improve the ergonomics of `std::optional` when used from Swift code.

As of now, the overlay adds an initializer of `Swift.Optional` that takes an instance of `CxxOptional` as a parameter.
2023-03-03 19:41:30 +01:00
Egor Zhdan
cc23f46c92 [cxx-interop] Add a test for std::optional usage from Swift 2023-02-14 17:47:08 +00:00