🍒[cxx-interop] Skip type metadata for C++ types that are only used in private C++ fields #78607
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.
Explanation: When importing C++ types that use pointer-to-implementation idiom, when the implementation type is forward-declared, the compiler would previously emit an error:
This was happening because Swift was trying to emit the value witness table for
std::unique_ptr<IncompleteType>
, which isn't possible, because the destructor cannot be instantiated for an incomplete pointee type.Scope: This changes IRGen logic that emits Swift metadata for private fields. It now ignores private fields imported from Clang, since there is no way to use those from Swift.
Risk: Low, this only affects type metadata of private fields. Swift started importing C++ private fields very recently. Non-C++ imported types don't get private fields in Swift.
Testing: Added new compiler tests.
Issue: rdar://141960396
Reviewer: @Xazax-hun @rjmccall
Original PR: #78467