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::
559
559
return llvm::createStringError (" Type has no child named '%s'" ,
560
560
name.AsCString ());
561
561
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 ())
564
565
return llvm::createStringError (" Type has no child named '%s'" ,
565
566
name.AsCString ());
566
- return idx ;
567
+ return optional_idx. value () ;
567
568
}
568
569
569
570
SyntheticChildrenFrontEnd *
Original file line number Diff line number Diff line change @@ -747,9 +747,10 @@ HashedSyntheticChildrenFrontEnd::GetIndexOfChildWithName(ConstString name) {
747
747
return llvm::createStringError (" Type has no child named '%s'" ,
748
748
name.AsCString ());
749
749
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 ())
752
753
return llvm::createStringError (" Type has no child named '%s'" ,
753
754
name.AsCString ());
754
- return idx ;
755
+ return optional_idx. value () ;
755
756
}
You can’t perform that action at this time.
0 commit comments