Skip to content

[cxx-interop] Avoid spurious type aliases in reverse interop #78287

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
Dec 19, 2024

Conversation

Xazax-hun
Copy link
Contributor

To support nested structs, we emit type aliases in the outer class. Unfortunately, we emitted these type aliases unconditionally, even if the actualy nested struct was not emitted to the reverse interop header (due to visibility or the construct being unsupported). This PR fixed this issue by checking first if the nested entity should be included in the reverse interop header.

rdar://141688074

To support nested structs, we emit type aliases in the outer class.
Unfortunately, we emitted these type aliases unconditionally, even if
the actualy nested struct was not emitted to the reverse interop header
(due to visibility or the construct being unsupported). This PR fixed
this issue by checking first if the nested entity should be included in
the reverse interop header.

rdar://141688074
@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Dec 19, 2024
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

Xazax-hun pushed a commit that referenced this pull request Dec 19, 2024
Explanation: Due to a missing check we emitted using declarations for
types we did not emit into the reverse interop header resulted in
compilation errors.
Scope: C++ reverse interop
Risk: Low. The fix is straightforward calling a function to do the check
if the entity should be included in the reverse interop header. It does
not affect other code paths.
Testing: Added compiler tests.
Issue: rdar://141688074
Reviewer: @egorzhdan

Original PR: #78287
Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@Xazax-hun Xazax-hun enabled auto-merge December 19, 2024 13:37
@Xazax-hun Xazax-hun merged commit 9843de2 into main Dec 19, 2024
3 checks passed
@Xazax-hun Xazax-hun deleted the gaborh/fix-nested-structs branch December 19, 2024 14:53
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