Commit Graph

6 Commits

Author SHA1 Message Date
Allan Shortlidge
14200e412c SILGen/stdlib: Remove _diagnoseUnavailableCodeReached_aeic().
It should no longer be necessary to provide an `@_alwaysEmitIntoClient` version
of `_diagnoseUnavailableCodeReached()`. This workaround was originally added to
provide compatibility with projects that were misconfigured to compile against
a newer stdlib but link against an older one.

Resolves rdar://119892482.
2024-07-11 14:53:03 -07:00
Allan Shortlidge
da2d250105 Tests: Loosen CHECK: lines matching _diagnoseUnavailableCodeReached().
Depending on deployment target and platform, the function called to diagnose
reaching unavailable code could be `_diagnoseUnavailableCodeReached()` itself,
the back-deployment thunk, or the `@_alwaysEmitIntoClient` variant of the
function.

Resolves rdar://121344690
2024-01-29 09:09:26 -08:00
Allan Shortlidge
6d22433d0f AST/SILGen: Use @_alwaysEmitIntoClient diagnostic helper in unavailable code.
The `_diagnoseUnavailableCodeReached()` function was introduced in the Swift
5.9 standard library and employs `@backDeployed` to support compilation of
binaries that target OS releases aligned with earlier Swift releases.
Unfortunately, though, this backdeployment strategy doesn't work well for some
unusual build environments. Specifically, in some configurations code may be
built with a compiler from a recent Swift toolchain and then linked against the
dylibs in an older toolchain. When linking against the older dylibs, the
`_diagnoseUnavailableCodeReached()` function does not exist but the
`@backDeployed` thunks emitted into the binary reference that function and
therefore linking fails.

The idea of building with one toolchain and then linking to the dylibs in a
different, older toolchain is extremely dubious. However, it exists and for now
we need to support it. This PR introduces an alternative
`_diagnoseUnavailableCodeReached()` function that is annotated with
`@_alwaysEmitIntoClient`. Calls to the AEIC variant are now emitted by the
compiler when the deployment target is before Swift 5.9.

Once these unusual build environments upgrade and start linking against a Swift
5.9 toolchain or later we can revert all of this.

Resolves rdar://119046537
2023-12-19 16:26:56 -08:00
Allan Shortlidge
12a122a063 Tests: Fix unavailable_decl_optimization_stub tests on Windows. 2023-05-03 15:51:14 -07:00
Allan Shortlidge
65de2a5a9d SILGen: In unavailable stubs apply diagnostic func's back deployment thunk.
Part of rdar://107388493.
2023-05-03 15:19:32 -07:00
Allan Shortlidge
2f5b61ebe0 SILOptimizer: Suppress unreachable code diagnostics for unavailable stubs.
User code should not be diagnosed as "unreachable" by the SIL optimizer when
the no-return function that made the code unreachable is a compiler inserted
call to `_diagnoseUnavailableCodeReached()`.

Part of rdar://107388493
2023-05-03 15:19:31 -07:00