File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
lldb/source/Plugins/Language/Swift Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -559,11 +559,12 @@ llvm::Expected<size_t> lldb_private::formatters::swift::ArraySyntheticFrontEnd::
559559 return llvm::createStringError (" Type has no child named '%s'" ,
560560 name.AsCString ());
561561 const char *item_name = name.GetCString ();
562- uint32_t idx = ExtractIndexFromString (item_name);
563- if (idx == UINT32_MAX || idx >= CalculateNumChildrenIgnoringErrors ())
562+ auto optional_idx = ExtractIndexFromString (item_name);
563+ if (!optional_idx ||
564+ optional_idx.value () >= CalculateNumChildrenIgnoringErrors ())
564565 return llvm::createStringError (" Type has no child named '%s'" ,
565566 name.AsCString ());
566- return idx ;
567+ return optional_idx. value () ;
567568}
568569
569570SyntheticChildrenFrontEnd *
Original file line number Diff line number Diff line change @@ -747,9 +747,10 @@ HashedSyntheticChildrenFrontEnd::GetIndexOfChildWithName(ConstString name) {
747747 return llvm::createStringError (" Type has no child named '%s'" ,
748748 name.AsCString ());
749749 const char *item_name = name.GetCString ();
750- uint32_t idx = ExtractIndexFromString (item_name);
751- if (idx == UINT32_MAX || idx >= CalculateNumChildrenIgnoringErrors ())
750+ auto optional_idx = ExtractIndexFromString (item_name);
751+ if (!optional_idx ||
752+ optional_idx.value () >= CalculateNumChildrenIgnoringErrors ())
752753 return llvm::createStringError (" Type has no child named '%s'" ,
753754 name.AsCString ());
754- return idx ;
755+ return optional_idx. value () ;
755756}
You can’t perform that action at this time.
0 commit comments