-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[scanner] setup the clang importer injected redirecting overlay vfs f… #78184
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
base: main
Are you sure you want to change the base?
Conversation
@swift-ci please 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.
Can you be more specific about what problem is being fixed here. I see you added SilentClangImporterOverlayWrapperFS
to avoid assertions in clang dependency scanner, is that the problem? But I don't the class being used anywhere.
Also I am unsure where is the VFS for ucrt module coming from. It would be good to elaborate the process of how the module map is found and what problem it has for dependency scanner right now.
Sorry, the SilentClangImporterOverlayWrapperFS is no longer needed after the rebranch (my original fix was on a pre-rebranch branch which had a strong assertion related to VFS overlay optimization count that is different now in the new branch). Now it should be more clear hopefully! Answers inline:
The module map for UCRT is shipped alongside swift (ucrt.modulemap). The clang importer then constructs the redirecting file system, that redirects from the virtual module map (doesn't exist on disk) located windows SDK in MSVC to the real one that's located next to Swift. This lets Swift import windows C runtime and C++ stdlib correctly in implicit module-based compilation, as clang can then actually load the injected module map file for UCRT. Right now the Clang scanner that the Swift scanner uses for Clang modules doesn't know about the injected files that Clang requires to correctly import Clang modules that have system dependencies like UCRT on windows, and as such it is impossible to use This change ensures that the Swift scanner sets up the exact same injection redirect & overlay VFS for the Clang dependency scanner as it does for the Clang importer. This lets the scanner correctly find the module map and construct appropriate invocation for the build of the UCRT module, that will later go through
The |
@swift-ci please test |
@swift-ci please test windows platform |
Is the process to import the |
The CI doesn't seem to find the overlay still, even though locally I can do it. Need to trace the overlay path in the CI:
|
Standalone clang currently doesn't import anything from the WinSDK using clang modules, this is all just for Swift for now. |
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.
Seems fine to me if windows clang has no plan to support module in winSDK for now.
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 modulo the comment from @cachemeifyoucan
…or correct clang dependency scanning This makes its possible to use -explicit-module-build to correctly find 'crt' swift module on windows
7e70067
to
8237e1b
Compare
I'd like to drive this PR to merge on behalf of @hyp |
LGTM |
Thanks @cachemeifyoucan
So something needs to be fixed further :) |
Please test with following PR: @swift-ci Please test |
Please test with following PR: @swift-ci Please test Linux Platform |
@cachemeifyoucan @egorzhdan @compnerd I sent this PR for review as an alternative to this PR because the |
…or correct clang dependency scanning
This makes its possible to use -explicit-module-build to correctly find 'crt' swift module on windows