@@ -2543,40 +2543,45 @@ static bool addCachedModuleFileToInMemoryCache(
25432543
25442544 auto ID = CAS.parseID (CacheKey);
25452545 if (!ID) {
2546- Diags.Report (diag::err_cas_cannot_get_module_cache_key )
2547- << CacheKey << Provider << ID.takeError ();
2546+ Diags.Report (diag::err_cas_unloadable_module )
2547+ << Path << CacheKey << ID.takeError ();
25482548 return true ;
25492549 }
25502550
25512551 auto Value = Cache.get (*ID);
2552- if (!Value || !*Value) {
2553- auto Diag = Diags.Report (diag::err_cas_cannot_get_module_cache_key)
2554- << CacheKey << Provider;
2555- if (!Value) {
2556- Diag << Value.takeError ();
2557- } else {
2558- std::string ErrStr (" no such entry in action cache; expected compile:\n " );
2559- llvm::raw_string_ostream Err (ErrStr);
2560- if (auto E = printCompileJobCacheKey (CAS, *ID, Err))
2561- Diag << std::move (E);
2562- else
2563- Diag << Err.str ();
2564- }
2552+ if (!Value) {
2553+ Diags.Report (diag::err_cas_unloadable_module)
2554+ << Path << CacheKey << Value.takeError ();
2555+ return true ;
2556+ }
2557+ if (!*Value) {
2558+ auto Diag = Diags.Report (diag::err_cas_missing_module)
2559+ << Path << CacheKey;
2560+ std::string ErrStr (" expected to be produced by:\n " );
2561+ llvm::raw_string_ostream Err (ErrStr);
2562+ if (auto E = printCompileJobCacheKey (CAS, *ID, Err)) {
2563+ // Ignore the error and skip printing the cache key. The cache key can
2564+ // be setup by a different compiler that is using an unknown schema.
2565+ llvm::consumeError (std::move (E));
2566+ Diag << " module file is not available in the CAS" ;
2567+ } else
2568+ Diag << Err.str ();
2569+
25652570 return true ;
25662571 }
25672572 auto ValueRef = CAS.getReference (**Value);
25682573 if (!ValueRef) {
2569- Diags.Report (diag::err_cas_cannot_get_module_cache_key )
2570- << CacheKey << Provider << " result module doesn't exist in CAS" ;
2574+ Diags.Report (diag::err_cas_unloadable_module )
2575+ << Path << CacheKey << " result module cannot be loaded from CAS" ;
25712576
25722577 return true ;
25732578 }
25742579
25752580 std::optional<cas::CompileJobCacheResult> Result;
25762581 cas::CompileJobResultSchema Schema (CAS);
25772582 if (llvm::Error E = Schema.load (*ValueRef).moveInto (Result)) {
2578- Diags.Report (diag::err_cas_cannot_get_module_cache_key )
2579- << CacheKey << Provider << std::move (E);
2583+ Diags.Report (diag::err_cas_unloadable_module )
2584+ << Path << CacheKey << std::move (E);
25802585 return true ;
25812586 }
25822587 auto Output =
@@ -2589,8 +2594,8 @@ static bool addCachedModuleFileToInMemoryCache(
25892594 // better network utilization.
25902595 auto OutputProxy = CAS.getProxy (Output->Object );
25912596 if (!OutputProxy) {
2592- Diags.Report (diag::err_cas_cannot_get_module_cache_key )
2593- << CacheKey << Provider << OutputProxy.takeError ();
2597+ Diags.Report (diag::err_cas_unloadable_module )
2598+ << Path << CacheKey << OutputProxy.takeError ();
25942599 return true ;
25952600 }
25962601
0 commit comments