mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Dependency Scanning] Do not include -target in extraPCMArgs when scanning an interface
https://github.com/apple/swift/pull/37774 (related to rdar://72480261) has made it so that the target of built clang modules (even downstream from Swift interface dependencies) can be consistent with that of the main module. This means that when building transitive Clang dependencies of the main module, they will always have a matching triple to the main module itself (ensured with `-clang-target`). This means we no longer have to report the target triple in the set of `extraPCMArgs` which encode an interface-specific requirement for building its dependencies.
This commit is contained in:
@@ -1647,15 +1647,20 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
|
||||
}
|
||||
info.BuildArguments = BuildArgs;
|
||||
info.Hash = CacheHash;
|
||||
auto target = *(std::find(BuildArgs.rbegin(), BuildArgs.rend(), "-target") - 1);
|
||||
auto target = *(std::find(BuildArgs.rbegin(), BuildArgs.rend(), "-target") - 1);
|
||||
auto langVersion = *(std::find(BuildArgs.rbegin(), BuildArgs.rend(),
|
||||
"-swift-version") - 1);
|
||||
std::array<StringRef, 6> ExtraPCMArgs = {
|
||||
// PCMs should use the target triple the interface will be using to build
|
||||
"-Xcc", "-target", "-Xcc", target,
|
||||
|
||||
std::vector<StringRef> ExtraPCMArgs = {
|
||||
// PCMs should use the effective Swift language version for apinotes.
|
||||
"-Xcc", ArgSaver.save((llvm::Twine("-fapinotes-swift-version=") + langVersion).str())
|
||||
"-Xcc",
|
||||
ArgSaver.save((llvm::Twine("-fapinotes-swift-version=") + langVersion).str())
|
||||
};
|
||||
if (!subInvocation.getLangOptions().ClangTarget.hasValue()) {
|
||||
ExtraPCMArgs.insert(ExtraPCMArgs.begin(), {"-Xcc", "-target",
|
||||
"-Xcc", target});
|
||||
}
|
||||
|
||||
info.ExtraPCMArgs = ExtraPCMArgs;
|
||||
// Run the action under the sub compiler instance.
|
||||
return action(info);
|
||||
|
||||
Reference in New Issue
Block a user