================
@@ -270,10 +270,14 @@ class VectorTypeSyntheticFrontEnd : public 
SyntheticChildrenFrontEnd {
   }
 
   llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override {
-    const char *item_name = name.GetCString();
-    uint32_t idx = ExtractIndexFromString(item_name);
-    if (idx == UINT32_MAX ||
-        (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors()))
+    auto idx_or_err = ExtractIndexFromString(name.AsCString());
+    if (!idx_or_err) {
+      llvm::consumeError(idx_or_err.takeError());
+      return llvm::createStringError("Type has no child named '%s'",
----------------
adrian-prantl wrote:

See my comment above. I would probably just return optional from 
ExtractIndexFromString, since the error message isn't that useful. But if it 
were useful, I wanted to point out that we also have llvm::joinErrors()

https://github.com/llvm/llvm-project/pull/138297
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to