[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 22 07:05:58 PDT 2025


================
@@ -172,8 +173,15 @@ bool lldb_private::formatters::BlockPointerSummaryProvider(
 
   static const ConstString s_FuncPtr_name("__FuncPtr");
 
-  lldb::ValueObjectSP child_sp = synthetic_children->GetChildAtIndex(
-      synthetic_children->GetIndexOfChildWithName(s_FuncPtr_name));
+  auto index_or_err =
+      synthetic_children->GetIndexOfChildWithName(s_FuncPtr_name);
+
+  if (!index_or_err) {
+    return false;
----------------
Michael137 wrote:

you will need to `llvm::consumeError` here (or even log the error...search for `LLDB_LOG_ERROR` for some examples). Otherwise we crash

If tests pass it probably means we don't have coverage for that case

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


More information about the lldb-commits mailing list