[AST/Sema] Add availability attributes for macCatalyst

Add a platform kind and availability attributes for macCatalyst. macCatalyst
uses iOS version numbers and inherits availability from iOS attributes unless
a macCatalyst attribute is explicitly provided.
This commit is contained in:
Devin Coughlin
2020-01-05 21:26:17 -08:00
parent 8c5c5ec802
commit 082421048a
15 changed files with 345 additions and 11 deletions

View File

@@ -584,10 +584,12 @@ static void reportAttributes(ASTContext &Ctx,
DocInfoConsumer &Consumer) {
static UIdent AvailableAttrKind("source.lang.swift.attribute.availability");
static UIdent PlatformIOS("source.availability.platform.ios");
static UIdent PlatformMacCatalyst("source.availability.platform.maccatalyst");
static UIdent PlatformOSX("source.availability.platform.osx");
static UIdent PlatformtvOS("source.availability.platform.tvos");
static UIdent PlatformWatchOS("source.availability.platform.watchos");
static UIdent PlatformIOSAppExt("source.availability.platform.ios_app_extension");
static UIdent PlatformMacCatalystAppExt("source.availability.platform.maccatalyst_app_extension");
static UIdent PlatformOSXAppExt("source.availability.platform.osx_app_extension");
static UIdent PlatformtvOSAppExt("source.availability.platform.tvos_app_extension");
static UIdent PlatformWatchOSAppExt("source.availability.platform.watchos_app_extension");
@@ -601,6 +603,8 @@ static void reportAttributes(ASTContext &Ctx,
PlatformUID = UIdent(); break;
case PlatformKind::iOS:
PlatformUID = PlatformIOS; break;
case PlatformKind::macCatalyst:
PlatformUID = PlatformIOS; break;
case PlatformKind::OSX:
PlatformUID = PlatformOSX; break;
case PlatformKind::tvOS:
@@ -609,6 +613,8 @@ static void reportAttributes(ASTContext &Ctx,
PlatformUID = PlatformWatchOS; break;
case PlatformKind::iOSApplicationExtension:
PlatformUID = PlatformIOSAppExt; break;
case PlatformKind::macCatalystApplicationExtension:
PlatformUID = PlatformMacCatalystAppExt; break;
case PlatformKind::OSXApplicationExtension:
PlatformUID = PlatformOSXAppExt; break;
case PlatformKind::tvOSApplicationExtension: