diff options
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 553ee7e..16c3226 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -2037,19 +2037,19 @@ lldb::ValueObjectSP ScriptInterpreterPythonImpl::GetChildAtIndex( return ret_val; } -int ScriptInterpreterPythonImpl::GetIndexOfChildWithName( +llvm::Expected<int> ScriptInterpreterPythonImpl::GetIndexOfChildWithName( const StructuredData::ObjectSP &implementor_sp, const char *child_name) { if (!implementor_sp) - return UINT32_MAX; + return llvm::createStringError("Type has no child named '%s'", child_name); StructuredData::Generic *generic = implementor_sp->GetAsGeneric(); if (!generic) - return UINT32_MAX; + return llvm::createStringError("Type has no child named '%s'", child_name); auto *implementor = static_cast<PyObject *>(generic->GetValue()); if (!implementor) - return UINT32_MAX; + return llvm::createStringError("Type has no child named '%s'", child_name); - int ret_val = UINT32_MAX; + int ret_val = INT32_MAX; { Locker py_lock(this, @@ -2058,6 +2058,8 @@ int ScriptInterpreterPythonImpl::GetIndexOfChildWithName( child_name); } + if (ret_val == INT32_MAX) + return llvm::createStringError("Type has no child named '%s'", child_name); return ret_val; } |