Skip to content

ModuleLoader: minor clean-up to remove dead code. NFC #66719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions lib/Frontend/ModuleInterfaceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,15 +719,16 @@ class ModuleInterfaceLoaderImpl {
return pathStartsWith(hostPath, path);
}

bool isInSystemFrameworks(StringRef path) {
bool isInSystemFrameworks(StringRef path, bool publicFramework) {
StringRef sdkPath = ctx.SearchPathOpts.getSDKPath();
if (sdkPath.empty()) return false;

SmallString<128> publicFrameworksPath;
llvm::sys::path::append(publicFrameworksPath,
sdkPath, "System", "Library", "Frameworks");
SmallString<128> frameworksPath;
llvm::sys::path::append(frameworksPath,
sdkPath, "System", "Library",
publicFramework ? "Frameworks" : "PrivateFrameworks");

return pathStartsWith(publicFrameworksPath, path);
return pathStartsWith(frameworksPath, path);
}

std::pair<std::string, std::string> getCompiledModuleCandidates() {
Expand All @@ -738,11 +739,7 @@ class ModuleInterfaceLoaderImpl {

// Don't use the adjacent swiftmodule for frameworks from the public
// Frameworks folder of the SDK.
SmallString<128> publicFrameworksPath;
llvm::sys::path::append(publicFrameworksPath,
ctx.SearchPathOpts.getSDKPath(),
"System", "Library", "Frameworks");
if (isInSystemFrameworks(modulePath)) {
if (isInSystemFrameworks(modulePath, /*publicFramework*/true)) {
shouldLoadAdjacentModule = false;
rebuildInfo.addIgnoredModule(modulePath, ReasonIgnored::PublicFramework);
} else if (isInResourceHostDir(modulePath)) {
Expand Down