[llvm] [llvm] Errorize DebuginfodFetcher::fetch() for inspection at call-sites (NFC) (PR #191191)

Stefan Gränitz via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 04:00:13 PDT 2026


================
@@ -152,10 +152,12 @@ int llvm_debuginfod_find_main(int argc, char **argv,
 
 // Find a debug file in local build ID directories and via debuginfod.
 std::string fetchDebugInfo(object::BuildIDRef BuildID) {
-  if (std::optional<std::string> Path =
-          DebuginfodFetcher(DebugFileDirectory).fetch(BuildID))
-    return *Path;
-  errs() << "Build ID " << llvm::toHex(BuildID, /*Lowercase=*/true)
+  Expected<std::string> PathOrErr =
+      DebuginfodFetcher(DebugFileDirectory).fetch(BuildID);
+  if (PathOrErr)
+    return *PathOrErr;
+  errs() << "Build ID " << llvm::toHex(BuildID, /*Lowercase=*/true) << ": "
          << " could not be found.\n";
----------------
weliveindetail wrote:

Yes, that's the whole point, but I'd like tho keep this patch NFC and adapt the logic in the PR I linked above.

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


More information about the llvm-commits mailing list