[llvm] [llvm] Errorize DebuginfodFetcher::fetch() for inspection at call-sites (NFC) (PR #191191)
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 02:05:29 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";
----------------
DavidSpickett wrote:
It seems odd that you make the effort to return a string error up to this point, then discard it and make a new error string. Though it does keep the existing behaviour intact, so not something to deal with in this PR.
Presumably you'll figure out how far to propagate the error as you develop on top of these changes.
https://github.com/llvm/llvm-project/pull/191191
More information about the llvm-commits
mailing list