@@ -1215,6 +1215,7 @@ class ModuleInterfaceLoaderImpl {
1215
1215
ctx.SourceMgr , diagsToUse,
1216
1216
astDelegate, interfacePath,
1217
1217
ctx.SearchPathOpts .getSDKPath (),
1218
+ ctx.SearchPathOpts .getSysRoot (),
1218
1219
realName.str (), cacheDir,
1219
1220
prebuiltCacheDir, backupInterfaceDir, StringRef (),
1220
1221
Opts.disableInterfaceLock ,
@@ -1250,6 +1251,7 @@ class ModuleInterfaceLoaderImpl {
1250
1251
ImplicitModuleInterfaceBuilder fallbackBuilder (
1251
1252
ctx.SourceMgr , &ctx.Diags , astDelegate, backupPath,
1252
1253
ctx.SearchPathOpts .getSDKPath (),
1254
+ ctx.SearchPathOpts .getSysRoot (),
1253
1255
moduleName, cacheDir,
1254
1256
prebuiltCacheDir, backupInterfaceDir, StringRef (),
1255
1257
Opts.disableInterfaceLock ,
@@ -1475,6 +1477,7 @@ bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
1475
1477
RequireOSSAModules);
1476
1478
ImplicitModuleInterfaceBuilder builder (SourceMgr, &Diags, astDelegate, InPath,
1477
1479
SearchPathOpts.getSDKPath (),
1480
+ SearchPathOpts.getSysRoot (),
1478
1481
ModuleName, CacheDir, PrebuiltCacheDir,
1479
1482
BackupInterfaceDir, ABIOutputPath,
1480
1483
LoaderOpts.disableInterfaceLock ,
@@ -1495,6 +1498,7 @@ bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
1495
1498
assert (!backInPath.empty ());
1496
1499
ImplicitModuleInterfaceBuilder backupBuilder (SourceMgr, &Diags, astDelegate, backInPath,
1497
1500
SearchPathOpts.getSDKPath (),
1501
+ SearchPathOpts.getSysRoot (),
1498
1502
ModuleName, CacheDir, PrebuiltCacheDir,
1499
1503
BackupInterfaceDir, ABIOutputPath,
1500
1504
LoaderOpts.disableInterfaceLock ,
@@ -2049,12 +2053,13 @@ std::error_code
2049
2053
InterfaceSubContextDelegateImpl::runInSubContext (StringRef moduleName,
2050
2054
StringRef interfacePath,
2051
2055
StringRef sdkPath,
2056
+ std::optional<StringRef> sysRoot,
2052
2057
StringRef outputPath,
2053
2058
SourceLoc diagLoc,
2054
2059
llvm::function_ref<std::error_code(ASTContext&, ModuleDecl*, ArrayRef<StringRef>,
2055
2060
StringRef, StringRef)> action) {
2056
- return runInSubCompilerInstance (moduleName, interfacePath, sdkPath, outputPath ,
2057
- diagLoc, /* silenceErrors=*/ false ,
2061
+ return runInSubCompilerInstance (moduleName, interfacePath, sdkPath, sysRoot ,
2062
+ outputPath, diagLoc, /* silenceErrors=*/ false ,
2058
2063
[&](SubCompilerInstanceInfo &info){
2059
2064
std::string UserModuleVer = info.Instance ->getInvocation ().getFrontendOptions ()
2060
2065
.UserModuleVersion .getAsString ();
@@ -2070,6 +2075,7 @@ std::error_code
2070
2075
InterfaceSubContextDelegateImpl::runInSubCompilerInstance (StringRef moduleName,
2071
2076
StringRef interfacePath,
2072
2077
StringRef sdkPath,
2078
+ std::optional<StringRef> sysRoot,
2073
2079
StringRef outputPath,
2074
2080
SourceLoc diagLoc,
2075
2081
bool silenceErrors,
@@ -2101,6 +2107,9 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
2101
2107
subInvocation.setModuleName (moduleName);
2102
2108
BuildArgs.push_back (" -module-name" );
2103
2109
BuildArgs.push_back (moduleName);
2110
+ if (sysRoot) {
2111
+ subInvocation.setSysRoot (sysRoot.value ());
2112
+ }
2104
2113
2105
2114
// FIXME: Hack for Darwin.swiftmodule, which cannot be rebuilt with C++
2106
2115
// interop enabled by the Swift CI because it uses an old host SDK.
0 commit comments