@@ -2515,6 +2515,12 @@ struct ExplicitCASModuleLoader::Implementation {
25152515 // Same as the regular explicit module map but must be loaded from
25162516 // CAS, instead of a file that is not tracked by the dependency.
25172517 void parseSwiftExplicitModuleMap (StringRef ID) {
2518+ // ModuleLoader can be setup with no explicit module map and explicitly
2519+ // setup each individual dependencies via `addExplicitModulePath` function.
2520+ // If the input CASID is empty, just return.
2521+ if (ID.empty ())
2522+ return ;
2523+
25182524 ExplicitModuleMapParser parser (Allocator);
25192525 llvm::StringMap<ExplicitClangModuleInputInfo> ExplicitClangModuleMap;
25202526 llvm::StringMap<std::string> ModuleAliases;
@@ -2700,9 +2706,12 @@ bool ExplicitCASModuleLoader::findModule(
27002706 Impl.CAS , Impl.Cache , Ctx.Diags , moduleCASID,
27012707 file_types::ID::TY_SwiftModuleFile, moduleInfo.modulePath );
27022708 if (!moduleBuf) {
2703- // We cannot read the module content, diagnose.
2704- Ctx.Diags .diagnose (SourceLoc (), diag::error_opening_explicit_module_file,
2705- moduleInfo.modulePath );
2709+ // Cannot load the module. For any real issues like malformed CASID or
2710+ // module, the error has been diagnosed in
2711+ // `loadCachedCompileResultFromCacheKey`. The only way to reach here without
2712+ // error diagnostics is that the module is not found via loader, just return
2713+ // false in the case so the next loader can try findModule without hitting
2714+ // an error.
27062715 return false ;
27072716 }
27082717
0 commit comments