8000 🍒[cxx-interop] Fix metadata mismatch regarding fields of structs by susmonteiro · Pull Request #81740 · swiftlang/swift · GitHub
[go: up one dir, main page]

Skip to content

🍒[cxx-interop] Fix metadata mismatch regarding fields of structs #81740

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 27, 2025

Conversation

susmonteiro
Copy link
Contributor

In #78467 and #78961, we stopped emitting metadata for private C++ fields. However, this created a mismatch between the fields emitted and the number of fields + their offsets in the StructDescriptor.

rdar://147263490
(cherry picked from commit 72b13b3)
@susmonteiro susmonteiro requested a review from a team as a code owner May 23, 2025 10:34
@susmonteiro susmonteiro added the c++ interop Feature: Interoperability with C++ label May 23, 2025
@susmonteiro
Copy link
Contributor Author

@swift-ci please test

for (VarDecl *prop : Target->getStoredProperties())
asImpl().addFieldOffset(prop);
for (VarDecl *prop : Target->getStoredProperties()) {
if (!(prop->getClangDecl() &&
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer if this check went through the same function as isExportableField to determine whether the particular VarDecl is exported. It doesn't matter so much on the 6.2 branch, but I can imagine us tuning this predicate in the future, and it would be best to have it in a single place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll make this change

@susmonteiro susmonteiro enabled auto-merge May 23, 2025 11:23
@susmonteiro
Copy link
Contributor Author

@swift-ci please test macOS platform

@susmonteiro susmonteiro merged commit 4283d2b into release/6.2 May 27, 2025
5 checks passed
@susmonteiro susmonteiro deleted the susmonteiro/6.2-metadata-private-fields branch May 27, 2025 18:43
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.

3 participants
0