mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Explicit Module Builds] Add '-clang-target-variant' flag
https://github.com/swiftlang/swift/pull/37774 added '-clang-target' which allows us to specify a target triple that only differs from '-target' by the OS version, when we want to provide a different OS version for API availability and type-checking, in order to set a common/unified target triple for the entire Clang module dependency graph, for presenting a unified API surface to the Swift client, serving as a maximum type-checking epoch. This change adds an equivalent flag for the '-target-variant' configuration, as a mechanism to ensure that the entire module dependency graph presents a consistent os version.
This commit is contained in:
@@ -1668,6 +1668,15 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
|
||||
GenericArgs.push_back(triple);
|
||||
}
|
||||
|
||||
if (LangOpts.ClangTargetVariant.has_value()) {
|
||||
genericSubInvocation.getLangOptions().ClangTargetVariant = LangOpts.ClangTargetVariant;
|
||||
auto variantTriple = ArgSaver.save(genericSubInvocation.getLangOptions()
|
||||
.ClangTargetVariant->getTriple());
|
||||
assert(!variantTriple.empty());
|
||||
GenericArgs.push_back("-clang-target-variant");
|
||||
GenericArgs.push_back(variantTriple);
|
||||
}
|
||||
|
||||
// Inherit the target SDK name and version
|
||||
if (!LangOpts.SDKName.empty()) {
|
||||
genericSubInvocation.getLangOptions().SDKName = LangOpts.SDKName;
|
||||
|
||||
Reference in New Issue
Block a user