From b678cc29899b387b632596b7c0f85abf2fc8ea81 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 24 Aug 2014 20:57:40 +0200 Subject: QRegion: remove some toplevel const from return types It has no effect and inhibits move semantics. After this change, two and five more copies are moves in QtGui and QtWidgets, resp. Keep the old form for compilers that mangle the return type. Change-Id: I6257683144110230079fe9095303907ecc858c94 Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/gui/painting/qregion.cpp | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'src/gui/painting/qregion.cpp') diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 549dce2923..e4e4893071 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -450,7 +450,10 @@ QDebug operator<<(QDebug s, const QRegion &r) \sa united(), operator+() */ -const QRegion QRegion::operator|(const QRegion &r) const +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE +const +#endif +QRegion QRegion::operator|(const QRegion &r) const { return united(r); } /*! @@ -459,14 +462,20 @@ const QRegion QRegion::operator|(const QRegion &r) const \sa united(), operator|() */ -const QRegion QRegion::operator+(const QRegion &r) const +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE +const +#endif +QRegion QRegion::operator+(const QRegion &r) const { return united(r); } /*! \overload \since 4.4 */ -const QRegion QRegion::operator+(const QRect &r) const +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE +const +#endif +QRegion QRegion::operator+(const QRect &r) const { return united(r); } /*! @@ -475,14 +484,20 @@ const QRegion QRegion::operator+(const QRect &r) const \sa intersected() */ -const QRegion QRegion::operator&(const QRegion &r) const +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE +const +#endif +QRegion QRegion::operator&(const QRegion &r) const { return intersected(r); } /*! \overload \since 4.4 */ -const QRegion QRegion::operator&(const QRect &r) const +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE +const +#endif +QRegion QRegion::operator&(const QRect &r) const { return intersected(r); } @@ -493,7 +508,10 @@ const QRegion QRegion::operator&(const QRect &r) const \sa subtracted() */ -const QRegion QRegion::operator-(const QRegion &r) const +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE +const +#endif +QRegion QRegion::operator-(const QRegion &r) const { return subtracted(r); } /*! @@ -502,7 +520,10 @@ const QRegion QRegion::operator-(const QRegion &r) const \sa xored() */ -const QRegion QRegion::operator^(const QRegion &r) const +#ifdef Q_COMPILER_MANGLES_RETURN_TYPE +const +#endif +QRegion QRegion::operator^(const QRegion &r) const { return xored(r); } /*! -- cgit v1.2.3