[llvm] r364971 - [triple] add 'macCatalyst' environment type
Alex Lorenz via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 14:37:01 PDT 2019
Author: arphaman
Date: Tue Jul 2 14:37:00 2019
New Revision: 364971
URL: http://llvm.org/viewvc/llvm-project?rev=364971&view=rev
Log:
[triple] add 'macCatalyst' environment type
Mac Catalyst is a new deployment platform in macOS Catalina.
Differential Revision: https://reviews.llvm.org/D64097
Modified:
llvm/trunk/include/llvm/ADT/Triple.h
llvm/trunk/lib/Support/Triple.cpp
llvm/trunk/unittests/ADT/TripleTest.cpp
Modified: llvm/trunk/include/llvm/ADT/Triple.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=364971&r1=364970&r2=364971&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Triple.h (original)
+++ llvm/trunk/include/llvm/ADT/Triple.h Tue Jul 2 14:37:00 2019
@@ -214,8 +214,9 @@ public:
Itanium,
Cygnus,
CoreCLR,
- Simulator, // Simulator variants of other systems, e.g., Apple's iOS
- LastEnvironmentType = Simulator
+ Simulator, // Simulator variants of other systems, e.g., Apple's iOS
+ MacCatalyst,
+ LastEnvironmentType = MacCatalyst
};
enum ObjectFormatType {
UnknownObjectFormat,
@@ -485,6 +486,10 @@ public:
return getEnvironment() == Triple::Simulator;
}
+ bool isMacCatalystEnvironment() const {
+ return getEnvironment() == Triple::MacCatalyst;
+ }
+
bool isOSNetBSD() const {
return getOS() == Triple::NetBSD;
}
Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=364971&r1=364970&r2=364971&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Tue Jul 2 14:37:00 2019
@@ -239,6 +239,7 @@ StringRef Triple::getEnvironmentTypeName
case Cygnus: return "cygnus";
case CoreCLR: return "coreclr";
case Simulator: return "simulator";
+ case MacCatalyst: return "maccatalyst";
}
llvm_unreachable("Invalid EnvironmentType!");
@@ -541,6 +542,7 @@ static Triple::EnvironmentType parseEnvi
.StartsWith("cygnus", Triple::Cygnus)
.StartsWith("coreclr", Triple::CoreCLR)
.StartsWith("simulator", Triple::Simulator)
+ .StartsWith("maccatalyst", Triple::MacCatalyst)
.Default(Triple::UnknownEnvironment);
}
Modified: llvm/trunk/unittests/ADT/TripleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=364971&r1=364970&r2=364971&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/TripleTest.cpp (original)
+++ llvm/trunk/unittests/ADT/TripleTest.cpp Tue Jul 2 14:37:00 2019
@@ -1237,6 +1237,17 @@ TEST(TripleTest, getOSVersion) {
EXPECT_EQ((unsigned)3, Minor);
EXPECT_EQ((unsigned)0, Micro);
EXPECT_TRUE(T.isSimulatorEnvironment());
+ EXPECT_FALSE(T.isMacCatalystEnvironment());
+
+ T = Triple("x86_64-apple-ios13.0-maccatalyst");
+ EXPECT_TRUE(T.isiOS());
+ T.getiOSVersion(Major, Minor, Micro);
+ EXPECT_EQ((unsigned)13, Major);
+ EXPECT_EQ((unsigned)0, Minor);
+ EXPECT_EQ((unsigned)0, Micro);
+ EXPECT_TRUE(T.getEnvironment() == Triple::MacCatalyst);
+ EXPECT_TRUE(T.isMacCatalystEnvironment());
+ EXPECT_FALSE(T.isSimulatorEnvironment());
}
TEST(TripleTest, FileFormat) {
More information about the llvm-commits
mailing list