diff --git a/AK/NonnullOwnPtr.h b/AK/NonnullOwnPtr.h index 1645a0009dbf4cef495a040c8bf4d199235caa3b..8121467e5b8745a4ad3f076019718a6c3f0a4fc2 100644 --- a/AK/NonnullOwnPtr.h +++ b/AK/NonnullOwnPtr.h @@ -25,7 +25,7 @@ template class WeakPtr; template -class NonnullOwnPtr { +class [[nodiscard]] NonnullOwnPtr { public: using ElementType = T; diff --git a/AK/NonnullRefPtr.h b/AK/NonnullRefPtr.h index 7f9a0d00c2bc0ffef6632e5b9434fd6f2bb4721e..4640518c2a99ca31bd13c8dfee93cb1a535dd6f7 100644 --- a/AK/NonnullRefPtr.h +++ b/AK/NonnullRefPtr.h @@ -39,7 +39,7 @@ ALWAYS_INLINE void unref_if_not_null(T* ptr) } template -class NonnullRefPtr { +class [[nodiscard]] NonnullRefPtr { template friend class RefPtr; template @@ -218,8 +218,11 @@ public: AK::swap(m_ptr, other.m_ptr); } + // clang-format off private: NonnullRefPtr() = delete; + // clang-format on + ALWAYS_INLINE RETURNS_NONNULL T* as_nonnull_ptr() const { VERIFY(m_ptr); diff --git a/AK/OwnPtr.h b/AK/OwnPtr.h index b950076efc084c41055dd8c7c12a25086f3b8df6..fe1494bf8d449af5e1afb44bff01fe252735f0a9 100644 --- a/AK/OwnPtr.h +++ b/AK/OwnPtr.h @@ -15,7 +15,7 @@ namespace AK { template -class OwnPtr { +class [[nodiscard]] OwnPtr { public: OwnPtr() = default; diff --git a/AK/RefPtr.h b/AK/RefPtr.h index 41fe032d2b46d4ceda8fcf338a5b0b06d16aaa76..5d3acff198f4a038b4ef6dc7d2296bb333f98d81 100644 --- a/AK/RefPtr.h +++ b/AK/RefPtr.h @@ -27,7 +27,7 @@ template class OwnPtr; template -class RefPtr { +class [[nodiscard]] RefPtr { template friend class RefPtr; template diff --git a/AK/WeakPtr.h b/AK/WeakPtr.h index 69c36d2428063aa89d072f25db7b14c28747d09b..f31004f7cde496dbcf55410a12e8f6ff5388c93e 100644 --- a/AK/WeakPtr.h +++ b/AK/WeakPtr.h @@ -15,7 +15,7 @@ namespace AK { template -class WeakPtr { +class [[nodiscard]] WeakPtr { template friend class Weakable;