[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
Tue Jan 20 07:21:35 PST 2026
================
@@ -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 =
----------------
cyndyishida wrote:
This comparator should move the definition of `SDKPlatformInfo` as another equality operator. It also seems unfortunate that this check has to be written twice, with all the same function calls between different types. Maybe it could be templated instead?
https://github.com/llvm/llvm-project/pull/176541
More information about the cfe-commits
mailing list