From 6cfb8e02a89be9fc76556b10c06e92047eecd8a6 Mon Sep 17 00:00:00 2001 From: Vitor K Date: Wed, 27 Sep 2023 13:42:19 -0300 Subject: [PATCH] clang format (#7017) --- .../app/src/main/jni/camera/ndk_camera.cpp | 4 +- src/common/expected.h | 60 +++++++++---------- src/common/polyfill_thread.h | 4 +- src/common/settings.h | 12 ++-- src/common/vector_math.h | 16 ++--- src/core/arm/dyncom/arm_dyncom_trans.cpp | 2 +- src/video_core/shader/shader.h | 2 +- 7 files changed, 48 insertions(+), 52 deletions(-) diff --git a/src/android/app/src/main/jni/camera/ndk_camera.cpp b/src/android/app/src/main/jni/camera/ndk_camera.cpp index bf8ad18c8e..beb560fed4 100644 --- a/src/android/app/src/main/jni/camera/ndk_camera.cpp +++ b/src/android/app/src/main/jni/camera/ndk_camera.cpp @@ -42,9 +42,7 @@ struct CaptureSession final { #define MEMBER(type, name, func) \ struct type##Deleter { \ - void operator()(type* ptr) { \ - type##_##func(ptr); \ - } \ + void operator()(type* ptr) { type##_##func(ptr); } \ }; \ std::unique_ptr name diff --git a/src/common/expected.h b/src/common/expected.h index c8d8579c1d..78b755f632 100644 --- a/src/common/expected.h +++ b/src/common/expected.h @@ -65,7 +65,7 @@ struct no_init_t { * Additionally, this requires E to be trivially destructible */ template > -requires std::is_trivially_destructible_v + requires std::is_trivially_destructible_v struct expected_storage_base { constexpr expected_storage_base() : m_val{T{}}, m_has_val{true} {} @@ -112,7 +112,7 @@ struct expected_storage_base { * Additionally, this requires E to be trivially destructible */ template -requires std::is_trivially_destructible_v + requires std::is_trivially_destructible_v struct expected_storage_base { constexpr expected_storage_base() : m_val{T{}}, m_has_val{true} {} @@ -252,7 +252,7 @@ struct expected_operations_base : expected_storage_base { * Additionally, this requires E to be trivially copy constructible */ template > -requires std::is_trivially_copy_constructible_v + requires std::is_trivially_copy_constructible_v struct expected_copy_base : expected_operations_base { using expected_operations_base::expected_operations_base; }; @@ -262,7 +262,7 @@ struct expected_copy_base : expected_operations_base { * Additionally, this requires E to be trivially copy constructible */ template -requires std::is_trivially_copy_constructible_v + requires std::is_trivially_copy_constructible_v struct expected_copy_base : expected_operations_base { using expected_operations_base::expected_operations_base; @@ -290,7 +290,7 @@ struct expected_copy_base : expected_operations_base { * Additionally, this requires E to be trivially move constructible */ template > -requires std::is_trivially_move_constructible_v + requires std::is_trivially_move_constructible_v struct expected_move_base : expected_copy_base { using expected_copy_base::expected_copy_base; }; @@ -300,7 +300,7 @@ struct expected_move_base : expected_copy_base { * Additionally, this requires E to be trivially move constructible */ template -requires std::is_trivially_move_constructible_v + requires std::is_trivially_move_constructible_v struct expected_move_base : expected_copy_base { using expected_copy_base::expected_copy_base; @@ -331,9 +331,9 @@ template , std::is_trivially_copy_constructible, std::is_trivially_destructible>> -requires std::conjunction_v, - std::is_trivially_copy_constructible, - std::is_trivially_destructible> + requires std::conjunction_v, + std::is_trivially_copy_constructible, + std::is_trivially_destructible> struct expected_copy_assign_base : expected_move_base { using expected_move_base::expected_move_base; }; @@ -343,9 +343,9 @@ struct expected_copy_assign_base : expected_move_base { * Additionally, this requires E to be trivially copy assignable */ template -requires std::conjunction_v, - std::is_trivially_copy_constructible, - std::is_trivially_destructible> + requires std::conjunction_v, + std::is_trivially_copy_constructible, + std::is_trivially_destructible> struct expected_copy_assign_base : expected_move_base { using expected_move_base::expected_move_base; @@ -372,9 +372,9 @@ template , std::is_trivially_move_constructible, std::is_trivially_destructible>> -requires std::conjunction_v, - std::is_trivially_move_constructible, - std::is_trivially_destructible> + requires std::conjunction_v, + std::is_trivially_move_constructible, + std::is_trivially_destructible> struct expected_move_assign_base : expected_copy_assign_base { using expected_copy_assign_base::expected_copy_assign_base; }; @@ -384,9 +384,9 @@ struct expected_move_assign_base : expected_copy_assign_base { * Additionally, this requires E to be trivially move assignable */ template -requires std::conjunction_v, - std::is_trivially_move_constructible, - std::is_trivially_destructible> + requires std::conjunction_v, + std::is_trivially_move_constructible, + std::is_trivially_destructible> struct expected_move_assign_base : expected_copy_assign_base { using expected_copy_assign_base::expected_copy_assign_base; @@ -413,7 +413,7 @@ struct expected_move_assign_base : expected_copy_assign_base */ template , bool EnableMove = std::is_move_constructible_v> -requires std::conjunction_v, std::is_move_constructible> + requires std::conjunction_v, std::is_move_constructible> struct expected_delete_ctor_base { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base&) = default; @@ -423,7 +423,7 @@ struct expected_delete_ctor_base { }; template -requires std::conjunction_v, std::is_move_constructible> + requires std::conjunction_v, std::is_move_constructible> struct expected_delete_ctor_base { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base&) = default; @@ -433,7 +433,7 @@ struct expected_delete_ctor_base { }; template -requires std::conjunction_v, std::is_move_constructible> + requires std::conjunction_v, std::is_move_constructible> struct expected_delete_ctor_base { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base&) = delete; @@ -443,7 +443,7 @@ struct expected_delete_ctor_base { }; template -requires std::conjunction_v, std::is_move_constructible> + requires std::conjunction_v, std::is_move_constructible> struct expected_delete_ctor_base { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base&) = delete; @@ -461,8 +461,8 @@ template < typename T, typename E, bool EnableCopy = std::conjunction_v, std::is_copy_assignable>, bool EnableMove = std::conjunction_v, std::is_move_assignable>> -requires std::conjunction_v, std::is_move_constructible, - std::is_copy_assignable, std::is_move_assignable> + requires std::conjunction_v, std::is_move_constructible, + std::is_copy_assignable, std::is_move_assignable> struct expected_delete_assign_base { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base&) = default; @@ -472,8 +472,8 @@ struct expected_delete_assign_base { }; template -requires std::conjunction_v, std::is_move_constructible, - std::is_copy_assignable, std::is_move_assignable> + requires std::conjunction_v, std::is_move_constructible, + std::is_copy_assignable, std::is_move_assignable> struct expected_delete_assign_base { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base&) = default; @@ -483,8 +483,8 @@ struct expected_delete_assign_base { }; template -requires std::conjunction_v, std::is_move_constructible, - std::is_copy_assignable, std::is_move_assignable> + requires std::conjunction_v, std::is_move_constructible, + std::is_copy_assignable, std::is_move_assignable> struct expected_delete_assign_base { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base&) = default; @@ -494,8 +494,8 @@ struct expected_delete_assign_base { }; template -requires std::conjunction_v, std::is_move_constructible, - std::is_copy_assignable, std::is_move_assignable> + requires std::conjunction_v, std::is_move_constructible, + std::is_copy_assignable, std::is_move_assignable> struct expected_delete_assign_base { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base&) = default; diff --git a/src/common/polyfill_thread.h b/src/common/polyfill_thread.h index 852fbca2c5..60e600e281 100644 --- a/src/common/polyfill_thread.h +++ b/src/common/polyfill_thread.h @@ -205,7 +205,7 @@ public: using callback_type = Callback; template - requires constructible_from + requires constructible_from explicit stop_callback(const stop_token& st, C&& cb) noexcept(is_nothrow_constructible_v) : m_stop_state(st.m_stop_state) { @@ -214,7 +214,7 @@ public: } } template - requires constructible_from + requires constructible_from explicit stop_callback(stop_token&& st, C&& cb) noexcept(is_nothrow_constructible_v) : m_stop_state(std::move(st.m_stop_state)) { diff --git a/src/common/settings.h b/src/common/settings.h index fcc10aa24f..aa4b4908e2 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -178,7 +178,8 @@ public: * @param default_val Intial value of the setting, and default value of the setting * @param name Label for the setting */ - explicit Setting(const Type& default_val, const std::string& name) requires(!ranged) + explicit Setting(const Type& default_val, const std::string& name) + requires(!ranged) : value{default_val}, default_value{default_val}, label{name} {} virtual ~Setting() = default; @@ -191,7 +192,8 @@ public: * @param name Label for the setting */ explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val, - const std::string& name) requires(ranged) + const std::string& name) + requires(ranged) : value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {} @@ -279,7 +281,8 @@ public: * @param default_val Intial value of the setting, and default value of the setting * @param name Label for the setting */ - explicit SwitchableSetting(const Type& default_val, const std::string& name) requires(!ranged) + explicit SwitchableSetting(const Type& default_val, const std::string& name) + requires(!ranged) : Setting{default_val, name} {} virtual ~SwitchableSetting() = default; @@ -292,7 +295,8 @@ public: * @param name Label for the setting */ explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val, - const std::string& name) requires(ranged) + const std::string& name) + requires(ranged) : Setting{default_val, min_val, max_val, name} {} /** diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 7033ad8ac7..536f8e1691 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -396,9 +396,7 @@ public: // _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all // component names (x<->r) and permutations (xy<->yx) #define _DEFINE_SWIZZLER2(a, b, name) \ - [[nodiscard]] constexpr Vec2 name() const { \ - return Vec2(a, b); \ - } + [[nodiscard]] constexpr Vec2 name() const { return Vec2(a, b); } #define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \ _DEFINE_SWIZZLER2(a, b, a##b); \ _DEFINE_SWIZZLER2(a, b, a2##b2); \ @@ -598,9 +596,7 @@ public: // DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and // permutations (xy<->yx) #define _DEFINE_SWIZZLER2(a, b, name) \ - [[nodiscard]] constexpr Vec2 name() const { \ - return Vec2(a, b); \ - } + [[nodiscard]] constexpr Vec2 name() const { return Vec2(a, b); } #define DEFINE_SWIZZLER2_COMP1(a, a2) \ _DEFINE_SWIZZLER2(a, a, a##a); \ _DEFINE_SWIZZLER2(a, a, a2##a2) @@ -625,9 +621,7 @@ public: #undef _DEFINE_SWIZZLER2 #define _DEFINE_SWIZZLER3(a, b, c, name) \ - [[nodiscard]] constexpr Vec3 name() const { \ - return Vec3(a, b, c); \ - } + [[nodiscard]] constexpr Vec3 name() const { return Vec3(a, b, c); } #define DEFINE_SWIZZLER3_COMP1(a, a2) \ _DEFINE_SWIZZLER3(a, a, a, a##a##a); \ _DEFINE_SWIZZLER3(a, a, a, a2##a2##a2) @@ -690,8 +684,8 @@ template // linear interpolation via float: 0.0=begin, 1.0=end template -[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) - Lerp(const X& begin, const X& end, const float t) { +[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end, + const float t) { return begin * (1.f - t) + end * t; } diff --git a/src/core/arm/dyncom/arm_dyncom_trans.cpp b/src/core/arm/dyncom/arm_dyncom_trans.cpp index 77dafbac7a..729c40797c 100644 --- a/src/core/arm/dyncom/arm_dyncom_trans.cpp +++ b/src/core/arm/dyncom/arm_dyncom_trans.cpp @@ -63,7 +63,7 @@ static ARM_INST_PTR INTERPRETER_TRANSLATE(add)(unsigned int inst, int index) { return inst_base; } -static ARM_INST_PTR INTERPRETER_TRANSLATE(and)(unsigned int inst, int index) { +static ARM_INST_PTR INTERPRETER_TRANSLATE (and)(unsigned int inst, int index) { arm_inst* inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(and_inst)); and_inst* inst_cream = (and_inst*)inst_base->component; diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index 65a586e318..36c2520eca 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h @@ -104,7 +104,7 @@ struct GSEmitter { struct Handlers { VertexHandler vertex_handler; WindingSetter winding_setter; - } * handlers; + }* handlers; GSEmitter(); ~GSEmitter();