diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2015-10-24 01:08:35 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2015-10-24 01:08:35 +0000 |
commit | edb35d95d1ffa14fca9dfdb97d30cc0f834155ba (patch) | |
tree | 87d69039114a4172df389d8ef385c1986c1e8567 /lldb/source/Plugins/ScriptInterpreter/Python | |
parent | 284350e5405ce0d164e9fe35c5b3a95316569763 (diff) | |
download | bcm5719-llvm-edb35d95d1ffa14fca9dfdb97d30cc0f834155ba.tar.gz bcm5719-llvm-edb35d95d1ffa14fca9dfdb97d30cc0f834155ba.zip |
Fix Clang-tidy modernize-use-override warnings in some files in source/Plugins; other minor fixes.
llvm-svn: 251167
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h | 22 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h | 114 |
2 files changed, 78 insertions, 58 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h index eff2efab1d7..477a427a611 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -1,4 +1,4 @@ -//===-- PythonDataObjects.h----------------------------------------*- C++ -*-===// +//===-- PythonDataObjects.h--------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,7 +12,6 @@ // C Includes // C++ Includes - // Other libraries and framework includes // Project includes #include "lldb/lldb-defines.h" @@ -23,6 +22,7 @@ #include "lldb/Interpreter/OptionValue.h" namespace lldb_private { + class PythonString; class PythonList; class PythonDictionary; @@ -30,7 +30,7 @@ class PythonInteger; class StructuredPythonObject : public StructuredData::Generic { - public: +public: StructuredPythonObject() : StructuredData::Generic() { @@ -42,7 +42,7 @@ class StructuredPythonObject : public StructuredData::Generic Py_XINCREF(GetValue()); } - virtual ~StructuredPythonObject() + ~StructuredPythonObject() override { if (Py_IsInitialized()) Py_XDECREF(GetValue()); @@ -57,7 +57,7 @@ class StructuredPythonObject : public StructuredData::Generic void Dump(Stream &s) const override; - private: +private: DISALLOW_COPY_AND_ASSIGN(StructuredPythonObject); }; @@ -106,7 +106,10 @@ public: Reset(rhs); } - virtual ~PythonObject() { Reset(); } + virtual ~PythonObject() + { + Reset(); + } void Reset() @@ -235,6 +238,7 @@ public: explicit PythonString(const char *string); PythonString(PyRefType type, PyObject *o); PythonString(const PythonString &object); + ~PythonString() override; static bool Check(PyObject *py_obj); @@ -262,6 +266,7 @@ public: explicit PythonInteger(int64_t value); PythonInteger(PyRefType type, PyObject *o); PythonInteger(const PythonInteger &object); + ~PythonInteger() override; static bool Check(PyObject *py_obj); @@ -286,6 +291,7 @@ public: explicit PythonList(int list_size); PythonList(PyRefType type, PyObject *o); PythonList(const PythonList &list); + ~PythonList() override; static bool Check(PyObject *py_obj); @@ -312,6 +318,7 @@ public: explicit PythonDictionary(PyInitialValue value); PythonDictionary(PyRefType type, PyObject *o); PythonDictionary(const PythonDictionary &dict); + ~PythonDictionary() override; static bool Check(PyObject *py_obj); @@ -338,6 +345,7 @@ class PythonFile : public PythonObject PythonFile(File &file, const char *mode); PythonFile(const char *path, const char *mode); PythonFile(PyRefType type, PyObject *o); + ~PythonFile() override; static bool Check(PyObject *py_obj); @@ -352,4 +360,4 @@ class PythonFile : public PythonObject } // namespace lldb_private -#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H +#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_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 <memory> +#include <string> +#include <vector> + +// 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 |