diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-16 10:51:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-16 10:55:54 +0200 |
commit | 76bcd284f9dddc93f975cccabae9dc4c040c5a53 (patch) | |
tree | 50f159d03b562be0d0919d61593b69b94e577f31 /AK/Optional.h | |
parent | 16c858d9f033d3b30bf978142e47a6bda564c618 (diff) | |
download | serenity-76bcd284f9dddc93f975cccabae9dc4c040c5a53.zip |
AK: Remove experimental clang -Wconsumed stuff
This stopped working quite some time ago due to Clang losing track of
typestates for some reason and everything becoming "unknown".
Since we're primarily using GCC anyway, it doesn't seem worth it to try
and maintain this non-working experiment for a secondary compiler.
Also it doesn't look like the Clang team is actively maintaining this
flag anyway. So good-bye, -Wconsumed. :/
Diffstat (limited to 'AK/Optional.h')
-rw-r--r-- | AK/Optional.h | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/AK/Optional.h b/AK/Optional.h index 37b4647e6b..db9ee7b014 100644 --- a/AK/Optional.h +++ b/AK/Optional.h @@ -34,12 +34,10 @@ namespace AK { template<typename T> -class CONSUMABLE(unknown) alignas(T) Optional { +class alignas(T) Optional { public: - RETURN_TYPESTATE(unknown) Optional() {} - RETURN_TYPESTATE(unknown) Optional(const T& value) : m_has_value(true) { @@ -47,21 +45,18 @@ public: } template<typename U> - RETURN_TYPESTATE(unknown) Optional(const U& value) : m_has_value(true) { new (&m_storage) T(value); } - RETURN_TYPESTATE(unknown) Optional(T&& value) : m_has_value(true) { new (&m_storage) T(move(value)); } - RETURN_TYPESTATE(unknown) Optional(Optional&& other) : m_has_value(other.m_has_value) { @@ -71,7 +66,6 @@ public: } } - RETURN_TYPESTATE(unknown) Optional(const Optional& other) : m_has_value(other.m_has_value) { @@ -80,7 +74,6 @@ public: } } - RETURN_TYPESTATE(unknown) Optional& operator=(const Optional& other) { if (this != &other) { @@ -93,7 +86,6 @@ public: return *this; } - RETURN_TYPESTATE(unknown) Optional& operator=(Optional&& other) { if (this != &other) { @@ -118,23 +110,19 @@ public: } } - SET_TYPESTATE(consumed) ALWAYS_INLINE bool has_value() const { return m_has_value; } - CALLABLE_WHEN(consumed) ALWAYS_INLINE T& value() { ASSERT(m_has_value); return *reinterpret_cast<T*>(&m_storage); } - CALLABLE_WHEN(consumed) ALWAYS_INLINE const T& value() const { return value_without_consume_state(); } - CALLABLE_WHEN(consumed) T release_value() { ASSERT(m_has_value); |