https://github.com/ian-twilightcoder updated 
https://github.com/llvm/llvm-project/pull/176541

>From 0ca2fd8c067c574e4431efe880e7bbdbaecf6b3e Mon Sep 17 00:00:00 2001
From: Ian Anderson <[email protected]>
Date: Sat, 17 Jan 2026 00:14:47 -0800
Subject: [PATCH] [clang][driver][darwin] Prefer DarwinSDKInfo for platform
 identification and compatibility over the -isysroot path

Using the file system path to identify the SDK platform, and determine which 
platforms the SDK supports, is unreliable. In particular, the SDK's file name 
prefix is usually significant, and dropping it usually gives incorrect results. 
Instead, use information from SDKinfo to positively identify its 
platform/environment, and to identify which triples are compatible.
---
 clang/include/clang/Basic/DarwinSDKInfo.h     |  24 +-
 clang/lib/Basic/DarwinSDKInfo.cpp             |   8 +-
 clang/lib/Driver/ToolChains/Darwin.cpp        | 229 +++++++++++-------
 clang/lib/Driver/ToolChains/Darwin.h          |   1 -
 .../Inputs/XROS1.0.sdk/SDKSettings.json       |   1 +
 .../XRSimulator1.0.sdk/SDKSettings.json       |   1 +
 clang/test/Driver/darwin-sdk-with-prefix.c    |  10 +-
 .../Driver/xros-driver-requires-darwin-host.c |   7 +-
 8 files changed, 182 insertions(+), 99 deletions(-)
 create mode 100644 clang/test/Driver/Inputs/XROS1.0.sdk/SDKSettings.json
 create mode 100644 clang/test/Driver/Inputs/XRSimulator1.0.sdk/SDKSettings.json

