[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


================
@@ -18,14 +18,12 @@
 
 using namespace llvm;
 
-std::optional<std::string>
+Expected<std::string>
 DebuginfodFetcher::fetch(ArrayRef<uint8_t> BuildID) const {
-  if (std::optional<std::string> Path = BuildIDFetcher::fetch(BuildID))
+  if (Expected<std::string> Path = BuildIDFetcher::fetch(BuildID))
     return std::move(*Path);
+  else
+    consumeError(Path.takeError());
----------------
DavidSpickett wrote:

I wonder what wins here when it comes to style:
* `if (auto whatever =.... ) {` which is nice to limit scope of the variable.
* Not using else after a return.

In a change above you went with the second style. For what is a small function anyway, I think that would be fine here too.

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


More information about the llvm-commits mailing list