@@ -1703,6 +1703,17 @@ bool InterfaceSubContextDelegateImpl::extractSwiftInterfaceVersionAndArgs(
1703
1703
interfacePath, diagnosticLoc))
1704
1704
return true ;
1705
1705
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
+
1706
1717
SmallString<32 > ExpectedModuleName = subInvocation.getModuleName ();
1707
1718
if (subInvocation.parseArgs (interfaceInfo.Arguments , *Diags)) {
1708
1719
return true ;
@@ -2023,7 +2034,6 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
2023
2034
subInvocation.getFrontendOptions ().InputsAndOutputs
2024
2035
.setMainAndSupplementaryOutputs (outputFiles, ModuleOutputPaths);
2025
2036
2026
- SmallVector<const char *, 64 > SubArgs;
2027
2037
SwiftInterfaceInfo interfaceInfo;
2028
2038
// Extract compiler arguments from the interface file and use them to configure
2029
2039
// the compiler invocation.
@@ -2032,25 +2042,9 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
2032
2042
return std::make_error_code (std::errc::not_supported);
2033
2043
}
2034
2044
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
-
2049
2045
// 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 ());
2054
2048
2055
2049
// If the target triple parsed from the Swift interface file differs
2056
2050
// only in subarchitecture from the original target triple, then
0 commit comments