Commit Graph

7 Commits

Author SHA1 Message Date
Erik Eckstein
c2866b397b Sema: add a @_semantics attribute to synthesized enum comparison functions
So that optimizations can identify and deal with them.
2025-05-27 12:11:03 +02:00
Doug Gregor
abad2fae0f Make the optional feature StrictMemorySafety migratable
This feature is essentially self-migrating, but fit it into the
migration flow by marking it as migratable, adding
`-strict-memory-safety:migrate`, and introducing a test.
2025-05-22 11:07:13 +01:00
Doug Gregor
fcd206fb79 [Strict memory safety] Squash warning about unsafety in "@objc enum" synthesized code
There's a synthesized call to unsafeBitCast(_:to:), which is obvious
unsafe, and is being diagnosed as such. The compiler generates this
call, so have the compiler also generate the `unsafe` around it to
suppress these warnings.

Fixes rdar://151199011.
2025-05-12 21:30:16 -07:00
Doug Gregor
9d493db479 [SE-0470] Fix synthesized conformances with default main actor isolation
When defaulting to main-actor isolation, types that have synthesized
conformances (e.g., for Equatable, Hashable, Codable) were getting
nonisolated members by default. That would cause compiler errors
because the conformances themselves defaulted to main-actor isolation
when their types were.

Be careful to only mark these members as 'nonisolated' when it makes
sense, and leave them to get the isolation of their enclosing type
when the conformance might have isolation. This ensures that one can
use synthesis of these protocols along with default main-actor mode.

There is a one-off trick here to force the synthesized CodingKeys to
be nonisolated, because the CodingKey protocol requires Sendable.
We'll separately consider whether to generalize this rule.

More of rdar://150691429.
2025-05-09 14:35:56 -07:00
Pavel Yaskevich
3906980f58 [AST] NFC: Add a convenient way to create implicit NonisolatedAttrs 2025-04-11 15:59:25 -07:00
Anthony Latsis
a0930dec31 AST: Cut down on DescriptiveDeclKind usage in DiagnosticsSema.def 2025-04-05 12:31:19 +01:00
Anthony Latsis
3fd8f0a008 [NFC] Sema: Factor out derived conformance sources into subdirectory 2025-04-05 05:32:37 +01:00