diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2023-06-22 09:38:08 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2023-06-22 16:20:10 +0000 |
| commit | 31d834a1c0d83d22fcf74624577013a558ad1974 (patch) | |
| tree | a0c7aa7b099bde26d639af8a8476f9b97ffbab8b /src/corelib/tools/qarraydatapointer.h | |
| parent | 17542386569505b4f8be526f922103ab09d0c812 (diff) | |
Mark all remaining RAII/smart pointer class ctors [[nodiscard]]
... like QUIP-0019 suggests.
The main problem here is finding these classes. We don't have markup
for RAII classes, so I had to find them by name. This patch is based
on the output of
git grep -we Q[A-Z0-9a-z_]+er
extracting the matches and piping them through sort -u, then removing
a lot of suffixes like Manager and Handler, then visually inspecting
the remaining list.
Task-number: QTBUG-104164
Pick-to: 6.6
Change-Id: I59b18d8d0a0237fcc11047857adc39b984ad7fcb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/tools/qarraydatapointer.h')
| -rw-r--r-- | src/corelib/tools/qarraydatapointer.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index eb20330f0f4..258e7b7446b 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -27,27 +27,32 @@ public: typedef typename std::conditional<pass_parameter_by_value, T, const T &>::type parameter_type; + Q_NODISCARD_CTOR constexpr QArrayDataPointer() noexcept : d(nullptr), ptr(nullptr), size(0) { } + Q_NODISCARD_CTOR QArrayDataPointer(const QArrayDataPointer &other) noexcept : d(other.d), ptr(other.ptr), size(other.size) { ref(); } + Q_NODISCARD_CTOR constexpr QArrayDataPointer(Data *header, T *adata, qsizetype n = 0) noexcept : d(header), ptr(adata), size(n) { } + Q_NODISCARD_CTOR explicit QArrayDataPointer(QPair<QTypedArrayData<T> *, T *> adata, qsizetype n = 0) noexcept : d(adata.first), ptr(adata.second), size(n) { } + Q_NODISCARD_CTOR static QArrayDataPointer fromRawData(const T *rawData, qsizetype length) noexcept { Q_ASSERT(rawData || !length); @@ -61,6 +66,7 @@ public: return *this; } + Q_NODISCARD_CTOR QArrayDataPointer(QArrayDataPointer &&other) noexcept : d(other.d), ptr(other.ptr), size(other.size) { |
