[swiftinterface] Handle target variants the same as targets (#77156)

Based on preliminary work from @rmaz.

The compilation arguments for a swiftinterface file are preprocessed to
modify the `-target` argument to match the preferred target (which comes
from the command line) in cases in which the sub-architecture differs,
but it is compatible (for example using `arm64e` when `arm64` is being
compiled), but this was not done for the target variant, which ended up
with mismatches on the sub-architecture used by the target and target
variant, which fails an assert in assert toolchains.
This commit is contained in:
Daniel Rodríguez Troitiño
2024-10-22 16:34:19 -07:00
committed by GitHub
parent bc30ecc438
commit 4e2fbe17c3
3 changed files with 45 additions and 22 deletions

View File

@@ -571,7 +571,8 @@ public:
bool extractCompilerFlagsFromInterface(
StringRef interfacePath, StringRef buffer, llvm::StringSaver &ArgSaver,
SmallVectorImpl<const char *> &SubArgs,
std::optional<llvm::Triple> PreferredTarget = std::nullopt);
std::optional<llvm::Triple> PreferredTarget = std::nullopt,
std::optional<llvm::Triple> PreferredTargetVariant = std::nullopt);
/// Extract the user module version number from an interface file.
llvm::VersionTuple extractUserModuleVersionFromInterface(StringRef moduleInterfacePath);