forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 319
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
Turn off implicit clang modules while importing CU dependencies. #8752
Merged
adrian-prantl
merged 1 commit into
apple:swift/release/6.0
from
adrian-prantl:127455779
May 16, 2024
Merged
Turn off implicit clang modules while importing CU dependencies. #8752
adrian-prantl
merged 1 commit into
apple:swift/release/6.0
from
adrian-prantl:127455779
May 16, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci test |
@swift-ci test |
@swift-ci test |
ping @augusto2112 @kastiglione |
augusto2112
approved these changes
May 15, 2024
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
Do you think it'd be possible to add a test which contains an import statement that triggers an implicit import?
ModuleFileSharedCore::getTransitiveLoadingBehavior() has a best-effort mode that is enabled when debugger support is turned on that will try to import implementation-only imports of Swift modules, but won't treat import failures as errors. When explicit modules are on, this has the unwanted side-effect of potentially triggering an implicit Clang module build if one of the internal dependencies of a library was not used to build the target. To avoid these costly and potentially dangerous imports we turn off implicit modules while importing the CU imports only. If a user manually evaluates an expression that contains an import statement that can still trigger an implict import. Implicit imports can be dangerous if an implicit module depends on a module that also exists as an explicit input: In this case, a subsequent explicit import of said dependency will error because Clang now knows about two versions of the same module. rdar://127455779
@swift-ci test |
@swift-ci test windows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ModuleFileSharedCore::getTransitiveLoadingBehavior() has a best-effort mode that is enabled when debugger support is turned on that will try to import implementation-only imports of Swift modules, but won't treat import failures as errors. When explicit modules are on, this has the unwanted side-effect of potentially triggering an implicit Clang module build if one of the internal dependencies of a library was not used to build the target. To avoid these costly and potentially dangerous imports we turn off implicit modules while importing the CU imports only. If a user manually evaluates an expression that contains an import statement that can still trigger an implict import. Implicit imports can be dangerous if an implicit module depends on a module that also exists as an explicit input: In this case, a subsequent explicit import of said dependency will error because Clang now knows about two versions of the same module.
rdar://127455779