mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	Move to Clang Format 15
Depends on https://github.com/yuzu-emu/build-environments/pull/69 clang-15 primary run
This commit is contained in:
		@@ -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<CLASS>;                                                        \
 | 
			
		||||
    }                                                                                              \
 | 
			
		||||
    static constexpr inline ClassTokenType ClassToken() { return ::Kernel::ClassToken<CLASS>; }    \
 | 
			
		||||
                                                                                                   \
 | 
			
		||||
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 <typename U>
 | 
			
		||||
    requires(std::derived_from<T, U> ||
 | 
			
		||||
             std::derived_from<U, T>) constexpr KScopedAutoObject(KScopedAutoObject<U>&& rhs) {
 | 
			
		||||
        requires(std::derived_from<T, U> || std::derived_from<U, T>)
 | 
			
		||||
    constexpr KScopedAutoObject(KScopedAutoObject<U>&& rhs) {
 | 
			
		||||
        if constexpr (std::derived_from<U, T>) {
 | 
			
		||||
            // Upcast.
 | 
			
		||||
            m_obj = rhs.m_obj;
 | 
			
		||||
 
 | 
			
		||||
@@ -17,35 +17,41 @@ namespace Kernel {
 | 
			
		||||
class KThread;
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T & t) {
 | 
			
		||||
    { t.GetAffinityMask() } -> Common::ConvertibleTo<u64>;
 | 
			
		||||
    {t.SetAffinityMask(0)};
 | 
			
		||||
concept KPriorityQueueAffinityMask = !
 | 
			
		||||
std::is_reference_v<T>&& requires(T& t) {
 | 
			
		||||
                             { t.GetAffinityMask() } -> Common::ConvertibleTo<u64>;
 | 
			
		||||
                             { t.SetAffinityMask(0) };
 | 
			
		||||
 | 
			
		||||
    { t.GetAffinity(0) } -> std::same_as<bool>;
 | 
			
		||||
    {t.SetAffinity(0, false)};
 | 
			
		||||
    {t.SetAll()};
 | 
			
		||||
};
 | 
			
		||||
                             { t.GetAffinity(0) } -> std::same_as<bool>;
 | 
			
		||||
                             { t.SetAffinity(0, false) };
 | 
			
		||||
                             { t.SetAll() };
 | 
			
		||||
                         };
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
concept KPriorityQueueMember = !std::is_reference_v<T> && 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<T*>;
 | 
			
		||||
    { (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
 | 
			
		||||
    { t.GetPriorityQueueEntry(0) } -> std::same_as<typename T::QueueEntry&>;
 | 
			
		||||
concept KPriorityQueueMember = !
 | 
			
		||||
std::is_reference_v<T>&& 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<T*>;
 | 
			
		||||
                             { (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
 | 
			
		||||
                             {
 | 
			
		||||
                                 t.GetPriorityQueueEntry(0)
 | 
			
		||||
                                 } -> std::same_as<typename T::QueueEntry&>;
 | 
			
		||||
 | 
			
		||||
    {t.GetAffinityMask()};
 | 
			
		||||
    { std::remove_cvref_t<decltype(t.GetAffinityMask())>() } -> KPriorityQueueAffinityMask;
 | 
			
		||||
                             { t.GetAffinityMask() };
 | 
			
		||||
                             {
 | 
			
		||||
                                 std::remove_cvref_t<decltype(t.GetAffinityMask())>()
 | 
			
		||||
                                 } -> KPriorityQueueAffinityMask;
 | 
			
		||||
 | 
			
		||||
    { t.GetActiveCore() } -> Common::ConvertibleTo<s32>;
 | 
			
		||||
    { t.GetPriority() } -> Common::ConvertibleTo<s32>;
 | 
			
		||||
    { t.IsDummyThread() } -> Common::ConvertibleTo<bool>;
 | 
			
		||||
};
 | 
			
		||||
                             { t.GetActiveCore() } -> Common::ConvertibleTo<s32>;
 | 
			
		||||
                             { t.GetPriority() } -> Common::ConvertibleTo<s32>;
 | 
			
		||||
                             { t.IsDummyThread() } -> Common::ConvertibleTo<bool>;
 | 
			
		||||
                         };
 | 
			
		||||
 | 
			
		||||
template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority>
 | 
			
		||||
requires KPriorityQueueMember<Member>
 | 
			
		||||
    requires KPriorityQueueMember<Member>
 | 
			
		||||
class KPriorityQueue {
 | 
			
		||||
public:
 | 
			
		||||
    using AffinityMaskType = std::remove_cv_t<
 | 
			
		||||
 
 | 
			
		||||
@@ -9,13 +9,14 @@
 | 
			
		||||
namespace Kernel {
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
concept KLockable = !std::is_reference_v<T> && requires(T & t) {
 | 
			
		||||
    { t.Lock() } -> std::same_as<void>;
 | 
			
		||||
    { t.Unlock() } -> std::same_as<void>;
 | 
			
		||||
};
 | 
			
		||||
concept KLockable = !
 | 
			
		||||
std::is_reference_v<T>&& requires(T& t) {
 | 
			
		||||
                             { t.Lock() } -> std::same_as<void>;
 | 
			
		||||
                             { t.Unlock() } -> std::same_as<void>;
 | 
			
		||||
                         };
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
requires KLockable<T>
 | 
			
		||||
    requires KLockable<T>
 | 
			
		||||
class [[nodiscard]] KScopedLock {
 | 
			
		||||
public:
 | 
			
		||||
    explicit KScopedLock(T* l) : lock_ptr(l) {
 | 
			
		||||
 
 | 
			
		||||
@@ -677,7 +677,7 @@ private:
 | 
			
		||||
    union SyncObjectBuffer {
 | 
			
		||||
        std::array<KSynchronizationObject*, Svc::ArgumentHandleCountMax> sync_objects{};
 | 
			
		||||
        std::array<Handle,
 | 
			
		||||
                   Svc::ArgumentHandleCountMax*(sizeof(KSynchronizationObject*) / sizeof(Handle))>
 | 
			
		||||
                   Svc::ArgumentHandleCountMax * (sizeof(KSynchronizationObject*) / sizeof(Handle))>
 | 
			
		||||
            handles;
 | 
			
		||||
        constexpr SyncObjectBuffer() {}
 | 
			
		||||
    };
 | 
			
		||||
@@ -698,10 +698,8 @@ private:
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        template <typename T>
 | 
			
		||||
        requires(
 | 
			
		||||
            std::same_as<T, KThread> ||
 | 
			
		||||
            std::same_as<T, RedBlackKeyType>) static constexpr int Compare(const T& lhs,
 | 
			
		||||
                                                                           const KThread& rhs) {
 | 
			
		||||
            requires(std::same_as<T, KThread> || std::same_as<T, RedBlackKeyType>)
 | 
			
		||||
        static constexpr int Compare(const T& lhs, const KThread& rhs) {
 | 
			
		||||
            const u64 l_key = lhs.GetConditionVariableKey();
 | 
			
		||||
            const u64 r_key = rhs.GetConditionVariableKey();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -70,10 +70,8 @@ public:
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template <typename T>
 | 
			
		||||
    requires(std::same_as<T, KThreadLocalPage> ||
 | 
			
		||||
             std::same_as<T, RedBlackKeyType>) static constexpr int Compare(const T& lhs,
 | 
			
		||||
                                                                            const KThreadLocalPage&
 | 
			
		||||
                                                                                rhs) {
 | 
			
		||||
        requires(std::same_as<T, KThreadLocalPage> || std::same_as<T, RedBlackKeyType>)
 | 
			
		||||
    static constexpr int Compare(const T& lhs, const KThreadLocalPage& rhs) {
 | 
			
		||||
        const VAddr lval = GetRedBlackKey(lhs);
 | 
			
		||||
        const VAddr rval = GetRedBlackKey(rhs);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user