Merge remote-tracking branch 'origin/master' into master-next

This commit is contained in:
swift_jenkins
2020-05-19 07:58:16 -07:00
3 changed files with 12 additions and 6 deletions

View File

@@ -197,18 +197,20 @@ void SerializedModuleLoaderBase::collectVisibleTopLevelModuleNamesImpl(
bool requireTargetSpecificModule = Ctx.LangOpts.Target.isOSDarwin();
forEachDirectoryEntryPath(searchPath, [&](StringRef path) {
auto pathExt = llvm::sys::path::extension(path);
if (requireTargetSpecificModule) {
if (pathExt != moduleSuffix)
if (pathExt != moduleSuffix)
if (requireTargetSpecificModule || pathExt != suffix)
return;
if (!checkTargetFiles(path))
return;
} else {
if (suffix != pathExt)
if (!checkTargetFiles(path)) {
if (requireTargetSpecificModule)
return;
auto stat = fs.status(path);
if (!stat || stat->isDirectory())
return;
}
// Extract module name.
auto name = llvm::sys::path::filename(path).drop_back(pathExt.size());
names.push_back(Ctx.getIdentifier(name));