From 7e8196510df88bc956492593c27da1af7b31b8ef Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 25 Mar 2024 08:08:58 +0100 Subject: [PATCH] QDebug: fix copy-instead-of-move issues Coverity correctly complains that we're copying the QDebug object when calling print*Container() when we could have moved it into the helper. So do move it. Pick-to: 6.7 6.6 6.5 Coverity-Id: 406803 Coverity-Id: 407406 Coverity-Id: 408523 Coverity-Id: 408562 Coverity-Id: 418431 Coverity-Id: 424788 Coverity-Id: 425106 Coverity-Id: 426537 Coverity-Id: 427163 Coverity-Id: 428925 Coverity-Id: 444463 Change-Id: Ic80247f315a09fffe9363577dff1d1c781859304 Reviewed-by: Giuseppe D'Angelo --- src/corelib/io/qdebug.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 71fdaebe897..4797bcd169f 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -318,67 +318,67 @@ using QDebugIfHasDebugStreamContainer = template inline QDebugIfHasDebugStreamContainer, T> operator<<(QDebug debug, const QList &vec) { - return QtPrivate::printSequentialContainer(debug, "QList", vec); + return QtPrivate::printSequentialContainer(std::move(debug), "QList", vec); } template inline QDebugIfHasDebugStream operator<<(QDebug debug, const QVarLengthArray &vec) { - return QtPrivate::printSequentialContainer(debug, "QVarLengthArray", vec); + return QtPrivate::printSequentialContainer(std::move(debug), "QVarLengthArray", vec); } template inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::vector &vec) { - return QtPrivate::printSequentialContainer(debug, "std::vector", vec); + return QtPrivate::printSequentialContainer(std::move(debug), "std::vector", vec); } template inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::list &vec) { - return QtPrivate::printSequentialContainer(debug, "std::list", vec); + return QtPrivate::printSequentialContainer(std::move(debug), "std::list", vec); } template inline QDebugIfHasDebugStream operator<<(QDebug debug, std::initializer_list list) { - return QtPrivate::printSequentialContainer(debug, "std::initializer_list", list); + return QtPrivate::printSequentialContainer(std::move(debug), "std::initializer_list", list); } template inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::map &map) { - return QtPrivate::printSequentialContainer(debug, "std::map", map); // yes, sequential: *it is std::pair + return QtPrivate::printSequentialContainer(std::move(debug), "std::map", map); // yes, sequential: *it is std::pair } template inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::multimap &map) { - return QtPrivate::printSequentialContainer(debug, "std::multimap", map); // yes, sequential: *it is std::pair + return QtPrivate::printSequentialContainer(std::move(debug), "std::multimap", map); // yes, sequential: *it is std::pair } template inline QDebugIfHasDebugStreamContainer, Key, T> operator<<(QDebug debug, const QMap &map) { - return QtPrivate::printAssociativeContainer(debug, "QMap", map); + return QtPrivate::printAssociativeContainer(std::move(debug), "QMap", map); } template inline QDebugIfHasDebugStreamContainer, Key, T> operator<<(QDebug debug, const QMultiMap &map) { - return QtPrivate::printAssociativeContainer(debug, "QMultiMap", map); + return QtPrivate::printAssociativeContainer(std::move(debug), "QMultiMap", map); } template inline QDebugIfHasDebugStreamContainer, Key, T> operator<<(QDebug debug, const QHash &hash) { - return QtPrivate::printAssociativeContainer(debug, "QHash", hash); + return QtPrivate::printAssociativeContainer(std::move(debug), "QHash", hash); } template inline QDebugIfHasDebugStreamContainer, Key, T> operator<<(QDebug debug, const QMultiHash &hash) { - return QtPrivate::printAssociativeContainer(debug, "QMultiHash", hash); + return QtPrivate::printAssociativeContainer(std::move(debug), "QMultiHash", hash); } template @@ -403,7 +403,7 @@ inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::pair inline QDebugIfHasDebugStreamContainer, T> operator<<(QDebug debug, const QSet &set) { - return QtPrivate::printSequentialContainer(debug, "QSet", set); + return QtPrivate::printSequentialContainer(std::move(debug), "QSet", set); } template