diff options
author | Cyndy Ishida <cyndy_ishida@apple.com> | 2019-09-23 15:28:02 +0000 |
---|---|---|
committer | Cyndy Ishida <cyndy_ishida@apple.com> | 2019-09-23 15:28:02 +0000 |
commit | d8d99d957c1624ac812d2586a22fdc72f79b758e (patch) | |
tree | ed9ec05825ed6916177f12b8c18c32ed79c2f7f4 /llvm/lib/TextAPI/MachO/Platform.cpp | |
parent | b70323e5d35171ae32ea10ff49e86cdb4b118c30 (diff) | |
download | bcm5719-llvm-d8d99d957c1624ac812d2586a22fdc72f79b758e.tar.gz bcm5719-llvm-d8d99d957c1624ac812d2586a22fdc72f79b758e.zip |
[TextAPI] Add New Supported Platforms
Summary: This patch introduces simulators, as well was the restriced zippered and macCatalyst to supported platforms
Reviewers: ributzka, steven_wu
Reviewed By: ributzka
Subscribers: hiraditya, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67528
llvm-svn: 372618
Diffstat (limited to 'llvm/lib/TextAPI/MachO/Platform.cpp')
-rw-r--r-- | llvm/lib/TextAPI/MachO/Platform.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/llvm/lib/TextAPI/MachO/Platform.cpp b/llvm/lib/TextAPI/MachO/Platform.cpp index 66bb7df9aa5..588ec9a4d83 100644 --- a/llvm/lib/TextAPI/MachO/Platform.cpp +++ b/llvm/lib/TextAPI/MachO/Platform.cpp @@ -17,6 +17,20 @@ namespace llvm { namespace MachO { +PlatformKind mapToPlatformKind(PlatformKind Platform, bool WantSim) { + switch (Platform) { + default: + return Platform; + case PlatformKind::iOS: + return WantSim ? PlatformKind::iOSSimulator : PlatformKind::iOS; + case PlatformKind::tvOS: + return WantSim ? PlatformKind::tvOSSimulator : PlatformKind::tvOS; + case PlatformKind::watchOS: + return WantSim ? PlatformKind::watchOSSimulator : PlatformKind::watchOS; + } + llvm_unreachable("Unknown llvm.MachO.PlatformKind enum"); +} + PlatformKind mapToPlatformKind(const Triple &Target) { switch (Target.getOS()) { default: @@ -24,13 +38,20 @@ PlatformKind mapToPlatformKind(const Triple &Target) { case Triple::MacOSX: return PlatformKind::macOS; case Triple::IOS: + if (Target.isSimulatorEnvironment()) + return PlatformKind::iOSSimulator; + if (Target.getEnvironment() == Triple::MacABI) + return PlatformKind::macCatalyst; return PlatformKind::iOS; case Triple::TvOS: - return PlatformKind::tvOS; + return Target.isSimulatorEnvironment() ? PlatformKind::tvOSSimulator + : PlatformKind::tvOS; case Triple::WatchOS: - return PlatformKind::watchOS; + return Target.isSimulatorEnvironment() ? PlatformKind::watchOSSimulator + : PlatformKind::watchOS; // TODO: add bridgeOS once in llvm::Triple } + llvm_unreachable("Unknown Target Triple"); } PlatformSet mapToPlatformSet(ArrayRef<Triple> Targets) { @@ -54,6 +75,14 @@ StringRef getPlatformName(PlatformKind Platform) { return "watchOS"; case PlatformKind::bridgeOS: return "bridgeOS"; + case PlatformKind::macCatalyst: + return "macCatalyst"; + case PlatformKind::iOSSimulator: + return "iOS Simulator"; + case PlatformKind::tvOSSimulator: + return "tvOS Simulator"; + case PlatformKind::watchOSSimulator: + return "watchOS Simulator"; } llvm_unreachable("Unknown llvm.MachO.PlatformKind enum"); } |