From d5fc56db4bdebcf4f45e39e9c9d0f40229de8cea Mon Sep 17 00:00:00 2001 From: Levi Behunin Date: Sun, 29 Jan 2023 13:54:13 -0700 Subject: Move to Clang Format 15 Depends on https://github.com/yuzu-emu/build-environments/pull/69 clang-15 primary run --- src/core/hle/kernel/k_auto_object.h | 20 ++++-------- src/core/hle/kernel/k_priority_queue.h | 54 +++++++++++++++++-------------- src/core/hle/kernel/k_scoped_lock.h | 11 ++++--- src/core/hle/kernel/k_thread.h | 8 ++--- src/core/hle/kernel/k_thread_local_page.h | 6 ++-- 5 files changed, 47 insertions(+), 52 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h index 2827763d5..e8118c2b8 100644 --- a/src/core/hle/kernel/k_auto_object.h +++ b/src/core/hle/kernel/k_auto_object.h @@ -24,9 +24,7 @@ private: friend class ::Kernel::KClassTokenGenerator; \ static constexpr inline auto ObjectType = ::Kernel::KClassTokenGenerator::ObjectType::CLASS; \ static constexpr inline const char* const TypeName = #CLASS; \ - static constexpr inline ClassTokenType ClassToken() { \ - return ::Kernel::ClassToken; \ - } \ + static constexpr inline ClassTokenType ClassToken() { return ::Kernel::ClassToken; } \ \ public: \ YUZU_NON_COPYABLE(CLASS); \ @@ -37,15 +35,9 @@ public: constexpr ClassTokenType Token = ClassToken(); \ return TypeObj(TypeName, Token); \ } \ - static constexpr const char* GetStaticTypeName() { \ - return TypeName; \ - } \ - virtual TypeObj GetTypeObj() ATTRIBUTE { \ - return GetStaticTypeObj(); \ - } \ - virtual const char* GetTypeName() ATTRIBUTE { \ - return GetStaticTypeName(); \ - } \ + static constexpr const char* GetStaticTypeName() { return TypeName; } \ + virtual TypeObj GetTypeObj() ATTRIBUTE { return GetStaticTypeObj(); } \ + virtual const char* GetTypeName() ATTRIBUTE { return GetStaticTypeName(); } \ \ private: \ constexpr bool operator!=(const TypeObj& rhs) @@ -245,8 +237,8 @@ public: } template - requires(std::derived_from || - std::derived_from) constexpr KScopedAutoObject(KScopedAutoObject&& rhs) { + requires(std::derived_from || std::derived_from) + constexpr KScopedAutoObject(KScopedAutoObject&& rhs) { if constexpr (std::derived_from) { // Upcast. m_obj = rhs.m_obj; diff --git a/src/core/hle/kernel/k_priority_queue.h b/src/core/hle/kernel/k_priority_queue.h index cb2512b0b..645c5b531 100644 --- a/src/core/hle/kernel/k_priority_queue.h +++ b/src/core/hle/kernel/k_priority_queue.h @@ -17,35 +17,41 @@ namespace Kernel { class KThread; template -concept KPriorityQueueAffinityMask = !std::is_reference_v && requires(T & t) { - { t.GetAffinityMask() } -> Common::ConvertibleTo; - {t.SetAffinityMask(0)}; +concept KPriorityQueueAffinityMask = ! +std::is_reference_v&& requires(T& t) { + { t.GetAffinityMask() } -> Common::ConvertibleTo; + { t.SetAffinityMask(0) }; - { t.GetAffinity(0) } -> std::same_as; - {t.SetAffinity(0, false)}; - {t.SetAll()}; -}; + { t.GetAffinity(0) } -> std::same_as; + { t.SetAffinity(0, false) }; + { t.SetAll() }; + }; template -concept KPriorityQueueMember = !std::is_reference_v && requires(T & t) { - {typename T::QueueEntry()}; - {(typename T::QueueEntry()).Initialize()}; - {(typename T::QueueEntry()).SetPrev(std::addressof(t))}; - {(typename T::QueueEntry()).SetNext(std::addressof(t))}; - { (typename T::QueueEntry()).GetNext() } -> std::same_as; - { (typename T::QueueEntry()).GetPrev() } -> std::same_as; - { t.GetPriorityQueueEntry(0) } -> std::same_as; - - {t.GetAffinityMask()}; - { std::remove_cvref_t() } -> KPriorityQueueAffinityMask; - - { t.GetActiveCore() } -> Common::ConvertibleTo; - { t.GetPriority() } -> Common::ConvertibleTo; - { t.IsDummyThread() } -> Common::ConvertibleTo; -}; +concept KPriorityQueueMember = ! +std::is_reference_v&& requires(T& t) { + { typename T::QueueEntry() }; + { (typename T::QueueEntry()).Initialize() }; + { (typename T::QueueEntry()).SetPrev(std::addressof(t)) }; + { (typename T::QueueEntry()).SetNext(std::addressof(t)) }; + { (typename T::QueueEntry()).GetNext() } -> std::same_as; + { (typename T::QueueEntry()).GetPrev() } -> std::same_as; + { + t.GetPriorityQueueEntry(0) + } -> std::same_as; + + { t.GetAffinityMask() }; + { + std::remove_cvref_t() + } -> KPriorityQueueAffinityMask; + + { t.GetActiveCore() } -> Common::ConvertibleTo; + { t.GetPriority() } -> Common::ConvertibleTo; + { t.IsDummyThread() } -> Common::ConvertibleTo; + }; template -requires KPriorityQueueMember + requires KPriorityQueueMember class KPriorityQueue { public: using AffinityMaskType = std::remove_cv_t< diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h index 857e21156..59b3e32ae 100644 --- a/src/core/hle/kernel/k_scoped_lock.h +++ b/src/core/hle/kernel/k_scoped_lock.h @@ -9,13 +9,14 @@ namespace Kernel { template -concept KLockable = !std::is_reference_v && requires(T & t) { - { t.Lock() } -> std::same_as; - { t.Unlock() } -> std::same_as; -}; +concept KLockable = ! +std::is_reference_v&& requires(T& t) { + { t.Lock() } -> std::same_as; + { t.Unlock() } -> std::same_as; + }; template -requires KLockable + requires KLockable class [[nodiscard]] KScopedLock { public: explicit KScopedLock(T* l) : lock_ptr(l) { diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index 9d771de0e..8b8dc51be 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h @@ -677,7 +677,7 @@ private: union SyncObjectBuffer { std::array sync_objects{}; std::array + Svc::ArgumentHandleCountMax * (sizeof(KSynchronizationObject*) / sizeof(Handle))> handles; constexpr SyncObjectBuffer() {} }; @@ -698,10 +698,8 @@ private: }; template - requires( - std::same_as || - std::same_as) static constexpr int Compare(const T& lhs, - const KThread& rhs) { + requires(std::same_as || std::same_as) + static constexpr int Compare(const T& lhs, const KThread& rhs) { const u64 l_key = lhs.GetConditionVariableKey(); const u64 r_key = rhs.GetConditionVariableKey(); diff --git a/src/core/hle/kernel/k_thread_local_page.h b/src/core/hle/kernel/k_thread_local_page.h index fe0cff084..71254eb55 100644 --- a/src/core/hle/kernel/k_thread_local_page.h +++ b/src/core/hle/kernel/k_thread_local_page.h @@ -70,10 +70,8 @@ public: } template - requires(std::same_as || - std::same_as) static constexpr int Compare(const T& lhs, - const KThreadLocalPage& - rhs) { + requires(std::same_as || std::same_as) + static constexpr int Compare(const T& lhs, const KThreadLocalPage& rhs) { const VAddr lval = GetRedBlackKey(lhs); const VAddr rval = GetRedBlackKey(rhs); -- cgit v1.2.3