@@ -1185,12 +1185,22 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
1185
1185
}
1186
1186
1187
1187
std::vector<std::string>
1188
- ModuleInterfaceCheckerImpl::getCompiledModuleCandidatesForInterface (
1189
- StringRef moduleName, StringRef interfacePath) {
1188
+ ModuleInterfaceCheckerImpl::getCompiledModuleCandidatesForInterface (StringRef moduleName, StringRef interfacePath) {
1190
1189
// Derive .swiftmodule path from the .swiftinterface path.
1190
+ auto interfaceExt = file_types::getExtension (file_types::TY_SwiftModuleInterfaceFile);
1191
1191
auto newExt = file_types::getExtension (file_types::TY_SwiftModuleFile);
1192
- llvm::SmallString<32 > modulePath = interfacePath;
1193
- llvm::sys::path::replace_extension (modulePath, newExt);
1192
+ llvm::SmallString<32 > modulePath;
1193
+
1194
+ // When looking up the module for a private interface, strip the '.private.' section of the base name
1195
+ if (interfacePath.endswith (" .private." + interfaceExt.str ())) {
1196
+ auto newBaseName = llvm::sys::path::stem (llvm::sys::path::stem (interfacePath));
1197
+ modulePath = llvm::sys::path::parent_path (interfacePath);
1198
+ llvm::sys::path::append (modulePath, newBaseName + " ." + newExt.str ());
1199
+ } else {
1200
+ modulePath = interfacePath;
1201
+ llvm::sys::path::replace_extension (modulePath, newExt);
1202
+ }
1203
+
1194
1204
ModuleInterfaceLoaderImpl Impl (Ctx, modulePath, interfacePath, moduleName,
1195
1205
CacheDir, PrebuiltCacheDir, BackupInterfaceDir,
1196
1206
SourceLoc (), Opts,
0 commit comments