Skip to content

Commit 5c818e3

Browse files
authored
updated CI to Clang 21 (#7272)
1 parent 588728c commit 5c818e3

19 files changed

+157
-140
lines changed

.clang-tidy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ Checks: >
5050
-modernize-type-traits,
5151
-modernize-use-designated-initializers,
5252
-modernize-use-nodiscard,
53+
-modernize-use-scoped-lock,
5354
-modernize-use-trailing-return-type,
5455
-performance-avoid-endl,
5556
-performance-inefficient-string-concatenation,
5657
-performance-no-automatic-move,
58+
-portability-avoid-pragma-once,
5759
-portability-simd-intrinsics,
5860
-portability-std-allocator-const,
5961
-readability-avoid-nested-conditional-operator,
@@ -68,7 +70,8 @@ Checks: >
6870
-readability-isolate-declaration,
6971
-readability-magic-numbers,
7072
-readability-suspicious-call-argument,
71-
-readability-uppercase-literal-suffix
73+
-readability-uppercase-literal-suffix,
74+
-readability-use-concise-preprocessor-directives
7275
WarningsAsErrors: '*'
7376
HeaderFilterRegex: '(cli|gui|frontend|lib|oss-fuzz|test|triage)\/[a-z_]+\.h'
7477
ExcludeHeaderFilterRegex: 'ui_.*.h'
@@ -77,3 +80,5 @@ CheckOptions:
7780
value: '1'
7881
- key: readability-simplify-boolean-expr.SimplifyDeMorgan
7982
value: '0'
83+
- key: modernize-use-trailing-return-type.TransformFunctions
84+
value: false

.github/workflows/asan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
5454
wget https://apt.llvm.org/llvm.sh
5555
chmod +x llvm.sh
56-
sudo ./llvm.sh 20
56+
sudo ./llvm.sh 21
5757
5858
- name: Install Qt ${{ env.QT_VERSION }}
5959
uses: jurplel/install-qt-action@v4
@@ -76,8 +76,8 @@ jobs:
7676
run: |
7777
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
7878
env:
79-
CC: clang-20
80-
CXX: clang++-20
79+
CC: clang-21
80+
CXX: clang++-21
8181

8282
- name: Build cppcheck
8383
run: |

.github/workflows/clang-tidy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
4444
wget https://apt.llvm.org/llvm.sh
4545
chmod +x llvm.sh
46-
sudo ./llvm.sh 20
47-
sudo apt-get install -y clang-tidy-20
46+
sudo ./llvm.sh 21
47+
sudo apt-get install -y clang-tidy-21
4848
4949
- name: Install Qt ${{ env.QT_VERSION }}
5050
uses: jurplel/install-qt-action@v4
@@ -57,14 +57,14 @@ jobs:
5757

5858
- name: Verify clang-tidy configuration
5959
run: |
60-
clang-tidy-20 --verify-config
60+
clang-tidy-21 --verify-config
6161
6262
- name: Prepare CMake
6363
run: |
6464
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCPPCHK_GLIBCXX_DEBUG=Off -DWARNINGS_ARE_ERRORS=On
6565
env:
66-
CC: clang-20
67-
CXX: clang++-20
66+
CC: clang-21
67+
CXX: clang++-21
6868

6969
- name: Prepare CMake dependencies
7070
run: |

.github/workflows/iwyu.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ jobs:
215215
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
216216
wget https://apt.llvm.org/llvm.sh
217217
chmod +x llvm.sh
218-
sudo ./llvm.sh 20
219-
sudo apt-get install -y clang-tools-20
218+
sudo ./llvm.sh 21
219+
sudo apt-get install -y clang-tools-21
220220
221221
- name: Install libc++
222222
if: matrix.stdlib == 'libc++'
223223
run: |
224-
sudo apt-get install -y libc++-20-dev
224+
sudo apt-get install -y libc++-21-dev
225225
226226
- name: Install Qt ${{ env.QT_VERSION }}
227227
uses: jurplel/install-qt-action@v4
@@ -237,8 +237,8 @@ jobs:
237237
# TODO: why does it build dmake in the next step?
238238
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On -DUSE_LIBCXX=${{ matrix.use_libcxx }}
239239
env:
240-
CC: clang-20
241-
CXX: clang++-20
240+
CC: clang-21
241+
CXX: clang++-21
242242

243243
- name: Prepare CMake dependencies
244244
run: |
@@ -255,7 +255,7 @@ jobs:
255255
- name: clang-include-cleaner
256256
run: |
257257
# TODO: run multi-threaded
258-
find $PWD/cli $PWD/lib $PWD/test $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-20 --print=changes --extra-arg=-w --extra-arg=-stdlib=${{ matrix.stdlib }} -p cmake.output > clang-include-cleaner.log 2>&1
258+
find $PWD/cli $PWD/lib $PWD/test $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-21 --print=changes --extra-arg=-w --extra-arg=-stdlib=${{ matrix.stdlib }} -p cmake.output > clang-include-cleaner.log 2>&1
259259
260260
- uses: actions/upload-artifact@v4
261261
if: success() || failure()

.github/workflows/tsan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
5454
wget https://apt.llvm.org/llvm.sh
5555
chmod +x llvm.sh
56-
sudo ./llvm.sh 20
56+
sudo ./llvm.sh 21
5757
5858
- name: Install Qt ${{ env.QT_VERSION }}
5959
uses: jurplel/install-qt-action@v4
@@ -75,8 +75,8 @@ jobs:
7575
run: |
7676
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
7777
env:
78-
CC: clang-20
79-
CXX: clang++-20
78+
CC: clang-21
79+
CXX: clang++-21
8080

8181
- name: Build cppcheck
8282
run: |

.github/workflows/ubsan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
5454
wget https://apt.llvm.org/llvm.sh
5555
chmod +x llvm.sh
56-
sudo ./llvm.sh 20
56+
sudo ./llvm.sh 21
5757
5858
- name: Install Qt ${{ env.QT_VERSION }}
5959
uses: jurplel/install-qt-action@v4
@@ -76,8 +76,8 @@ jobs:
7676
run: |
7777
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
7878
env:
79-
CC: clang-20
80-
CXX: clang++-20
79+
CC: clang-21
80+
CXX: clang++-21
8181

8282
- name: Build cppcheck
8383
run: |

clang-tidy.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ These are coding guidelines we do not follow. Some of the checks might be explic
3333

3434
`readability-braces-around-statements`<br/>
3535
`readability-isolate-declaration`<br/>
36-
`modernize-use-trailing-return-type`<br/>
3736
`readability-uppercase-literal-suffix`<br/>
3837
`readability-identifier-length`<br/>
3938

@@ -112,7 +111,11 @@ Also reports a false positive about templates which deduce the array length: htt
112111

113112
`misc-include-cleaner`<br/>
114113

115-
We run this separately via `clang-include-cleaner` in the `iwyu.yml` workflow as the findings of the include checkers still need to be reviewed manually before applying them.
114+
We run this separately via `clang-include-cleaner` in the `iwyu.yml` workflow as the findings of the include checkers still need to be reviewed manually before applying them.
115+
116+
`readability-use-concise-preprocessor-directives`<br/>
117+
118+
Does not improve the readability.
116119

117120
`bugprone-branch-clone`<br/>
118121
`modernize-return-braced-init-list`<br/>
@@ -126,6 +129,7 @@ We run this separately via `clang-include-cleaner` in the `iwyu.yml` workflow as
126129
`readability-avoid-nested-conditional-operator`<br/>
127130
`modernize-use-designated-initializers`<br/>
128131
`readability-enum-initial-value`<br/>
132+
`modernize-use-trailing-return-type`<br/>
129133

130134
To be evaluated (need to remove exclusion).
131135

@@ -144,9 +148,14 @@ To be evaluated (need to enable explicitly).
144148

145149
`modernize-type-traits`<br/>
146150
`modernize-use-nodiscard`<br/>
151+
`modernize-use-scoped-lock`<br/>
147152

148153
These apply to codebases which use later standards then C++11 (C++17 is used when building with Qt6) so we cannot simply apply them.
149154

155+
`portability-avoid-pragma-once`<br/>
156+
157+
We are not interested in this.
158+
150159
### Disabled for performance reasons
151160

152161
`portability-std-allocator-const`<br/>

cli/processexecutor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ namespace {
127127
const ssize_t bytes_written = write(mWpipe, data, to_write);
128128
if (bytes_written <= 0) {
129129
const int err = errno;
130-
std::cerr << "#### ThreadExecutor::writeToPipeInternal() error for type " << type << ": " << std::strerror(err) << std::endl;
130+
std::cerr << "#### ThreadExecutor::writeToPipeInternal() error for type " << static_cast<unsigned char>(type) << ": " << std::strerror(err) << std::endl;
131131
std::exit(EXIT_FAILURE);
132132
}
133133
// TODO: write until everything is written
134134
if (bytes_written != to_write) {
135-
std::cerr << "#### ThreadExecutor::writeToPipeInternal() error for type " << type << ": insufficient data written (expected: " << to_write << " / got: " << bytes_written << ")" << std::endl;
135+
std::cerr << "#### ThreadExecutor::writeToPipeInternal() error for type " << static_cast<unsigned char>(type) << ": insufficient data written (expected: " << to_write << " / got: " << bytes_written << ")" << std::endl;
136136
std::exit(EXIT_FAILURE);
137137
}
138138
}

cli/signalhandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#ifdef __USE_DYNAMIC_STACK_SIZE
5959
static constexpr size_t MYSTACKSIZE = (16*1024)+32768; // wild guess about a reasonable buffer
6060
#else
61-
static constexpr size_t MYSTACKSIZE = 16*1024+SIGSTKSZ; // wild guess about a reasonable buffer
61+
static constexpr size_t MYSTACKSIZE = (16*1024)+SIGSTKSZ; // wild guess about a reasonable buffer
6262
#endif
6363
static char mytstack[MYSTACKSIZE]= {0}; // alternative stack for signal handler
6464
static bool bStackBelowHeap=false; // lame attempt to locate heap vs. stack address space. See CppCheckExecutor::check_wrapper()

cmake/clang_tidy.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if(NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
1111
message(STATUS "Cannot use non-Clang compiler with clang-tidy when precompiled headers are enabled - skipping 'run-clang-tidy'/'run-clang-tidy-csa' target generation")
1212
endif()
1313
else()
14-
set(RUN_CLANG_TIDY_NAMES run-clang-tidy run-clang-tidy-20 run-clang-tidy-19 run-clang-tidy-18 run-clang-tidy-17 run-clang-tidy-16 run-clang-tidy-15 run-clang-tidy-14 run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8)
14+
set(RUN_CLANG_TIDY_NAMES run-clang-tidy run-clang-tidy-21 run-clang-tidy-20 run-clang-tidy-19 run-clang-tidy-18 run-clang-tidy-17 run-clang-tidy-16 run-clang-tidy-15 run-clang-tidy-14 run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8)
1515
endif()
1616

1717
if(RUN_CLANG_TIDY_NAMES)
@@ -32,10 +32,9 @@ if(RUN_CLANG_TIDY_NAMES)
3232
# clang-analyzer-cplusplus.NewDelete
3333
# clang-analyzer-core.NullDereference
3434
# clang-analyzer-unix.Stream
35-
# clang-analyzer-optin.cplusplus.UninitializedObject - false positives with unnamed fields - see https://github.com/llvm/llvm-project/issues/132001
3635
# clang-analyzer-alpha.clone.CloneChecker
3736
# clang-analyzer-alpha.webkit.* - we are not interested in these
38-
set(CLANG_TIDY_CSA_CONFIG "-config={InheritParentConfig: true, Checks: '-*,clang-analyzer-*,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-analyzer-cplusplus.NewDelete,-clang-analyzer-core.NullDereference,-clang-analyzer-unix.Stream,-clang-analyzer-optin.cplusplus.UninitializedObject,-clang-analyzer-alpha.clone.CloneChecker,-clang-analyzer-alpha.webkit.*'}")
37+
set(CLANG_TIDY_CSA_CONFIG "-config={InheritParentConfig: true, Checks: '-*,clang-analyzer-*,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-analyzer-cplusplus.NewDelete,-clang-analyzer-core.NullDereference,-clang-analyzer-unix.Stream,-clang-analyzer-alpha.clone.CloneChecker,-clang-analyzer-alpha.webkit.*'}")
3938
if (ENABLE_CSA_ALPHA)
4039
set(CLANG_TIDY_CSA_ALPHA_OPTS "-allow-enabling-alpha-checkers" "-extra-arg=-Xclang" "-extra-arg=-analyzer-config" "-extra-arg=-Xclang" "-extra-arg=aggressive-binary-operation-simplification=true")
4140
endif()

0 commit comments

Comments
 (0)