Skip to content

[6.2 🍒][Dependency Scanning][C++Interop] Do not query CxxStdlib Swift overlay for textual modules which were not built with c++interop #81416

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 1 commit into from
May 15, 2025

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented May 9, 2025

Cherry-pick of #81415

  • Explanation: When we discover a textual module dependency which is a module which was not originally built from source using C++ interop (specifying -formal-cxx-interoperability-mode=off), avoid looking up the C++ standard library Swift overlay for it. This is required for the case of the Darwin module, for example, which includes headers which map to C++ stdlib headers when the compiler is operating in C++ interop mode, but the C++ standard library Swift overlay module itself depends on 'Darwin', which results in a cycle. To resolve such situations, we can rely on the fact that Swift textual interfaces of modules which were not built with C++ interop must be able to build without importing the C++ standard library Swift overlay, so we avoid specifying it as a dependency for such modules. The primary source module, as well as Swift textual module dependencies which were built with C++ interop will continue getting a direct depedency of the 'CxxStdlib' Swift module.

  • Scope: C++Interop-enabled builds using Explicitly-Built modules which rely on Apple SDKs.

  • Risk: Low, this change removes module dependency on CxxStdlib for certain Swift modules which, in expectation, are guaranteed to be buildable without this module dependency.

  • Issue: rdar://150222155

  • Reviewed By: @egorzhdan, @cachemeifyoucan

  • Original PR: [Dependency Scanning][C++Interop] Do not query CxxStdlib Swift overlay for textual modules which were not built with c++interop #81415

@artemcm artemcm added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels May 9, 2025
@artemcm
Copy link
Contributor Author

artemcm commented May 9, 2025

@swift-ci test

…lay for textual modules which were not built with c++interop

When we discover a textual module dependency which is a module which was not originally built from source using C++ interop (specifying '-formal-cxx-interoperability-mode=off'), avoid looking up the C++ standard library Swift overlay for it. This is required for the case of the 'Darwin' module, for example, which includes headers which map to C++ stdlib headers when the compiler is operating in C++ interop mode, but the C++ standard library Swift overlay module itself depends on 'Darwin', which results in a cycle. To resolve such situations, we can rely on the fact that Swift textual interfaces of modules which were not built with C++ interop must be able to build without importing the C++ standard library Swift overlay, so we avoid specifying it as a dependency for such modules.

The primary source module, as well as Swift textual module dependencies which *were* built with C++ interop will continue getting a direct depedency of the 'CxxStdlib' Swift module.

Resolves rdar://150222155
@artemcm artemcm force-pushed the CXXInteropDarwinCycleFix-62 branch from bc50cf9 to 7be7ab1 Compare May 9, 2025 20:01
@artemcm
Copy link
Contributor Author

artemcm commented May 9, 2025

@swift-ci test

@artemcm artemcm marked this pull request as ready for review May 12, 2025 16:39
@artemcm artemcm requested a review from a team as a code owner May 12, 2025 16:39
@artemcm artemcm requested a review from nkcsgexi May 12, 2025 16:43
@artemcm artemcm merged commit f8f749b into swiftlang:release/6.2 May 15, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants