Skip to content

Sema: fix reporting reexporting submodules imports as unused in API #77538

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
merged 1 commit into from
Nov 12, 2024

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Nov 11, 2024

Importing a clang submodule from Swift implies importing the top-level module too. We make sure we don't warn on the import of the top-level module as being unused when the submodule is used by associating all references to the top-level module instead of submodules. This change applies the same logic for transitive imports, marking the import of the top-level module as used instead of the submodule with the export *.

In the updated test, this silences the following warning:

public import of 'ClangReexportedSubmodulePublic' was not used in public
declarations or inlinable code

rdar://139492772

@xymus
Copy link
Contributor Author

xymus commented Nov 11, 2024

@swift-ci Please smoke test

@xymus xymus requested a review from tshortli November 11, 2024 20:37
Importing a clang submodule from Swift implies importing the top-level
module too. We make sure we don't warn on the import of the top-level
module as being unused when the submodule is used by associating all
references to the top-level module instead of submodules. This change
applies the same logic for transitive imports, marking the import of the
top-level module as used instead of the submodule with the `export *`.

In the updated test, this silences the following warning:
```
public import of 'ClangReexportedSubmodulePublic' was not used in public
declarations or inlinable code
```

rdar://139492772
@xymus xymus force-pushed the dont-warn-submodules-reexport branch from b20107e to a4fcdef Compare November 12, 2024 17:36
@xymus
Copy link
Contributor Author

xymus commented Nov 12, 2024

@swift-ci Please smoke test

@xymus xymus merged commit b5bf217 into swiftlang:main Nov 12, 2024
3 checks passed
@xymus xymus deleted the dont-warn-submodules-reexport branch November 12, 2024 21:59
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