Skip to content

Sema: Reexport SPI via Swift exported imports but not clang's #70566

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 4 commits into from
Jan 3, 2024

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Dec 20, 2023

This is a new attempt at a reexport feature for SPI decls. The previous behavior was to reexport SPI only between modules with both @_exported and an export-as relationship. The limitation on export-as turned out to be too restrictive in some cases.

We may be tempted to reexport SPI through all exported imports. However, the exported imports are very common between clang module and it can lead to surprises if dependencies between clang modules end up exporting SPI from unexpected modules.

As a middle ground, reexport SPI only through Swift @_exported dependencies, and not through clang reexports. While this is a new distinction between Swift and clang dependencies, I believe it provides the expected behavior and the result is more straightforward than the current logic.

rdar://115901208

…ules

Exported imports are common between clang modules. Make sure we test
against accidently reexporting Swift SPIs through these exported
imports.
@xymus
Copy link
Contributor Author

xymus commented Dec 20, 2023

@swift-ci Please smoke test

@xymus xymus force-pushed the spi-reexport-swift-only branch from 652677c to c7e90ca Compare December 20, 2023 23:06
…imports

This is a new attempt at a reexport feature for SPI decls. The previous
behavior was to reexport SPIs only between modules with both `@_exported` and
an export-as relationship. The limitation on export-as turned out to be too
restrictive in some cases.

We may be tempted to reexport SPIs through all exported imports. However,
the exported imports are very common between clang module and it can lead
to surprises if dependencies between clang modules end up exporting SPIs from
unexpected modules.

As a middle ground, reexport SPI only through Swift `@_exported` dependencies,
and not through clang reexports. While this is a new distinction between Swift
and clang dependencies, I believe it provides the expected behavior and
the result is more straightforward than the current logic.

rdar://115901208
@xymus xymus force-pushed the spi-reexport-swift-only branch from c7e90ca to 8b91e4c Compare December 20, 2023 23:34
@xymus
Copy link
Contributor Author

xymus commented Dec 20, 2023

@swift-ci Please smoke test

1 similar comment
@xymus
Copy link
Contributor Author

xymus commented Jan 2, 2024

@swift-ci Please smoke test

@xymus xymus merged commit 91c62de into swiftlang:main Jan 3, 2024
@xymus xymus deleted the spi-reexport-swift-only branch January 3, 2024 17:33
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.

1 participant