[Frontend] Use the private module interface when available

This commit is contained in:
Alexis Laferrière
2020-02-06 12:28:27 -08:00
parent 901392896d
commit ffa0bda67e

View File

@@ -1000,7 +1000,8 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
llvm::SmallString<256>
ModPath{ BaseName.getName(file_types::TY_SwiftModuleFile) },
InPath{ BaseName.getName(file_types::TY_SwiftModuleInterfaceFile) };
InPath{ BaseName.getName(file_types::TY_SwiftModuleInterfaceFile) },
PrivateInPath{BaseName.getName(file_types::TY_PrivateSwiftModuleInterfaceFile)};
// First check to see if the .swiftinterface exists at all. Bail if not.
auto &fs = *Ctx.SourceMgr.getFileSystem();
@@ -1014,6 +1015,11 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
return std::make_error_code(std::errc::no_such_file_or_directory);
}
// If present, use the private interface instead of the public one.
if (fs.exists(PrivateInPath)) {
InPath = PrivateInPath;
}
// Create an instance of the Impl to do the heavy lifting.
auto ModuleName = ModuleID.Item.str();
ModuleInterfaceLoaderImpl Impl(