@@ -1214,12 +1214,22 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
1214
1214
}
1215
1215
1216
1216
std::vector<std::string>
1217
- ModuleInterfaceCheckerImpl::getCompiledModuleCandidatesForInterface (
1218
- StringRef moduleName, StringRef interfacePath) {
1217
+ ModuleInterfaceCheckerImpl::getCompiledModuleCandidatesForInterface (StringRef moduleName, StringRef interfacePath) {
1219
1218
// Derive .swiftmodule path from the .swiftinterface path.
1219
+ auto interfaceExt = file_types::getExtension (file_types::TY_SwiftModuleInterfaceFile);
1220
1220
auto newExt = file_types::getExtension (file_types::TY_SwiftModuleFile);
1221
- llvm::SmallString<32 > modulePath = interfacePath;
1222
- llvm::sys::path::replace_extension (modulePath, newExt);
1221
+ llvm::SmallString<32 > modulePath;
1222
+
1223
+ // When looking up the module for a private interface, strip the '.private.' section of the base name
1224
+ if (interfacePath.endswith (" .private." + interfaceExt.str ())) {
1225
+ auto newBaseName = llvm::sys::path::stem (llvm::sys::path::stem (interfacePath));
1226
+ modulePath = llvm::sys::path::parent_path (interfacePath);
1227
+ llvm::sys::path::append (modulePath, newBaseName + " ." + newExt.str ());
1228
+ } else {
1229
+ modulePath = interfacePath;
1230
+ llvm::sys::path::replace_extension (modulePath, newExt);
1231
+ }
1232
+
1223
1233
ModuleInterfaceLoaderImpl Impl (Ctx, modulePath, interfacePath, moduleName,
1224
1234
CacheDir, PrebuiltCacheDir, BackupInterfaceDir,
1225
1235
SourceLoc (), Opts,
0 commit comments