mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #71845 from al45tair/eng/PR-123506588
[Frontend] Use the `swift_static` directory when appropriate.
This commit is contained in:
@@ -186,8 +186,9 @@ void CompilerInvocation::setDefaultBlocklistsIfNecessary() {
|
||||
}
|
||||
|
||||
static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
|
||||
LangOptions &LangOpts) {
|
||||
llvm::Triple &Triple = LangOpts.Target;
|
||||
const FrontendOptions &FrontendOpts,
|
||||
const LangOptions &LangOpts) {
|
||||
const llvm::Triple &Triple = LangOpts.Target;
|
||||
llvm::SmallString<128> LibPath(SearchPathOpts.RuntimeResourcePath);
|
||||
|
||||
StringRef LibSubDir = getPlatformNameForTriple(Triple);
|
||||
@@ -220,15 +221,18 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
|
||||
}
|
||||
|
||||
if (!SearchPathOpts.getSDKPath().empty()) {
|
||||
const char *swiftDir = FrontendOpts.UseSharedResourceFolder
|
||||
? "swift" : "swift_static";
|
||||
|
||||
if (tripleIsMacCatalystEnvironment(Triple)) {
|
||||
LibPath = SearchPathOpts.getSDKPath();
|
||||
llvm::sys::path::append(LibPath, "System", "iOSSupport");
|
||||
llvm::sys::path::append(LibPath, "usr", "lib", "swift");
|
||||
llvm::sys::path::append(LibPath, "usr", "lib", swiftDir);
|
||||
RuntimeLibraryImportPaths.push_back(std::string(LibPath.str()));
|
||||
}
|
||||
|
||||
LibPath = SearchPathOpts.getSDKPath();
|
||||
llvm::sys::path::append(LibPath, "usr", "lib", "swift");
|
||||
llvm::sys::path::append(LibPath, "usr", "lib", swiftDir);
|
||||
if (!Triple.isOSDarwin()) {
|
||||
// Use the non-architecture suffixed form with directory-layout
|
||||
// swiftmodules.
|
||||
@@ -298,7 +302,7 @@ setBridgingHeaderFromFrontendOptions(ClangImporterOptions &ImporterOpts,
|
||||
|
||||
void CompilerInvocation::setRuntimeResourcePath(StringRef Path) {
|
||||
SearchPathOpts.RuntimeResourcePath = Path.str();
|
||||
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts);
|
||||
updateRuntimeLibraryPaths(SearchPathOpts, FrontendOpts, LangOpts);
|
||||
}
|
||||
|
||||
void CompilerInvocation::setTargetTriple(StringRef Triple) {
|
||||
@@ -307,12 +311,12 @@ void CompilerInvocation::setTargetTriple(StringRef Triple) {
|
||||
|
||||
void CompilerInvocation::setTargetTriple(const llvm::Triple &Triple) {
|
||||
LangOpts.setTarget(Triple);
|
||||
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts);
|
||||
updateRuntimeLibraryPaths(SearchPathOpts, FrontendOpts, LangOpts);
|
||||
}
|
||||
|
||||
void CompilerInvocation::setSDKPath(const std::string &Path) {
|
||||
SearchPathOpts.setSDKPath(Path);
|
||||
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts);
|
||||
updateRuntimeLibraryPaths(SearchPathOpts, FrontendOpts, LangOpts);
|
||||
}
|
||||
|
||||
bool CompilerInvocation::setModuleAliasMap(std::vector<std::string> args,
|
||||
@@ -3308,7 +3312,7 @@ bool CompilerInvocation::parseArgs(
|
||||
return true;
|
||||
}
|
||||
|
||||
updateRuntimeLibraryPaths(SearchPathOpts, LangOpts);
|
||||
updateRuntimeLibraryPaths(SearchPathOpts, FrontendOpts, LangOpts);
|
||||
setDefaultPrebuiltCacheIfNecessary();
|
||||
setDefaultBlocklistsIfNecessary();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user