Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lib/Frontend/ModuleInterfaceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2512,6 +2512,12 @@ struct ExplicitCASModuleLoader::Implementation {
// Same as the regular explicit module map but must be loaded from
// CAS, instead of a file that is not tracked by the dependency.
void parseSwiftExplicitModuleMap(StringRef ID) {
// ModuleLoader can be setup with no explicit module map and explicitly
// setup each individual dependencies via `addExplicitModulePath` function.
// If the input CASID is empty, just return.
if (ID.empty())
return;

ExplicitModuleMapParser parser(Allocator);
llvm::StringMap<ExplicitClangModuleInputInfo> ExplicitClangModuleMap;
llvm::StringMap<std::string> ModuleAliases;
Expand Down Expand Up @@ -2697,9 +2703,12 @@ bool ExplicitCASModuleLoader::findModule(
Impl.CAS, Impl.Cache, Ctx.Diags, moduleCASID,
file_types::ID::TY_SwiftModuleFile, moduleInfo.modulePath);
if (!moduleBuf) {
// We cannot read the module content, diagnose.
Ctx.Diags.diagnose(SourceLoc(), diag::error_opening_explicit_module_file,
moduleInfo.modulePath);
// Cannot load the module. For any real issues like malformed CASID or
// module, the error has been diagnosed in
// `loadCachedCompileResultFromCacheKey`. The only way to reach here without
// error diagnostics is that the module is not found via loader, just return
// false in the case so the next loader can try findModule without hitting
// an error.
return false;
}

Expand Down