Skip to content

[cxx-interop] Move swift/bridging header to clang resource dir#12861

Open
j-hui wants to merge 1 commit intoswiftlang:stable/21.xfrom
j-hui:move-swift-bridging
Open

[cxx-interop] Move swift/bridging header to clang resource dir#12861
j-hui wants to merge 1 commit intoswiftlang:stable/21.xfrom
j-hui:move-swift-bridging

Conversation

@j-hui
Copy link
Copy Markdown

@j-hui j-hui commented Apr 30, 2026

The swift/bridging header provides annotation macros (e.g., SWIFT_SHARED_REFERENCE, SWIFT_COMPUTED_PROPERTY) for C++ code that interoperate with Swift. Previously, this header was shipped in the Swift toolchain's usr/include, which is not part of Clang's default search paths in the OSS toolchain, which forced users to manually pass -I flags to find the header.

By placing it in Clang's resource directory, the header is automatically discoverable by both clang and swift (via its embedded Clang instance), since both already search /include by default.

rdar://136716355

The swift/bridging header provides annotation macros (e.g.,
SWIFT_SHARED_REFERENCE, SWIFT_COMPUTED_PROPERTY) for C++ code that
interoperate with Swift. Previously, this header was shipped in the
Swift toolchain's usr/include, which is not part of Clang's default
search paths in the OSS toolchain, which forced users to manually pass
-I flags to find the header.

By placing it in Clang's resource directory, the header is automatically
discoverable by both clang and swift (via its embedded Clang instance),
since both already search <clang-resource-dir>/include by default.

rdar://136716355
@j-hui
Copy link
Copy Markdown
Author

j-hui commented Apr 30, 2026

swiftlang/swift#88748

@swift-ci please smoke test

@j-hui
Copy link
Copy Markdown
Author

j-hui commented Apr 30, 2026

09:34:05  FAILED: swift/_FoundationCollections.swiftmodule

Windows failure does not seem to be related.

@j-hui
Copy link
Copy Markdown
Author

j-hui commented Apr 30, 2026

swiftlang/swift#88748

@swift-ci please smoke test windows platform

@j-hui j-hui marked this pull request as ready for review April 30, 2026 16:18
@j-hui j-hui requested a review from a team as a code owner April 30, 2026 16:18
@j-hui
Copy link
Copy Markdown
Author

j-hui commented Apr 30, 2026

@swift-ci please smoke test macos platform

@j-hui
Copy link
Copy Markdown
Author

j-hui commented Apr 30, 2026

@swift-ci please smoke test linux platform

@j-hui
Copy link
Copy Markdown
Author

j-hui commented May 5, 2026

swiftlang/swift#88748

@swift-ci please smoke test

@hnrklssn hnrklssn requested a review from finagolfin May 5, 2026 22:07
@hnrklssn
Copy link
Copy Markdown
Member

hnrklssn commented May 5, 2026

@finagolfin Do you know how this would affect C++ interop on Android?

@finagolfin
Copy link
Copy Markdown
Member

Not something I've looked at much, but may not make a difference on Android, since we don't use the Swift-forked clang resource directory, but the one from the NDK. Are there C++ Interop tests that make sure this works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants