1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

Meta+AK: Make clang-format-10 clean

This commit is contained in:
Ben Wiederhake 2020-09-18 09:49:51 +02:00 committed by Andreas Kling
parent 468a29f4a1
commit 8940bc3503
28 changed files with 315 additions and 313 deletions

View file

@ -85,7 +85,6 @@ template<typename T, typename V = typename RemoveVolatile<T>::Type>
return __atomic_compare_exchange_n(const_cast<V**>(var), &expected, nullptr, false, order, order); return __atomic_compare_exchange_n(const_cast<V**>(var), &expected, nullptr, false, order, order);
} }
template<typename T> template<typename T>
static inline T atomic_fetch_add(volatile T* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept static inline T atomic_fetch_add(volatile T* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
{ {

View file

@ -31,7 +31,7 @@ namespace AK {
template<typename T> template<typename T>
class Badge { class Badge {
friend T; friend T;
Badge() {} Badge() { }
Badge(const Badge&) = delete; Badge(const Badge&) = delete;
Badge& operator=(const Badge&) = delete; Badge& operator=(const Badge&) = delete;
@ -43,4 +43,3 @@ class Badge {
} }
using AK::Badge; using AK::Badge;

View file

@ -38,7 +38,7 @@ template<typename Out, typename... In>
class Function<Out(In...)> { class Function<Out(In...)> {
public: public:
Function() = default; Function() = default;
Function(std::nullptr_t) {} Function(std::nullptr_t) { }
template<typename CallableType, class = typename EnableIf<!(IsPointer<CallableType>::value && IsFunction<typename RemovePointer<CallableType>::Type>::value) && IsRvalueReference<CallableType&&>::value>::Type> template<typename CallableType, class = typename EnableIf<!(IsPointer<CallableType>::value && IsFunction<typename RemovePointer<CallableType>::Type>::value) && IsRvalueReference<CallableType&&>::value>::Type>
Function(CallableType&& callable) Function(CallableType&& callable)
@ -83,7 +83,7 @@ public:
private: private:
class CallableWrapperBase { class CallableWrapperBase {
public: public:
virtual ~CallableWrapperBase() {} virtual ~CallableWrapperBase() { }
virtual Out call(In...) const = 0; virtual Out call(In...) const = 0;
}; };

View file

@ -276,7 +276,6 @@ void GenericLexer::ignore_until(Condition condition)
m_index++; m_index++;
} }
bool is_control(char c) bool is_control(char c)
{ {
return (c >= 0 && c <= 31) || c == 127; return (c >= 0 && c <= 31) || c == 127;

View file

@ -53,7 +53,7 @@ inline unsigned u64_hash(u64 key)
inline unsigned ptr_hash(FlatPtr ptr) inline unsigned ptr_hash(FlatPtr ptr)
{ {
if constexpr(sizeof(ptr) == 8) if constexpr (sizeof(ptr) == 8)
return u64_hash((u64)ptr); return u64_hash((u64)ptr);
else else
return int_hash((u32)ptr); return int_hash((u32)ptr);

View file

@ -47,7 +47,7 @@ private:
}; };
public: public:
HashMap() {} HashMap() { }
bool is_empty() const { return m_table.is_empty(); } bool is_empty() const { return m_table.is_empty(); }
size_t size() const { return m_table.size(); } size_t size() const { return m_table.size(); }

View file

@ -26,16 +26,16 @@
#pragma once #pragma once
#include <stdlib.h>
#include <AK/HashTable.h> #include <AK/HashTable.h>
#include <stdlib.h>
namespace AK { namespace AK {
class IDAllocator { class IDAllocator {
public: public:
IDAllocator() {} IDAllocator() { }
~IDAllocator() {} ~IDAllocator() { }
int allocate() int allocate()
{ {

View file

@ -104,7 +104,7 @@ inline T* InlineLinkedListNode<T>::next() const
template<typename T> template<typename T>
class InlineLinkedList { class InlineLinkedList {
public: public:
InlineLinkedList() {} InlineLinkedList() { }
bool is_empty() const { return !m_head; } bool is_empty() const { return !m_head; }
size_t size_slow() const; size_t size_slow() const;

View file

@ -34,8 +34,8 @@ namespace AK {
class JsonArray { class JsonArray {
public: public:
JsonArray() {} JsonArray() { }
~JsonArray() {} ~JsonArray() { }
JsonArray(const JsonArray& other) JsonArray(const JsonArray& other)
: m_values(other.m_values) : m_values(other.m_values)

View file

@ -37,8 +37,8 @@ namespace AK {
class JsonObject { class JsonObject {
public: public:
JsonObject() {} JsonObject() { }
~JsonObject() {} ~JsonObject() { }
JsonObject(const JsonObject& other) JsonObject(const JsonObject& other)
: m_order(other.m_order) : m_order(other.m_order)

View file

@ -33,7 +33,7 @@
class [[gnu::packed]] MACAddress class [[gnu::packed]] MACAddress
{ {
public: public:
MACAddress() {} MACAddress() { }
MACAddress(const u8 data[6]) MACAddress(const u8 data[6])
{ {
__builtin_memcpy(m_data, data, 6); __builtin_memcpy(m_data, data, 6);
@ -47,7 +47,7 @@ public:
m_data[4] = e; m_data[4] = e;
m_data[5] = f; m_data[5] = f;
} }
~MACAddress() {} ~MACAddress() { }
u8 operator[](int i) const u8 operator[](int i) const
{ {
@ -78,7 +78,7 @@ static_assert(sizeof(MACAddress) == 6);
namespace AK { namespace AK {
template <> template<>
struct Traits<MACAddress> : public GenericTraits<MACAddress> { struct Traits<MACAddress> : public GenericTraits<MACAddress> {
static unsigned hash(const MACAddress& address) { return string_hash((const char*)&address, sizeof(address)); } static unsigned hash(const MACAddress& address) { return string_hash((const char*)&address, sizeof(address)); }
}; };

View file

@ -26,14 +26,13 @@
#pragma once #pragma once
#include <AK/NonnullPtrVector.h>
#include <AK/NonnullOwnPtr.h> #include <AK/NonnullOwnPtr.h>
#include <AK/NonnullPtrVector.h>
namespace AK { namespace AK {
template<typename T, int inline_capacity = 0> template<typename T, int inline_capacity = 0>
class NonnullOwnPtrVector : public NonnullPtrVector<NonnullOwnPtr<T>, inline_capacity> class NonnullOwnPtrVector : public NonnullPtrVector<NonnullOwnPtr<T>, inline_capacity> {
{
}; };
} }

View file

@ -32,8 +32,7 @@
namespace AK { namespace AK {
template<typename T, int inline_capacity = 0> template<typename T, int inline_capacity = 0>
class NonnullRefPtrVector : public NonnullPtrVector<NonnullRefPtr<T>, inline_capacity> class NonnullRefPtrVector : public NonnullPtrVector<NonnullRefPtr<T>, inline_capacity> {
{
}; };
} }

View file

@ -88,4 +88,3 @@ private:
} }
using AK::Queue; using AK::Queue;

View file

@ -44,7 +44,7 @@ public:
Adopt Adopt
}; };
RefPtr() {} RefPtr() { }
RefPtr(const T* ptr) RefPtr(const T* ptr)
: m_ptr(const_cast<T*>(ptr)) : m_ptr(const_cast<T*>(ptr))
{ {
@ -108,7 +108,7 @@ public:
m_ptr = (T*)(0xe0e0e0e0); m_ptr = (T*)(0xe0e0e0e0);
#endif #endif
} }
RefPtr(std::nullptr_t) {} RefPtr(std::nullptr_t) { }
template<typename U> template<typename U>
RefPtr(const OwnPtr<U>&) = delete; RefPtr(const OwnPtr<U>&) = delete;

View file

@ -32,7 +32,8 @@
namespace AK { namespace AK {
template<typename ValueType, typename ErrorType> template<typename ValueType, typename ErrorType>
class [[nodiscard]] Result { class [[nodiscard]] Result
{
public: public:
Result(const ValueType& res) Result(const ValueType& res)
: m_result(res) : m_result(res)
@ -50,13 +51,19 @@ public:
{ {
} }
// FIXME: clang-format gets confused about Result. Why?
// clang-format off
Result(Result&& other) Result(Result&& other)
// clang-format on
: m_result(move(other.m_result)) : m_result(move(other.m_result))
, m_error(move(other.m_error)) , m_error(move(other.m_error))
{ {
} }
// FIXME: clang-format gets confused about Result. Why?
// clang-format off
Result(Result& other) Result(Result& other)
// clang-format on
: m_result(other.m_result) : m_result(other.m_result)
, m_error(other.m_error) , m_error(other.m_error)
{ {

View file

@ -70,5 +70,5 @@ private:
} }
using AK::ScopeGuard;
using AK::ArmedScopeGuard; using AK::ArmedScopeGuard;
using AK::ScopeGuard;

View file

@ -30,7 +30,7 @@
#include <AK/Atomic.h> #include <AK/Atomic.h>
#include <AK/kmalloc.h> #include <AK/kmalloc.h>
#ifdef KERNEL #ifdef KERNEL
#include <Kernel/Arch/i386/CPU.h> # include <Kernel/Arch/i386/CPU.h>
#endif #endif
#ifndef __serenity__ #ifndef __serenity__
@ -51,6 +51,7 @@ template<typename T, T* (*InitFunction)() = SingletonInstanceCreator<T>::create>
class Singleton { class Singleton {
AK_MAKE_NONCOPYABLE(Singleton); AK_MAKE_NONCOPYABLE(Singleton);
AK_MAKE_NONMOVABLE(Singleton); AK_MAKE_NONMOVABLE(Singleton);
public: public:
Singleton() = default; Singleton() = default;

View file

@ -34,8 +34,8 @@ template<typename T>
class SinglyLinkedListWithCount : private SinglyLinkedList<T> { class SinglyLinkedListWithCount : private SinglyLinkedList<T> {
public: public:
SinglyLinkedListWithCount() {} SinglyLinkedListWithCount() { }
~SinglyLinkedListWithCount() {} ~SinglyLinkedListWithCount() { }
using List = SinglyLinkedList<T>; using List = SinglyLinkedList<T>;

View file

@ -59,7 +59,7 @@ TEST_CASE(enqueue_begin_being_moved_from)
{ {
CircularDeque<String, 2> strings; CircularDeque<String, 2> strings;
String str{"test"}; String str { "test" };
strings.enqueue_begin(move(str)); strings.enqueue_begin(move(str));
EXPECT(str.is_null()); EXPECT(str.is_null());
} }

View file

@ -26,8 +26,8 @@
#include <AK/TestSuite.h> #include <AK/TestSuite.h>
#include <AK/String.h>
#include <AK/Optional.h> #include <AK/Optional.h>
#include <AK/String.h>
TEST_CASE(basic_optional) TEST_CASE(basic_optional)
{ {

View file

@ -26,8 +26,8 @@
#include <AK/TestSuite.h> #include <AK/TestSuite.h>
#include <AK/String.h>
#include <AK/Queue.h> #include <AK/Queue.h>
#include <AK/String.h>
TEST_CASE(construct) TEST_CASE(construct)
{ {

View file

@ -80,14 +80,14 @@ TEST_CASE(assign_copy_self)
RefPtr<Object> object = adopt(*new Object); RefPtr<Object> object = adopt(*new Object);
EXPECT_EQ(object->ref_count(), 1u); EXPECT_EQ(object->ref_count(), 1u);
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic push # pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded" # pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif #endif
object = object; object = object;
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic pop # pragma clang diagnostic pop
#endif #endif
EXPECT_EQ(object->ref_count(), 1u); EXPECT_EQ(object->ref_count(), 1u);
} }

View file

@ -39,8 +39,8 @@ class WeakPtr {
friend class Weakable<T>; friend class Weakable<T>;
public: public:
WeakPtr() {} WeakPtr() { }
WeakPtr(std::nullptr_t) {} WeakPtr(std::nullptr_t) { }
template<typename U> template<typename U>
WeakPtr(WeakPtr<U>&& other) WeakPtr(WeakPtr<U>&& other)