aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/TextAPI/Platform.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-09-02 21:17:18 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-12-08 17:34:50 +0000
commit06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e (patch)
tree62f873df87c7c675557a179e0c4c83fe9f3087bc /contrib/llvm-project/llvm/lib/TextAPI/Platform.cpp
parentcf037972ea8863e2bab7461d77345367d2c1e054 (diff)
parent7fa27ce4a07f19b07799a767fc29416f3b625afb (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/TextAPI/Platform.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/TextAPI/Platform.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/llvm-project/llvm/lib/TextAPI/Platform.cpp b/contrib/llvm-project/llvm/lib/TextAPI/Platform.cpp
index c3c74252301e..d0575847a876 100644
--- a/contrib/llvm-project/llvm/lib/TextAPI/Platform.cpp
+++ b/contrib/llvm-project/llvm/lib/TextAPI/Platform.cpp
@@ -13,7 +13,7 @@
#include "llvm/TextAPI/Platform.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringSwitch.h"
-#include "llvm/ADT/Triple.h"
+#include "llvm/TargetParser/Triple.h"
namespace llvm {
namespace MachO {
@@ -90,6 +90,7 @@ StringRef getPlatformName(PlatformType Platform) {
PlatformType getPlatformFromName(StringRef Name) {
return StringSwitch<PlatformType>(Name)
+ .Case("osx", PLATFORM_MACOS)
.Case("macos", PLATFORM_MACOS)
.Case("ios", PLATFORM_IOS)
.Case("tvos", PLATFORM_TVOS)
@@ -132,5 +133,12 @@ std::string getOSAndEnvironmentName(PlatformType Platform,
llvm_unreachable("Unknown llvm::MachO::PlatformType enum");
}
+VersionTuple mapToSupportedOSVersion(const Triple &Triple) {
+ const VersionTuple MinSupportedOS = Triple.getMinimumSupportedOSVersion();
+ if (MinSupportedOS > Triple.getOSVersion())
+ return MinSupportedOS;
+ return Triple.getOSVersion();
+}
+
} // end namespace MachO.
} // end namespace llvm.