lawrence_danna created this revision. lawrence_danna added reviewers: labath, jasonmolenda, JDevlieghere. Herald added subscribers: lldb-commits, arphaman. Herald added a project: LLDB.
Remove LLDBSwigPython_GetIndexOfChildWithName and associated functions. They are not used. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D78603 Files: lldb/bindings/python/python-wrapper.swig lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp =================================================================== --- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp +++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp @@ -147,11 +147,6 @@ return nullptr; } -extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor, - const char *child_name) { - return 0; -} - extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data) { return nullptr; } Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h =================================================================== --- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h +++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h @@ -146,8 +146,6 @@ GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx) override; - int GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor, - const char *child_name) override; bool UpdateSynthProviderInstance( const StructuredData::ObjectSP &implementor) override; Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -139,9 +139,6 @@ extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor, uint32_t idx); -extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor, - const char *child_name); - extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data); extern lldb::ValueObjectSP @@ -2447,28 +2444,6 @@ return ret_val; } -int ScriptInterpreterPythonImpl::GetIndexOfChildWithName( - const StructuredData::ObjectSP &implementor_sp, const char *child_name) { - if (!implementor_sp) - return UINT32_MAX; - - StructuredData::Generic *generic = implementor_sp->GetAsGeneric(); - if (!generic) - return UINT32_MAX; - void *implementor = generic->GetValue(); - if (!implementor) - return UINT32_MAX; - - int ret_val = UINT32_MAX; - - { - Locker py_lock(this, - Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); - ret_val = LLDBSwigPython_GetIndexOfChildWithName(implementor, child_name); - } - - return ret_val; -} bool ScriptInterpreterPythonImpl::UpdateSynthProviderInstance( const StructuredData::ObjectSP &implementor_sp) { Index: lldb/bindings/python/python-wrapper.swig =================================================================== --- lldb/bindings/python/python-wrapper.swig +++ lldb/bindings/python/python-wrapper.swig @@ -567,35 +567,6 @@ return result.release(); } -SWIGEXPORT int -LLDBSwigPython_GetIndexOfChildWithName -( - PyObject *implementor, - const char* child_name -) -{ - PyErr_Cleaner py_err_cleaner(true); - - PythonObject self(PyRefType::Borrowed, implementor); - auto pfunc = self.ResolveName<PythonCallable>("get_child_index"); - - if (!pfunc.IsAllocated()) - return UINT32_MAX; - - llvm::Expected<PythonObject> result = pfunc.Call(PythonString(child_name)); - - long long retval = unwrapOrSetPythonException(As<long long>(std::move(result))); - - if (PyErr_Occurred()) { - PyErr_Clear(); // FIXME print this? do something else - return UINT32_MAX; - } - - if (retval >= 0) - return (uint32_t)retval; - - return UINT32_MAX; -} SWIGEXPORT bool LLDBSwigPython_UpdateSynthProviderInstance
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits