1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +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);
}
template<typename T>
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>
class Badge {
friend T;
Badge() {}
Badge() { }
Badge(const Badge&) = delete;
Badge& operator=(const Badge&) = delete;
@ -43,4 +43,3 @@ class Badge {
}
using AK::Badge;

View file

@ -38,7 +38,7 @@ template<typename Out, typename... In>
class Function<Out(In...)> {
public:
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>
Function(CallableType&& callable)
@ -83,7 +83,7 @@ public:
private:
class CallableWrapperBase {
public:
virtual ~CallableWrapperBase() {}
virtual ~CallableWrapperBase() { }
virtual Out call(In...) const = 0;
};

View file

@ -276,7 +276,6 @@ void GenericLexer::ignore_until(Condition condition)
m_index++;
}
bool is_control(char c)
{
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)
{
if constexpr(sizeof(ptr) == 8)
if constexpr (sizeof(ptr) == 8)
return u64_hash((u64)ptr);
else
return int_hash((u32)ptr);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -26,14 +26,13 @@
#pragma once
#include <AK/NonnullPtrVector.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/NonnullPtrVector.h>
namespace AK {
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 {
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;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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