Skip to content

[ModuleInterface] Report importing modules built from a swiftinterface without resilience #61765

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Oct 27, 2022

Generating a swiftinterface for a module without library-evolution is not currently a recommended configuration, and it leads to a warning at building the module. We’re now considering generating more swiftinterfaces even without library-evolution as the swiftinterface can be useful for documentation tools. However, while we can build against such a swiftinterface we shouldn’t expect the executable to work reliably.

This PR adds the infrastructure necessary to detect when we’re importing a module from a swiftinterface without it having enabled library-evoluation. It is reported as an error which can be downgraded to a warning with an env var. Compiler engineers may still want a full build even if the binary is unusable.

rdar://101637436


The diagnostic is mostly to test the underlying information about modules built from interfaces, so there's room for improvement here. The check only catches local imports and won't report this issue on implicit or indirect imports. While it would be useful for compiler engineers to disable that check we may prefer an alternative to the env var.

@xymus
Copy link
Contributor Author

xymus commented Oct 27, 2022

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Oct 28, 2022

There are many tests generating swiftinterfaces without enabling library-evolution to update.

@xymus xymus force-pushed the report-non-resilient-swiftinterfaces branch from 54b7bfc to 76cab29 Compare November 1, 2022 17:38
@xymus
Copy link
Contributor Author

xymus commented Nov 1, 2022

@swift-ci Please smoke test

@xymus xymus force-pushed the report-non-resilient-swiftinterfaces branch from 76cab29 to f46d841 Compare November 1, 2022 20:48
@xymus
Copy link
Contributor Author

xymus commented Nov 1, 2022

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Nov 10, 2022

swiftlang/llvm-project#5547

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Nov 17, 2022

swiftlang/llvm-project#5547

@swift-ci Please smoke test macOS

xymus added 3 commits December 7, 2022 11:16
…esilience

Generating a swiftinterface for a module without library-evolution is
not currently a recommended configuration, and it leads to a warning at
building the module. We’re now considering generating more
swiftinterface even without library evolution as the swiftinterface can
be useful for documentation tools. However, while we can build against
such a swiftinterface we shouldn’t expect the executable to work
reliably.

This PR adds the infrastructure necessary to detect when we’re importing
a module from a swiftinterface without it having enabled
library-evoluation. It is reported as an error which can be downgraded
to a warning with an env var. Compiler engineers may still want a full
build even if the binary is unusable.

rdar://101637436
Define SWIFT_ACCEPT_NON_RESILIENT_INTERFACES in tests intentionnally
building against a non-resilient swiftinterface.
@xymus xymus force-pushed the report-non-resilient-swiftinterfaces branch from 132c85e to eb2a12b Compare December 7, 2022 19:19
@xymus xymus requested a review from artemcm as a code owner December 7, 2022 19:19
@xymus
Copy link
Contributor Author

xymus commented Dec 7, 2022

swiftlang/llvm-project#5547

@swift-ci Please smoke test

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants