Skip to content

[cxx-interop] Types exposed from ObjC modules should be behind a macro #83002

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
Jul 15, 2025

Conversation

Xazax-hun
Copy link
Contributor

Functions or template instantiations with Obj-C types should always be behind a macro to make sure the interop header compiles cleanly in C++.

rdar://152836730

Functions or template instantiations with Obj-C types should always be
behind a macro to make sure the interop header compiles cleanly in C++.

rdar://152836730
@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Jul 11, 2025
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

@xedin xedin removed their request for review July 14, 2025 16:25
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 merged commit 761c503 into swiftlang:main Jul 15, 2025
3 checks passed
Xazax-hun added a commit to Xazax-hun/swift that referenced this pull request Jul 15, 2025
… macro

Explanation: We the generated reverse interop headers to be valid C++,
so every declaration coming from an Obj-C module should be behind an
ifdef. Unfortunately, we do not always have this information but we do
know that our frameworks contain Obj-C code. So this PR makes sure every
entity coming from our frameworks are behind ifdef.
Issues: rdar://152836730
Original PRs: swiftlang#83002
Risk: Low, the change is narrow and straightforward.
Testing: Added a compiler test.
Reviewers: @egorzhdan
Xazax-hun added a commit to Xazax-hun/swift that referenced this pull request Jul 16, 2025
… macro

Explanation: We the generated reverse interop headers to be valid C++,
so every declaration coming from an Obj-C module should be behind an
ifdef. Unfortunately, we do not always have this information but we do
know that our frameworks contain Obj-C code. So this PR makes sure every
entity coming from our frameworks are behind ifdef.
Issues: rdar://152836730
Original PRs: swiftlang#83002
Risk: Low, the change is narrow and straightforward.
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