[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:29 PDT 2026


================
@@ -274,7 +320,10 @@ Expected<std::string> getCachedOrDownloadArtifact(
         parseCachePruningPolicy(std::getenv("DEBUGINFOD_CACHE_POLICY"));
     if (!PruningPolicyOrErr)
       return PruningPolicyOrErr.takeError();
-    pruneCache(CacheDirectoryPath, *PruningPolicyOrErr);
+
+    auto ErrOrPruned = pruneCache(CacheDirectoryPath, *PruningPolicyOrErr);
+    if (!ErrOrPruned)
+      return ErrOrPruned.takeError();
----------------
jmmartinez wrote:

Good point. Yes it is, but not in that way: Before it was crashing with a fatal error and now it's returning the `Error`.

I could keep the compatibility by aborting on the `Error` though by calling `report_fatal_error` as it was done.

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


More information about the lldb-commits mailing list