diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-02-10 15:43:15 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-08-02 07:56:15 +0000 |
commit | bf5cc934ea8fba4f3516b9f00f44db70becd5bbd (patch) | |
tree | e28c857459edec043ad6da158002b09804fc4a76 | |
parent | 973cabd5c5c6a18f0f9d396be6c13bb0170fb843 (diff) | |
download | qt-creator-bf5cc934ea8fba4f3516b9f00f44db70becd5bbd.tar.gz |
qmake: restore nothrow move special members
The user-defined copy assignment, copy constructor
and dtor inhibit the move special member functions.
Implement them manually.
Change-Id: I0d38d7cf6c9611e13b5b081d734d01d6fe4d5276
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
(cherry picked from qtbase/9c63ad562bf0a44807f41ce49e4fe1b5ff181a63)
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r-- | src/shared/proparser/proitems.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/shared/proparser/proitems.h b/src/shared/proparser/proitems.h index d6bc4fe1cb..e1f3608f8b 100644 --- a/src/shared/proparser/proitems.h +++ b/src/shared/proparser/proitems.h @@ -360,6 +360,8 @@ class ProFunctionDef { public: ProFunctionDef(ProFile *pro, int offset) : m_pro(pro), m_offset(offset) { m_pro->ref(); } ProFunctionDef(const ProFunctionDef &o) : m_pro(o.m_pro), m_offset(o.m_offset) { m_pro->ref(); } + ProFunctionDef(ProFunctionDef &&other) Q_DECL_NOTHROW + : m_pro(other.m_pro), m_offset(other.m_offset) { other.m_pro = nullptr; } ~ProFunctionDef() { m_pro->deref(); } ProFunctionDef &operator=(const ProFunctionDef &o) { @@ -371,6 +373,18 @@ public: } return *this; } + ProFunctionDef &operator=(ProFunctionDef &&other) Q_DECL_NOTHROW + { + ProFunctionDef moved(std::move(other)); + swap(moved); + return *this; + } + void swap(ProFunctionDef &other) Q_DECL_NOTHROW + { + qSwap(m_pro, other.m_pro); + qSwap(m_offset, other.m_offset); + } + ProFile *pro() const { return m_pro; } const ushort *tokPtr() const { return m_pro->tokPtr() + m_offset; } private: |