Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit d8ef372

Browse files
committed
[triple] add 'macCatalyst' environment type
Mac Catalyst is a new deployment platform in macOS Catalina. Differential Revision: https://reviews.llvm.org/D64097 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364971 91177308-0d34-0410-b5e6-96231b3b80d8 (cherry picked from commit f5d1f57)
1 parent a6015a4 commit d8ef372

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

include/llvm/ADT/Triple.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ class Triple {
210210
Itanium,
211211
Cygnus,
212212
CoreCLR,
213-
Simulator, // Simulator variants of other systems, e.g., Apple's iOS
214-
LastEnvironmentType = Simulator
213+
Simulator, // Simulator variants of other systems, e.g., Apple's iOS
214+
MacCatalyst,
215+
LastEnvironmentType = MacCatalyst
215216
};
216217
enum ObjectFormatType {
217218
UnknownObjectFormat,
@@ -480,6 +481,10 @@ class Triple {
480481
return getEnvironment() == Triple::Simulator;
481482
}
482483

484+
bool isMacCatalystEnvironment() const {
485+
return getEnvironment() == Triple::MacCatalyst;
486+
}
487+
483488
bool isOSNetBSD() const {
484489
return getOS() == Triple::NetBSD;
485490
}

lib/Support/Triple.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) {
237237
case Cygnus: return "cygnus";
238238
case CoreCLR: return "coreclr";
239239
case Simulator: return "simulator";
240+
case MacCatalyst: return "maccatalyst";
240241
}
241242

242243
llvm_unreachable("Invalid EnvironmentType!");
@@ -533,6 +534,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
533534
.StartsWith("cygnus", Triple::Cygnus)
534535
.StartsWith("coreclr", Triple::CoreCLR)
535536
.StartsWith("simulator", Triple::Simulator)
537+
.StartsWith("maccatalyst", Triple::MacCatalyst)
536538
.Default(Triple::UnknownEnvironment);
537539
}
538540

unittests/ADT/TripleTest.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,17 @@ TEST(TripleTest, getOSVersion) {
12151215
EXPECT_EQ((unsigned)3, Minor);
12161216
EXPECT_EQ((unsigned)0, Micro);
12171217
EXPECT_TRUE(T.isSimulatorEnvironment());
1218+
EXPECT_FALSE(T.isMacCatalystEnvironment());
1219+
1220+
T = Triple("x86_64-apple-ios13.0-maccatalyst");
1221+
EXPECT_TRUE(T.isiOS());
1222+
T.getiOSVersion(Major, Minor, Micro);
1223+
EXPECT_EQ((unsigned)13, Major);
1224+
EXPECT_EQ((unsigned)0, Minor);
1225+
EXPECT_EQ((unsigned)0, Micro);
1226+
EXPECT_TRUE(T.getEnvironment() == Triple::MacCatalyst);
1227+
EXPECT_TRUE(T.isMacCatalystEnvironment());
1228+
EXPECT_FALSE(T.isSimulatorEnvironment());
12181229
}
12191230

12201231
TEST(TripleTest, FileFormat) {

0 commit comments

Comments
 (0)