================
@@ -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'",
----------------
charles-zablit wrote:

I ended up switching to `std::optional` following the different discussions. 
The error message are not very descriptive, and not finding an index did not 
mean there was an error, but rather that the name was not found in the string.

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