Skip to content

🍒 [6.4] [swift/cxx-interop] Move swift/bridging header to clang resource dir#13297

Open
j-hui wants to merge 1 commit into
swiftlang:swift/release/6.4.xfrom
j-hui:j-hui/6.4.x/move-swift-bridging
Open

🍒 [6.4] [swift/cxx-interop] Move swift/bridging header to clang resource dir#13297
j-hui wants to merge 1 commit into
swiftlang:swift/release/6.4.xfrom
j-hui:j-hui/6.4.x/move-swift-bridging

Conversation

@j-hui

@j-hui j-hui commented Jul 2, 2026

Copy link
Copy Markdown

Explanation: Place the swift/bridging header in Clang's resource directory, so that it is automatically #include-able by both clang and swift. This file is already #include-able on Apple's Xcode toolchains (which as different search pathes), but NOT OSS toolchains; this cherry-pick brings the two into alignment for the 6.4 release.

Scope: header files that #include <swift/bridging>, i.e., those written for Swift/C[++] interop

Risk: the fact that OSS toolchains behave differently than Apple toolchains means that some projects may have workarounds that conflict with this change. I will leave it to the discretion of the branch managers + reviewers whether this is an acceptable risk.

Testing: CI testing

Original PR: #12861 swiftlang/swift#88748 swiftlang/swift-installer-scripts#532

Reviewed by: @egorzhdan @etcwilde @compnerd @Xazax-hun @finagolfin

Issues: rdar://136716355

Details:

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.

(cherry picked from commit c19415a)

Paired with swiftlang/swift#90358

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
(cherry picked from commit c19415a)
@j-hui

j-hui commented Jul 2, 2026

Copy link
Copy Markdown
Author

swiftlang/swift#90358

@swift-ci please test

@j-hui j-hui marked this pull request as ready for review July 2, 2026 05:49
@j-hui j-hui requested a review from a team as a code owner July 2, 2026 05:49
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.

1 participant