diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:03:47 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:04:23 +0000 |
commit | 7fa27ce4a07f19b07799a767fc29416f3b625afb (patch) | |
tree | 27825c83636c4de341eb09a74f49f5d38a15d165 /llvm/lib/TextAPI/Platform.cpp | |
parent | e3b557809604d036af6e00c60f012c2025b59a5e (diff) |
Diffstat (limited to 'llvm/lib/TextAPI/Platform.cpp')
-rw-r--r-- | llvm/lib/TextAPI/Platform.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/TextAPI/Platform.cpp b/llvm/lib/TextAPI/Platform.cpp index c3c74252301e..d0575847a876 100644 --- a/llvm/lib/TextAPI/Platform.cpp +++ b/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. |