- Do not load modules of the same package if built from interface.

- Show diagnostics with an interface path

Resolves rdar://104617990
This commit is contained in:
Ellie Shin
2023-03-20 14:50:54 -07:00
parent 25280cb4cd
commit fc2b61da71
3 changed files with 56 additions and 1 deletions

View File

@@ -798,8 +798,18 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
M.setABIName(Ctx.getIdentifier(loadedModuleFile->getModuleABIName()));
if (loadedModuleFile->isConcurrencyChecked())
M.setIsConcurrencyChecked();
if (!loadedModuleFile->getModulePackageName().empty())
if (!loadedModuleFile->getModulePackageName().empty()) {
if (loadedModuleFile->isBuiltFromInterface() &&
loadedModuleFile->getModulePackageName().str() == Ctx.LangOpts.PackageName) {
Ctx.Diags.diagnose(SourceLoc(),
diag::in_package_module_not_compiled_from_source,
M.getBaseIdentifier(),
Ctx.LangOpts.PackageName,
loadedModuleFile->getModuleSourceFilename()
);
}
M.setPackageName(Ctx.getIdentifier(loadedModuleFile->getModulePackageName()));
}
M.setUserModuleVersion(loadedModuleFile->getUserModuleVersion());
for (auto name: loadedModuleFile->getAllowableClientNames()) {
M.addAllowableClientName(Ctx.getIdentifier(name));