diff --git a/clang/include/clang/Basic/DarwinSDKInfo.h 
b/clang/include/clang/Basic/DarwinSDKInfo.h
index 54e4df5988526..d9d3ba6ccfe90 100644
--- a/clang/include/clang/Basic/DarwinSDKInfo.h
+++ b/clang/include/clang/Basic/DarwinSDKInfo.h
@@ -181,23 +181,42 @@ class DarwinSDKInfo {
   using PlatformInfoStorageType = SmallVector<SDKPlatformInfo, 2>;
 
   DarwinSDKInfo(
-      VersionTuple Version, VersionTuple MaximumDeploymentTarget,
+      StringRef DisplayName, VersionTuple Version,
+      VersionTuple MaximumDeploymentTarget,
       PlatformInfoStorageType PlatformInfos,
       llvm::DenseMap<OSEnvPair::StorageType,
                      std::optional<RelatedTargetVersionMapping>>
           VersionMappings =
               llvm::DenseMap<OSEnvPair::StorageType,
                              std::optional<RelatedTargetVersionMapping>>())
-      : Version(Version), MaximumDeploymentTarget(MaximumDeploymentTarget),
+      : DisplayName(DisplayName), Version(Version),
+        MaximumDeploymentTarget(MaximumDeploymentTarget),
         PlatformInfos(std::move(PlatformInfos)),
         VersionMappings(std::move(VersionMappings)) {}
 
+  const StringRef getDisplayName() const { return DisplayName; }
+
   const llvm::VersionTuple &getVersion() const { return Version; }
 
   const SDKPlatformInfo &getCanonicalPlatformInfo() const {
     return PlatformInfos[0];
   }
 
+  bool supportsPlatformInfo(SDKPlatformInfo PlatformInfo) const {
+    // Consider a platform info supported if its triple parts match.
+    auto MatchesPlatformInfo =
+        [&](SDKPlatformInfo SupportedPlatformInfo) -> bool {
+      return (SupportedPlatformInfo.getVendor() == PlatformInfo.getVendor()) &&
+             (SupportedPlatformInfo.getOS() == PlatformInfo.getOS()) &&
+             (SupportedPlatformInfo.getEnvironment() ==
+              PlatformInfo.getEnvironment()) &&
+             (SupportedPlatformInfo.getObjectFormat() ==
+              PlatformInfo.getObjectFormat());
+    };
+    return llvm::find_if(PlatformInfos, MatchesPlatformInfo) !=
+           PlatformInfos.end();
+  }
+
   const StringRef getPlatformPrefix(llvm::Triple Triple) const {
     auto PlatformInfoIt = llvm::find(PlatformInfos, Triple);
     if (PlatformInfoIt == PlatformInfos.end())
@@ -227,6 +246,7 @@ class DarwinSDKInfo {
   parseDarwinSDKSettingsJSON(const llvm::json::Object *Obj);
 
 private:
+  std::string DisplayName;
   VersionTuple Version;
   VersionTuple MaximumDeploymentTarget;
   PlatformInfoStorageType PlatformInfos;
diff --git a/clang/lib/Basic/DarwinSDKInfo.cpp 
b/clang/lib/Basic/DarwinSDKInfo.cpp
index b55ffd1c39a86..e1a26b3480edc 100644
--- a/clang/lib/Basic/DarwinSDKInfo.cpp
+++ b/clang/lib/Basic/DarwinSDKInfo.cpp
@@ -185,6 +185,12 @@ DarwinSDKInfo::parseDarwinSDKSettingsJSON(const 
llvm::json::Object *Obj) {
   if (!MaximumDeploymentVersion)
     return std::nullopt;
   PlatformInfoStorageType PlatformInfos = parsePlatformInfos(*Obj, *Version);
+  auto DisplayName = Obj->getString("DisplayName");
+  if (!DisplayName) {
+    // DisplayName should always be present, but most of the testing 
SDKSettings
+    // don't have one.
+    DisplayName = Obj->getString("CanonicalName");
+  }
   llvm::DenseMap<OSEnvPair::StorageType,
                  std::optional<RelatedTargetVersionMapping>>
       VersionMappings;
@@ -226,7 +232,7 @@ DarwinSDKInfo::parseDarwinSDKSettingsJSON(const 
llvm::json::Object *Obj) {
     }
   }
 
-  return DarwinSDKInfo(std::move(*Version),
+  return DarwinSDKInfo(DisplayName.value_or("<unknown>"), std::move(*Version),
                        std::move(*MaximumDeploymentVersion),
                        std::move(PlatformInfos), std::move(VersionMappings));
 }
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index fb75739360328..d6bb56c77e764 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1382,26 +1382,61 @@ std::string Darwin::getCompilerRT(const ArgList &Args, 
StringRef Component,
   return std::string(FullPath);
 }
 
-StringRef Darwin::getPlatformFamily() const {
+static StringRef getPlatformFamily(Darwin::DarwinPlatformKind TargetPlatform) {
   switch (TargetPlatform) {
-    case DarwinPlatformKind::MacOS:
-      return "MacOSX";
-    case DarwinPlatformKind::IPhoneOS:
-      if (TargetEnvironment == MacCatalyst)
-        return "MacOSX";
-      return "iPhone";
-    case DarwinPlatformKind::TvOS:
-      return "AppleTV";
-    case DarwinPlatformKind::WatchOS:
-      return "Watch";
-    case DarwinPlatformKind::DriverKit:
-      return "DriverKit";
-    case DarwinPlatformKind::XROS:
-      return "XR";
+  case Darwin::DarwinPlatformKind::MacOS:
+    return "MacOSX";
+  case Darwin::DarwinPlatformKind::IPhoneOS:
+    return "iPhone";
+  case Darwin::DarwinPlatformKind::TvOS:
+    return "AppleTV";
+  case Darwin::DarwinPlatformKind::WatchOS:
+    return "Watch";
+  case Darwin::DarwinPlatformKind::DriverKit:
+    return "DriverKit";
+  default:
+    break;
   }
   llvm_unreachable("Unsupported platform");
 }
 
+static std::string getPlatformAndEnvironmentString(
+    Darwin::DarwinPlatformKind TargetPlatform,
+    Darwin::DarwinEnvironmentKind TargetEnvironment) {
+  SmallVector<StringRef, 2> Components;
+  switch (TargetPlatform) {
+  case Darwin::DarwinPlatformKind::MacOS:
+    Components.push_back("macos");
+    break;
+  case Darwin::DarwinPlatformKind::IPhoneOS:
+    Components.push_back("ios");
+    break;
+  case Darwin::DarwinPlatformKind::TvOS:
+    Components.push_back("tvos");
+    break;
+  case Darwin::DarwinPlatformKind::WatchOS:
+    Components.push_back("watchos");
+    break;
+  case Darwin::DarwinPlatformKind::DriverKit:
+    Components.push_back("driverkit");
+    break;
+  case Darwin::DarwinPlatformKind::XROS:
+    Components.push_back("visionos");
+    break;
+  }
+  switch (TargetEnvironment) {
+  case Darwin::DarwinEnvironmentKind::Simulator:
+    Components.push_back("simulator");
+    break;
+  case Darwin::DarwinEnvironmentKind::MacCatalyst:
+    Components.push_back("macabi");
+    break;
+  default:
+    break;
+  }
+  return join(Components, "-");
+}
+
 StringRef Darwin::getSDKName(StringRef isysroot) {
   // Assume SDK has path: SOME_PATH/SDKs/PlatformXX.YY.sdk
   auto BeginSDK = llvm::sys::path::rbegin(isysroot);
@@ -1754,6 +1789,17 @@ struct DarwinPlatform {
   /// Returns true if the simulator environment can be inferred from the arch.
   bool canInferSimulatorFromArch() const { return InferSimulatorFromArch; }
 
+  DarwinSDKInfo::SDKPlatformInfo getPlatformInfo() const {
+    llvm::Triple::OSType OS = getOSFromPlatform(Platform);
+    llvm::Triple::EnvironmentType EnvironmentType =
+        getEnvironmentTypeFromEnvironmentKind(Environment);
+    StringRef PlatformPrefix =
+        (Platform == DarwinPlatformKind::DriverKit) ? "/System/DriverKit" : "";
+    return DarwinSDKInfo::SDKPlatformInfo(llvm::Triple::Apple, OS,
+                                          EnvironmentType, llvm::Triple::MachO,
+                                          PlatformPrefix);
+  }
+
   const std::optional<llvm::Triple> &getTargetVariantTriple() const {
     return TargetVariantTriple;
   }
@@ -1888,6 +1934,19 @@ struct DarwinPlatform {
     Result.EnvVarName = EnvVarName;
     return Result;
   }
+  static DarwinPlatform createFromSDKInfo(StringRef SDKRoot,
+                                          const DarwinSDKInfo &SDKInfo) {
+    const DarwinSDKInfo::SDKPlatformInfo PlatformInfo =
+        SDKInfo.getCanonicalPlatformInfo();
+    DarwinPlatform Result(InferredFromSDK,
+                          getPlatformFromOS(PlatformInfo.getOS()),
+                          SDKInfo.getVersion());
+    Result.Environment =
+        getEnvironmentKindFromEnvironmentType(PlatformInfo.getEnvironment());
+    Result.InferSimulatorFromArch = false;
+    Result.InferredSource = SDKRoot;
+    return Result;
+  }
   static DarwinPlatform createFromSDK(StringRef SDKRoot,
                                       DarwinPlatformKind Platform,
                                       StringRef Value,
@@ -1913,15 +1972,10 @@ struct DarwinPlatform {
   /// the platform from the SDKPath.
   DarwinSDKInfo inferSDKInfo() {
     assert(Kind == InferredFromSDK && "can infer SDK info only");
-    llvm::Triple::OSType OS = getOSFromPlatform(Platform);
-    StringRef PlatformPrefix =
-        (Platform == DarwinPlatformKind::DriverKit) ? "/System/DriverKit" : "";
-    return DarwinSDKInfo(
-        getOSVersion(), /*MaximumDeploymentTarget=*/
-        VersionTuple(getOSVersion().getMajor(), 0, 99),
-        {DarwinSDKInfo::SDKPlatformInfo(llvm::Triple::Apple, OS,
-                                        llvm::Triple::UnknownEnvironment,
-                                        llvm::Triple::MachO, PlatformPrefix)});
+    return DarwinSDKInfo(getPlatformFamily(Platform), getOSVersion(),
+                         /*MaximumDeploymentTarget=*/
+                         VersionTuple(getOSVersion().getMajor(), 0, 99),
+                         {getPlatformInfo()});
   }
 
 private:
@@ -1982,6 +2036,33 @@ struct DarwinPlatform {
     llvm_unreachable("Unknown DarwinPlatformKind enum");
   }
 
+  static DarwinEnvironmentKind getEnvironmentKindFromEnvironmentType(
+      llvm::Triple::EnvironmentType EnvironmentType) {
+    switch (EnvironmentType) {
+    case llvm::Triple::UnknownEnvironment:
+      return DarwinEnvironmentKind::NativeEnvironment;
+    case llvm::Triple::Simulator:
+      return DarwinEnvironmentKind::Simulator;
+    case llvm::Triple::MacABI:
+      return DarwinEnvironmentKind::MacCatalyst;
+    default:
+      llvm_unreachable("Unable to infer Darwin environment");
+    }
+  }
+
+  static llvm::Triple::EnvironmentType
+  getEnvironmentTypeFromEnvironmentKind(DarwinEnvironmentKind EnvironmentKind) 
{
+    switch (EnvironmentKind) {
+    case DarwinEnvironmentKind::NativeEnvironment:
+      return llvm::Triple::UnknownEnvironment;
+    case DarwinEnvironmentKind::Simulator:
+      return llvm::Triple::Simulator;
+    case DarwinEnvironmentKind::MacCatalyst:
+      return llvm::Triple::MacABI;
+    }
+    llvm_unreachable("Unknown DarwinEnvironmentKind enum");
+  }
+
   SourceKind Kind;
   DarwinPlatformKind Platform;
   DarwinEnvironmentKind Environment = DarwinEnvironmentKind::NativeEnvironment;
@@ -2126,15 +2207,6 @@ getDeploymentTargetFromEnvironmentVariables(const Driver 
&TheDriver,
   return std::nullopt;
 }
 
-/// Returns the SDK name without the optional prefix that ends with a '.' or an
-/// empty string otherwise.
-static StringRef dropSDKNamePrefix(StringRef SDKName) {
-  size_t PrefixPos = SDKName.find('.');
-  if (PrefixPos == StringRef::npos)
-    return "";
-  return SDKName.substr(PrefixPos + 1);
-}
-
 /// Tries to infer the deployment target from the SDK specified by -isysroot
 /// (or SDKROOT). Uses the version specified in the SDKSettings.json file if
 /// it's available.
@@ -2145,57 +2217,43 @@ inferDeploymentTargetFromSDK(DerivedArgList &Args,
   if (!A)
     return std::nullopt;
   StringRef isysroot = A->getValue();
+  if (SDKInfo)
+    return DarwinPlatform::createFromSDKInfo(isysroot, *SDKInfo);
+
   StringRef SDK = Darwin::getSDKName(isysroot);
   if (!SDK.size())
     return std::nullopt;
 
   std::string Version;
-  if (SDKInfo) {
-    // Get the version from the SDKSettings.json if it's available.
-    Version = SDKInfo->getVersion().getAsString();
-  } else {
-    // Slice the version number out.
-    // Version number is between the first and the last number.
-    size_t StartVer = SDK.find_first_of("0123456789");
-    size_t EndVer = SDK.find_last_of("0123456789");
-    if (StartVer != StringRef::npos && EndVer > StartVer)
-      Version = std::string(SDK.slice(StartVer, EndVer + 1));
-  }
+  // Slice the version number out.
+  // Version number is between the first and the last number.
+  size_t StartVer = SDK.find_first_of("0123456789");
+  size_t EndVer = SDK.find_last_of("0123456789");
+  if (StartVer != StringRef::npos && EndVer > StartVer)
+    Version = std::string(SDK.slice(StartVer, EndVer + 1));
   if (Version.empty())
     return std::nullopt;
 
-  auto CreatePlatformFromSDKName =
-      [&](StringRef SDK) -> std::optional<DarwinPlatform> {
-    if (SDK.starts_with("iPhoneOS") || SDK.starts_with("iPhoneSimulator"))
-      return DarwinPlatform::createFromSDK(
-          isysroot, Darwin::IPhoneOS, Version,
-          /*IsSimulator=*/SDK.starts_with("iPhoneSimulator"));
-    else if (SDK.starts_with("MacOSX"))
-      return DarwinPlatform::createFromSDK(isysroot, Darwin::MacOS,
-                                           
getSystemOrSDKMacOSVersion(Version));
-    else if (SDK.starts_with("WatchOS") || SDK.starts_with("WatchSimulator"))
-      return DarwinPlatform::createFromSDK(
-          isysroot, Darwin::WatchOS, Version,
-          /*IsSimulator=*/SDK.starts_with("WatchSimulator"));
-    else if (SDK.starts_with("AppleTVOS") ||
-             SDK.starts_with("AppleTVSimulator"))
-      return DarwinPlatform::createFromSDK(
-          isysroot, Darwin::TvOS, Version,
-          /*IsSimulator=*/SDK.starts_with("AppleTVSimulator"));
-    else if (SDK.starts_with("XR"))
-      return DarwinPlatform::createFromSDK(
-          isysroot, Darwin::XROS, Version,
-          /*IsSimulator=*/SDK.contains("Simulator"));
-    else if (SDK.starts_with("DriverKit"))
-      return DarwinPlatform::createFromSDK(isysroot, Darwin::DriverKit,
-                                           Version);
-    return std::nullopt;
-  };
-  if (auto Result = CreatePlatformFromSDKName(SDK))
-    return Result;
-  // The SDK can be an SDK variant with a name like `<prefix>.<platform>`.
-  return CreatePlatformFromSDKName(dropSDKNamePrefix(SDK));
+  if (SDK.starts_with("iPhoneOS") || SDK.starts_with("iPhoneSimulator"))
+    return DarwinPlatform::createFromSDK(
+        isysroot, Darwin::IPhoneOS, Version,
+        /*IsSimulator=*/SDK.starts_with("iPhoneSimulator"));
+  else if (SDK.starts_with("MacOSX"))
+    return DarwinPlatform::createFromSDK(isysroot, Darwin::MacOS,
+                                         getSystemOrSDKMacOSVersion(Version));
+  else if (SDK.starts_with("WatchOS") || SDK.starts_with("WatchSimulator"))
+    return DarwinPlatform::createFromSDK(
+        isysroot, Darwin::WatchOS, Version,
+        /*IsSimulator=*/SDK.starts_with("WatchSimulator"));
+  else if (SDK.starts_with("AppleTVOS") || SDK.starts_with("AppleTVSimulator"))
+    return DarwinPlatform::createFromSDK(
+        isysroot, Darwin::TvOS, Version,
+        /*IsSimulator=*/SDK.starts_with("AppleTVSimulator"));
+  else if (SDK.starts_with("DriverKit"))
+    return DarwinPlatform::createFromSDK(isysroot, Darwin::DriverKit, Version);
+  return std::nullopt;
 }
+
 // Compute & get the OS Version when the target triple omitted one.
 VersionTuple getInferredOSVersion(llvm::Triple::OSType OS,
                                   const llvm::Triple &Triple,
@@ -2598,15 +2656,20 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) 
const {
         << TargetVariantTriple->str();
   }
 
-  if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
+  if (SDKInfo) {
+    if (!SDKInfo->supportsPlatformInfo(PlatformAndVersion->getPlatformInfo())) 
{
+      getDriver().Diag(diag::warn_incompatible_sysroot)
+          << SDKInfo->getDisplayName()
+          << getPlatformAndEnvironmentString(TargetPlatform, 
TargetEnvironment);
+    }
+  } else if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
     StringRef SDK = getSDKName(A->getValue());
     if (SDK.size() > 0) {
       size_t StartVer = SDK.find_first_of("0123456789");
       StringRef SDKName = SDK.slice(0, StartVer);
-      if (!SDKName.starts_with(getPlatformFamily()) &&
-          !dropSDKNamePrefix(SDKName).starts_with(getPlatformFamily()))
+      if (!SDKName.starts_with(getPlatformFamily(TargetPlatform)))
         getDriver().Diag(diag::warn_incompatible_sysroot)
-            << SDKName << getPlatformFamily();
+            << SDKName << getPlatformFamily(TargetPlatform);
     }
   }
 }
@@ -3130,12 +3193,8 @@ bool Darwin::isAlignedAllocationUnavailable() const {
 static bool
 sdkSupportsBuiltinModules(const std::optional<DarwinSDKInfo> &SDKInfo) {
   if (!SDKInfo)
-    // If there is no SDK info, assume this is building against a
-    // pre-SDK version of macOS (i.e. before Mac OS X 10.4). Those
-    // don't support modules anyway, but the headers definitely
-    // don't support builtin modules either. It might also be some
-    // kind of degenerate build environment, err on the side of
-    // the old behavior which is to not use builtin modules.
+    // If there is no SDK info, assume this is building against an SDK that
+    // predates SDKSettings.json. None of those support builtin modules.
     return false;
 
   DarwinSDKInfo::SDKPlatformInfo PlatformInfo =
diff --git a/clang/lib/Driver/ToolChains/Darwin.h 
b/clang/lib/Driver/ToolChains/Darwin.h
index 4a3b75be3c258..3e3ea5a347a44 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -588,7 +588,6 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public AppleMachO {
       const llvm::opt::ArgList &Args,
       llvm::opt::ArgStringList &CC1ASArgs) const override;
 
-  StringRef getPlatformFamily() const;
   StringRef getOSLibraryNameSuffix(bool IgnoreSim = false) const override;
 
 public:
diff --git a/clang/test/Driver/Inputs/XROS1.0.sdk/SDKSettings.json 
b/clang/test/Driver/Inputs/XROS1.0.sdk/SDKSettings.json
new file mode 100644
index 0000000000000..50fede738d5fb
--- /dev/null
+++ b/clang/test/Driver/Inputs/XROS1.0.sdk/SDKSettings.json
@@ -0,0 +1 @@
+{"DisplayName":"visionOS 
1.0","DefaultProperties":{"CODE_SIGN_ENTITLEMENTS":"","ENTITLEMENTS_REQUIRED":"YES","KASAN_DEFAULT_CFLAGS":"$(KASAN_CFLAGS_CLASSIC)","KASAN_DEFAULT_CFLAGS[arch=arm64]":"$(KASAN_CFLAGS_TBI)","KASAN_DEFAULT_CFLAGS[arch=arm64e]":"$(KASAN_CFLAGS_TBI)","DEAD_CODE_STRIPPING":"YES","GCC_THUMB_SUPPORT":"YES","SUPPORTED_DEVICE_FAMILIES":"7","TAPI_VERIFY_MODE":"Pedantic","TEST_LIBRARY_SEARCH_PATHS":"$(inherited)
 
$(PLATFORM_DIR)\/Developer\/usr\/lib","PLATFORM_NAME":"xros","KASAN_CFLAGS_CLASSIC":"-DKASAN=1
 -DKASAN_CLASSIC=1 -fsanitize=address -mllvm -asan-globals-live-support -mllvm 
-asan-force-dynamic-shadow","XROS_DEPLOYMENT_TARGET":"1.0","CODE_SIGNING_REQUIRED":"YES","CODE_SIGN_IDENTITY":"Apple
 Development","KASAN_CFLAGS_TBI":"-DKASAN=1 -DKASAN_TBI=1 
-fsanitize=kernel-hwaddress -mllvm -hwasan-recover=0 -mllvm 
-hwasan-instrument-atomics=0 -mllvm -hwasan-instrument-stack=1 -mllvm 
-hwasan-generate-tags-with-calls=1 -mllvm -hwasan-instrument-with-calls=1 
-mllvm -hwasan-use-short-granules=0 -mllvm 
-hwasan-memory-access-callback-prefix=__asan_","TEST_FRAMEWORK_SEARCH_PATHS":"$(inherited)
 $(PLATFORM_DIR)\/Developer\/Library\/Frameworks 
$(SDKROOT)\/Developer\/Library\/Frameworks","TAPI_USE_SRCROOT":"YES","ENTITLEMENTS_DESTINATION":"Signature","RESOURCES_PLATFORM_NAME":"xros","DEFAULT_COMPILER":"com.apple.compilers.llvm.clang.1_0","DEPLOYMENT_TARGET_SUGGESTED_VALUES":["1.0"],"AD_HOC_CODE_SIGNING_ALLOWED":"NO"},"MinimalDisplayName":"1.0","Version":"1.0","IsBaseSDK":"YES","SupportedTargets":{"xros":{"LLVMTargetTripleVendor":"apple","DeploymentTargetSettingName":"XROS_DEPLOYMENT_TARGET","PlatformFamilyDisplayName":"visionOS","Archs":["arm64e","arm64"],"LLVMTargetTripleEnvironment":"","ClangRuntimeLibraryPlatformName":"xros","MaximumDeploymentTarget":"1.0.99","BuildVersionPlatformID":"11","DefaultDeploymentTarget":"1.0","LLVMTargetTripleSys":"xros","DeviceFamilies":[{"Identifier":"7","Name":"vision","DisplayName":"Apple
 
Vision"}],"MinimumDeploymentTarget":"1.0","SwiftConcurrencyMinimumDeploymentTarget":"1.0","SwiftOSRuntimeMinimumDeploymentTarget":"1.0","RecommendedDeploymentTarget":"1.0","PlatformFamilyName":"xrOS","SystemPrefix":"","ValidDeploymentTargets":["1.0"]}},"PropertyConditionFallbackNames":["embedded"],"VersionMap":{"xrOS_iOS":{"1.0":"17.1"},"iOS_visionOS":{"17.1":"1.0"},"iOS_xrOS":{"17.1":"1.0"},"visionOS_iOS":{"1.0":"17.1"}},"DefaultDeploymentTarget":"1.0","MaximumDeploymentTarget":"1.0.99","DebuggerOptions":{"SupportsViewDebugging":"YES"},"CanonicalName":"xros1.0","CustomProperties":{"CLANG_ENABLE_EXPLICIT_MODULES":"NO"}}
\ No newline at end of file
diff --git a/clang/test/Driver/Inputs/XRSimulator1.0.sdk/SDKSettings.json 
b/clang/test/Driver/Inputs/XRSimulator1.0.sdk/SDKSettings.json
new file mode 100644
index 0000000000000..f9f0d77bc450f
--- /dev/null
+++ b/clang/test/Driver/Inputs/XRSimulator1.0.sdk/SDKSettings.json
@@ -0,0 +1 @@
+{"DisplayName":"Simulator - visionOS 
1.0","DefaultProperties":{"LLVM_TARGET_TRIPLE_SUFFIX":"-simulator","DEFAULT_COMPILER":"com.apple.compilers.llvm.clang.1_0","AD_HOC_CODE_SIGNING_ALLOWED":"YES","TEST_LIBRARY_SEARCH_PATHS":"$(inherited)
 
$(PLATFORM_DIR)\/Developer\/usr\/lib","DEPLOYMENT_TARGET_SUGGESTED_VALUES":["1.0"],"TEST_FRAMEWORK_SEARCH_PATHS":"$(inherited)
 $(PLATFORM_DIR)\/Developer\/Library\/Frameworks 
$(SDKROOT)\/Developer\/Library\/Frameworks","DEAD_CODE_STRIPPING":"YES","CODE_SIGN_IDENTITY":"-","CODE_SIGNING_REQUIRED":"YES","TAPI_VERIFY_MODE":"Pedantic","SUPPORTED_DEVICE_FAMILIES":"7","ENTITLEMENTS_DESTINATION":"__entitlements","PLATFORM_NAME":"xrsimulator","ENTITLEMENTS_REQUIRED":"YES","CODE_SIGN_ENTITLEMENTS":"","XROS_DEPLOYMENT_TARGET":"1.0","RESOURCES_PLATFORM_NAME":"xros","TAPI_USE_SRCROOT":"YES"},"MinimalDisplayName":"Simulator
 - 
1.0","Version":"1.0","IsBaseSDK":"YES","SupportedTargets":{"xrsimulator":{"LLVMTargetTripleVendor":"apple","DeploymentTargetSettingName":"XROS_DEPLOYMENT_TARGET","PlatformFamilyDisplayName":"visionOS","Archs":["arm64","x86_64"],"LLVMTargetTripleEnvironment":"simulator","ClangRuntimeLibraryPlatformName":"xrossim","MaximumDeploymentTarget":"1.0.99","BuildVersionPlatformID":"12","DefaultDeploymentTarget":"1.0","LLVMTargetTripleSys":"xros","DeviceFamilies":[{"Identifier":"7","Name":"vision","DisplayName":"Apple
 
Vision"}],"MinimumDeploymentTarget":"1.0","SwiftConcurrencyMinimumDeploymentTarget":"1.0","SwiftOSRuntimeMinimumDeploymentTarget":"1.0","RecommendedDeploymentTarget":"1.0","PlatformFamilyName":"xrOS","SystemPrefix":"","ValidDeploymentTargets":["1.0"]}},"PropertyConditionFallbackNames":["embeddedsimulator"],"VersionMap":{"xrOS_iOS":{"1.0":"17.1"},"iOS_visionOS":{"17.1":"1.0"},"iOS_xrOS":{"17.1":"1.0"},"visionOS_iOS":{"1.0":"17.1"}},"DefaultDeploymentTarget":"1.0","MaximumDeploymentTarget":"1.0.99","DebuggerOptions":{"SupportsViewDebugging":"YES"},"CanonicalName":"xrsimulator1.0","CustomProperties":{"CLANG_ENABLE_EXPLICIT_MODULES":"NO"}}
\ No newline at end of file
diff --git a/clang/test/Driver/darwin-sdk-with-prefix.c 
b/clang/test/Driver/darwin-sdk-with-prefix.c
index 7619ded56b65a..ad9382f64cb75 100644
--- a/clang/test/Driver/darwin-sdk-with-prefix.c
+++ b/clang/test/Driver/darwin-sdk-with-prefix.c
@@ -1,10 +1,10 @@
 // RUN: rm -rf %t.dir
 // RUN: mkdir -p %t.dir
 
-// RUN: rm -rf %t.dir/prefix.iPhoneOS12.0.0.sdk
-// RUN: mkdir -p %t.dir/prefix.iPhoneOS12.0.0.sdk
-// RUN: %clang -c -isysroot %t.dir/prefix.iPhoneOS12.0.0.sdk -target 
arm64-apple-darwin %s -### 2>&1 | FileCheck %s
-// RUN: env SDKROOT=%t.dir/prefix.iPhoneOS12.0.0.sdk %clang -c -target 
arm64-apple-darwin %s -### 2>&1 | FileCheck %s
+// RUN: rm -rf %t.dir/prefix.iPhoneOS13.0.sdk
+// RUN: cp -R %S/Inputs/iPhoneOS13.0.sdk %t.dir/prefix.iPhoneOS13.0.sdk
+// RUN: %clang -c -isysroot %t.dir/prefix.iPhoneOS13.0.sdk -target 
arm64-apple-darwin %s -### 2>&1 | FileCheck %s
+// RUN: env SDKROOT=%t.dir/prefix.iPhoneOS13.0.sdk %clang -c -target 
arm64-apple-darwin %s -### 2>&1 | FileCheck %s
 //
 // CHECK-NOT: warning: using sysroot for
-// CHECK: "-triple" "arm64-apple-ios12.0.0"
+// CHECK: "-triple" "arm64-apple-ios13.0.0"
diff --git a/clang/test/Driver/xros-driver-requires-darwin-host.c 
b/clang/test/Driver/xros-driver-requires-darwin-host.c
index 94c13b9f414a9..1de8cca17e6ef 100644
--- a/clang/test/Driver/xros-driver-requires-darwin-host.c
+++ b/clang/test/Driver/xros-driver-requires-darwin-host.c
@@ -2,11 +2,8 @@
 
 // RUN: env XROS_DEPLOYMENT_TARGET=1.0 %clang -arch arm64 -c -### %s 2>&1 | 
FileCheck %s
 
-// RUN: rm -rf %t.dir
-// RUN: mkdir -p %t.dir/XROS1.0.sdk
-// RUN: %clang -arch arm64 -isysroot %t.dir/XROS1.0.sdk -c -### %s 2>&1 | 
FileCheck %s
-// RUN: mkdir -p %t.dir/XRSimulator1.0.sdk
-// RUN: %clang -arch arm64 -isysroot %t.dir/XRSimulator1.0.sdk -c -### %s 2>&1 
| FileCheck --check-prefix=CHECK_SIM %s
+// RUN: %clang -arch arm64 -isysroot %S/Inputs/XROS1.0.sdk -c -### %s 2>&1 | 
FileCheck %s
+// RUN: %clang -arch arm64 -isysroot %S/Inputs/XRSimulator1.0.sdk -c -### %s 
2>&1 | FileCheck --check-prefix=CHECK_SIM %s
 
 
 // CHECK: "-cc1"{{.*}} "-triple" "arm64-apple-xros1.0.0"

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to