[clang] [clang][driver][darwin] Base the platform prefix on the SDK, not the target (PR #171970)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 2 10:47:17 PST 2026


================
@@ -141,20 +177,32 @@ class DarwinSDKInfo {
     llvm::DenseMap<VersionTuple, VersionTuple> Mapping;
   };
 
+  using PlatformInfoStorageType = SmallVector<SDKPlatformInfo, 2>;
+
   DarwinSDKInfo(
       VersionTuple Version, VersionTuple MaximumDeploymentTarget,
-      llvm::Triple::OSType OS,
+      PlatformInfoStorageType PlatformInfos,
       llvm::DenseMap<OSEnvPair::StorageType,
                      std::optional<RelatedTargetVersionMapping>>
           VersionMappings =
               llvm::DenseMap<OSEnvPair::StorageType,
                              std::optional<RelatedTargetVersionMapping>>())
       : Version(Version), MaximumDeploymentTarget(MaximumDeploymentTarget),
-        OS(OS), VersionMappings(std::move(VersionMappings)) {}
+        PlatformInfos(std::move(PlatformInfos)),
+        VersionMappings(std::move(VersionMappings)) {}
 
   const llvm::VersionTuple &getVersion() const { return Version; }
 
-  const llvm::Triple::OSType &getOS() const { return OS; }
+  const SDKPlatformInfo &getCanonicalPlatformInfo() const {
+    return PlatformInfos[0];
+  }
+
+  const StringRef getPlatformPrefix(llvm::Triple Triple) const {
+    auto PlatformPrefix = llvm::find(PlatformInfos, Triple);
----------------
cyndyishida wrote:

nit: 
```suggestion
    auto PlatformInfoIt = llvm::find(PlatformInfos, Triple);
```

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


More information about the cfe-commits mailing list