Skip to content
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

[cxx-interop] Refer to SwiftBridging module from usr/include/module.modulemap #72186

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

egorzhdan
Copy link
Contributor

The recent Clang compiler change makes -fno-modulemap-allow-subdirectory-search the default behavior. This means that projects that use C++ interop and #include <swift/bridging> no longer compile, since Clang won't search for the SwiftBridging module under usr/include/swift anymore.

This change adds a new modulemap file to be installed at toolchain/usr/include/module.modulemap. This modulemap is under a default Clang include search path, which will make sure Clang can discover the SwiftBridging module.

rdar://123334601

…e.modulemap`

The recent Clang compiler change makes `-fno-modulemap-allow-subdirectory-search` the default behavior. This means that projects that use C++ interop and `#include <swift/bridging>` no longer compile, since Clang won't search for the SwiftBridging module under `usr/include/swift` anymore.

This change adds a new modulemap file to be installed at `toolchain/usr/include/module.modulemap`. This modulemap is under a default Clang include search path, which will make sure Clang can discover the SwiftBridging module.

rdar://123334601
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Mar 8, 2024
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan
Copy link
Contributor Author

@swift-ci please build toolchain macOS

@vsapsai
Copy link
Contributor

vsapsai commented Mar 8, 2024

For the record, upon seeing #include <swift/bridging> clang would check "swift/module.modulemap" and then "swift/../module.modulemap". I don't think it is a performance problem, just wanted to share some details how "swift/bridging.modulemap" is processed.

By the way, this approach works with a test project too.

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan
Copy link
Contributor Author

@swift-ci please build toolchain macOS

@egorzhdan egorzhdan force-pushed the egorzhdan/swift-bridging-modulemap branch from 560d792 to d494632 Compare March 8, 2024 20:13
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan
Copy link
Contributor Author

@swift-ci please build toolchain macOS

@egorzhdan
Copy link
Contributor Author

swiftlang/swift-installer-scripts#282

@swift-ci please build toolchain Windows platform

@egorzhdan
Copy link
Contributor Author

swiftlang/swift-installer-scripts#282

@swift-ci please test Windows

@egorzhdan
Copy link
Contributor Author

@swift-ci please test macOS

@egorzhdan egorzhdan merged commit 2c6cc4a into main Mar 11, 2024
7 checks passed
@egorzhdan egorzhdan deleted the egorzhdan/swift-bridging-modulemap branch March 11, 2024 19:01
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