aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/TextAPI/Platform.cpp
diff options
context:
space:
mode:
authorSam Powell <sam@sampowell.dev>2021-06-09 10:29:29 -0700
committerCyndy Ishida <cyndy_ishida@apple.com>2021-06-09 10:35:41 -0700
commit20126c9fd4afe2fe11510becccaa769332da302f (patch)
treec4321264ee655621e3f60e2c83226c37be9ecfe6 /llvm/lib/TextAPI/Platform.cpp
parentc8d6e67d53a0d2a462696acc831e990183cd9d0f (diff)
downloadllvm-20126c9fd4afe2fe11510becccaa769332da302f.zip
llvm-20126c9fd4afe2fe11510becccaa769332da302f.tar.gz
llvm-20126c9fd4afe2fe11510becccaa769332da302f.tar.bz2
Reland "[llvm] llvm-tapi-diff"
This is relanding commit d1d36f7ad2ae82bea8a6fcc40d6c42a72e21f096 . This patch additionally addresses failures found in buildbots & post review comments. This patch introduces a new tool, llvm-tapi-diff, that compares and returns the diff of two TBD files. Reviewed By: ributzka, JDevlieghere Differential Revision: https://reviews.llvm.org/D101835
Diffstat (limited to 'llvm/lib/TextAPI/Platform.cpp')
-rw-r--r--llvm/lib/TextAPI/Platform.cpp29
1 files changed, 29 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.