@@ -1703,6 +1703,17 @@ bool InterfaceSubContextDelegateImpl::extractSwiftInterfaceVersionAndArgs(
17031703 interfacePath, diagnosticLoc))
17041704 return true ;
17051705
1706+ // Prior to Swift 5.9, swiftinterfaces were always built (accidentally) with
1707+ // `-target-min-inlining-version target` prepended to the argument list. To
1708+ // preserve compatibility we must continue to prepend those flags to the
1709+ // invocation when the interface was generated by an older compiler.
1710+ if (auto toolsVersion = interfaceInfo.CompilerToolsVersion ) {
1711+ if (toolsVersion < version::Version{5 , 9 }) {
1712+ interfaceInfo.Arguments .push_back (" -target-min-inlining-version" );
1713+ interfaceInfo.Arguments .push_back (" target" );
1714+ }
1715+ }
1716+
17061717 SmallString<32 > ExpectedModuleName = subInvocation.getModuleName ();
17071718 if (subInvocation.parseArgs (interfaceInfo.Arguments , *Diags)) {
17081719 return true ;
@@ -2023,7 +2034,6 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
20232034 subInvocation.getFrontendOptions ().InputsAndOutputs
20242035 .setMainAndSupplementaryOutputs (outputFiles, ModuleOutputPaths);
20252036
2026- SmallVector<const char *, 64 > SubArgs;
20272037 SwiftInterfaceInfo interfaceInfo;
20282038 // Extract compiler arguments from the interface file and use them to configure
20292039 // the compiler invocation.
@@ -2032,25 +2042,9 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
20322042 return std::make_error_code (std::errc::not_supported);
20332043 }
20342044
2035- // Prior to Swift 5.9, swiftinterfaces were always built (accidentally) with
2036- // `-target-min-inlining-version target` prepended to the argument list. To
2037- // preserve compatibility we must continue to prepend those flags to the
2038- // invocation when the interface was generated by an older compiler.
2039- if (auto toolsVersion = interfaceInfo.CompilerToolsVersion ) {
2040- if (toolsVersion < version::Version{5 , 9 }) {
2041- SubArgs.push_back (" -target-min-inlining-version" );
2042- SubArgs.push_back (" target" );
2043- }
2044- }
2045-
2046- SubArgs.insert (SubArgs.end (), interfaceInfo.Arguments .begin (),
2047- interfaceInfo.Arguments .end ());
2048-
20492045 // Insert arguments collected from the interface file.
2050- BuildArgs.insert (BuildArgs.end (), SubArgs.begin (), SubArgs.end ());
2051- if (subInvocation.parseArgs (SubArgs, *Diags)) {
2052- return std::make_error_code (std::errc::not_supported);
2053- }
2046+ BuildArgs.insert (BuildArgs.end (), interfaceInfo.Arguments .begin (),
2047+ interfaceInfo.Arguments .end ());
20542048
20552049 // If the target triple parsed from the Swift interface file differs
20562050 // only in subarchitecture from the original target triple, then
0 commit comments