@@ -2496,6 +2496,12 @@ struct ExplicitCASModuleLoader::Implementation {
24962496 // Same as the regular explicit module map but must be loaded from
24972497 // CAS, instead of a file that is not tracked by the dependency.
24982498 void parseSwiftExplicitModuleMap (StringRef ID) {
2499+ // ModuleLoader can be setup with no explicit module map and explicitly
2500+ // setup each individual dependencies via `addExplicitModulePath` function.
2501+ // If the input CASID is empty, just return.
2502+ if (ID.empty ())
2503+ return ;
2504+
24992505 ExplicitModuleMapParser parser (Allocator);
25002506 llvm::StringMap<ExplicitClangModuleInputInfo> ExplicitClangModuleMap;
25012507 llvm::StringMap<std::string> ModuleAliases;
@@ -2681,9 +2687,12 @@ bool ExplicitCASModuleLoader::findModule(
26812687 Impl.CAS , Impl.Cache , Ctx.Diags , moduleCASID,
26822688 file_types::ID::TY_SwiftModuleFile, moduleInfo.modulePath );
26832689 if (!moduleBuf) {
2684- // We cannot read the module content, diagnose.
2685- Ctx.Diags .diagnose (SourceLoc (), diag::error_opening_explicit_module_file,
2686- moduleInfo.modulePath );
2690+ // Cannot load the module. For any real issues like malformed CASID or
2691+ // module, the error has been diagnosed in
2692+ // `loadCachedCompileResultFromCacheKey`. The only way to reach here without
2693+ // error diagnostics is that the module is not found via loader, just return
2694+ // false in the case so the next loader can try findModule without hitting
2695+ // an error.
26872696 return false ;
26882697 }
26892698
0 commit comments