Skip to content

Commit 0ff1f39

Browse files
LucasChollettimschumi
authored andcommitted
Everywhere: Run clang-format
The following command was used to clang-format these files: clang-format-20 -i $(find . \ -not \( -path "./\.*" -prune \) \ -not \( -path "./Base/*" -prune \) \ -not \( -path "./Build/*" -prune \) \ -not \( -path "./Toolchain/*" -prune \) \ -not \( -path "./Ports/*" -prune \) \ -type f -name "*.cpp" -o -name "*.mm" -o -name "*.h")
1 parent 8a3f29f commit 0ff1f39

File tree

121 files changed

+471
-412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+471
-412
lines changed

AK/DistinctNumeric.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ namespace AK {
4646
*/
4747

4848
namespace DistinctNumericFeature {
49-
enum Arithmetic {};
50-
enum CastToBool {};
51-
enum CastToUnderlying {};
52-
enum Comparison {};
53-
enum Flags {};
54-
enum Increment {};
55-
enum Shift {};
49+
enum Arithmetic { };
50+
enum CastToBool { };
51+
enum CastToUnderlying { };
52+
enum Comparison { };
53+
enum Flags { };
54+
enum Increment { };
55+
enum Shift { };
5656
};
5757

5858
template<typename T, typename X, typename... Opts>

AK/IntrusiveList.h

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class IntrusiveListNode;
2424

2525
struct ExtractIntrusiveListTypes {
2626
template<typename V, typename Container, typename T>
27-
static V value(IntrusiveListNode<V, Container> T::*x);
27+
static V value(IntrusiveListNode<V, Container> T::* x);
2828
template<typename V, typename Container, typename T>
29-
static Container container(IntrusiveListNode<V, Container> T::*x);
29+
static Container container(IntrusiveListNode<V, Container> T::* x);
3030
};
3131

3232
template<typename T, typename Container = RawPtr<T>>
@@ -37,14 +37,14 @@ class IntrusiveListStorage {
3737
private:
3838
friend class IntrusiveListNode<T, Container>;
3939

40-
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::*member>
40+
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::* member>
4141
friend class IntrusiveList;
4242

4343
SubstitutedIntrusiveListNode<T, Container>* m_first { nullptr };
4444
SubstitutedIntrusiveListNode<T, Container>* m_last { nullptr };
4545
};
4646

47-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
47+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
4848
class IntrusiveList {
4949
AK_MAKE_NONCOPYABLE(IntrusiveList);
5050
AK_MAKE_NONMOVABLE(IntrusiveList);
@@ -166,7 +166,7 @@ class IntrusiveListNode {
166166
// to be of equal types. so for now, just make the members public on clang.
167167
#if !defined(AK_COMPILER_CLANG)
168168
private:
169-
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::*member>
169+
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::* member>
170170
friend class ::AK::Detail::IntrusiveList;
171171
#endif
172172

@@ -176,7 +176,7 @@ class IntrusiveListNode {
176176
[[no_unique_address]] SelfReferenceIfNeeded<Container, IsRaw> m_self;
177177
};
178178

179-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
179+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
180180
inline typename IntrusiveList<T, Container, member>::Iterator& IntrusiveList<T, Container, member>::Iterator::erase()
181181
{
182182
auto old = m_value;
@@ -185,26 +185,26 @@ inline typename IntrusiveList<T, Container, member>::Iterator& IntrusiveList<T,
185185
return *this;
186186
}
187187

188-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
188+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
189189
inline IntrusiveList<T, Container, member>::~IntrusiveList()
190190
{
191191
clear();
192192
}
193193

194-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
194+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
195195
inline void IntrusiveList<T, Container, member>::clear()
196196
{
197197
while (m_storage.m_first)
198198
m_storage.m_first->remove();
199199
}
200200

201-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
201+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
202202
inline bool IntrusiveList<T, Container, member>::is_empty() const
203203
{
204204
return m_storage.m_first == nullptr;
205205
}
206206

207-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
207+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
208208
inline size_t IntrusiveList<T, Container, member>::size_slow() const
209209
{
210210
size_t size = 0;
@@ -215,7 +215,7 @@ inline size_t IntrusiveList<T, Container, member>::size_slow() const
215215
return size;
216216
}
217217

218-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
218+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
219219
inline void IntrusiveList<T, Container, member>::append(T& n)
220220
{
221221
remove(n);
@@ -234,7 +234,7 @@ inline void IntrusiveList<T, Container, member>::append(T& n)
234234
m_storage.m_first = &nnode;
235235
}
236236

237-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
237+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
238238
inline void IntrusiveList<T, Container, member>::prepend(T& n)
239239
{
240240
remove(n);
@@ -253,7 +253,7 @@ inline void IntrusiveList<T, Container, member>::prepend(T& n)
253253
m_storage.m_last = &nnode;
254254
}
255255

256-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
256+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
257257
inline void IntrusiveList<T, Container, member>::insert_before(T& bn, T& n)
258258
{
259259
remove(n);
@@ -275,28 +275,28 @@ inline void IntrusiveList<T, Container, member>::insert_before(T& bn, T& n)
275275
new_node.m_self.reference = &n;
276276
}
277277

278-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
278+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
279279
inline void IntrusiveList<T, Container, member>::remove(T& n)
280280
{
281281
auto& nnode = n.*member;
282282
if (nnode.m_storage)
283283
nnode.remove();
284284
}
285285

286-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
286+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
287287
inline bool IntrusiveList<T, Container, member>::contains(T const& n) const
288288
{
289289
auto& nnode = n.*member;
290290
return nnode.m_storage == &m_storage;
291291
}
292292

293-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
293+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
294294
inline Container IntrusiveList<T, Container, member>::first() const
295295
{
296296
return m_storage.m_first ? node_to_value(*m_storage.m_first) : nullptr;
297297
}
298298

299-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
299+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
300300
inline Container IntrusiveList<T, Container, member>::take_first()
301301
{
302302
if (Container ptr = first()) {
@@ -306,7 +306,7 @@ inline Container IntrusiveList<T, Container, member>::take_first()
306306
return nullptr;
307307
}
308308

309-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
309+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
310310
inline Container IntrusiveList<T, Container, member>::take_last()
311311
{
312312
if (Container ptr = last()) {
@@ -316,63 +316,63 @@ inline Container IntrusiveList<T, Container, member>::take_last()
316316
return nullptr;
317317
}
318318

319-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
319+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
320320
inline Container IntrusiveList<T, Container, member>::last() const
321321
{
322322
return m_storage.m_last ? node_to_value(*m_storage.m_last) : nullptr;
323323
}
324324

325-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
325+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
326326
inline T const* IntrusiveList<T, Container, member>::next(T const* current)
327327
{
328328
auto& nextnode = (current->*member).m_next;
329329
T const* nextstruct = nextnode ? node_to_value(*nextnode) : nullptr;
330330
return nextstruct;
331331
}
332332

333-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
333+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
334334
inline T const* IntrusiveList<T, Container, member>::prev(T const* current)
335335
{
336336
auto& prevnode = (current->*member).m_prev;
337337
T const* prevstruct = prevnode ? node_to_value(*prevnode) : nullptr;
338338
return prevstruct;
339339
}
340340

341-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
341+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
342342
inline T* IntrusiveList<T, Container, member>::next(T* current)
343343
{
344344
auto& nextnode = (current->*member).m_next;
345345
T* nextstruct = nextnode ? node_to_value(*nextnode) : nullptr;
346346
return nextstruct;
347347
}
348348

349-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
349+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
350350
inline T* IntrusiveList<T, Container, member>::prev(T* current)
351351
{
352352
auto& prevnode = (current->*member).m_prev;
353353
T* prevstruct = prevnode ? node_to_value(*prevnode) : nullptr;
354354
return prevstruct;
355355
}
356356

357-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
357+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
358358
inline typename IntrusiveList<T, Container, member>::Iterator IntrusiveList<T, Container, member>::begin()
359359
{
360360
return m_storage.m_first ? Iterator(node_to_value(*m_storage.m_first)) : Iterator();
361361
}
362362

363-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
363+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
364364
inline typename IntrusiveList<T, Container, member>::ReverseIterator IntrusiveList<T, Container, member>::rbegin()
365365
{
366366
return m_storage.m_last ? ReverseIterator(node_to_value(*m_storage.m_last)) : ReverseIterator();
367367
}
368368

369-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
369+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
370370
inline typename IntrusiveList<T, Container, member>::ConstIterator IntrusiveList<T, Container, member>::begin() const
371371
{
372372
return m_storage.m_first ? ConstIterator(node_to_value(*m_storage.m_first)) : ConstIterator();
373373
}
374374

375-
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
375+
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
376376
inline T* IntrusiveList<T, Container, member>::node_to_value(SubstitutedIntrusiveListNode<T, Container>& node)
377377
{
378378
// Note: A data member pointer is a 32-bit offset in the Windows ABI (both x86 and x86_64),
@@ -426,7 +426,7 @@ inline bool IntrusiveListNode<T, Container>::is_in_list() const
426426
// By default, intrusive lists cannot contain null entries anyway, so switch to RefPtr
427427
// and just make the user-facing functions deref the pointers.
428428

429-
template<class T, SubstitutedIntrusiveListNode<T, NonnullRefPtr<T>> T::*member>
429+
template<class T, SubstitutedIntrusiveListNode<T, NonnullRefPtr<T>> T::* member>
430430
class IntrusiveList<T, NonnullRefPtr<T>, member> : public IntrusiveList<T, RefPtr<T>, member> {
431431
public:
432432
[[nodiscard]] NonnullRefPtr<T> first() const { return *IntrusiveList<T, RefPtr<T>, member>::first(); }
@@ -441,7 +441,7 @@ class IntrusiveList<T, NonnullRefPtr<T>, member> : public IntrusiveList<T, RefPt
441441
// By default, intrusive lists cannot contain null entries anyway, so switch to LockRefPtr
442442
// and just make the user-facing functions deref the pointers.
443443

444-
template<class T, SubstitutedIntrusiveListNode<T, NonnullLockRefPtr<T>> T::*member>
444+
template<class T, SubstitutedIntrusiveListNode<T, NonnullLockRefPtr<T>> T::* member>
445445
class IntrusiveList<T, NonnullLockRefPtr<T>, member> : public IntrusiveList<T, LockRefPtr<T>, member> {
446446
public:
447447
[[nodiscard]] NonnullLockRefPtr<T> first() const { return *IntrusiveList<T, LockRefPtr<T>, member>::first(); }

AK/IntrusiveListRelaxedConst.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace AK {
1212
namespace Detail {
1313

14-
template<class T, typename Container, IntrusiveListNode<T, Container> T::*member>
14+
template<class T, typename Container, IntrusiveListNode<T, Container> T::* member>
1515
class IntrusiveListRelaxedConst : public IntrusiveList<T, Container, member> {
1616
AK_MAKE_NONCOPYABLE(IntrusiveListRelaxedConst);
1717
AK_MAKE_NONMOVABLE(IntrusiveListRelaxedConst);

AK/IntrusiveRedBlackTree.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ class IntrusiveRedBlackTreeNode;
1616

1717
struct ExtractIntrusiveRedBlackTreeTypes {
1818
template<typename K, typename V, typename Container, typename T>
19-
static K key(IntrusiveRedBlackTreeNode<K, V, Container> T::*x);
19+
static K key(IntrusiveRedBlackTreeNode<K, V, Container> T::* x);
2020
template<typename K, typename V, typename Container, typename T>
21-
static V value(IntrusiveRedBlackTreeNode<K, V, Container> T::*x);
21+
static V value(IntrusiveRedBlackTreeNode<K, V, Container> T::* x);
2222
template<typename K, typename V, typename Container, typename T>
23-
static Container container(IntrusiveRedBlackTreeNode<K, V, Container> T::*x);
23+
static Container container(IntrusiveRedBlackTreeNode<K, V, Container> T::* x);
2424
};
2525

2626
template<Integral K, typename V, typename Container = RawPtr<V>>
2727
using SubstitutedIntrusiveRedBlackTreeNode = IntrusiveRedBlackTreeNode<K, V, typename SubstituteIntrusiveContainerType<V, Container>::Type>;
2828

29-
template<Integral K, typename V, typename Container, SubstitutedIntrusiveRedBlackTreeNode<K, V, Container> V::*member>
29+
template<Integral K, typename V, typename Container, SubstitutedIntrusiveRedBlackTreeNode<K, V, Container> V::* member>
3030
class IntrusiveRedBlackTree : public BaseRedBlackTree<K> {
3131

3232
public:
@@ -200,7 +200,7 @@ class IntrusiveRedBlackTreeNode : public BaseRedBlackTree<K>::Node {
200200

201201
#if !defined(AK_COMPILER_CLANG)
202202
private:
203-
template<Integral TK, typename TV, typename TContainer, SubstitutedIntrusiveRedBlackTreeNode<TK, TV, TContainer> TV::*member>
203+
template<Integral TK, typename TV, typename TContainer, SubstitutedIntrusiveRedBlackTreeNode<TK, TV, TContainer> TV::* member>
204204
friend class ::AK::Detail::IntrusiveRedBlackTree;
205205
#endif
206206

@@ -211,7 +211,7 @@ class IntrusiveRedBlackTreeNode : public BaseRedBlackTree<K>::Node {
211211
// Specialise IntrusiveRedBlackTree for NonnullRefPtr
212212
// By default, red black trees cannot contain null entries anyway, so switch to RefPtr
213213
// and just make the user-facing functions deref the pointers.
214-
template<Integral K, typename V, SubstitutedIntrusiveRedBlackTreeNode<K, V, NonnullRefPtr<V>> V::*member>
214+
template<Integral K, typename V, SubstitutedIntrusiveRedBlackTreeNode<K, V, NonnullRefPtr<V>> V::* member>
215215
class IntrusiveRedBlackTree<K, V, NonnullRefPtr<V>, member> : public IntrusiveRedBlackTree<K, V, RefPtr<V>, member> {
216216
public:
217217
[[nodiscard]] NonnullRefPtr<V> find(K key) const { return IntrusiveRedBlackTree<K, V, RefPtr<V>, member>::find(key).release_nonnull(); }

AK/Memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ inline void secure_zero(void* ptr, size_t size)
4949
// The memory barrier is here to avoid the compiler optimizing
5050
// away the memset when we rely on it for wiping secrets.
5151
asm volatile("" ::
52-
: "memory");
52+
: "memory");
5353
}
5454

5555
// Naive implementation of a constant time buffer comparison function.

AK/Result.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ class [[nodiscard]] Result<void, ErrorT> {
9494
~Result() = default;
9595

9696
// For compatibility with TRY().
97-
void value() {};
98-
void release_value() {};
97+
void value() { }
98+
void release_value() { }
9999

100100
ErrorType& error()
101101
{

AK/StdLibExtraDetails.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ inline constexpr bool IsFunction<Ret(Args...) const volatile> = true;
110110
template<class Ret, class... Args>
111111
inline constexpr bool IsFunction<Ret(Args..., ...) const volatile> = true;
112112
template<class Ret, class... Args>
113-
inline constexpr bool IsFunction<Ret(Args...)&> = true;
113+
inline constexpr bool IsFunction<Ret(Args...) &> = true;
114114
template<class Ret, class... Args>
115-
inline constexpr bool IsFunction<Ret(Args..., ...)&> = true;
115+
inline constexpr bool IsFunction<Ret(Args..., ...) &> = true;
116116
template<class Ret, class... Args>
117117
inline constexpr bool IsFunction<Ret(Args...) const&> = true;
118118
template<class Ret, class... Args>

AK/StdLibExtras.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ requires(IsIntegral<T>)
155155
{
156156
if (!is_constant_evaluated()) {
157157
asm volatile(""
158-
: "+r"(value));
158+
: "+r"(value));
159159
}
160160
}
161161

@@ -165,9 +165,9 @@ requires(!IsIntegral<T>)
165165
{
166166
if (!is_constant_evaluated()) {
167167
asm volatile(""
168-
:
169-
: "m"(value)
170-
: "memory");
168+
:
169+
: "m"(value)
170+
: "memory");
171171
}
172172
}
173173

0 commit comments

Comments
 (0)