Skip to content

Commit 4eb81e7

Browse files
authored
Merge pull request #66733 from nkcsgexi/5.9-module-load-cleanup
[5.9] ModuleLoader: minor clean-up to remove dead code. NFC
2 parents 4152088 + 3798fa9 commit 4eb81e7

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -713,15 +713,16 @@ class ModuleInterfaceLoaderImpl {
713713
return pathStartsWith(hostPath, path);
714714
}
715715

716-
bool isInSystemFrameworks(StringRef path) {
716+
bool isInSystemFrameworks(StringRef path, bool publicFramework) {
717717
StringRef sdkPath = ctx.SearchPathOpts.getSDKPath();
718718
if (sdkPath.empty()) return false;
719719

720-
SmallString<128> publicFrameworksPath;
721-
llvm::sys::path::append(publicFrameworksPath,
722-
sdkPath, "System", "Library", "Frameworks");
720+
SmallString<128> frameworksPath;
721+
llvm::sys::path::append(frameworksPath,
722+
sdkPath, "System", "Library",
723+
publicFramework ? "Frameworks" : "PrivateFrameworks");
723724

724-
return pathStartsWith(publicFrameworksPath, path);
725+
return pathStartsWith(frameworksPath, path);
725726
}
726727

727728
std::pair<std::string, std::string> getCompiledModuleCandidates() {
@@ -732,11 +733,7 @@ class ModuleInterfaceLoaderImpl {
732733

733734
// Don't use the adjacent swiftmodule for frameworks from the public
734735
// Frameworks folder of the SDK.
735-
SmallString<128> publicFrameworksPath;
736-
llvm::sys::path::append(publicFrameworksPath,
737-
ctx.SearchPathOpts.getSDKPath(),
738-
"System", "Library", "Frameworks");
739-
if (isInSystemFrameworks(modulePath)) {
736+
if (isInSystemFrameworks(modulePath, /*publicFramework*/true)) {
740737
shouldLoadAdjacentModule = false;
741738
rebuildInfo.addIgnoredModule(modulePath, ReasonIgnored::PublicFramework);
742739
} else if (isInResourceHostDir(modulePath)) {

0 commit comments

Comments
 (0)