[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:
Harlan Haskins
2019-04-05 14:05:35 -07:00
parent be48d64697
commit 149367e5d5
3 changed files with 59 additions and 6 deletions

View File

@@ -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;
}
}