Skip to content

🍒[cxx-interop] Pull changes from swift-6 compat mode into swift-5.9 #73223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

egorzhdan
Copy link
Contributor

@egorzhdan egorzhdan commented Apr 24, 2024

Explanation: This gives projects using C++ interop compat mode 5.9 access to the new features, such as virtual methods, move-only types, and default arguments. This also fixes a bug where T* was being imported as UnsafeMutablePointer<T> when compiling with non-copyable generics disabled, triggering assertions in the compiler, which were blocking the enablement of move-only types.
Scope: ClangImporter logic was changed to accommodate for the versioning change.
Risk: Low, most of the changes are guarded by C++ interop being enabled.
Testing: Added/changed compiler tests.
Issue: rdar://126485814
Reviewer: @DougGregor

Original PRs: #73055 and #72912

… generics are disabled

C++ pointer type `T*` is generally imported as `Unsafe(Mutable)Pointer<T>`. However, if `T` is non-copyable in Swift (e.g. it has a deleted C++ copy constructor), using `UnsafePointer<T>` type requires noncopyable generics to be enabled.

This was causing assertion failures when building SwiftCompilerSources in #72912.

(cherry picked from commit 78eee32)
…T` when adding base member accessors

(cherry picked from commit 6140ba1)
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

(cherry picked from commit b330376)
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Apr 24, 2024
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan egorzhdan marked this pull request as ready for review April 24, 2024 18:20
@egorzhdan egorzhdan requested a review from a team as a code owner April 24, 2024 18:20
@egorzhdan egorzhdan requested a review from DougGregor April 24, 2024 18:20
@egorzhdan
Copy link
Contributor Author

@swift-ci please test macOS

@egorzhdan
Copy link
Contributor Author

@swift-ci please test Linux

@egorzhdan egorzhdan merged commit a843d69 into release/6.0 Apr 25, 2024
@egorzhdan egorzhdan deleted the egorzhdan/6.0-cxx-interop-compat-mode branch April 25, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants