From 1cd6c667ebfbf93161dd86df450ea0e210b3c018 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Sat, 14 Mar 2015 08:06:56 +0000 Subject: [PATCH] Strip trailing whitespace from python-wrapper.swig (To test the dependency added in r232256.) llvm-svn: 232257 --- lldb/scripts/Python/python-wrapper.swig | 316 ++++++++++++++++---------------- 1 file changed, 158 insertions(+), 158 deletions(-) diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index 57291bc..80343a6 100644 --- a/lldb/scripts/Python/python-wrapper.swig +++ b/lldb/scripts/Python/python-wrapper.swig @@ -11,7 +11,7 @@ public: m_print(print) { } - + ~PyErr_Cleaner() { if (PyErr_Occurred()) @@ -21,7 +21,7 @@ public: PyErr_Clear(); } } - + private: bool m_print; }; @@ -67,10 +67,10 @@ ResolvePythonName(const char* name, if (!dot_pos) { - dest_object = NULL; + dest_object = NULL; while (PyDict_Next (main_dict, &pos, &key, &value)) { - // We have stolen references to the key and value objects in the dictionary; we need to increment + // We have stolen references to the key and value objects in the dictionary; we need to increment // them now so that Python's garbage collector doesn't collect them out from under us. Py_INCREF (key); Py_INCREF (value); @@ -79,7 +79,7 @@ ResolvePythonName(const char* name, dest_object = value; break; } - } + } if (!dest_object || dest_object == Py_None) return NULL; return dest_object; @@ -135,14 +135,14 @@ public: { return m_callable != NULL; } - + template PyObject* operator () (Args... args) { return (*this)({SBTypeToSWIGWrapper(args)...}); } - + PyObject* operator () (std::initializer_list args) { @@ -167,13 +167,13 @@ public: Py_XDECREF (pargs); return retval; } - + static PyCallable FindWithPythonObject (PyObject* pfunc) { return PyCallable(pfunc); } - + static PyCallable FindWithFunctionName (const char *python_function_name, const char *session_dictionary_name) @@ -184,7 +184,7 @@ public: return PyCallable(); return FindWithFunctionName(python_function_name,FindSessionDictionary (session_dictionary_name)); } - + static PyCallable FindWithFunctionName (const char *python_function_name, PyObject *session_dict) @@ -195,7 +195,7 @@ public: return PyCallable(); return PyCallable(ResolvePythonName (python_function_name, session_dict)); } - + static PyCallable FindWithMemberFunction (PyObject *self, const char *python_function_name) @@ -206,10 +206,10 @@ public: return PyCallable(); return PyCallable(PyObject_GetAttrString(self, python_function_name)); } - + private: PyObject* m_callable; - + PyCallable (PyObject *callable = NULL) : m_callable(callable) { @@ -232,39 +232,39 @@ private: // and is used when a script command is attached to a breakpoint for execution. SWIGEXPORT bool -LLDBSwigPythonBreakpointCallbackFunction +LLDBSwigPythonBreakpointCallbackFunction ( const char *python_function_name, const char *session_dictionary_name, - const lldb::StackFrameSP& frame_sp, + const lldb::StackFrameSP& frame_sp, const lldb::BreakpointLocationSP& bp_loc_sp ) { lldb::SBFrame sb_frame (frame_sp); lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp); - + bool stop_at_breakpoint = true; - + { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); - + if (!pfunc) return stop_at_breakpoint; - + PyObject* session_dict = NULL; PyObject* pvalue = NULL; pvalue = pfunc(sb_frame, sb_bp_loc, session_dict = FindSessionDictionary(session_dictionary_name)); - + Py_XINCREF (session_dict); - + if (pvalue == Py_False) stop_at_breakpoint = false; - + Py_XDECREF (pvalue); } - + return stop_at_breakpoint; } @@ -272,11 +272,11 @@ LLDBSwigPythonBreakpointCallbackFunction // and is used when a script command is attached to a watchpoint for execution. SWIGEXPORT bool -LLDBSwigPythonWatchpointCallbackFunction +LLDBSwigPythonWatchpointCallbackFunction ( const char *python_function_name, const char *session_dictionary_name, - const lldb::StackFrameSP& frame_sp, + const lldb::StackFrameSP& frame_sp, const lldb::WatchpointSP& wp_sp ) { @@ -284,27 +284,27 @@ LLDBSwigPythonWatchpointCallbackFunction lldb::SBWatchpoint sb_wp(wp_sp); bool stop_at_watchpoint = true; - + { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); - + if (!pfunc) return stop_at_watchpoint; - + PyObject* session_dict = NULL; PyObject* pvalue = NULL; pvalue = pfunc(sb_frame, sb_wp, session_dict = FindSessionDictionary(session_dictionary_name)); - + Py_XINCREF (session_dict); - + if (pvalue == Py_False) stop_at_watchpoint = false; - + Py_XDECREF (pvalue); } - + return stop_at_watchpoint; } @@ -336,7 +336,7 @@ PyObjectToString (PyObject* object, } SWIGEXPORT bool -LLDBSwigPythonCallTypeScript +LLDBSwigPythonCallTypeScript ( const char *python_function_name, const void *session_dictionary, @@ -355,7 +355,7 @@ LLDBSwigPythonCallTypeScript return false; PyObject *session_dict = (PyObject*)session_dictionary, *pfunc_impl = NULL, *pvalue = NULL; - + if (pyfunct_wrapper && *pyfunct_wrapper && PyFunction_Check (*pyfunct_wrapper)) { pfunc_impl = (PyObject*)(*pyfunct_wrapper); @@ -369,7 +369,7 @@ LLDBSwigPythonCallTypeScript if (PyDict_Check(session_dict)) { PyErr_Cleaner pyerr_cleanup(true); // show Python errors - + if (!pfunc_impl) { pfunc_impl = ResolvePythonName (python_function_name, session_dict); @@ -383,7 +383,7 @@ LLDBSwigPythonCallTypeScript } PyCallable pfunc = PyCallable::FindWithPythonObject(pfunc_impl); - + if (!pfunc) return false; @@ -397,16 +397,16 @@ LLDBSwigPythonCallTypeScript pvalue = pfunc(sb_value,session_dict); Py_INCREF (session_dict); - + PyObjectToString(pvalue,retval); - + Py_XDECREF (pvalue); } return true; } SWIGEXPORT void* -LLDBSwigPythonCreateSyntheticProvider +LLDBSwigPythonCreateSyntheticProvider ( const char *python_class_name, const char *session_dictionary_name, @@ -426,26 +426,26 @@ LLDBSwigPythonCreateSyntheticProvider if (ValObj_PyObj == NULL) Py_RETURN_NONE; - + { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name); - + if (!pfunc) return retval; - + Py_INCREF(ValObj_PyObj); - + PyObject* session_dict = NULL; session_dict = FindSessionDictionary(session_dictionary_name); retval = pfunc(sb_value, session_dict); - + Py_XINCREF (session_dict); - + Py_XINCREF(retval); } - + if (retval) return retval; else @@ -469,21 +469,21 @@ LLDBSwigPythonCreateCommandObject { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name); - + if (!pfunc) return retval; - + PyObject* session_dict = NULL; session_dict = FindSessionDictionary(session_dictionary_name); retval = pfunc(debugger_sb, session_dict); - + Py_XINCREF (session_dict); - + Py_XINCREF(retval); } - + if (retval) return retval; else @@ -511,26 +511,26 @@ LLDBSwigPythonCreateScriptedThreadPlan if (ThreadPlan_PyObj == NULL) Py_RETURN_NONE; - + { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name, session_dictionary_name); - + if (!pfunc) return retval; - + Py_INCREF(ThreadPlan_PyObj); - + PyObject* session_dict = NULL; session_dict = FindSessionDictionary(session_dictionary_name); retval = pfunc(tp_value, session_dict); // FIXME: At this point we should check that the class we found supports all the methods // that we need. - + Py_XINCREF (session_dict); - + Py_XINCREF(retval); } @@ -554,9 +554,9 @@ LLDBSWIGPythonCallThreadPlan PyErr_Cleaner py_err_cleaner(false); - + PyCallable pfunc = PyCallable::FindWithMemberFunction((PyObject *) implementor, method_name); - + if (!pfunc) { return ret_val; @@ -596,7 +596,7 @@ LLDBSWIGPythonCallThreadPlan printf ("Wrong return value type for call to %s.\n", method_name); } } - + Py_XDECREF(py_return); return ret_val; @@ -613,9 +613,9 @@ LLDBSwigPython_CallOptionalMember ) { PyErr_Cleaner py_err_cleaner(false); - + PyCallable pfunc = PyCallable::FindWithMemberFunction(self,callee_name); - + if (!pfunc) { if (was_found) @@ -623,10 +623,10 @@ LLDBSwigPython_CallOptionalMember Py_XINCREF(ret_if_not_found); return ret_if_not_found; } - + if (was_found) *was_found = true; - + PyObject* py_return = pfunc(); return py_return; } @@ -650,13 +650,13 @@ LLDBSwigPython_CalculateNumChildren ret_val = PyInt_AsLong(py_return); Py_XDECREF(py_return); - + if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); } - + return ret_val; } @@ -668,33 +668,33 @@ LLDBSwigPython_GetChildAtIndex ) { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_at_index"); - + if (!pfunc) return NULL; - + PyObject *py_return = NULL; py_return = pfunc(idx); - + if (py_return == NULL || py_return == Py_None) { Py_XDECREF(py_return); return NULL; } - + lldb::SBValue* sbvalue_ptr = NULL; - + if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1) { Py_XDECREF(py_return); return NULL; } - + if (sbvalue_ptr == NULL) return NULL; - - return py_return; + + return py_return; } SWIGEXPORT int @@ -705,27 +705,27 @@ LLDBSwigPython_GetIndexOfChildWithName ) { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_index"); - + if (!pfunc) return UINT32_MAX; - + PyObject *py_return = NULL; py_return = pfunc(child_name); - + if (py_return == NULL || py_return == Py_None) { Py_XDECREF(py_return); return UINT32_MAX; } - + long retval = PyInt_AsLong(py_return); Py_XDECREF(py_return); if (retval >= 0) return (uint32_t)retval; - + return UINT32_MAX; } @@ -745,7 +745,7 @@ LLDBSwigPython_UpdateSynthProviderInstance ret_val = true; Py_XDECREF(py_return); - + return ret_val; } @@ -765,7 +765,7 @@ LLDBSwigPython_MightHaveChildrenSynthProviderInstance ret_val = true; Py_XDECREF(py_return); - + return ret_val; } @@ -785,7 +785,7 @@ LLDBSwigPython_GetValueSynthProviderInstance ret_val = nullptr; lldb::SBValue* sbvalue_ptr = NULL; - + if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1) ret_val = nullptr; else if (sbvalue_ptr == NULL) @@ -804,7 +804,7 @@ LLDBSWIGPython_CastPyObjectToSBValue ) { lldb::SBValue* sb_ptr = NULL; - + int valid_cast = SWIG_ConvertPtr(data, (void**)&sb_ptr, SWIGTYPE_p_lldb__SBValue, 0); if (valid_cast == -1) @@ -838,7 +838,7 @@ private: }; SWIGEXPORT bool -LLDBSwigPythonCallCommand +LLDBSwigPythonCallCommand ( const char *python_function_name, const char *session_dictionary_name, @@ -859,7 +859,7 @@ LLDBSwigPythonCallCommand { PyErr_Cleaner py_err_cleaner(true); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); - + if (!pfunc) return retval; @@ -873,13 +873,13 @@ LLDBSwigPythonCallCommand pvalue = pfunc(debugger_sb, args, exe_ctx_sb, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name)); else pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name)); - + Py_XINCREF (session_dict); Py_XDECREF (pvalue); - + retval = true; } - + return retval; } @@ -905,7 +905,7 @@ LLDBSwigPythonCallCommandObject PyErr_Cleaner py_err_cleaner(true); PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"__call__"); - + if (!pfunc) return NULL; @@ -916,10 +916,10 @@ LLDBSwigPythonCallCommandObject pvalue = pfunc(debugger_sb, args, exe_ctx_sb, &cmd_retobj_sb); Py_XDECREF (pvalue); - + retval = true; } - + return retval; } @@ -947,23 +947,23 @@ LLDBSWIGPythonCreateOSPlugin { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name); - + if (!pfunc) return retval; - + Py_INCREF(SBProc_PyObj); - + PyObject* session_dict = NULL; session_dict = session_dict = FindSessionDictionary(session_dictionary_name); retval = pfunc(SBProc_PyObj); - + Py_XINCREF (session_dict); - + Py_XINCREF(retval); } - + if (retval) return retval; else @@ -978,19 +978,19 @@ LLDBSWIGPython_GetDynamicSetting (void* module, const char* setting, const lldb: Py_RETURN_NONE; lldb::SBTarget target_sb(target_sp); - + PyObject *pvalue = NULL; { PyErr_Cleaner py_err_cleaner(true); PyCallable pfunc = PyCallable::FindWithFunctionName("get_dynamic_setting",(PyObject *)module); - + if (!pfunc) Py_RETURN_NONE; - + pvalue = pfunc(target_sb, setting); } - + return pvalue; } @@ -1011,24 +1011,24 @@ std::string& output) { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); - + if (!pfunc) return retval; - + PyObject* session_dict = NULL; PyObject* pvalue = NULL; pvalue = pfunc(process_sb, session_dict = FindSessionDictionary(session_dictionary_name)); - + Py_XINCREF (session_dict); - + if (PyObjectToString(pvalue,output)) retval = true; - + Py_XDECREF(pvalue); } - + return retval; } @@ -1046,27 +1046,27 @@ std::string& output) return retval; lldb::SBThread thread_sb(thread); - + { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); - + if (!pfunc) return retval; - + PyObject* session_dict = NULL; PyObject* pvalue = NULL; pvalue = pfunc(thread_sb, session_dict = FindSessionDictionary(session_dictionary_name)); - + Py_XINCREF (session_dict); - + if (PyObjectToString(pvalue,output)) retval = true; - + Py_XDECREF(pvalue); } - + return retval; } @@ -1084,27 +1084,27 @@ std::string& output) return retval; lldb::SBTarget target_sb(target); - + { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); - + if (!pfunc) return retval; - + PyObject* session_dict = NULL; PyObject* pvalue = NULL; pvalue = pfunc(target_sb, session_dict = FindSessionDictionary(session_dictionary_name)); - + Py_XINCREF (session_dict); - + if (PyObjectToString(pvalue,output)) retval = true; - + Py_XDECREF(pvalue); } - + return retval; } @@ -1122,27 +1122,27 @@ std::string& output) return retval; lldb::SBFrame frame_sb(frame); - + { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); - + if (!pfunc) return retval; - + PyObject* session_dict = NULL; PyObject* pvalue = NULL; pvalue = pfunc(frame_sb, session_dict = FindSessionDictionary(session_dictionary_name)); - + Py_XINCREF (session_dict); - + if (PyObjectToString(pvalue,output)) retval = true; - + Py_XDECREF(pvalue); } - + return retval; } @@ -1160,32 +1160,32 @@ std::string& output) return retval; lldb::SBValue value_sb(value); - + { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); - + if (!pfunc) return retval; - + PyObject* session_dict = NULL; PyObject* pvalue = NULL; pvalue = pfunc(value_sb, session_dict = FindSessionDictionary(session_dictionary_name)); - + Py_XINCREF (session_dict); - + if (PyObjectToString(pvalue,output)) retval = true; - + Py_XDECREF(pvalue); } - + return retval; } SWIGEXPORT bool -LLDBSwigPythonCallModuleInit +LLDBSwigPythonCallModuleInit ( const char *python_module_name, const char *session_dictionary_name, @@ -1199,26 +1199,26 @@ LLDBSwigPythonCallModuleInit std::string python_function_name_string = python_module_name; python_function_name_string += ".__lldb_init_module"; const char* python_function_name = python_function_name_string.c_str(); - + { PyErr_Cleaner py_err_cleaner(true); - + PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); - + if (!pfunc) return true; - + PyObject* session_dict = NULL; PyObject* pvalue = NULL; pvalue = pfunc(debugger_sb, session_dict = FindSessionDictionary(session_dictionary_name)); - + Py_XINCREF (session_dict); - + retval = true; - + Py_XDECREF(pvalue); } - + return retval; } %} @@ -1228,7 +1228,7 @@ LLDBSwigPythonCallModuleInit // Forward declaration to be inserted at the start of LLDBWrapPython.h #include "lldb/API/SBDebugger.h" #include "lldb/API/SBValue.h" - + SWIGEXPORT lldb::ValueObjectSP LLDBSWIGPython_GetValueObjectSPFromSBValue (void* data) { -- 2.7.4