From d87c80bd46d9dc761b048cad48838a039cff214a Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Wed, 29 Oct 2025 18:22:54 +0000 Subject: [lldb] Do not narrow `GetIndexOfChildWithName` return type to int (#165453) Modify the python wrapper to return uint32_t, which prevents incorrect child name-to-index mapping and avoids performing redundant operations on non-existent SBValues. --- .../Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 73c5c72..d257a08 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -1939,7 +1939,7 @@ lldb::ValueObjectSP ScriptInterpreterPythonImpl::GetChildAtIndex( return ret_val; } -llvm::Expected ScriptInterpreterPythonImpl::GetIndexOfChildWithName( +llvm::Expected ScriptInterpreterPythonImpl::GetIndexOfChildWithName( const StructuredData::ObjectSP &implementor_sp, const char *child_name) { if (!implementor_sp) return llvm::createStringError("Type has no child named '%s'", child_name); @@ -1951,7 +1951,7 @@ llvm::Expected ScriptInterpreterPythonImpl::GetIndexOfChildWithName( if (!implementor) return llvm::createStringError("Type has no child named '%s'", child_name); - int ret_val = INT32_MAX; + uint32_t ret_val = UINT32_MAX; { Locker py_lock(this, @@ -1960,7 +1960,7 @@ llvm::Expected ScriptInterpreterPythonImpl::GetIndexOfChildWithName( child_name); } - if (ret_val == INT32_MAX) + if (ret_val == UINT32_MAX) return llvm::createStringError("Type has no child named '%s'", child_name); return ret_val; } -- cgit v1.1