Skip to content

[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

Merged

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Mar 28, 2024

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

…ule dependencies' header inputs' module dependencies
@artemcm artemcm requested a review from cachemeifyoucan March 28, 2024 18:07
@artemcm
Copy link
Contributor Author

artemcm commented Mar 28, 2024

@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.
@artemcm artemcm changed the title [Dependency Scanning] Add libSwiftScan entrypoint to query binary module dependencies' header inputs' module dependencies [Explicit Module Builds] Only specify '-fmodule-map-file' for bridging header Clang module dependencies Mar 28, 2024
@artemcm
Copy link
Contributor Author

artemcm commented Mar 28, 2024

@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?

@artemcm artemcm requested a review from cachemeifyoucan March 28, 2024 20:48
@artemcm
Copy link
Contributor Author

artemcm commented Mar 28, 2024

@swift-ci test

Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a 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;
Copy link
Contributor

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.

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.

2 participants