Skip to content

[cxx-interop] Avoid circular reference errors when importing C++ structs #69327

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
Oct 23, 2023

Conversation

egorzhdan
Copy link
Contributor

When importing a C++ struct, if its owning module requires cplusplus, Swift tried to auto-conform it to certain protocols from the Cxx module. This triggers name lookup in the clang struct, specifically for __beginUnsafe() and __endUnsafe methods, which imports all of the base structs including their methods.

This moves the import of base structs out of the name lookup request, preventing cycles.

rdar://116426238

When importing a C++ struct, if its owning module requires cplusplus, Swift tried to auto-conform it to certain protocols from the Cxx module. This triggers name lookup in the clang struct, specifically for `__beginUnsafe()` and `__endUnsafe` methods, which imports all of the base structs including their methods.

This moves the import of base structs out of the name lookup request, preventing cycles.

rdar://116426238
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Oct 23, 2023
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

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.

1 participant