[Lldb-commits] [lld] [lldb] [llvm] [Support][Cache] Make `pruneCache` return an `Expected` (PR #191367)

Juan Manuel Martinez CaamaƱo via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 16 02:12:30 PDT 2026


================
@@ -1212,7 +1210,12 @@ void ThinLTOCodeGenerator::run() {
     }
   }
 
-  pruneCache(CacheOptions.Path, CacheOptions.Policy, ProducedBinaries);
+  auto ErrOrPruned =
+      pruneCache(CacheOptions.Path, CacheOptions.Policy, ProducedBinaries);
+  if (!ErrOrPruned) {
+    errs() << "Error: " << toString(ErrOrPruned.takeError()) << "\n";
+    report_fatal_error("ThinLTO: failure to prune cache");
----------------
jmmartinez wrote:

I've used the `report_fatal_error` to keep the same pattern/behavior from above in this file when dealing with errors:

```cpp
auto DiagFileOrErr = lto::setupLLVMOptimizationRemarks(
            Context, RemarksFilename, RemarksPasses, RemarksFormat,
            RemarksWithHotness, RemarksHotnessThreshold, count);
        if (!DiagFileOrErr) {
          errs() << "Error: " << toString(DiagFileOrErr.takeError()) << "\n";
          report_fatal_error("ThinLTO: Can't get an output file for the "
                             "remarks");
        }
```

https://github.com/llvm/llvm-project/pull/191367


More information about the lldb-commits mailing list