Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Everywhere: Reformat using clang-format 19 #25075

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 45 additions & 10 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,36 @@ runs:
set -e

wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main'

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt-get update
sudo apt-get install ccache clang-18 clang++-18 clang-format-18 lld-18 gcc-13 g++-13 libstdc++-13-dev ninja-build unzip qt6-base-dev qt6-tools-dev-tools libqt6svg6-dev qt6-multimedia-dev libgl1-mesa-dev libpulse-dev libssl-dev libegl1-mesa-dev libclang-18-dev

sudo apt-get remove clang-{13,14,15} clang++-{13,14,15} libclang-{13,14,15}-dev llvm-{13,14,15}
sudo apt-get install clang-18 clang++-18 llvm-18 llvm-18-dev
sudo apt-get install ccache \
clang++-19 \
clang-19 \
clang-format-19 \
g++-13 \
gcc-13 \
libclang-19-dev \
libegl1-mesa-dev \
libgl1-mesa-dev \
libpulse-dev \
libqt6svg6-dev \
libssl-dev \
libstdc++-13-dev \
lld-19 \
llvm-19 \
llvm-19-dev \
ninja-build \
qt6-base-dev \
qt6-multimedia-dev \
qt6-tools-dev-tools \
unzip

sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-19 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100

Expand Down Expand Up @@ -63,14 +81,31 @@ runs:
set -e

wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main'

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt-get update
sudo apt-get remove clang-{13,14,15} clang++-{13,14,15} libclang-{13,14,15}-dev llvm-{13,14,15}
sudo apt-get install clang-format-18 ccache e2fsprogs gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip generate-ninja libegl1-mesa-dev
sudo apt-get install clang-18 clang++-18 llvm-18 llvm-18-dev
sudo apt-get install ccache \
clang++-19 \
clang-19 \
clang-format-19 \
e2fsprogs \
g++-13 \
gcc-13 \
generate-ninja \
libegl1-mesa-dev \
libmpc-dev \
libmpfr-dev \
libstdc++-13-dev \
llvm-19 \
llvm-19-dev \
ninja-build \
optipng \
qemu-system-i386 \
qemu-utils \
unzip

- name: Enable KVM group perms
if: ${{ inputs.os == 'Serenity' }}
Expand All @@ -86,4 +121,4 @@ runs:
run: |
set -e
brew update
brew install coreutils bash ninja wabt ccache unzip qt llvm@18
brew install coreutils bash ninja wabt ccache unzip qt llvm@19
8 changes: 4 additions & 4 deletions .github/workflows/lagom-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ jobs:
run: |
if ${{ inputs.os_name == 'Linux' }} ; then
if ${{ inputs.toolchain == 'Clang' }} ; then
echo "host_cc=clang-18" >> "$GITHUB_OUTPUT"
echo "host_cxx=clang++-18" >> "$GITHUB_OUTPUT"
echo "host_cc=clang-19" >> "$GITHUB_OUTPUT"
echo "host_cxx=clang++-19" >> "$GITHUB_OUTPUT"
elif ${{ inputs.toolchain == 'GNU' }} ; then
echo "host_cc=gcc-13" >> "$GITHUB_OUTPUT"
echo "host_cxx=g++-13" >> "$GITHUB_OUTPUT"
fi
elif ${{ inputs.os_name == 'macOS' }} ; then
echo "host_cc=$(brew --prefix llvm@18)/bin/clang" >> "$GITHUB_OUTPUT"
echo "host_cxx=$(brew --prefix llvm@18)/bin/clang++" >> "$GITHUB_OUTPUT"
echo "host_cc=$(brew --prefix llvm@19)/bin/clang" >> "$GITHUB_OUTPUT"
echo "host_cxx=$(brew --prefix llvm@19)/bin/clang++" >> "$GITHUB_OUTPUT"
fi

