diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-31 10:09:39 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-31 10:06:13 +0000 |
commit | 4af51767cf8514b196ce9be76c6c31111ea5fe3f (patch) | |
tree | ff073094ee01e7f7972c30efd1a1fe32edfd2164 | |
parent | e95e2b74f109eaf167782cb916f76d72eaac9ed6 (diff) |
libshiboken: Fix clang-tidy warnings about class definitions
- Add override
- Use = default for trivial constructors/destructors
- Delete copy and move constructors/assignment and move assignment
operators where not needed
- Use member initialization and remove constructors from simple structs
- Use explicit where applicable
Change-Id: Id293dd0008b05243e665347f12fd1dee3b1b70f7
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | sources/shiboken2/libshiboken/autodecref.h | 7 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/bindingmanager.cpp | 4 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/bindingmanager.h | 8 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/gilstate.h | 5 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/helper.h | 7 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/sbkdbg.h | 5 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/sbkenum.cpp | 11 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/threadstatesaver.h | 8 |
8 files changed, 38 insertions, 17 deletions
diff --git a/sources/shiboken2/libshiboken/autodecref.h b/sources/shiboken2/libshiboken/autodecref.h index 7b6aa47da..0af66624e 100644 --- a/sources/shiboken2/libshiboken/autodecref.h +++ b/sources/shiboken2/libshiboken/autodecref.h @@ -58,6 +58,11 @@ namespace Shiboken struct LIBSHIBOKEN_API AutoDecRef { public: + AutoDecRef(const AutoDecRef&) = delete; + AutoDecRef(AutoDecRef&&) = delete; + AutoDecRef& operator=(const AutoDecRef&) = delete; + AutoDecRef& operator=(AutoDecRef&&) = delete; + /** * AutoDecRef constructor. * \param pyobj A borrowed reference to a Python object @@ -112,8 +117,6 @@ public: } private: PyObject* m_pyObj; - AutoDecRef(const AutoDecRef&); - AutoDecRef& operator=(const AutoDecRef&); }; } // namespace Shiboken diff --git a/sources/shiboken2/libshiboken/bindingmanager.cpp b/sources/shiboken2/libshiboken/bindingmanager.cpp index 83ea6244f..4053b87f9 100644 --- a/sources/shiboken2/libshiboken/bindingmanager.cpp +++ b/sources/shiboken2/libshiboken/bindingmanager.cpp @@ -62,9 +62,7 @@ public: Edges m_edges; - Graph() - { - } + Graph() = default; void addEdge(SbkObjectType* from, SbkObjectType* to) { diff --git a/sources/shiboken2/libshiboken/bindingmanager.h b/sources/shiboken2/libshiboken/bindingmanager.h index 13a4d3a2e..c09b985dc 100644 --- a/sources/shiboken2/libshiboken/bindingmanager.h +++ b/sources/shiboken2/libshiboken/bindingmanager.h @@ -55,6 +55,11 @@ typedef void (*ObjectVisitor)(SbkObject*, void*); class LIBSHIBOKEN_API BindingManager { public: + BindingManager(const BindingManager&) = delete; + BindingManager(BindingManager&&) = delete; + BindingManager& operator=(const BindingManager&) = delete; + BindingManager& operator=(BindingManager&&) = delete; + static BindingManager& instance(); bool hasWrapper(const void *cptr); @@ -94,10 +99,7 @@ public: private: ~BindingManager(); - // disable copy BindingManager(); - BindingManager(const BindingManager&); - BindingManager& operator=(const BindingManager&); struct BindingManagerPrivate; BindingManagerPrivate* m_d; diff --git a/sources/shiboken2/libshiboken/gilstate.h b/sources/shiboken2/libshiboken/gilstate.h index 00b049802..9da4871d1 100644 --- a/sources/shiboken2/libshiboken/gilstate.h +++ b/sources/shiboken2/libshiboken/gilstate.h @@ -49,6 +49,11 @@ namespace Shiboken class LIBSHIBOKEN_API GilState { public: + GilState(const GilState&) = delete; + GilState(GilState&&) = delete; + GilState& operator=(const GilState&) = delete; + GilState& operator=(GilState&&) = delete; + GilState(); ~GilState(); void release(); diff --git a/sources/shiboken2/libshiboken/helper.h b/sources/shiboken2/libshiboken/helper.h index b215142c7..79a30871a 100644 --- a/sources/shiboken2/libshiboken/helper.h +++ b/sources/shiboken2/libshiboken/helper.h @@ -77,7 +77,12 @@ template<class T> class AutoArrayPointer { public: - AutoArrayPointer(int size) { data = new T[size]; } + AutoArrayPointer(const AutoArrayPointer&) = delete; + AutoArrayPointer(AutoArrayPointer&&) = delete; + AutoArrayPointer& operator=(const AutoArrayPointer&) = delete; + AutoArrayPointer& operator=(AutoArrayPointer&&) = delete; + + explicit AutoArrayPointer(int size) { data = new T[size]; } T& operator[](int pos) { return data[pos]; } operator T*() const { return data; } ~AutoArrayPointer() { delete[] data; } diff --git a/sources/shiboken2/libshiboken/sbkdbg.h b/sources/shiboken2/libshiboken/sbkdbg.h index c26816bbd..fdaf2a27a 100644 --- a/sources/shiboken2/libshiboken/sbkdbg.h +++ b/sources/shiboken2/libshiboken/sbkdbg.h @@ -63,6 +63,11 @@ class BaseLogger { public: + BaseLogger(const BaseLogger&) = delete; + BaseLogger(BaseLogger&&) = delete; + BaseLogger& operator=(const BaseLogger&) = delete; + BaseLogger& operator=(BaseLogger&&) = delete; + BaseLogger(std::ostream& output, const char* function, const char* context) : m_stream(output), m_function(function), m_context(context) {} ~BaseLogger() diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp index d563c765d..4d516f1e8 100644 --- a/sources/shiboken2/libshiboken/sbkenum.cpp +++ b/sources/shiboken2/libshiboken/sbkenum.cpp @@ -339,14 +339,17 @@ namespace Shiboken { class DeclaredEnumTypes { public: + DeclaredEnumTypes(const DeclaredEnumTypes&) = delete; + DeclaredEnumTypes(DeclaredEnumTypes&&) = delete; + DeclaredEnumTypes& operator=(const DeclaredEnumTypes&) = delete; + DeclaredEnumTypes& operator=(DeclaredEnumTypes&&) = delete; + DeclaredEnumTypes(); ~DeclaredEnumTypes(); static DeclaredEnumTypes& instance(); void addEnumType(PyTypeObject* type); private: - DeclaredEnumTypes(const DeclaredEnumTypes&); - DeclaredEnumTypes& operator=(const DeclaredEnumTypes&); std::vector<PyTypeObject *> m_enumTypes; }; @@ -641,9 +644,7 @@ DeclaredEnumTypes& DeclaredEnumTypes::instance() return me; } -DeclaredEnumTypes::DeclaredEnumTypes() -{ -} +DeclaredEnumTypes::DeclaredEnumTypes() = default; DeclaredEnumTypes::~DeclaredEnumTypes() { diff --git a/sources/shiboken2/libshiboken/threadstatesaver.h b/sources/shiboken2/libshiboken/threadstatesaver.h index e9f97f300..ddad9b67f 100644 --- a/sources/shiboken2/libshiboken/threadstatesaver.h +++ b/sources/shiboken2/libshiboken/threadstatesaver.h @@ -49,15 +49,17 @@ namespace Shiboken class LIBSHIBOKEN_API ThreadStateSaver { public: + ThreadStateSaver(const ThreadStateSaver&) = delete; + ThreadStateSaver(ThreadStateSaver&&) = delete; + ThreadStateSaver &operator=(const ThreadStateSaver&) = delete; + ThreadStateSaver &operator=(ThreadStateSaver&&) = delete; + ThreadStateSaver(); ~ThreadStateSaver(); void save(); void restore(); private: PyThreadState* m_threadState; - - ThreadStateSaver(const ThreadStateSaver&); - ThreadStateSaver& operator=(const ThreadStateSaver&); }; } // namespace Shiboken |