diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-03-15 21:20:46 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-03-17 22:01:21 +0000 |
commit | 03ad0c2968f811da7fea4e947b09bdf17de51d14 (patch) | |
tree | 19c10a7171df8b2d92f7f056c8fa6cb8051065a9 | |
parent | 79b9f32f088b907e0d895867b4360c14d2802359 (diff) |
Rest of QtBase: compile-optimize inline swap functions
Instead of using the overly-generic qSwap() monster, use
- qt_ptr_swap() for swapping raw pointers
- member-swap for swapping smart pointers and owning containers
In QtCore, this has proven to give a nice reduction in compile time
for Qt users, cf. b1b0c2970e480ef460a61f37fa430dc443390358.
Task-number: QTBUG-97601
Change-Id: I53e031a021031d53a74a712cd0f5e6bb8bf800bd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 60592f72d61366922771b90bed95b596e05a1545)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/opengl/qopengldebug.h | 2 | ||||
-rw-r--r-- | src/sql/kernel/qsqlerror.h | 2 | ||||
-rw-r--r-- | src/sql/kernel/qsqlquery.h | 4 | ||||
-rw-r--r-- | src/sql/models/qsqlrelationaltablemodel.h | 6 |
4 files changed, 6 insertions, 8 deletions
diff --git a/src/opengl/qopengldebug.h b/src/opengl/qopengldebug.h index f61808e4c7..34706a09dc 100644 --- a/src/opengl/qopengldebug.h +++ b/src/opengl/qopengldebug.h @@ -112,7 +112,7 @@ public: QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpenGLDebugMessage) ~QOpenGLDebugMessage(); - void swap(QOpenGLDebugMessage &other) noexcept { qSwap(d, other.d); } + void swap(QOpenGLDebugMessage &other) noexcept { d.swap(other.d); } Source source() const; Type type() const; diff --git a/src/sql/kernel/qsqlerror.h b/src/sql/kernel/qsqlerror.h index a956a54f7b..8c1be600aa 100644 --- a/src/sql/kernel/qsqlerror.h +++ b/src/sql/kernel/qsqlerror.h @@ -70,7 +70,7 @@ public: bool operator!=(const QSqlError& other) const; ~QSqlError(); - void swap(QSqlError &other) noexcept { qSwap(d, other.d); } + void swap(QSqlError &other) noexcept { qt_ptr_swap(d, other.d); } QString driverText() const; QString databaseText() const; diff --git a/src/sql/kernel/qsqlquery.h b/src/sql/kernel/qsqlquery.h index b34452c302..132bc41396 100644 --- a/src/sql/kernel/qsqlquery.h +++ b/src/sql/kernel/qsqlquery.h @@ -80,9 +80,7 @@ public: ~QSqlQuery(); void swap(QSqlQuery &other) noexcept - { - qSwap(d, other.d); - } + { qt_ptr_swap(d, other.d); } bool isValid() const; bool isActive() const; diff --git a/src/sql/models/qsqlrelationaltablemodel.h b/src/sql/models/qsqlrelationaltablemodel.h index f9e3620eb6..8a37e8439a 100644 --- a/src/sql/models/qsqlrelationaltablemodel.h +++ b/src/sql/models/qsqlrelationaltablemodel.h @@ -60,9 +60,9 @@ public: void swap(QSqlRelation &other) noexcept { - qSwap(tName, other.tName); - qSwap(iColumn, other.iColumn); - qSwap(dColumn, other.dColumn); + tName.swap(other.tName); + iColumn.swap(other.iColumn); + dColumn.swap(other.dColumn); } inline QString tableName() const |