Merge pull request #42486 from xymus/ignore-adjacent-public-swiftmodule

[ModuleInterface] Ignore adjacent swiftmodules under the Frameworks folder
This commit is contained in:
Alexis Laferrière
2022-04-25 09:17:42 -07:00
committed by GitHub
2 changed files with 49 additions and 2 deletions

View File

@@ -651,10 +651,20 @@ class ModuleInterfaceLoaderImpl {
std::pair<std::string, std::string> getCompiledModuleCandidates() {
std::pair<std::string, std::string> result;
// Keep track of whether we should attempt to load a .swiftmodule adjacent
// to the .swiftinterface.
// Should we attempt to load a swiftmodule adjacent to the swiftinterface?
bool shouldLoadAdjacentModule = true;
// 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 (!ctx.SearchPathOpts.getSDKPath().empty() &&
modulePath.startswith(publicFrameworksPath)) {
shouldLoadAdjacentModule = false;
}
switch (loadMode) {
case ModuleLoadingMode::OnlyInterface:
// Always skip both the caches and adjacent modules, and always build the