diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-08-11 15:36:59 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-08-17 12:19:55 +0000 |
commit | 6bbf186d135e731e3c7b84a0c3cf9e74c946d32d (patch) | |
tree | 27caec4a51fc1e45ed0e0d4f1022e00341da7274 /src/bluetooth/qbluetoothuuid.h | |
parent | 8223141371399a95bca0fe9d0623c67b31d9526f (diff) |
QBluetoothUuid: inline converting ctor from QUuid
It really shouldn't be out-of-line. We should allow the compiler to
see it as the no-op that it is.
As a drive-by, pre-program the signature to pass by value come Qt 7,
fixing a Clazy warning. We could already do it now, but since T and
const T& don't overload, we'd have to take out the QT6_NEW_OVERLOAD
bazooka, and it's not really worth it. When the code is inline, the
compiler can see through the pass-by-reference overhead and avoid
allocating the argument on the stack.
Pick-to: 6.6
Change-Id: Ic708bb9b2cacd4df22313b704de557dbda4d28fa
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothuuid.h')
-rw-r--r-- | src/bluetooth/qbluetoothuuid.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothuuid.h b/src/bluetooth/qbluetoothuuid.h index 9e087d76..1eaf7808 100644 --- a/src/bluetooth/qbluetoothuuid.h +++ b/src/bluetooth/qbluetoothuuid.h @@ -360,7 +360,8 @@ public: : QUuid(uuid, order) {}; explicit QBluetoothUuid(const QString &uuid); QBluetoothUuid(const QBluetoothUuid &uuid) = default; - QBluetoothUuid(const QUuid &uuid); + QT_BLUETOOTH_INLINE_SINCE(6, 6) + QBluetoothUuid(QUuid QT6_ONLY(const &)uuid); ~QBluetoothUuid() = default; QBluetoothUuid &operator=(const QBluetoothUuid &other) = default; @@ -399,6 +400,14 @@ public: static QString descriptorToString(DescriptorType uuid); }; +#if QT_BLUETOOTH_INLINE_IMPL_SINCE(6, 6) +QBluetoothUuid::QBluetoothUuid(QUuid QT6_ONLY(const &)uuid) + : QUuid(uuid) +{ +} +#endif + + #ifndef QT_NO_DATASTREAM inline QDataStream &operator<<(QDataStream &s, const QBluetoothUuid &uuid) { |