AK: Remove AK_HAS_CONDITIONALLY_TRIVIAL

Code behind this appears to compile nicely with Clang 17 and later.
This commit is contained in:
Andreas Kling 2024-05-10 10:06:02 +02:00 committed by Alexander Kalenik
parent ae11a4de1c
commit 6b2b90d2b0
3 changed files with 0 additions and 24 deletions

View file

@ -70,7 +70,6 @@ public:
return *this;
}
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
Optional(Optional const& other)
requires(!IsCopyConstructible<T>)
= delete;
@ -93,12 +92,9 @@ public:
requires(!IsDestructible<T>)
= delete;
~Optional() = default;
#endif
ALWAYS_INLINE Optional(Optional const& other)
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
requires(!IsTriviallyCopyConstructible<T>)
#endif
: m_has_value(other.m_has_value)
{
if (other.has_value())
@ -138,9 +134,7 @@ public:
}
ALWAYS_INLINE Optional& operator=(Optional const& other)
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
requires(!IsTriviallyCopyConstructible<T> || !IsTriviallyDestructible<T>)
#endif
{
if (this != &other) {
clear();
@ -177,9 +171,7 @@ public:
}
ALWAYS_INLINE ~Optional()
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
requires(!IsTriviallyDestructible<T>)
#endif
{
clear();
}

View file

@ -159,10 +159,6 @@
# define VALIDATE_IS_RISCV64() static_assert(false, "Trying to include riscv64 only header on non riscv64 platform");
#endif
#if !defined(AK_COMPILER_CLANG)
# define AK_HAS_CONDITIONALLY_TRIVIAL
#endif
// Apple Clang 14.0.3 (shipped in Xcode 14.3) has a bug that causes __builtin_subc{,l,ll}
// to incorrectly return whether a borrow occurred on AArch64. See our writeup for the Qemu
// issue also caused by it: https://gitlab.com/qemu-project/qemu/-/issues/1659#note_1408275831

View file

@ -267,7 +267,6 @@ public:
{
}
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
Variant(Variant const&)
requires(!(IsCopyConstructible<Ts> && ...))
= delete;
@ -292,12 +291,9 @@ public:
requires(!(IsMoveConstructible<Ts> && ...) || !(IsDestructible<Ts> && ...))
= delete;
Variant& operator=(Variant&&) = default;
#endif
ALWAYS_INLINE Variant(Variant const& old)
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
requires(!(IsTriviallyCopyConstructible<Ts> && ...))
#endif
: Detail::MergeAndDeduplicatePacks<Detail::VariantConstructors<Ts, Variant<Ts...>>...>()
, m_data {}
, m_index(old.m_index)
@ -310,9 +306,7 @@ public:
// and if a variant with a nontrivial move ctor is moved from, it may or may not be valid
// but it will still contain the "moved-from" state of the object it previously contained.
ALWAYS_INLINE Variant(Variant&& old)
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
requires(!(IsTriviallyMoveConstructible<Ts> && ...))
#endif
: Detail::MergeAndDeduplicatePacks<Detail::VariantConstructors<Ts, Variant<Ts...>>...>()
, m_index(old.m_index)
{
@ -320,17 +314,13 @@ public:
}
ALWAYS_INLINE ~Variant()
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
requires(!(IsTriviallyDestructible<Ts> && ...))
#endif
{
Helper::delete_(m_index, m_data);
}
ALWAYS_INLINE Variant& operator=(Variant const& other)
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
requires(!(IsTriviallyCopyConstructible<Ts> && ...) || !(IsTriviallyDestructible<Ts> && ...))
#endif
{
if (this != &other) {
if constexpr (!(IsTriviallyDestructible<Ts> && ...)) {
@ -343,9 +333,7 @@ public:
}
ALWAYS_INLINE Variant& operator=(Variant&& other)
#ifdef AK_HAS_CONDITIONALLY_TRIVIAL
requires(!(IsTriviallyMoveConstructible<Ts> && ...) || !(IsTriviallyDestructible<Ts> && ...))
#endif
{
if (this != &other) {
if constexpr (!(IsTriviallyDestructible<Ts> && ...)) {