Skip to content

Commit cdb53a8

Browse files
author
Colin Davidson
committed
[CI][CLANG-FORMAT] Switch to clang-20-format
This keeps it in line with upstream dpc++. Also fixed up other issues with lit python formatting to fit with dpc++
1 parent d729283 commit cdb53a8

970 files changed

Lines changed: 23186 additions & 24314 deletions

File tree

Some content is hidden

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

.clang-format

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,2 @@
11
---
2-
Language: Cpp
3-
BasedOnStyle: Google
4-
Standard: Cpp11
5-
IncludeBlocks: Regroup
6-
IncludeCategories:
7-
- Regex: '^<.*\.(h|hpp)>'
8-
Priority: 1
9-
- Regex: '^<.*'
10-
Priority: 2
11-
- Regex: '.*'
12-
Priority: 3
13-
DerivePointerAlignment: false
14-
QualifierAlignment: Left
15-
PointerAlignment: Right
16-
Macros:
17-
- CL_LAMBDA_CALLBACK=[[]]
18-
- VK_LAMBDA_CALLBACK=[[]]
19-
...
2+
BasedOnStyle: LLVM

.github/workflows/run_ock_internal_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ jobs:
172172

173173
- name: setup-ubuntu-clang-format
174174
run:
175-
pip install clang-format==19.1.0
175+
pip install clang-format==20.1.8
176176

177177
- name: run clang-format
178178
run: |
179-
# we've installed clang-format-19 in the docker via pip, which just installs it as clang-format,
179+
# we've installed clang-format-20 in the docker via pip, which just installs it as clang-format,
180180
# so just use clang-format-diff and -b clang-format directly
181181
git fetch origin ${{ github.base_ref }}
182182
git diff --no-color origin/${{ github.base_ref }} | \

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,12 @@ find_package(PythonInterp 3.6 REQUIRED)
197197
# which perform static analysis and style checking on source files.
198198
# When updating the version here, also update that used in the merge request
199199
# config
200-
find_package(ClangTools 19 COMPONENTS clang-format clang-tidy)
200+
find_package(ClangTools 19 COMPONENTS clang-tidy)
201201
if(TARGET ClangTools::clang-tidy)
202202
ca_option(CA_CLANG_TIDY_FLAGS STRING
203-
"Semi-color separated list of clang-tidy flags" "")
203+
"Semi-colon separated list of clang-tidy flags" "")
204204
endif()
205+
find_package(ClangTools 20 COMPONENTS clang-format)
205206

206207
# Find the operating systems threading library.
207208
find_package(Threads REQUIRED)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ To install the dependencies on Ubuntu, open the terminal and run:
4545

