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

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 24 04:44:54 PDT 2025


================
@@ -172,8 +175,16 @@ 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) {
+    LLDB_LOG_ERROR(GetLog(LLDBLog::Types), index_or_err.takeError(), "{0}");
----------------
Michael137 wrote:

```suggestion
    LLDB_LOG_ERROR(GetLog(LLDBLog::DataFormatters), index_or_err.takeError(), "{0}");
```

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


More information about the lldb-commits mailing list