================
@@ -78,6 +78,43 @@ TEST(DarwinSDKInfo, VersionMappingParseError) {
.has_value());
}
+TEST(DarwinSDKInfo, SystemPrefix) {
+ llvm::json::Object SDKSettings({{"CanonicalName", "macosx26.0"},
+ {"Version", "26.0"},
+ {"MaximumDeploymentTarget", "26.0.99"}});
+ llvm::json::Object SupportedTargets;
+ llvm::json::Object MacOS({{"Archs", {"x86_64", "arm64"}},
+ {"LLVMTargetTripleVendor", "apple"},
+ {"LLVMTargetTripleSys", "macos"},
+ {"LLVMTargetTripleEnvironment", ""},
+ {"SystemPrefix", "/System/macOSSupport"}});
+ llvm::json::Object MacCatalyst({{"Archs", {"x86_64", "arm64"}},
+ {"LLVMTargetTripleVendor", "apple"},
+ {"LLVMTargetTripleSys", "ios"},
+ {"LLVMTargetTripleEnvironment", "macabi"},
+ {"SystemPrefix", "/System/iOSSupport"}});
+ llvm::json::Object DriverKit({{"Archs", {"x86_64", "arm64"}},
+ {"LLVMTargetTripleVendor", "apple"},
+ {"LLVMTargetTripleSys", "driverkit"},
+ {"LLVMTargetTripleEnvironment", ""},
+ {"SystemPrefix", ""}});
+ SupportedTargets["macosx"] = std::move(MacOS);
+ SupportedTargets["iosmac"] = std::move(MacCatalyst);
+ SupportedTargets["driverkit"] = std::move(DriverKit);
+ SDKSettings["SupportedTargets"] = std::move(SupportedTargets);
+
+ auto SDKInfo = DarwinSDKInfo::parseDarwinSDKSettingsJSON(&SDKSettings);
+ ASSERT_TRUE(SDKInfo);
+ EXPECT_EQ(SDKInfo->getSystemPrefix(Triple("arm64-apple-macos26.0")),
+ "/System/macOSSupport");
+ EXPECT_EQ(SDKInfo->getSystemPrefix(Triple("ppc-apple-macos26.0")),
+ "/System/macOSSupport");
+ EXPECT_EQ(SDKInfo->getSystemPrefix(Triple("arm64-apple-ios26.0")),
+ "/System/macOSSupport");
----------------
cyndyishida wrote:
Does `ios` result in `"/System/macOSSupport"` because there's no entry for it
in `SDKInfo` and it defaults to use the `CanonicalName` as the platform value?
Why is that desired behavior? This seems like it would result in an observable
change for users that may not be holding the SDK arguments in the _common_ way
for compiler invocations.
https://github.com/llvm/llvm-project/pull/171970
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits