@@ -186,8 +186,9 @@ void CompilerInvocation::setDefaultBlocklistsIfNecessary() {
186
186
}
187
187
188
188
static void updateRuntimeLibraryPaths (SearchPathOptions &SearchPathOpts,
189
- LangOptions &LangOpts) {
190
- llvm::Triple &Triple = LangOpts.Target ;
189
+ const FrontendOptions &FrontendOpts,
190
+ const LangOptions &LangOpts) {
191
+ const llvm::Triple &Triple = LangOpts.Target ;
191
192
llvm::SmallString<128 > LibPath (SearchPathOpts.RuntimeResourcePath );
192
193
193
194
StringRef LibSubDir = getPlatformNameForTriple (Triple);
@@ -220,15 +221,18 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
220
221
}
221
222
222
223
if (!SearchPathOpts.getSDKPath ().empty ()) {
224
+ const char *swiftDir = FrontendOpts.UseSharedResourceFolder
225
+ ? " swift" : " swift_static" ;
226
+
223
227
if (tripleIsMacCatalystEnvironment (Triple)) {
224
228
LibPath = SearchPathOpts.getSDKPath ();
225
229
llvm::sys::path::append (LibPath, " System" , " iOSSupport" );
226
- llvm::sys::path::append (LibPath, " usr" , " lib" , " swift " );
230
+ llvm::sys::path::append (LibPath, " usr" , " lib" , swiftDir );
227
231
RuntimeLibraryImportPaths.push_back (std::string (LibPath.str ()));
228
232
}
229
233
230
234
LibPath = SearchPathOpts.getSDKPath ();
231
- llvm::sys::path::append (LibPath, " usr" , " lib" , " swift " );
235
+ llvm::sys::path::append (LibPath, " usr" , " lib" , swiftDir );
232
236
if (!Triple.isOSDarwin ()) {
233
237
// Use the non-architecture suffixed form with directory-layout
234
238
// swiftmodules.
@@ -298,7 +302,7 @@ setBridgingHeaderFromFrontendOptions(ClangImporterOptions &ImporterOpts,
298
302
299
303
void CompilerInvocation::setRuntimeResourcePath (StringRef Path) {
300
304
SearchPathOpts.RuntimeResourcePath = Path.str ();
301
- updateRuntimeLibraryPaths (SearchPathOpts, LangOpts);
305
+ updateRuntimeLibraryPaths (SearchPathOpts, FrontendOpts, LangOpts);
302
306
}
303
307
304
308
void CompilerInvocation::setTargetTriple (StringRef Triple) {
@@ -307,12 +311,12 @@ void CompilerInvocation::setTargetTriple(StringRef Triple) {
307
311
308
312
void CompilerInvocation::setTargetTriple (const llvm::Triple &Triple) {
309
313
LangOpts.setTarget (Triple);
310
- updateRuntimeLibraryPaths (SearchPathOpts, LangOpts);
314
+ updateRuntimeLibraryPaths (SearchPathOpts, FrontendOpts, LangOpts);
311
315
}
312
316
313
317
void CompilerInvocation::setSDKPath (const std::string &Path) {
314
318
SearchPathOpts.setSDKPath (Path);
315
- updateRuntimeLibraryPaths (SearchPathOpts, LangOpts);
319
+ updateRuntimeLibraryPaths (SearchPathOpts, FrontendOpts, LangOpts);
316
320
}
317
321
318
322
bool CompilerInvocation::setModuleAliasMap (std::vector<std::string> args,
@@ -3260,7 +3264,7 @@ bool CompilerInvocation::parseArgs(
3260
3264
return true ;
3261
3265
}
3262
3266
3263
- updateRuntimeLibraryPaths (SearchPathOpts, LangOpts);
3267
+ updateRuntimeLibraryPaths (SearchPathOpts, FrontendOpts, LangOpts);
3264
3268
setDefaultPrebuiltCacheIfNecessary ();
3265
3269
setDefaultBlocklistsIfNecessary ();
3266
3270
0 commit comments