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:
parent
3aab574521
commit
d5fc56db4b
|
@ -10,7 +10,7 @@ if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dis
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Default clang-format points to default 3.5 version one
|
# Default clang-format points to default 3.5 version one
|
||||||
CLANG_FORMAT=${CLANG_FORMAT:-clang-format-12}
|
CLANG_FORMAT=${CLANG_FORMAT:-clang-format-15}
|
||||||
$CLANG_FORMAT --version
|
$CLANG_FORMAT --version
|
||||||
|
|
||||||
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
|
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
template <typename VaType, size_t AddressSpaceBits>
|
template <typename VaType, size_t AddressSpaceBits>
|
||||||
concept AddressSpaceValid = std::is_unsigned_v<VaType> && sizeof(VaType) * 8 >= AddressSpaceBits;
|
concept AddressSpaceValid = std::is_unsigned_v<VaType> && sizeof(VaType) * 8 >=
|
||||||
|
AddressSpaceBits;
|
||||||
|
|
||||||
struct EmptyStruct {};
|
struct EmptyStruct {};
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,9 @@ public:
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept HasRedBlackKeyType = requires {
|
concept HasRedBlackKeyType = requires {
|
||||||
{ std::is_same<typename T::RedBlackKeyType, void>::value } -> std::convertible_to<bool>;
|
{
|
||||||
|
std::is_same<typename T::RedBlackKeyType, void>::value
|
||||||
|
} -> std::convertible_to<bool>;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
|
@ -9,12 +9,14 @@
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
requires(!std::is_array_v<T>) std::unique_ptr<T> make_unique_for_overwrite() {
|
requires(!std::is_array_v<T>)
|
||||||
|
std::unique_ptr<T> make_unique_for_overwrite() {
|
||||||
return std::unique_ptr<T>(new T);
|
return std::unique_ptr<T>(new T);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
requires std::is_unbounded_array_v<T> std::unique_ptr<T> make_unique_for_overwrite(std::size_t n) {
|
requires std::is_unbounded_array_v<T>
|
||||||
|
std::unique_ptr<T> make_unique_for_overwrite(std::size_t n) {
|
||||||
return std::unique_ptr<T>(new std::remove_extent_t<T>[n]);
|
return std::unique_ptr<T>(new std::remove_extent_t<T>[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,8 @@ public:
|
||||||
* @param default_val Intial value of the setting, and default value of the setting
|
* @param default_val Intial value of the setting, and default value of the setting
|
||||||
* @param name Label for 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} {}
|
: value{default_val}, default_value{default_val}, label{name} {}
|
||||||
virtual ~Setting() = default;
|
virtual ~Setting() = default;
|
||||||
|
|
||||||
|
@ -144,7 +145,8 @@ public:
|
||||||
* @param name Label for the setting
|
* @param name Label for the setting
|
||||||
*/
|
*/
|
||||||
explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val,
|
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},
|
: value{default_val},
|
||||||
default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {}
|
default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {}
|
||||||
|
|
||||||
|
@ -232,7 +234,8 @@ public:
|
||||||
* @param default_val Intial value of the setting, and default value of the setting
|
* @param default_val Intial value of the setting, and default value of the setting
|
||||||
* @param name Label for 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<Type>{default_val, name} {}
|
: Setting<Type>{default_val, name} {}
|
||||||
virtual ~SwitchableSetting() = default;
|
virtual ~SwitchableSetting() = default;
|
||||||
|
|
||||||
|
@ -245,7 +248,8 @@ public:
|
||||||
* @param name Label for the setting
|
* @param name Label for the setting
|
||||||
*/
|
*/
|
||||||
explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val,
|
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<Type, true>{default_val, min_val, max_val, name} {}
|
: Setting<Type, true>{default_val, min_val, max_val, name} {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -348,9 +348,7 @@ public:
|
||||||
// _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all
|
// _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all
|
||||||
// component names (x<->r) and permutations (xy<->yx)
|
// component names (x<->r) and permutations (xy<->yx)
|
||||||
#define _DEFINE_SWIZZLER2(a, b, name) \
|
#define _DEFINE_SWIZZLER2(a, b, name) \
|
||||||
[[nodiscard]] constexpr Vec2<T> name() const { \
|
[[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); }
|
||||||
return Vec2<T>(a, b); \
|
|
||||||
}
|
|
||||||
#define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \
|
#define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \
|
||||||
_DEFINE_SWIZZLER2(a, b, a##b); \
|
_DEFINE_SWIZZLER2(a, b, a##b); \
|
||||||
_DEFINE_SWIZZLER2(a, b, a2##b2); \
|
_DEFINE_SWIZZLER2(a, b, a2##b2); \
|
||||||
|
@ -543,9 +541,7 @@ public:
|
||||||
// DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and
|
// DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and
|
||||||
// permutations (xy<->yx)
|
// permutations (xy<->yx)
|
||||||
#define _DEFINE_SWIZZLER2(a, b, name) \
|
#define _DEFINE_SWIZZLER2(a, b, name) \
|
||||||
[[nodiscard]] constexpr Vec2<T> name() const { \
|
[[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); }
|
||||||
return Vec2<T>(a, b); \
|
|
||||||
}
|
|
||||||
#define DEFINE_SWIZZLER2_COMP1(a, a2) \
|
#define DEFINE_SWIZZLER2_COMP1(a, a2) \
|
||||||
_DEFINE_SWIZZLER2(a, a, a##a); \
|
_DEFINE_SWIZZLER2(a, a, a##a); \
|
||||||
_DEFINE_SWIZZLER2(a, a, a2##a2)
|
_DEFINE_SWIZZLER2(a, a, a2##a2)
|
||||||
|
@ -570,9 +566,7 @@ public:
|
||||||
#undef _DEFINE_SWIZZLER2
|
#undef _DEFINE_SWIZZLER2
|
||||||
|
|
||||||
#define _DEFINE_SWIZZLER3(a, b, c, name) \
|
#define _DEFINE_SWIZZLER3(a, b, c, name) \
|
||||||
[[nodiscard]] constexpr Vec3<T> name() const { \
|
[[nodiscard]] constexpr Vec3<T> name() const { return Vec3<T>(a, b, c); }
|
||||||
return Vec3<T>(a, b, c); \
|
|
||||||
}
|
|
||||||
#define DEFINE_SWIZZLER3_COMP1(a, a2) \
|
#define DEFINE_SWIZZLER3_COMP1(a, a2) \
|
||||||
_DEFINE_SWIZZLER3(a, a, a, a##a##a); \
|
_DEFINE_SWIZZLER3(a, a, a, a##a##a); \
|
||||||
_DEFINE_SWIZZLER3(a, a, a, a2##a2##a2)
|
_DEFINE_SWIZZLER3(a, a, a, a2##a2##a2)
|
||||||
|
@ -641,8 +635,8 @@ template <typename T>
|
||||||
|
|
||||||
// linear interpolation via float: 0.0=begin, 1.0=end
|
// linear interpolation via float: 0.0=begin, 1.0=end
|
||||||
template <typename X>
|
template <typename X>
|
||||||
[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{})
|
[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end,
|
||||||
Lerp(const X& begin, const X& end, const float t) {
|
const float t) {
|
||||||
return begin * (1.f - t) + end * t;
|
return begin * (1.f - t) + end * t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,7 @@ private:
|
||||||
friend class ::Kernel::KClassTokenGenerator; \
|
friend class ::Kernel::KClassTokenGenerator; \
|
||||||
static constexpr inline auto ObjectType = ::Kernel::KClassTokenGenerator::ObjectType::CLASS; \
|
static constexpr inline auto ObjectType = ::Kernel::KClassTokenGenerator::ObjectType::CLASS; \
|
||||||
static constexpr inline const char* const TypeName = #CLASS; \
|
static constexpr inline const char* const TypeName = #CLASS; \
|
||||||
static constexpr inline ClassTokenType ClassToken() { \
|
static constexpr inline ClassTokenType ClassToken() { return ::Kernel::ClassToken<CLASS>; } \
|
||||||
return ::Kernel::ClassToken<CLASS>; \
|
|
||||||
} \
|
|
||||||
\
|
\
|
||||||
public: \
|
public: \
|
||||||
YUZU_NON_COPYABLE(CLASS); \
|
YUZU_NON_COPYABLE(CLASS); \
|
||||||
|
@ -37,15 +35,9 @@ public:
|
||||||
constexpr ClassTokenType Token = ClassToken(); \
|
constexpr ClassTokenType Token = ClassToken(); \
|
||||||
return TypeObj(TypeName, Token); \
|
return TypeObj(TypeName, Token); \
|
||||||
} \
|
} \
|
||||||
static constexpr const char* GetStaticTypeName() { \
|
static constexpr const char* GetStaticTypeName() { return TypeName; } \
|
||||||
return TypeName; \
|
virtual TypeObj GetTypeObj() ATTRIBUTE { return GetStaticTypeObj(); } \
|
||||||
} \
|
virtual const char* GetTypeName() ATTRIBUTE { return GetStaticTypeName(); } \
|
||||||
virtual TypeObj GetTypeObj() ATTRIBUTE { \
|
|
||||||
return GetStaticTypeObj(); \
|
|
||||||
} \
|
|
||||||
virtual const char* GetTypeName() ATTRIBUTE { \
|
|
||||||
return GetStaticTypeName(); \
|
|
||||||
} \
|
|
||||||
\
|
\
|
||||||
private: \
|
private: \
|
||||||
constexpr bool operator!=(const TypeObj& rhs)
|
constexpr bool operator!=(const TypeObj& rhs)
|
||||||
|
@ -245,8 +237,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U>
|
template <typename U>
|
||||||
requires(std::derived_from<T, U> ||
|
requires(std::derived_from<T, U> || std::derived_from<U, T>)
|
||||||
std::derived_from<U, T>) constexpr KScopedAutoObject(KScopedAutoObject<U>&& rhs) {
|
constexpr KScopedAutoObject(KScopedAutoObject<U>&& rhs) {
|
||||||
if constexpr (std::derived_from<U, T>) {
|
if constexpr (std::derived_from<U, T>) {
|
||||||
// Upcast.
|
// Upcast.
|
||||||
m_obj = rhs.m_obj;
|
m_obj = rhs.m_obj;
|
||||||
|
|
|
@ -17,7 +17,8 @@ namespace Kernel {
|
||||||
class KThread;
|
class KThread;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T & t) {
|
concept KPriorityQueueAffinityMask = !
|
||||||
|
std::is_reference_v<T>&& requires(T& t) {
|
||||||
{ t.GetAffinityMask() } -> Common::ConvertibleTo<u64>;
|
{ t.GetAffinityMask() } -> Common::ConvertibleTo<u64>;
|
||||||
{ t.SetAffinityMask(0) };
|
{ t.SetAffinityMask(0) };
|
||||||
|
|
||||||
|
@ -27,17 +28,22 @@ concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T & t)
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept KPriorityQueueMember = !std::is_reference_v<T> && requires(T & t) {
|
concept KPriorityQueueMember = !
|
||||||
|
std::is_reference_v<T>&& requires(T& t) {
|
||||||
{ typename T::QueueEntry() };
|
{ typename T::QueueEntry() };
|
||||||
{ (typename T::QueueEntry()).Initialize() };
|
{ (typename T::QueueEntry()).Initialize() };
|
||||||
{ (typename T::QueueEntry()).SetPrev(std::addressof(t)) };
|
{ (typename T::QueueEntry()).SetPrev(std::addressof(t)) };
|
||||||
{ (typename T::QueueEntry()).SetNext(std::addressof(t)) };
|
{ (typename T::QueueEntry()).SetNext(std::addressof(t)) };
|
||||||
{ (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>;
|
{ (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>;
|
||||||
{ (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
|
{ (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
|
||||||
{ t.GetPriorityQueueEntry(0) } -> std::same_as<typename T::QueueEntry&>;
|
{
|
||||||
|
t.GetPriorityQueueEntry(0)
|
||||||
|
} -> std::same_as<typename T::QueueEntry&>;
|
||||||
|
|
||||||
{ t.GetAffinityMask() };
|
{ t.GetAffinityMask() };
|
||||||
{ std::remove_cvref_t<decltype(t.GetAffinityMask())>() } -> KPriorityQueueAffinityMask;
|
{
|
||||||
|
std::remove_cvref_t<decltype(t.GetAffinityMask())>()
|
||||||
|
} -> KPriorityQueueAffinityMask;
|
||||||
|
|
||||||
{ t.GetActiveCore() } -> Common::ConvertibleTo<s32>;
|
{ t.GetActiveCore() } -> Common::ConvertibleTo<s32>;
|
||||||
{ t.GetPriority() } -> Common::ConvertibleTo<s32>;
|
{ t.GetPriority() } -> Common::ConvertibleTo<s32>;
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
concept KLockable = !std::is_reference_v<T> && requires(T & t) {
|
concept KLockable = !
|
||||||
|
std::is_reference_v<T>&& requires(T& t) {
|
||||||
{ t.Lock() } -> std::same_as<void>;
|
{ t.Lock() } -> std::same_as<void>;
|
||||||
{ t.Unlock() } -> std::same_as<void>;
|
{ t.Unlock() } -> std::same_as<void>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -698,10 +698,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
requires(
|
requires(std::same_as<T, KThread> || std::same_as<T, RedBlackKeyType>)
|
||||||
std::same_as<T, KThread> ||
|
static constexpr int Compare(const T& lhs, const KThread& rhs) {
|
||||||
std::same_as<T, RedBlackKeyType>) static constexpr int Compare(const T& lhs,
|
|
||||||
const KThread& rhs) {
|
|
||||||
const u64 l_key = lhs.GetConditionVariableKey();
|
const u64 l_key = lhs.GetConditionVariableKey();
|
||||||
const u64 r_key = rhs.GetConditionVariableKey();
|
const u64 r_key = rhs.GetConditionVariableKey();
|
||||||
|
|
||||||
|
|
|
@ -70,10 +70,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
requires(std::same_as<T, KThreadLocalPage> ||
|
requires(std::same_as<T, KThreadLocalPage> || std::same_as<T, RedBlackKeyType>)
|
||||||
std::same_as<T, RedBlackKeyType>) static constexpr int Compare(const T& lhs,
|
static constexpr int Compare(const T& lhs, const KThreadLocalPage& rhs) {
|
||||||
const KThreadLocalPage&
|
|
||||||
rhs) {
|
|
||||||
const VAddr lval = GetRedBlackKey(lhs);
|
const VAddr lval = GetRedBlackKey(lhs);
|
||||||
const VAddr rval = GetRedBlackKey(rhs);
|
const VAddr rval = GetRedBlackKey(rhs);
|
||||||
|
|
||||||
|
|
|
@ -107,8 +107,8 @@ public:
|
||||||
* @returns output object containing the responce
|
* @returns output object containing the responce
|
||||||
*/
|
*/
|
||||||
template <typename Output>
|
template <typename Output>
|
||||||
requires std::is_trivially_copyable_v<Output> DriverResult ReadSPI(SpiAddress addr,
|
requires std::is_trivially_copyable_v<Output>
|
||||||
Output& output) {
|
DriverResult ReadSPI(SpiAddress addr, Output& output) {
|
||||||
std::array<u8, sizeof(Output)> buffer;
|
std::array<u8, sizeof(Output)> buffer;
|
||||||
output = {};
|
output = {};
|
||||||
|
|
||||||
|
|
|
@ -409,7 +409,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
requires(sizeof(T) <= sizeof(u32) && std::is_trivially_copyable_v<T>) struct Flags {
|
requires(sizeof(T) <= sizeof(u32) && std::is_trivially_copyable_v<T>)
|
||||||
|
struct Flags {
|
||||||
Flags() = default;
|
Flags() = default;
|
||||||
Flags(T proxy_) : proxy{proxy_} {}
|
Flags(T proxy_) : proxy{proxy_} {}
|
||||||
|
|
||||||
|
|
|
@ -101,9 +101,8 @@ public:
|
||||||
TypedValue() = default;
|
TypedValue() = default;
|
||||||
|
|
||||||
template <IR::Type other_type>
|
template <IR::Type other_type>
|
||||||
requires((other_type & type_) != IR::Type::Void) explicit(false)
|
requires((other_type & type_) != IR::Type::Void)
|
||||||
TypedValue(const TypedValue<other_type>& value)
|
explicit(false) TypedValue(const TypedValue<other_type>& value) : Value(value) {}
|
||||||
: Value(value) {}
|
|
||||||
|
|
||||||
explicit TypedValue(const Value& value) : Value(value) {
|
explicit TypedValue(const Value& value) : Value(value) {
|
||||||
if ((value.Type() & type_) == IR::Type::Void) {
|
if ((value.Type() & type_) == IR::Type::Void) {
|
||||||
|
@ -202,8 +201,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FlagsType>
|
template <typename FlagsType>
|
||||||
requires(sizeof(FlagsType) <= sizeof(u32) &&
|
requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>)
|
||||||
std::is_trivially_copyable_v<FlagsType>) void SetFlags(FlagsType value) noexcept {
|
void SetFlags(FlagsType value) noexcept {
|
||||||
std::memcpy(&flags, &value, sizeof(value));
|
std::memcpy(&flags, &value, sizeof(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,7 @@ public:
|
||||||
explicit DescriptorTable(Tegra::MemoryManager& gpu_memory_) : gpu_memory{gpu_memory_} {}
|
explicit DescriptorTable(Tegra::MemoryManager& gpu_memory_) : gpu_memory{gpu_memory_} {}
|
||||||
|
|
||||||
[[nodiscard]] bool Synchronize(GPUVAddr gpu_addr, u32 limit) {
|
[[nodiscard]] bool Synchronize(GPUVAddr gpu_addr, u32 limit) {
|
||||||
[[likely]] if (current_gpu_addr == gpu_addr && current_limit == limit) {
|
[[likely]] if (current_gpu_addr == gpu_addr && current_limit == limit) { return false; }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Refresh(gpu_addr, limit);
|
Refresh(gpu_addr, limit);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue