24
24
using namespace swift ;
25
25
26
26
StringRef swift::platformString (PlatformKind platform) {
27
- // FIXME: Update PlatformKinds.def to use the macOS spelling by default.
28
- switch (platform) {
29
- case PlatformKind::OSX:
30
- return " macOS" ;
31
- case PlatformKind::OSXApplicationExtension:
32
- return " macOSApplicationExtension" ;
33
- default : break ;
34
- }
35
-
36
27
switch (platform) {
37
28
case PlatformKind::none:
38
29
return " *" ;
@@ -62,8 +53,8 @@ Optional<PlatformKind> swift::platformFromString(StringRef Name) {
62
53
return llvm::StringSwitch<Optional<PlatformKind>>(Name)
63
54
#define AVAILABILITY_PLATFORM (X, PrettyName ) .Case(#X, PlatformKind::X)
64
55
#include " swift/AST/PlatformKinds.def"
65
- .Case (" macOS " , PlatformKind::OSX )
66
- .Case (" macOSApplicationExtension " , PlatformKind::OSXApplicationExtension )
56
+ .Case (" OSX " , PlatformKind::macOS )
57
+ .Case (" OSXApplicationExtension " , PlatformKind::macOSApplicationExtension )
67
58
.Default (Optional<PlatformKind>());
68
59
}
69
60
@@ -73,16 +64,16 @@ static bool isPlatformActiveForTarget(PlatformKind Platform,
73
64
if (Platform == PlatformKind::none)
74
65
return true ;
75
66
76
- if (Platform == PlatformKind::OSXApplicationExtension ||
67
+ if (Platform == PlatformKind::macOSApplicationExtension ||
77
68
Platform == PlatformKind::iOSApplicationExtension ||
78
69
Platform == PlatformKind::macCatalystApplicationExtension)
79
70
if (!EnableAppExtensionRestrictions)
80
71
return false ;
81
72
82
73
// FIXME: This is an awful way to get the current OS.
83
74
switch (Platform) {
84
- case PlatformKind::OSX :
85
- case PlatformKind::OSXApplicationExtension :
75
+ case PlatformKind::macOS :
76
+ case PlatformKind::macOSApplicationExtension :
86
77
return Target.isMacOSX ();
87
78
case PlatformKind::iOS:
88
79
case PlatformKind::iOSApplicationExtension:
@@ -118,8 +109,8 @@ bool swift::isPlatformActive(PlatformKind Platform, const LangOptions &LangOpts,
118
109
PlatformKind swift::targetPlatform (const LangOptions &LangOpts) {
119
110
if (LangOpts.Target .isMacOSX ()) {
120
111
return (LangOpts.EnableAppExtensionRestrictions
121
- ? PlatformKind::OSXApplicationExtension
122
- : PlatformKind::OSX );
112
+ ? PlatformKind::macOSApplicationExtension
113
+ : PlatformKind::macOS );
123
114
}
124
115
125
116
if (LangOpts.Target .isTvOS ()) {
@@ -171,8 +162,8 @@ llvm::VersionTuple swift::canonicalizePlatformVersion(
171
162
172
163
// Canonicalize macOS version for macOS Big Sur to treat
173
164
// 10.16 as 11.0.
174
- if (platform == PlatformKind::OSX ||
175
- platform == PlatformKind::OSXApplicationExtension ) {
165
+ if (platform == PlatformKind::macOS ||
166
+ platform == PlatformKind::macOSApplicationExtension ) {
176
167
return llvm::Triple::getCanonicalVersionForOS (llvm::Triple::MacOSX,
177
168
version);
178
169
}
0 commit comments