diff options
Diffstat (limited to 'llvm/lib/TextAPI')
-rw-r--r-- | llvm/lib/TextAPI/Platform.cpp | 29 | ||||
-rw-r--r-- | llvm/lib/TextAPI/Target.cpp | 6 |
2 files changed, 35 insertions, 0 deletions
diff --git a/llvm/lib/TextAPI/Platform.cpp b/llvm/lib/TextAPI/Platform.cpp index 038ad9d..a2ce6d0 100644 --- a/llvm/lib/TextAPI/Platform.cpp +++ b/llvm/lib/TextAPI/Platform.cpp @@ -105,5 +105,34 @@ PlatformKind getPlatformFromName(StringRef Name) { .Default(PlatformKind::unknown); } +std::string getOSAndEnvironmentName(PlatformKind Platform, + std::string Version) { + switch (Platform) { + case PlatformKind::unknown: + return "darwin" + Version; + case PlatformKind::macOS: + return "macos" + Version; + case PlatformKind::iOS: + return "ios" + Version; + case PlatformKind::tvOS: + return "tvos" + Version; + case PlatformKind::watchOS: + return "watchos" + Version; + case PlatformKind::bridgeOS: + return "bridgeos" + Version; + case PlatformKind::macCatalyst: + return "ios" + Version + "-macabi"; + case PlatformKind::iOSSimulator: + return "ios" + Version + "-simulator"; + case PlatformKind::tvOSSimulator: + return "tvos" + Version + "-simulator"; + case PlatformKind::watchOSSimulator: + return "watchos" + Version + "-simulator"; + case PlatformKind::driverKit: + return "driverkit" + Version; + } + llvm_unreachable("Unknown llvm::MachO::PlatformKind enum"); +} + } // end namespace MachO. } // end namespace llvm. diff --git a/llvm/lib/TextAPI/Target.cpp b/llvm/lib/TextAPI/Target.cpp index 4c33a58..35fe1bf 100644 --- a/llvm/lib/TextAPI/Target.cpp +++ b/llvm/lib/TextAPI/Target.cpp @@ -72,5 +72,11 @@ ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets) { return Result; } +std::string getTargetTripleName(const Target &Targ) { + return (getArchitectureName(Targ.Arch) + "-apple-" + + getOSAndEnvironmentName(Targ.Platform)) + .str(); +} + } // end namespace MachO. } // end namespace llvm. |