Skip to content

[cxx-interop] Fix crash when using bridging headers in reverse interop #83540

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

Conversation

Xazax-hun
Copy link
Contributor

The code had the assumption that clang nodes always have owning modules. In fact, when a header is imported via -import-objc-header this is not true.

rdar://157489426

The code had the assumption that clang nodes always have owning modules.
In fact, when a header is imported via `-import-objc-header` this is not
true.

rdar://157489426
@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Aug 5, 2025
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

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!

@Xazax-hun Xazax-hun enabled auto-merge August 5, 2025 13:35
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test Windows

@Xazax-hun Xazax-hun merged commit e5ed233 into swiftlang:main Aug 7, 2025
3 checks passed
Xazax-hun added a commit to Xazax-hun/swift that referenced this pull request Aug 7, 2025
…nterop

Explanation: The original code had the assumption we only import
modules. However, there is a flag to import an umbrella header in which
case the clang nodes have no owning module. This PR prevents a null
dereference in that case.
Issues: rdar://157489426
Original PRs: swiftlang#83540
Risk: Low, added a check to avoid null dereference.
Testing: Added a compiler test.
Reviewers: @egorzhdan
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