[cxx-interop] Import non-public members of SWIFT_PRIVATE_FILEID-annotated classes #80320
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ImportNonPublicCxxMembers experimental feature flag was introduced to gate the importation of non-public class members, to ward off latent bugs in projects that have no need for importing private members. However that flag is required by the SWIFT_PRIVATE_FILEID feature to access said private fields.
This patch relaxes the "don't import this non-public member" condition a bit by bypassing this feature flag for non-public members of C++ classes that have the SWIFT_PRIVATE_FILEID annotation, thus allowing that feature to be used without specifying the experimental feature flag. Since that annotation is opt-in by design, ClangImporter will still skip over the private members of most C++ classes (when ImportNonPublicCxxMembers is not enabled), so that projects not using this feature are unaffected.
ImportNonPublicCxxMembers is still useful (i.e., should be enabled by default in the future) because it improves the diagnostics for when a user tries to access any non-public member in Swift.
rdar://146304086