Skip to content

Commit e07ed95

Browse files
Support llvm 22 for clang-format (#485)
- Isolate code that has changed in behaviour since version 20 and use clang-format off comments to ignore - CoroutineScheduler.h and VulkanDevice.h for operator bool() - VulkanDevice.cpp for re-aligned declarations - RenderPasses.cpp for re-aligned function signature - update CI workflows for all OSs to use version 22 Co-authored-by: Mathew Benson <mathew@benson.co.ke>
1 parent 3e0a68b commit e07ed95

File tree

12 files changed

+38
-15
lines changed

12 files changed

+38
-15
lines changed

.github/workflows/job-clangformat.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
- name: Checkout repository
1515
uses: actions/checkout@v4
1616

17+
- name: update llvm to version 22
18+
run: choco upgrade llvm
19+
1720
- name: Checking formatting
1821
run: .\Scripts\ClangFormat.ps1 -SourceDirectory ${{ github.workspace }}/${{ inputs.srcDirectory }} -RunAsCheck 1
1922
shell: pwsh

.github/workflows/job-cmakebuild-linux.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ jobs:
2525
- name: Register the Microsoft repository GPG keys
2626
run: sudo dpkg -i packages-microsoft-prod.deb
2727

28-
- name: Install LLVM-20
28+
- name: Install LLVM-22
2929
run: |
3030
wget https://apt.llvm.org/llvm.sh
3131
chmod +x llvm.sh
32-
sudo ./llvm.sh 20
32+
sudo ./llvm.sh 22
3333
34-
- name: Update the list of packages after we added packages.microsoft.com
34+
- name: Update the list of packages
3535
run: sudo apt-get update
36-
- name: Install development library
37-
run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake apt-transport-https software-properties-common gcc g++ powershell clang-format-20 libwayland-dev libxkbcommon-dev dotnet-sdk-8.0
36+
37+
- name: Install Dependencies
38+
run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake apt-transport-https software-properties-common gcc g++ powershell clang-format-22 glslang-tools libwayland-dev libxkbcommon-dev
3839

3940
- name: CMake Build
4041
run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}}

.github/workflows/job-cmakebuild-macOS.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
- name: Install NuGet CLI
2727
run: brew install nuget
2828

29+
- name: Update LLVM
30+
run: brew install llvm
31+
2932
- name: CMake Build
3033
run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}} -Architecture ${{inputs.architecture}} -RunClangFormat 0
3134
shell: pwsh

.github/workflows/job-cmakebuild-windows.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ on:
1818
jobs:
1919
cmake-build:
2020
name: cmake-build-windows-${{ inputs.configuration }}
21-
runs-on: windows-2022
21+
runs-on: windows-2025
2222
steps:
2323
- name: Checkout repository
2424
uses: actions/checkout@v4
2525

26+
- name: update llvm to version 22
27+
run: choco upgrade llvm
28+
2629
- name: CMake Build
2730
run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}} -RunClangFormat 0
2831
shell: pwsh

.github/workflows/job-deploy-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
jobs:
1616
deploy:
1717
name: deploy-windows-x64-${{ inputs.configuration }}
18-
runs-on: windows-2022
18+
runs-on: windows-2025
1919
steps:
2020
- uses: actions/download-artifact@v4
2121
with:

.github/workflows/job-test-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
jobs:
1313
test:
1414
name: test-windows-${{ inputs.configuration }}
15-
runs-on: windows-2022
15+
runs-on: windows-2025
1616
steps:
1717
- name: Download All Artifacts
1818
uses: actions/download-artifact@v4

Scripts/Shared.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ function Find-ClangFormat () {
201201
}
202202
if ($IsLinux) {
203203
'/usr/bin/clang-format'
204+
'/usr/bin/clang-format-22'
205+
'/usr/bin/clang-format-21'
204206
'/usr/bin/clang-format-20'
205207
}
206208
'clang-format'

ZEngine/ZEngine/Core/CoroutineScheduler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ namespace ZEngine::Core
1414

1515
ReadyCallback Ready = nullptr;
1616
ExecuteCallback Action = nullptr;
17-
17+
// clang-format off
1818
operator bool() noexcept
1919
{
2020
return (Ready && Action);
2121
}
22+
// clang-format on
2223
};
2324

2425
struct CoroutineScheduler

ZEngine/ZEngine/Hardwares/VulkanDevice.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ namespace ZEngine::Hardwares
633633
VkSemaphore semaphores[] = {signal_semaphore->GetHandle()};
634634
VkCommandBuffer buffers[] = {command_buffer->GetHandle()};
635635
VkSubmitInfo submit_info = {
636+
// clang-format off
636637
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
637638
.pNext = nullptr,
638639
.waitSemaphoreCount = 0,
@@ -642,6 +643,7 @@ namespace ZEngine::Hardwares
642643
.pCommandBuffers = buffers,
643644
.signalSemaphoreCount = 0,
644645
.pSignalSemaphores = 0,
646+
//clang-format on
645647
};
646648

647649
ZENGINE_VALIDATE_ASSERT(vkQueueSubmit(GetQueue(command_buffer->QueueType).Handle, 1, &submit_info, fence->GetHandle()) == VK_SUCCESS, "Failed to submit queue")
@@ -2582,10 +2584,12 @@ namespace ZEngine::Hardwares
25822584
uint32_t byte_per_pixel = Specifications::BytePerChannelMap[VALUE_FROM_SPEC_MAP(Specifications::ImageFormat::R8G8B8A8_SRGB)];
25832585

25842586
Specifications::TextureSpecification spec = {
2587+
// clang-format off
25852588
.Width = width,
25862589
.Height = height,
25872590
.BytePerPixel = byte_per_pixel,
25882591
.Format = Specifications::ImageFormat::R8G8B8A8_SRGB,
2592+
// clang-format on
25892593
};
25902594

25912595
auto tex_handle = CreateTexture(spec);

ZEngine/ZEngine/Hardwares/VulkanDevice.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,12 @@ namespace ZEngine::Hardwares
7676
BufferType Type = BufferType::UNKNOWN;
7777
VkBuffer Handle = VK_NULL_HANDLE;
7878
VmaAllocation Allocation = nullptr;
79-
79+
// clang-format off
8080
operator bool() const
8181
{
8282
return (Handle != VK_NULL_HANDLE);
8383
}
84+
// clang-format on
8485
};
8586

8687
struct BufferImage
@@ -90,11 +91,12 @@ namespace ZEngine::Hardwares
9091
VkImageView ViewHandle{VK_NULL_HANDLE};
9192
VkSampler Sampler{VK_NULL_HANDLE};
9293
VmaAllocation Allocation{nullptr};
93-
94+
// clang-format off
9495
operator bool() const
9596
{
9697
return (Handle != VK_NULL_HANDLE);
9798
}
99+
// clang-format on
98100
};
99101

100102
struct IGraphicBuffer

0 commit comments

Comments
 (0)