[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:43:31 PDT 2025
================
@@ -1202,13 +1225,16 @@ lldb_private::formatters::Foundation1100::
m_data_64 = nullptr;
}
-size_t
-lldb_private::formatters::Foundation1100::
- NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
+llvm::Expected<size_t> lldb_private::formatters::Foundation1100::
+ NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
- return UINT32_MAX;
+ if (idx == UINT32_MAX ||
+ (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors()))
+ return llvm::createStringError(
+ "'SyntheticChildrenFrontEnd::NSDictionaryMSyntheticFrontEnd' cannot "
+ "find index of child '%s'. (idx='%d')",
----------------
Michael137 wrote:
Lets change all the index logging to:
```suggestion
"find index of child '%s'. (idx='%" PRIu32 "')",
```
https://github.com/llvm/llvm-project/pull/136693
More information about the lldb-commits
mailing list