From edb35d95d1ffa14fca9dfdb97d30cc0f834155ba Mon Sep 17 00:00:00 2001 From: Eugene Zelenko Date: Sat, 24 Oct 2015 01:08:35 +0000 Subject: Fix Clang-tidy modernize-use-override warnings in some files in source/Plugins; other minor fixes. llvm-svn: 251167 --- .../Python/ScriptInterpreterPython.h | 114 ++++++++++++--------- 1 file changed, 63 insertions(+), 51 deletions(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h index cdba5829dc0..4c6eb394989 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// - #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H @@ -17,6 +16,14 @@ #else +// C Includes +// C++ Includes +#include +#include +#include + +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "PythonDataObjects.h" #include "lldb/Core/IOHandler.h" @@ -74,12 +81,19 @@ public: const lldb::ProcessSP& process_sp); typedef size_t (*SWIGPythonCalculateNumChildren) (void *implementor, uint32_t max); + typedef void* (*SWIGPythonGetChildAtIndex) (void *implementor, uint32_t idx); + typedef int (*SWIGPythonGetIndexOfChildWithName) (void *implementor, const char* child_name); + typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data); + typedef lldb::ValueObjectSP (*SWIGPythonGetValueObjectSPFromSBValue) (void* data); + typedef bool (*SWIGPythonUpdateSynthProviderInstance) (void* data); + typedef bool (*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data); + typedef void* (*SWIGPythonGetValueSynthProviderInstance) (void *implementor); typedef bool (*SWIGPythonCallCommand) (const char *python_function_name, @@ -95,7 +109,6 @@ public: lldb_private::CommandReturnObject& cmd_retobj, lldb::ExecutionContextRefSP exe_ctx_ref_sp); - typedef bool (*SWIGPythonCallModuleInit) (const char *python_module_name, const char *session_dictionary_name, lldb::DebuggerSP& debugger); @@ -104,6 +117,7 @@ public: const char* session_dictionary_name, lldb::ProcessSP& process, std::string& output); + typedef bool (*SWIGPythonScriptKeyword_Thread) (const char* python_function_name, const char* session_dictionary_name, lldb::ThreadSP& thread, @@ -159,17 +173,17 @@ public: ExportFunctionDefinitionToInterpreter (StringList &function_def) override; bool - GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) override; + GenerateTypeScriptFunction(StringList &input, std::string& output, const void* name_token = nullptr) override; bool - GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) override; + GenerateTypeSynthClass(StringList &input, std::string& output, const void* name_token = nullptr) override; bool - GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) override; + GenerateTypeSynthClass(const char* oneliner, std::string& output, const void* name_token = nullptr) override; // use this if the function code is just a one-liner script bool - GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) override; + GenerateTypeScriptFunction(const char* oneliner, std::string& output, const void* name_token = nullptr) override; bool GenerateScriptAliasFunction (StringList &input, std::string& output) override; @@ -181,7 +195,9 @@ public: StructuredData::ObjectSP CreateScriptedThreadPlan(const char *class_name, lldb::ThreadPlanSP thread_plan) override; bool ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override; + bool ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override; + lldb::StateType ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error) override; StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) override; @@ -392,7 +408,6 @@ public: return m_dictionary_name.c_str(); } - PyThreadState * GetThreadState() { @@ -415,7 +430,6 @@ public: void IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override; - //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -437,46 +451,15 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString + lldb_private::ConstString GetPluginName() override; - virtual uint32_t + uint32_t GetPluginVersion() override; -protected: - - bool - EnterSession (uint16_t on_entry_flags, - FILE *in, - FILE *out, - FILE *err); - - void - LeaveSession (); - - void - SaveTerminalState (int fd); - - void - RestoreTerminalState (); - - class SynchronicityHandler + class Locker : public ScriptInterpreterLocker { - private: - lldb::DebuggerSP m_debugger_sp; - ScriptedCommandSynchronicity m_synch_wanted; - bool m_old_asynch; public: - SynchronicityHandler(lldb::DebuggerSP, - ScriptedCommandSynchronicity); - ~SynchronicityHandler(); - }; - -public: - class Locker : public ScriptInterpreterLocker - { - public: - enum OnEntry { AcquireLock = 0x0001, @@ -492,17 +475,16 @@ public: TearDownSession = 0x0004 }; - Locker (ScriptInterpreterPython *py_interpreter = NULL, - uint16_t on_entry = AcquireLock | InitSession, - uint16_t on_leave = FreeLock | TearDownSession, - FILE *in = NULL, - FILE *out = NULL, - FILE *err = NULL); + Locker(ScriptInterpreterPython *py_interpreter = nullptr, + uint16_t on_entry = AcquireLock | InitSession, + uint16_t on_leave = FreeLock | TearDownSession, + FILE *in = nullptr, + FILE *out = nullptr, + FILE *err = nullptr); ~Locker () override; - private: - + private: bool DoAcquireLock (); @@ -522,9 +504,23 @@ public: ScriptInterpreterPython *m_python_interpreter; // FILE* m_tmp_fh; PyGILState_STATE m_GILState; - }; + }; + protected: + class SynchronicityHandler + { + private: + lldb::DebuggerSP m_debugger_sp; + ScriptedCommandSynchronicity m_synch_wanted; + bool m_old_asynch; + public: + SynchronicityHandler(lldb::DebuggerSP, + ScriptedCommandSynchronicity); + + ~SynchronicityHandler(); + }; + enum class AddLocation { Beginning, @@ -533,6 +529,21 @@ protected: static void AddToSysPath(AddLocation location, std::string path); + bool + EnterSession(uint16_t on_entry_flags, + FILE *in, + FILE *out, + FILE *err); + + void + LeaveSession(); + + void + SaveTerminalState(int fd); + + void + RestoreTerminalState(); + uint32_t IsExecutingPython () const { @@ -588,6 +599,7 @@ protected: uint32_t m_lock_count; PyThreadState *m_command_thread_state; }; + } // namespace lldb_private #endif // LLDB_DISABLE_PYTHON -- cgit v1.2.3