mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ParseableInterfaces] Short-circuit module loading
Previously, the ParseableInterfaceModuleLoader relied on the assumption that, if it returned `errc::not_supported`, it would fall through the search paths and then move on to the SerializedModuleLoader. This did not anticipate the possibility of a valid .swiftinterface coming later in the search paths, which can cause issues for the standard library which is in the resource-dir and should always be loaded from there. Instead, make the module loading explicitly short-circuit when seeing `errc::not_supported`, and document it. Also add some more logging throughout `discoverLoadableModule` so we can more easily catch issues like this in the future. Fixes rdar://49479386
This commit is contained in:
@@ -218,6 +218,8 @@ SerializedModuleLoaderBase::findModule(AccessPathElem moduleID,
|
||||
moduleBuffer, moduleDocBuffer);
|
||||
if (!result) {
|
||||
return true;
|
||||
} else if (result == std::errc::not_supported) {
|
||||
return false;
|
||||
} else if (result != std::errc::no_such_file_or_directory) {
|
||||
return None;
|
||||
}
|
||||
@@ -251,6 +253,8 @@ SerializedModuleLoaderBase::findModule(AccessPathElem moduleID,
|
||||
moduleBuffer, moduleDocBuffer);
|
||||
if (!result)
|
||||
return true;
|
||||
else if (result == std::errc::not_supported)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,6 +324,8 @@ SerializedModuleLoaderBase::findModule(AccessPathElem moduleID,
|
||||
moduleBuffer, moduleDocBuffer);
|
||||
if (!result)
|
||||
return true;
|
||||
else if (result == std::errc::not_supported)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user