@@ -186,8 +186,9 @@ void CompilerInvocation::setDefaultBlocklistsIfNecessary() {
186186}
187187
188188static 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 ;
191192 llvm::SmallString<128 > LibPath (SearchPathOpts.RuntimeResourcePath );
192193
193194 StringRef LibSubDir = getPlatformNameForTriple (Triple);
@@ -220,15 +221,18 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
220221 }
221222
222223 if (!SearchPathOpts.getSDKPath ().empty ()) {
224+ const char *swiftDir = FrontendOpts.UseSharedResourceFolder
225+ ? " swift" : " swift_static" ;
226+
223227 if (tripleIsMacCatalystEnvironment (Triple)) {
224228 LibPath = SearchPathOpts.getSDKPath ();
225229 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 );
227231 RuntimeLibraryImportPaths.push_back (std::string (LibPath.str ()));
228232 }
229233
230234 LibPath = SearchPathOpts.getSDKPath ();
231- llvm::sys::path::append (LibPath, " usr" , " lib" , " swift " );
235+ llvm::sys::path::append (LibPath, " usr" , " lib" , swiftDir );
232236 if (!Triple.isOSDarwin ()) {
233237 // Use the non-architecture suffixed form with directory-layout
234238 // swiftmodules.
@@ -298,7 +302,7 @@ setBridgingHeaderFromFrontendOptions(ClangImporterOptions &ImporterOpts,
298302
299303void CompilerInvocation::setRuntimeResourcePath (StringRef Path) {
300304 SearchPathOpts.RuntimeResourcePath = Path.str ();
301- updateRuntimeLibraryPaths (SearchPathOpts, LangOpts);
305+ updateRuntimeLibraryPaths (SearchPathOpts, FrontendOpts, LangOpts);
302306}
303307
304308void CompilerInvocation::setTargetTriple (StringRef Triple) {
@@ -307,12 +311,12 @@ void CompilerInvocation::setTargetTriple(StringRef Triple) {
307311
308312void CompilerInvocation::setTargetTriple (const llvm::Triple &Triple) {
309313 LangOpts.setTarget (Triple);
310- updateRuntimeLibraryPaths (SearchPathOpts, LangOpts);
314+ updateRuntimeLibraryPaths (SearchPathOpts, FrontendOpts, LangOpts);
311315}
312316
313317void CompilerInvocation::setSDKPath (const std::string &Path) {
314318 SearchPathOpts.setSDKPath (Path);
315- updateRuntimeLibraryPaths (SearchPathOpts, LangOpts);
319+ updateRuntimeLibraryPaths (SearchPathOpts, FrontendOpts, LangOpts);
316320}
317321
318322bool CompilerInvocation::setModuleAliasMap (std::vector<std::string> args,
@@ -3308,7 +3312,7 @@ bool CompilerInvocation::parseArgs(
33083312 return true ;
33093313 }
33103314
3311- updateRuntimeLibraryPaths (SearchPathOpts, LangOpts);
3315+ updateRuntimeLibraryPaths (SearchPathOpts, FrontendOpts, LangOpts);
33123316 setDefaultPrebuiltCacheIfNecessary ();
33133317 setDefaultBlocklistsIfNecessary ();
33143318
0 commit comments