# https://github.com/actions/runner-images/issues/9330
Expand Down
14 changes: 7 additions & 7 deletions AK/DistinctNumeric.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ namespace AK {
*/

namespace DistinctNumericFeature {
enum Arithmetic {};
enum CastToBool {};
enum CastToUnderlying {};
enum Comparison {};
enum Flags {};
enum Increment {};
enum Shift {};
enum Arithmetic { };
enum CastToBool { };
enum CastToUnderlying { };
enum Comparison { };
enum Flags { };
enum Increment { };
enum Shift { };
};

template<typename T, typename X, typename... Opts>
Expand Down
58 changes: 29 additions & 29 deletions AK/IntrusiveList.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class IntrusiveListNode;

struct ExtractIntrusiveListTypes {
template<typename V, typename Container, typename T>
static V value(IntrusiveListNode<V, Container> T::*x);
static V value(IntrusiveListNode<V, Container> T::* x);
template<typename V, typename Container, typename T>
static Container container(IntrusiveListNode<V, Container> T::*x);
static Container container(IntrusiveListNode<V, Container> T::* x);
};

template<typename T, typename Container = RawPtr<T>>
Expand All @@ -37,14 +37,14 @@ class IntrusiveListStorage {
private:
friend class IntrusiveListNode<T, Container>;

template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::*member>
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::* member>
friend class IntrusiveList;

SubstitutedIntrusiveListNode<T, Container>* m_first { nullptr };
SubstitutedIntrusiveListNode<T, Container>* m_last { nullptr };
};

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
class IntrusiveList {
AK_MAKE_NONCOPYABLE(IntrusiveList);
AK_MAKE_NONMOVABLE(IntrusiveList);
Expand Down Expand Up @@ -166,7 +166,7 @@ class IntrusiveListNode {
// to be of equal types. so for now, just make the members public on clang.
#if !defined(AK_COMPILER_CLANG)
private:
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::*member>
template<class T_, typename Container_, SubstitutedIntrusiveListNode<T_, Container_> T_::* member>
friend class ::AK::Detail::IntrusiveList;
#endif

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

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline typename IntrusiveList<T, Container, member>::Iterator& IntrusiveList<T, Container, member>::Iterator::erase()
{
auto old = m_value;
Expand All @@ -185,26 +185,26 @@ inline typename IntrusiveList<T, Container, member>::Iterator& IntrusiveList<T,
return *this;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline IntrusiveList<T, Container, member>::~IntrusiveList()
{
clear();
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::clear()
{
while (m_storage.m_first)
m_storage.m_first->remove();
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline bool IntrusiveList<T, Container, member>::is_empty() const
{
return m_storage.m_first == nullptr;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline size_t IntrusiveList<T, Container, member>::size_slow() const
{
size_t size = 0;
Expand All @@ -215,7 +215,7 @@ inline size_t IntrusiveList<T, Container, member>::size_slow() const
return size;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::append(T& n)
{
remove(n);
Expand All @@ -234,7 +234,7 @@ inline void IntrusiveList<T, Container, member>::append(T& n)
m_storage.m_first = &nnode;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::prepend(T& n)
{
remove(n);
Expand All @@ -253,7 +253,7 @@ inline void IntrusiveList<T, Container, member>::prepend(T& n)
m_storage.m_last = &nnode;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::insert_before(T& bn, T& n)
{
remove(n);
Expand All @@ -275,28 +275,28 @@ inline void IntrusiveList<T, Container, member>::insert_before(T& bn, T& n)
new_node.m_self.reference = &n;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline void IntrusiveList<T, Container, member>::remove(T& n)
{
auto& nnode = n.*member;
if (nnode.m_storage)
nnode.remove();
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline bool IntrusiveList<T, Container, member>::contains(T const& n) const
{
auto& nnode = n.*member;
return nnode.m_storage == &m_storage;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline Container IntrusiveList<T, Container, member>::first() const
{
return m_storage.m_first ? node_to_value(*m_storage.m_first) : nullptr;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline Container IntrusiveList<T, Container, member>::take_first()
{
if (Container ptr = first()) {
Expand All @@ -306,7 +306,7 @@ inline Container IntrusiveList<T, Container, member>::take_first()
return nullptr;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline Container IntrusiveList<T, Container, member>::take_last()
{
if (Container ptr = last()) {
Expand All @@ -316,63 +316,63 @@ inline Container IntrusiveList<T, Container, member>::take_last()
return nullptr;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline Container IntrusiveList<T, Container, member>::last() const
{
return m_storage.m_last ? node_to_value(*m_storage.m_last) : nullptr;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline T const* IntrusiveList<T, Container, member>::next(T const* current)
{
auto& nextnode = (current->*member).m_next;
T const* nextstruct = nextnode ? node_to_value(*nextnode) : nullptr;
return nextstruct;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline T const* IntrusiveList<T, Container, member>::prev(T const* current)
{
auto& prevnode = (current->*member).m_prev;
T const* prevstruct = prevnode ? node_to_value(*prevnode) : nullptr;
return prevstruct;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline T* IntrusiveList<T, Container, member>::next(T* current)
{
auto& nextnode = (current->*member).m_next;
T* nextstruct = nextnode ? node_to_value(*nextnode) : nullptr;
return nextstruct;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline T* IntrusiveList<T, Container, member>::prev(T* current)
{
auto& prevnode = (current->*member).m_prev;
T* prevstruct = prevnode ? node_to_value(*prevnode) : nullptr;
return prevstruct;
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline typename IntrusiveList<T, Container, member>::Iterator IntrusiveList<T, Container, member>::begin()
{
return m_storage.m_first ? Iterator(node_to_value(*m_storage.m_first)) : Iterator();
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline typename IntrusiveList<T, Container, member>::ReverseIterator IntrusiveList<T, Container, member>::rbegin()
{
return m_storage.m_last ? ReverseIterator(node_to_value(*m_storage.m_last)) : ReverseIterator();
}

template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, SubstitutedIntrusiveListNode<T, Container> T::* member>
inline typename IntrusiveList<T, Container, member>::ConstIterator IntrusiveList<T, Container, member>::begin() const
{
return m_storage.m_first ? ConstIterator(node_to_value(*m_storage.m_first)) : ConstIterator();
}

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

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

template<class T, SubstitutedIntrusiveListNode<T, NonnullLockRefPtr<T>> T::*member>
template<class T, SubstitutedIntrusiveListNode<T, NonnullLockRefPtr<T>> T::* member>
class IntrusiveList<T, NonnullLockRefPtr<T>, member> : public IntrusiveList<T, LockRefPtr<T>, member> {
public:
[[nodiscard]] NonnullLockRefPtr<T> first() const { return *IntrusiveList<T, LockRefPtr<T>, member>::first(); }
Expand Down
2 changes: 1 addition & 1 deletion AK/IntrusiveListRelaxedConst.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace AK {
namespace Detail {

template<class T, typename Container, IntrusiveListNode<T, Container> T::*member>
template<class T, typename Container, IntrusiveListNode<T, Container> T::* member>
class IntrusiveListRelaxedConst : public IntrusiveList<T, Container, member> {
AK_MAKE_NONCOPYABLE(IntrusiveListRelaxedConst);
AK_MAKE_NONMOVABLE(IntrusiveListRelaxedConst);
Expand Down
Loading
Loading