Add swift::getNonSimulatorPlatform for DarwinPlatformKind

And use it in getDarwinLibraryNameSuffixForTriple, making the logic
there clearer.

Suggested by David U!
This commit is contained in:
Jordan Rose
2018-07-11 15:08:10 -07:00
parent d4668833e0
commit d11704bcc9
3 changed files with 31 additions and 13 deletions

View File

@@ -76,6 +76,22 @@ DarwinPlatformKind swift::getDarwinPlatformKind(const llvm::Triple &triple) {
llvm_unreachable("Unsupported Darwin platform");
}
DarwinPlatformKind swift::getNonSimulatorPlatform(DarwinPlatformKind platform) {
switch (platform) {
case DarwinPlatformKind::MacOS:
return DarwinPlatformKind::MacOS;
case DarwinPlatformKind::IPhoneOS:
case DarwinPlatformKind::IPhoneOSSimulator:
return DarwinPlatformKind::IPhoneOS;
case DarwinPlatformKind::TvOS:
case DarwinPlatformKind::TvOSSimulator:
return DarwinPlatformKind::TvOS;
case DarwinPlatformKind::WatchOS:
case DarwinPlatformKind::WatchOSSimulator:
return DarwinPlatformKind::WatchOS;
}
}
static StringRef getPlatformNameForDarwin(const DarwinPlatformKind platform) {
switch (platform) {
case DarwinPlatformKind::MacOS: