Skip to content
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

[cxx-interop] Fix access check for nested private C++ enums #80366

Merged
merged 3 commits into from
Apr 1, 2025

Conversation

j-hui
Copy link
Contributor

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

This patch fixes the access check for nested private C++ enums to look for the SWIFT_PRIVATE_FILEID of the enclosing C++ class, if any. Previously, the check was looking at for SWIFT_PRIVATE_FILEID on the enum decl itself (which is meaningless); that prevented nested private enum members from being accessible in Swift.

This patch also specializes the type signature of getPrivateFileIDAttrs to clarify the fact that SWIFT_PRIVATE_FILEID is not a meaningful annotation on anything other than CXXRecordDecl, because that is the only kind of decl that can assign access specifiers to its members.

rdar://148081340

This patch fixes the access check for nested private C++ enums to look
for the SWIFT_PRIVATE_FILEID of the enclosing C++ class, if any.
Previously, the check was looking at for SWIFT_PRIVATE_FILEID on the
enum decl itself (which is meaningless); that prevented nested private
enum members from being accessible in Swift.

This patch also specializes the type signature of getPrivateFileIDAttrs
to clarify the fact that SWIFT_PRIVATE_FILEID is not a meaningful
annotation on anything other than CXXRecordDecl, because that is the
only kind of decl that can assign access specifiers to its members.

rdar://148081340
@j-hui
Copy link
Contributor Author

j-hui commented Mar 28, 2025

@swift-ci please test

@j-hui
Copy link
Contributor Author

j-hui commented Mar 29, 2025

@swift-ci please test

@j-hui
Copy link
Contributor Author

j-hui commented Mar 31, 2025

@swift-ci please test

1 similar comment
@j-hui
Copy link
Contributor Author

j-hui commented Mar 31, 2025

@swift-ci please test

@j-hui
Copy link
Contributor Author

j-hui commented Mar 31, 2025

@swift-ci please test windows platform

@j-hui
Copy link
Contributor Author

j-hui commented Apr 1, 2025

@swift-ci please test macos platform

@j-hui j-hui enabled auto-merge (squash) April 1, 2025 04:19
@j-hui j-hui merged commit e8bcc52 into swiftlang:main Apr 1, 2025
4 of 5 checks passed
@j-hui j-hui deleted the fix-nested-private-enum branch April 1, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants