Skip to content

[clang][include-tree] Fix spurious dependencies #8266

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

jansvoboda11
Copy link

This patch fixes an incorrect assumption that only spurious imports cause both IncludeTreeBuilder::moduleImport() and IncludeTreeBuilder::exitedInclude() to be called for the same directive. This can also happen for #include of a header that belongs to the module being implemented that previously got transitively loaded from a PCM.

Instead of trying to guess that a submodule was a spurious import (by checking that it was not imported, is not from module file but its parent is from module file), we just mark it missing from umbrella header when we detect this. This allows us to stop putting the temporary ModuleImport onto the stack in one function and later popping and replacing it by SpuriousImport in another function.

rdar://123253616

Cherry-pick of /pull/8264

This patch fixes an incorrect assumption that only spurious imports cause both `IncludeTreeBuilder::moduleImport()` and `IncludeTreeBuilder::exitedInclude()` to be called for the same directive. This can also happen for `#include` of a header that belongs to the module being implemented that previously got transitively loaded from a PCM.

Instead of trying to guess that a submodule was a spurious import (by checking that it was not imported, is not from module file but its parent is from module file), we just mark it missing from umbrella header when we detect this. This allows us to stop putting the temporary `ModuleImport` onto the stack in one function and later popping and replacing it by `SpuriousImport` in another function.

rdar://123253616

Cherry-pick of /pull/8264
@jansvoboda11
Copy link
Author

@swift-ci please test

@jansvoboda11
Copy link
Author

swiftlang/swift#71886
@swift-ci please test Windows Platform

(cherry picked from commit 4cf26f5)
@jansvoboda11
Copy link
Author

swiftlang/swift#71886
@swift-ci please test

@jansvoboda11
Copy link
Author

@swift-ci please test

@jansvoboda11 jansvoboda11 merged commit 8aff003 into stable/20230725 Feb 27, 2024
@jansvoboda11 jansvoboda11 deleted the jan_svoboda/include-tree-spurious-fix-20230725 branch February 27, 2024 03:44
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