[clang] [clang][driver][darwin] Prefer DarwinSDKInfo for platform identification and compatibility over the -isysroot path (PR #176541)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 29 08:42:05 PST 2026


================
@@ -1997,6 +2041,49 @@ struct DarwinPlatform {
     llvm_unreachable("Unknown DarwinEnvironmentKind enum");
   }
 
+  static std::string
+  getDisplayNameString(DarwinPlatformKind TargetPlatform,
+                       DarwinEnvironmentKind TargetEnvironment,
+                       VersionTuple Version) {
+    SmallVector<StringRef, 3> Components;
+    switch (TargetPlatform) {
+    case DarwinPlatformKind::MacOS:
+      Components.push_back("macOS");
+      break;
+    case DarwinPlatformKind::IPhoneOS:
+      Components.push_back("iOS");
+      break;
+    case DarwinPlatformKind::TvOS:
+      Components.push_back("tvOS");
+      break;
+    case DarwinPlatformKind::WatchOS:
+      Components.push_back("watchOS");
+      break;
+    case DarwinPlatformKind::DriverKit:
+      Components.push_back("DriverKit");
+      break;
+    default:
+      llvm::reportFatalUsageError(
+          Twine("Getting a display name string to infer SDK Info for "
----------------
cyndyishida wrote:

I find this string a bit hard to parse. Maybe 

`"Platform: ' + std::to_string(TargetPlatform) + "' is unsupported when inferring SDK Info."`


https://github.com/llvm/llvm-project/pull/176541


More information about the cfe-commits mailing list