Commit Graph

7 Commits

Author SHA1 Message Date
Allan Shortlidge
f5bae411ca AST: Diagnose unrecognized platforms as errors with CustomAvailability enabled.
When the CustomAvailability experimental feature is enabled, make it an error
to specify an unrecognized availability domain name. Also, add these
diagnostics to a diagnostic group so that developers can control their behavior
when they are warnings.

Resolves rdar://152741624.
2025-06-06 22:44:12 -07:00
Allan Shortlidge
1cd636d9b3 Serialization: Encode custom availability domains.
When serializing `@available` attributes, if the attribute applies to a custom
domain include enough information to deserialize the reference to that domain.

Resolves rdar://138441265.
2025-04-08 10:35:32 -07:00
Allan Shortlidge
0a81283d34 ClangImporter: Remove custom AvailabilityDomain serialization.
Partially revert https://github.com/swiftlang/swift/pull/80035 now that Clang
has its own APIs for querying serialized modules for the decl representing the
availability domain with a given name.
2025-04-08 10:35:32 -07:00
Allan Shortlidge
fdc7626644 Tests: Use #include instead of #import for compatibility on Windows.
The `#import` directive is not supported by Clang in MSVC compatibility mode,
so use `#include` instead for compatibility in the ClangImporter tests for
custom availability domains.

Resolves rdar://147122406.
2025-04-08 10:35:32 -07:00
Allan Shortlidge
41be6eba9c Tests: Disable ClangImporter/availability_custom_domains.swift on Android.
Unblocks Windows CI, which apparently tests Android. The underlying issue is tracked by
https://github.com/swiftlang/swift/issues/80058.
2025-03-17 10:01:41 -07:00
Allan Shortlidge
e96b44be31 ClangImporter: Import clang::DomainAvailabilityAttr.
Import `__attribute__((availability(domain:MyDomain, ...)))` as
`@available(SomeDomain, ...)`.

Resolves rdar://138441266.
2025-03-15 07:44:37 -07:00
Allan Shortlidge
72c821e2a7 ClangImporter: Look up availability domains in Clang modules.
In addition to tracking availability domains in SwiftLookupTable, also
serialize and deserialize the mapping from domain name to `clang::VarDecl`.
Ideally this serialization and lookup infrastructure would be entirely handled
by Clang, since it also needs to look up availability domains in serialized
modules, but the implementation for that is not ready yet.

Part of rdar://138441266.
2025-03-15 07:44:37 -07:00