-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Explicit Module Builds] Only specify '-fmodule-map-file' for bridging header Clang module dependencies #72668
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
[Explicit Module Builds] Only specify '-fmodule-map-file' for bridging header Clang module dependencies #72668
Conversation
…ule dependencies' header inputs' module dependencies
@swift-ci smoke test |
…g header Clang module dependencies Relying on the corresponding field in the '-explicit-swift-module-map-file' provided by the driver. Only bridging headers require a module map because that's what aids header include resolution. With lazy module loading today, '.modulemap' parsing which happens when instantiating Clang is responsible for associating headers with modules. Then upon encountering a header include inside the bridging header the compiler knows which module corresponds to said header and is then able to load explicitly-provided PCM for that module. For all other module dependencies, they are only ever queried by-name from Swift, so '.modulemap' parsing is not necessary.
@cachemeifyoucan sorry, I've expanded the scope of this PR, because I want these changes to land in-tandem on the compiler. Could you please take another look? |
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general. I always wondering if swift scanner should write the file or content pass to explicit-swift-module-map-file
directly so there is no need to add more APIs to traffic more and more information to driver so driver can write this file.
@@ -476,7 +476,7 @@ class SearchPathOptions { | |||
std::vector<std::string> CandidateCompiledModules; | |||
|
|||
/// A map of explicit Swift module information. | |||
std::string ExplicitSwiftModuleMap; | |||
std::string ExplicitSwiftModuleMapPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caching build doesn't really take a path here (but a CASID). Maybe it wasn't a good idea to reuse this flag for caching build for the first place.
Relying on the corresponding field in the '-explicit-swift-module-map-file' provided by the driver.
Only bridging headers require a module map because that's what aids header include resolution. With lazy module loading today, '.modulemap' parsing which happens when instantiating Clang is responsible for associating headers with modules. Then upon encountering a header include inside the bridging header the compiler knows which module corresponds to said header and is then able to load explicitly-provided PCM for that module. For all other module dependencies, they are only ever queried by-name from Swift, so '.modulemap' parsing is not necessary.
[Dependency Scanning] Add libSwiftScan entrypoint to query binary module dependencies' header inputs' module dependencies