4646
### Recommended packages
4747
* [Ninja](https://ninja-build.org/)
48-
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html) 16
48+
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html) 20
4949
* [lit](https://llvm.org/docs/CommandGuide/lit.html)
5050

5151
To install the recommended packages, run:
5252
```sh
5353
$ sudo apt install -y ninja-build doxygen python3-pip
54-
$ sudo pip3 install lit virtualenv cmakelint clang-format==19.1.0
54+
$ sudo pip3 install lit virtualenv cmakelint clang-format==20.1.8
5555
```
5656

5757
### Compiling oneAPI Construction Kit

clik/external/hal_cpu/include/device/kernel_if.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ static uintptr_t start_dma(void *dst, const void *src, size_t size_in_bytes,
8383
return xfer_id;
8484
}
8585

86-
static void wait_dma(uintptr_t xfer_id, struct exec_state *e) { /* No-op */
87-
}
86+
static void wait_dma(uintptr_t xfer_id, struct exec_state *e) { /* No-op */ }
8887

8988
#endif // _HAL_CPU_KERNEL_IF_H

clik/external/hal_cpu/source/hal_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class cpu_hal_platform : public hal::hal_t {
5757

5858
cpu_hal_platform() {
5959
hal_device_info = &cpu_hal::setup_cpu_hal_device_info();
60-
60+
6161
static constexpr uint32_t implemented_api_version = 6;
6262
static_assert(implemented_api_version == hal_t::api_version,
6363
"Implemented API version for CPU HAL does not match hal.h");

modules/cargo/include/cargo/allocator.h

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ void free(void *pointer);
5858
/// defined.
5959
///
6060
/// @tparam T Type of object to allocate.
61-
template <class T>
62-
class mallocator {
63-
public:
61+
template <class T> class mallocator {
62+
public:
6463
using value_type = T;
6564
using size_type = size_t;
6665

@@ -87,8 +86,7 @@ class mallocator {
8786
///
8887
/// @return A constructed `value_type` pointer on success, or `nullptr`
8988
/// otherwise.
90-
template <class... Args>
91-
value_type *create(Args &&...args) {
89+
template <class... Args> value_type *create(Args &&...args) {
9290
value_type *object = static_cast<T *>(cargo::alloc(sizeof(T), alignof(T)));
9391
new (object) value_type(std::forward<Args>(args)...);
9492
return object;
@@ -113,9 +111,8 @@ class mallocator {
113111
/// number of contained elements.
114112
///
115113
/// @tparam T Type of the object to allocate.
116-
template <class T>
117-
class nullacator {
118-
public:
114+
template <class T> class nullacator {
115+
public:
119116
using value_type = T;
120117
using size_type = size_t;
121118

@@ -132,10 +129,7 @@ class nullacator {
132129
/// @tparam Args Constructor argument parameter type pack.
133130
///
134131
/// @return Returns a `nullptr`, always.
135-
template <class... Args>
136-
value_type *create(Args &&...) {
137-
return nullptr;
138-
}
132+
template <class... Args> value_type *create(Args &&...) { return nullptr; }
139133

140134
/// @brief Destroy and free a constructed object.
141135
void destroy(value_type *) {}
@@ -159,9 +153,8 @@ class nullacator {
159153
/// ```
160154
///
161155
/// @tparam T Type of the object to delete.
162-
template <class T>
163-
class deleter {
164-
public:
156+
template <class T> class deleter {
157+
public:
165158
/// @brief Destroy and deallocate object.
166159
///
167160
/// @param ptr Pointer to object to be destroyed.
@@ -172,6 +165,6 @@ class deleter {
172165
};
173166

174167
/// @}
175-
} // namespace cargo
168+
} // namespace cargo
176169

177-
#endif // CARGO_ALLOCATOR_H_INCLUDED
170+
#endif // CARGO_ALLOCATOR_H_INCLUDED

modules/cargo/include/cargo/argument_parser.h

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ namespace cargo {
5757

5858
/// @brief Description of an argument used with `cargo::argument_parser`.
5959
class argument {
60-
public:
60+
public:
6161
/// @brief Parse result, used in `cargo::argument_parser::parse_args`.
6262
enum class parse : uint32_t {
63-
NOT_FOUND, ///< Given argument was not found.
64-
INVALID, ///< Given argument is invalid.
65-
INCOMPLETE, ///< Given argument requires further parsing.
66-
COMPLETE, ///< Given argument parsing completed.
63+
NOT_FOUND, ///< Given argument was not found.
64+
INVALID, ///< Given argument is invalid.
65+
INCOMPLETE, ///< Given argument requires further parsing.
66+
COMPLETE, ///< Given argument parsing completed.
6767
};
6868

6969
/// @brief Type to store the bitset of parsing options.
7070
using option_bitset = uint8_t;
7171
/// @brief Enumeration of argument parsing options.
7272
enum option : uint8_t {
73-
NONE = 0, ///< No optional behavior enabled.
74-
STORE_TRUE = 0x1 << 1, ///< Store `bool` argument as `true`.
75-
STORE_FALSE = 0x1 << 2, ///< Store `bool` argument as `false`.
73+
NONE = 0, ///< No optional behavior enabled.
74+
STORE_TRUE = 0x1 << 1, ///< Store `bool` argument as `true`.
75+
STORE_FALSE = 0x1 << 2, ///< Store `bool` argument as `false`.
7676
};
7777

7878
/// @brief Function type for custom handlers.
@@ -107,8 +107,7 @@ class argument {
107107
cargo::array_view<cargo::string_view> choices,
108108
cargo::string_view &storage,
109109
cargo::argument::option_bitset options = NONE)
110-
: Name(name),
111-
Variant(ChoiceT{std::addressof(storage), choices}),
110+
: Name(name), Variant(ChoiceT{std::addressof(storage), choices}),
112111
Options(options) {}
113112

114113
/// @brief Construct an append value argument.
@@ -132,9 +131,8 @@ class argument {
132131
argument(cargo::string_view name, custom_handler_function &&parse_argument,
133132
custom_handler_function &&parse_value,
134133
cargo::argument::option_bitset options = NONE)
135-
: Name(name),
136-
Variant(
137-
CustomHandlerT{std::move(parse_argument), std::move(parse_value)}),
134+
: Name(name), Variant(CustomHandlerT{std::move(parse_argument),
135+
std::move(parse_value)}),
138136
Options(options) {}
139137

140138
/// @brief Parse a given argument, used by `cargo::argument_parser`.
@@ -146,9 +144,9 @@ class argument {
146144
/// @retval `INCOMPLETE` argument was found, requires a value.
147145
/// @retval `NOT_FOUND` argument was not found.
148146
/// @retval `INVALID` invalid argument, value not found.
149-
[[nodiscard]] cargo::error_or<cargo::argument::parse> parse_arg(
150-
cargo::string_view arg) {
151-
if (Name == arg) { // "<name> <value>"
147+
[[nodiscard]] cargo::error_or<cargo::argument::parse>
148+
parse_arg(cargo::string_view arg) {
149+
if (Name == arg) { // "<name> <value>"
152150
if (auto *Bool = isType<BOOL>()) {
153151
**Bool = (STORE_FALSE & Options) ? false : true;
154152
return cargo::argument::parse::COMPLETE;
@@ -160,7 +158,7 @@ class argument {
160158
return CustomHandler->ParseArgument(arg);
161159
}
162160
}
163-
if (arg.starts_with(Name)) { // "<name><value>"
161+
if (arg.starts_with(Name)) { // "<name><value>"
164162
auto value = arg.substr(Name.size(), cargo::string_view::npos);
165163
if (!value) {
166164
return cargo::argument::parse::NOT_FOUND;
@@ -180,8 +178,8 @@ class argument {
180178
/// @return Returns an error from `cargo::small_vector` or the parse result.
181179
/// @retval `COMPLETE` argument was found with no further action required.
182180
/// @retval `INVALID` invalid argument, value not found.
183-
[[nodiscard]] cargo::error_or<cargo::argument::parse> parse_value(
184-
cargo::string_view value) {
181+
[[nodiscard]] cargo::error_or<cargo::argument::parse>
182+
parse_value(cargo::string_view value) {
185183
if (isType<BOOL>()) {
186184
return cargo::argument::parse::INVALID;
187185
}
@@ -210,7 +208,7 @@ class argument {
210208
return cargo::argument::parse::COMPLETE;
211209
}
212210

213-
private:
211+
private:
214212
enum TypeT : uint8_t {
215213
BOOL,
216214
VALUE,
@@ -234,8 +232,7 @@ class argument {
234232
std::variant<BoolT, ValueT, ChoiceT, ValuesT, CustomHandlerT> Variant;
235233
option_bitset Options;
236234

237-
template <TypeT Type>
238-
auto isType() -> decltype(std::get_if<Type>(&Variant)) {
235+
template <TypeT Type> auto isType() -> decltype(std::get_if<Type>(&Variant)) {
239236
return std::get_if<Type>(&Variant);
240237
}
241238

@@ -287,9 +284,8 @@ enum argument_parser_option : uint8_t {
287284
/// return error;
288285
/// }
289286
/// ```
290-
template <size_t N, size_t NP = 1, size_t NU = 1>
291-
class argument_parser {
292-
public:
287+
template <size_t N, size_t NP = 1, size_t NU = 1> class argument_parser {
288+
public:
293289
/// @brief Construct the argument parser.
294290
///
295291
/// @param options Bitset of cargo::argument_parser_option values.
@@ -313,8 +309,8 @@ class argument_parser {
313309
/// @retval `cargo::success` parsing was successful.
314310
/// @retval `cargo::bad_argument` an invalid argument was found.
315311
/// @retval `cargo::bad_alloc` allocation failure.
316-
[[nodiscard]] cargo::result parse_args(
317-
cargo::array_view<cargo::string_view> args) {
312+
[[nodiscard]] cargo::result
313+
parse_args(cargo::array_view<cargo::string_view> args) {
318314
if (0 == args.size()) {
319315
return cargo::success;
320316
}
@@ -336,30 +332,30 @@ class argument_parser {
336332
return result.error();
337333
}
338334
switch (*result) {
335+
case cargo::argument::parse::COMPLETE:
336+
goto next_argument;
337+
case cargo::argument::parse::INCOMPLETE: {
338+
if (end == iter + 1) {
339+
return cargo::bad_argument;
340+
}
341+
iter++;
342+
auto result = Arg.parse_value(*iter);
343+
if (!result) {
344+
return result.error();
345+
}
346+
switch (*result) {
339347
case cargo::argument::parse::COMPLETE:
340348
goto next_argument;
341-
case cargo::argument::parse::INCOMPLETE: {
342-
if (end == iter + 1) {
343-
return cargo::bad_argument;
344-
}
345-
iter++;
346-
auto result = Arg.parse_value(*iter);
347-
if (!result) {
348-
return result.error();
349-
}
350-
switch (*result) {
351-
case cargo::argument::parse::COMPLETE:
352-
goto next_argument;
353-
case cargo::argument::parse::INCOMPLETE:
354-
case cargo::argument::parse::INVALID:
355-
case cargo::argument::parse::NOT_FOUND:
356-
return cargo::bad_argument;
357-
}
358-
} break;
349+
case cargo::argument::parse::INCOMPLETE:
359350
case cargo::argument::parse::INVALID:
360-
return cargo::bad_argument;
361351
case cargo::argument::parse::NOT_FOUND:
362-
continue;
352+
return cargo::bad_argument;
353+
}
354+
} break;
355+
case cargo::argument::parse::INVALID:
356+
return cargo::bad_argument;
357+
case cargo::argument::parse::NOT_FOUND:
358+
continue;
363359
}
364360
}
365361
if (AcceptPositionalArgs && arg == "--") {
@@ -440,14 +436,14 @@ class argument_parser {
440436
return UnrecognizedArgs;
441437
}
442438

443-
private:
439+
private:
444440
cargo::small_vector<argument, N> Args;
445441
cargo::small_vector<cargo::string_view, NP> PositionalArgs;
446442
cargo::small_vector<cargo::string_view, NU> UnrecognizedArgs;
447443
argument_parser_option_bitset Options;
448444
};
449445

450446
/// @}
451-
} // namespace cargo
447+
} // namespace cargo
452448

453-
#endif // CARGO_ARGUMENT_PARSER_H_INCLUDED
449+
#endif // CARGO_ARGUMENT_PARSER_H_INCLUDED

0 commit comments

Comments
 (0)