Skip to content

[cxx-interop] Make experimental flag ImportNonPublicCxxMembers #79728

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

Conversation

j-hui
Copy link
Contributor

@j-hui j-hui commented Mar 2, 2025

ClangImporter can now import non-public members as of be73254 and 66c2e2c, but doing so triggers some latent ClangImporter bugs in projects that don't use or need those non-public members.

This patch introduces a new experimental feature flag, ImportNonPublicCxxMembers, that guards against the importation of non-public members while we iron out those latent issues. Adopters of the SWIFT_PRIVATE_FILEID feature introduced in bdf2294 can enable this flag to opt into importing private members they wish to access from Swift.

rdar://145569473

Guards the functionality from 66c2e2c
under a new experimental feature flag, ImportCxxNonPublicBaseMembers.

Inheriting non-public base members triggers some latent
ClangImporter bugs that we are not quite ready to iron out.
@j-hui
Copy link
Contributor Author

j-hui commented Mar 2, 2025

@swift-ci Please smoke test

@j-hui
Copy link
Contributor Author

j-hui commented Mar 3, 2025

@swift-ci please smoke test

@j-hui
Copy link
Contributor Author

j-hui commented Mar 3, 2025

Now, I'm thinking that perhaps I should actually make this flag ImportCxxNonPublicMembers, and skip over all non-public members (aside from non-inherited fields). It simplifies the semantics of the flag, and mitigates more issues we might run into.

@j-hui
Copy link
Contributor Author

j-hui commented Mar 3, 2025

@swift-ci please smoke test

Copy link
Contributor

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions inline but the changes look good to me.

@Xazax-hun
Copy link
Contributor

Please update the title and the description with the new name/semantics.

@j-hui
Copy link
Contributor Author

j-hui commented Mar 3, 2025

@swift-ci Please smoke test

@j-hui j-hui changed the title [cxx-interop] Make experimental flag ImportCxxNonPublicBaseMembers [cxx-interop] Make experimental flag ImportNonPublicCxxMembers Mar 3, 2025
@j-hui
Copy link
Contributor Author

j-hui commented Mar 3, 2025

@swift-ci please test

Copy link
Contributor

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@j-hui j-hui merged commit edc7420 into swiftlang:main Mar 4, 2025
5 checks passed
@j-hui j-hui added the c++ interop Feature: Interoperability with C++ label Mar 13, 2025
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