AST: Use availability to control decl visibility in public swiftinterfaces.

Declarations that are unavailable at runtime because of an `@available`
attribute referencing a custom domain that was imported `@_spiOnly` should be
hidden from public swiftinterface files in `-library-level=api` modules. For
remaining declarations that do get printed in the public swiftinterface, skip
printing any `@available` attribute that refers to the domains from those
`@_spiOnly` dependencies. This allows API developers to control declaration
visibility using availability defined by another module.

Resolves rdar://156512028.
This commit is contained in:
Allan Shortlidge
2025-09-02 16:38:22 -07:00
parent ddca4b7404
commit b047396246
7 changed files with 185 additions and 4 deletions

View File

@@ -1,6 +1,10 @@
#include <availability_domain.h>
int huron_pred(void);
CLANG_ENABLED_AVAILABILITY_DOMAIN(Salt);
CLANG_DISABLED_AVAILABILITY_DOMAIN(Erie);
CLANG_DYNAMIC_AVAILABILITY_DOMAIN(Huron, huron_pred);
#define AVAIL 0
#define UNAVAIL 1

View File

@@ -1,7 +1,10 @@
#include <availability_domain.h>
int aegean_pred(void);
CLANG_ENABLED_AVAILABILITY_DOMAIN(Baltic);
CLANG_DISABLED_AVAILABILITY_DOMAIN(Mediterranean);
CLANG_DYNAMIC_AVAILABILITY_DOMAIN(Aegean, aegean_pred);
#define AVAIL 0
#define UNAVAIL 1