@@ -2579,40 +2579,45 @@ static bool addCachedModuleFileToInMemoryCache(
2579
2579
2580
2580
auto ID = CAS.parseID (CacheKey);
2581
2581
if (!ID) {
2582
- Diags.Report (diag::err_cas_cannot_get_module_cache_key )
2583
- << CacheKey << Provider << ID.takeError ();
2582
+ Diags.Report (diag::err_cas_unloadable_module )
2583
+ << Path << CacheKey << ID.takeError ();
2584
2584
return true ;
2585
2585
}
2586
2586
2587
2587
auto Value = Cache.get (*ID);
2588
- if (!Value || !*Value) {
2589
- auto Diag = Diags.Report (diag::err_cas_cannot_get_module_cache_key)
2590
- << CacheKey << Provider;
2591
- if (!Value) {
2592
- Diag << Value.takeError ();
2593
- } else {
2594
- std::string ErrStr (" no such entry in action cache; expected compile:\n " );
2595
- llvm::raw_string_ostream Err (ErrStr);
2596
- if (auto E = printCompileJobCacheKey (CAS, *ID, Err))
2597
- Diag << std::move (E);
2598
- else
2599
- Diag << Err.str ();
2600
- }
2588
+ if (!Value) {
2589
+ Diags.Report (diag::err_cas_unloadable_module)
2590
+ << Path << CacheKey << Value.takeError ();
2591
+ return true ;
2592
+ }
2593
+ if (!*Value) {
2594
+ auto Diag = Diags.Report (diag::err_cas_missing_module)
2595
+ << Path << CacheKey;
2596
+ std::string ErrStr (" expected to be produced by:\n " );
2597
+ llvm::raw_string_ostream Err (ErrStr);
2598
+ if (auto E = printCompileJobCacheKey (CAS, *ID, Err)) {
2599
+ // Ignore the error and skip printing the cache key. The cache key can
2600
+ // be setup by a different compiler that is using an unknown schema.
2601
+ llvm::consumeError (std::move (E));
2602
+ Diag << " module file is not available in the CAS" ;
2603
+ } else
2604
+ Diag << Err.str ();
2605
+
2601
2606
return true ;
2602
2607
}
2603
2608
auto ValueRef = CAS.getReference (**Value);
2604
2609
if (!ValueRef) {
2605
- Diags.Report (diag::err_cas_cannot_get_module_cache_key )
2606
- << CacheKey << Provider << " result module doesn't exist in CAS" ;
2610
+ Diags.Report (diag::err_cas_unloadable_module )
2611
+ << Path << CacheKey << " result module cannot be loaded from CAS" ;
2607
2612
2608
2613
return true ;
2609
2614
}
2610
2615
2611
2616
std::optional<cas::CompileJobCacheResult> Result;
2612
2617
cas::CompileJobResultSchema Schema (CAS);
2613
2618
if (llvm::Error E = Schema.load (*ValueRef).moveInto (Result)) {
2614
- Diags.Report (diag::err_cas_cannot_get_module_cache_key )
2615
- << CacheKey << Provider << std::move (E);
2619
+ Diags.Report (diag::err_cas_unloadable_module )
2620
+ << Path << CacheKey << std::move (E);
2616
2621
return true ;
2617
2622
}
2618
2623
auto Output =
@@ -2625,8 +2630,8 @@ static bool addCachedModuleFileToInMemoryCache(
2625
2630
// better network utilization.
2626
2631
auto OutputProxy = CAS.getProxy (Output->Object );
2627
2632
if (!OutputProxy) {
2628
- Diags.Report (diag::err_cas_cannot_get_module_cache_key )
2629
- << CacheKey << Provider << OutputProxy.takeError ();
2633
+ Diags.Report (diag::err_cas_unloadable_module )
2634
+ << Path << CacheKey << OutputProxy.takeError ();
2630
2635
return true ;
2631
2636
}
2632
2637
0 commit comments