Skip to content

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

Open
j-hui wants to merge 1 commit intoswiftlang:mainfrom
j-hui:move-swift-bridging
Open

[cxx-interop] Move swift/bridging header to clang resource dir#88748
j-hui wants to merge 1 commit intoswiftlang:mainfrom
j-hui:move-swift-bridging

Conversation

@j-hui
Copy link
Copy Markdown
Contributor

@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 <clang-resource-dir>/include by default.

In addition to removing lib/ClangImporter/SwiftBridging/, where the
swift/bridging lived, this patch also removes build settings related to
the bridging header (SWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER and
the --enable-cxx-interop-swift-bridging-header build-script flag), as
well as the explicit -I flags in interop tests pointing to the old
SwiftBridging directory.

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

j-hui commented Apr 30, 2026

swiftlang/llvm-project#12861

@swift-ci please smoke test

Copy link
Copy Markdown
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.

Thanks! This is the right way to go.

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.

3 participants