Skip to content

Commit 31d5815

Browse files
committed
Change clang-format to v18 to match the CI clang version and update format
1 parent d337c89 commit 31d5815

26 files changed

+94
-105
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ repos:
5050
)
5151
types: []
5252
- repo: https://github.com/pre-commit/mirrors-clang-format
53-
rev: v20.1.8
53+
rev: v18.1.4
5454
hooks:
5555
- id: clang-format
56-
# Fixing pre-commit provided by CI Ubuntu 22
57-
types_or: [c++, c, c#, cuda, java, javascript, json, objective-c, proto]
5856
name: C++ Format
5957
alias: cpp
6058
types_or:
@@ -95,21 +93,17 @@ repos:
9593
?^cpp/thirdparty/|
9694
)
9795
- repo: https://github.com/pre-commit/mirrors-clang-format
98-
rev: v20.1.8
96+
rev: v18.1.4
9997
hooks:
10098
- id: clang-format
101-
# Fixing pre-commit provided by CI Ubuntu 22
102-
types_or: [c++, c, c#, cuda, java, javascript, json, objective-c, proto]
10399
alias: c-glib
104100
name: C/GLib Format
105101
files: >-
106102
^c_glib/
107103
- repo: https://github.com/pre-commit/mirrors-clang-format
108-
rev: v20.1.8
104+
rev: v18.1.4
109105
hooks:
110106
- id: clang-format
111-
# Fixing pre-commit provided by CI Ubuntu 22
112-
types_or: [c++, c, c#, cuda, java, javascript, json, objective-c, proto]
113107
name: MATLAB (C++) Format
114108
alias: matlab-cpp-format
115109
files: >-
@@ -162,11 +156,9 @@ repos:
162156
files: >-
163157
^python/
164158
- repo: https://github.com/pre-commit/mirrors-clang-format
165-
rev: v20.1.8
159+
rev: v18.1.4
166160
hooks:
167161
- id: clang-format
168-
# Fixing pre-commit provided by CI Ubuntu 22
169-
types_or: [c++, c, c#, cuda, java, javascript, json, objective-c, proto]
170162
alias: python
171163
name: Python (C++) Format
172164
files: >-
@@ -221,11 +213,9 @@ repos:
221213
files: >-
222214
^r/.*\.R$
223215
- repo: https://github.com/pre-commit/mirrors-clang-format
224-
rev: v20.1.8
216+
rev: v18.1.4
225217
hooks:
226218
- id: clang-format
227-
# Fixing pre-commit provided by CI Ubuntu 22
228-
types_or: [c++, c, c#, cuda, java, javascript, json, objective-c, proto]
229219
alias: r
230220
name: R (C++) Format
231221
files: >-

cpp/src/arrow/acero/exec_plan.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct ExecPlanImpl : public ExecPlan {
137137
opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> span =
138138
::arrow::internal::tracing::UnwrapSpan(span_.details.get());
139139
std::for_each(std::begin(pairs), std::end(pairs),
140-
[span](std::pair<std::string, std::string> const& pair) {
140+
[span](const std::pair<std::string, std::string>& pair) {
141141
span->SetAttribute(pair.first, pair.second);
142142
});
143143
}

cpp/src/arrow/c/bridge.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ namespace {
533533
struct ExportedArrayPrivateData : PoolAllocationMixin<ExportedArrayPrivateData> {
534534
// The buffers are owned by the ArrayData member
535535
SmallVector<const void*, 3> buffers_;
536-
struct ArrowArray dictionary_{};
536+
struct ArrowArray dictionary_ {};
537537
SmallVector<struct ArrowArray, 1> children_;
538538
SmallVector<struct ArrowArray*, 4> child_pointers_;
539539

cpp/src/arrow/c/bridge_test.cc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,8 +1226,8 @@ TEST_F(TestArrayExport, MoveSeveralChildren) {
12261226
}
12271227

12281228
TEST_F(TestArrayExport, ExportArrayAndType) {
1229-
struct ArrowSchema c_schema{};
1230-
struct ArrowArray c_array{};
1229+
struct ArrowSchema c_schema {};
1230+
struct ArrowArray c_array {};
12311231
SchemaExportGuard schema_guard(&c_schema);
12321232
ArrayExportGuard array_guard(&c_array);
12331233

@@ -1244,8 +1244,8 @@ TEST_F(TestArrayExport, ExportArrayAndType) {
12441244
}
12451245

12461246
TEST_F(TestArrayExport, ExportRecordBatch) {
1247-
struct ArrowSchema c_schema{};
1248-
struct ArrowArray c_array{};
1247+
struct ArrowSchema c_schema {};
1248+
struct ArrowArray c_array {};
12491249

12501250
auto schema = ::arrow::schema(
12511251
{field("ints", int16()), field("bools", boolean(), /*nullable=*/false)});
@@ -1704,8 +1704,8 @@ TEST_F(TestDeviceArrayExport, ExportArrayAndType) {
17041704
std::shared_ptr<Device> device = std::make_shared<MyDevice>(1);
17051705
auto mm = device->default_memory_manager();
17061706

1707-
struct ArrowSchema c_schema{};
1708-
struct ArrowDeviceArray c_array{};
1707+
struct ArrowSchema c_schema {};
1708+
struct ArrowDeviceArray c_array {};
17091709
SchemaExportGuard schema_guard(&c_schema);
17101710
ArrayExportGuard array_guard(&c_array.array);
17111711

@@ -1726,8 +1726,8 @@ TEST_F(TestDeviceArrayExport, ExportRecordBatch) {
17261726
std::shared_ptr<Device> device = std::make_shared<MyDevice>(1);
17271727
auto mm = device->default_memory_manager();
17281728

1729-
struct ArrowSchema c_schema{};
1730-
struct ArrowDeviceArray c_array{};
1729+
struct ArrowSchema c_schema {};
1730+
struct ArrowDeviceArray c_array {};
17311731

17321732
auto schema = ::arrow::schema(
17331733
{field("ints", int16()), field("bools", boolean(), /*nullable=*/false)});
@@ -3619,7 +3619,7 @@ class TestSchemaRoundtrip : public ::testing::Test {
36193619
void TestWithTypeFactory(TypeFactory&& factory,
36203620
ExpectedTypeFactory&& factory_expected) {
36213621
std::shared_ptr<DataType> type, actual;
3622-
struct ArrowSchema c_schema{}; // zeroed
3622+
struct ArrowSchema c_schema {}; // zeroed
36233623
SchemaExportGuard schema_guard(&c_schema);
36243624

36253625
auto orig_bytes = pool_->bytes_allocated();
@@ -3650,7 +3650,7 @@ class TestSchemaRoundtrip : public ::testing::Test {
36503650
template <typename SchemaFactory>
36513651
void TestWithSchemaFactory(SchemaFactory&& factory) {
36523652
std::shared_ptr<Schema> schema, actual;
3653-
struct ArrowSchema c_schema{}; // zeroed
3653+
struct ArrowSchema c_schema {}; // zeroed
36543654
SchemaExportGuard schema_guard(&c_schema);
36553655

36563656
auto orig_bytes = pool_->bytes_allocated();
@@ -3865,8 +3865,8 @@ class TestArrayRoundtrip : public ::testing::Test {
38653865
void TestWithArrayFactory(ArrayFactory&& factory,
38663866
ExpectedArrayFactory&& factory_expected) {
38673867
std::shared_ptr<Array> array;
3868-
struct ArrowArray c_array{};
3869-
struct ArrowSchema c_schema{};
3868+
struct ArrowArray c_array {};
3869+
struct ArrowSchema c_schema {};
38703870
ArrayExportGuard array_guard(&c_array);
38713871
SchemaExportGuard schema_guard(&c_schema);
38723872

@@ -3910,8 +3910,8 @@ class TestArrayRoundtrip : public ::testing::Test {
39103910
template <typename BatchFactory>
39113911
void TestWithBatchFactory(BatchFactory&& factory) {
39123912
std::shared_ptr<RecordBatch> batch;
3913-
struct ArrowArray c_array{};
3914-
struct ArrowSchema c_schema{};
3913+
struct ArrowArray c_array {};
3914+
struct ArrowSchema c_schema {};
39153915
ArrayExportGuard array_guard(&c_array);
39163916
SchemaExportGuard schema_guard(&c_schema);
39173917

@@ -4184,7 +4184,7 @@ TEST_F(TestArrayRoundtrip, RegisteredExtensionNoMetadata) {
41844184
KeyValueMetadata::Make({"ARROW:extension:name"}, {ext_type->extension_name()});
41854185
auto ext_field = field("", ext_type->storage_type(), true, std::move(ext_metadata));
41864186

4187-
struct ArrowSchema c_schema{};
4187+
struct ArrowSchema c_schema {};
41884188
SchemaExportGuard schema_guard(&c_schema);
41894189
ASSERT_OK(ExportField(*ext_field, &c_schema));
41904190

@@ -4305,8 +4305,8 @@ class TestDeviceArrayRoundtrip : public ::testing::Test {
43054305
void TestWithArrayFactory(ArrayFactory&& factory,
43064306
ExpectedArrayFactory&& factory_expected) {
43074307
std::shared_ptr<Array> array;
4308-
struct ArrowDeviceArray c_array{};
4309-
struct ArrowSchema c_schema{};
4308+
struct ArrowDeviceArray c_array {};
4309+
struct ArrowSchema c_schema {};
43104310
ArrayExportGuard array_guard(&c_array.array);
43114311
SchemaExportGuard schema_guard(&c_schema);
43124312

@@ -4354,8 +4354,8 @@ class TestDeviceArrayRoundtrip : public ::testing::Test {
43544354
auto mm = device->default_memory_manager();
43554355

43564356
std::shared_ptr<RecordBatch> batch;
4357-
struct ArrowDeviceArray c_array{};
4358-
struct ArrowSchema c_schema{};
4357+
struct ArrowDeviceArray c_array {};
4358+
struct ArrowSchema c_schema {};
43594359
ArrayExportGuard array_guard(&c_array.array);
43604360
SchemaExportGuard schema_guard(&c_schema);
43614361

cpp/src/arrow/compute/kernels/hash_aggregate.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ concept CFloatingPointConcept = std::floating_point<T> || std::same_as<T, util::
282282

283283
template <typename T>
284284
concept CDecimalConcept = std::same_as<T, Decimal32> || std::same_as<T, Decimal64> ||
285-
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;
285+
std::same_as<T, Decimal128> || std::same_as<T, Decimal256>;
286286

287287
template <typename CType>
288288
struct AntiExtrema {

cpp/src/arrow/compute/kernels/scalar_round.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,10 +1227,11 @@ Status FixedRoundDecimalExec(KernelContext* ctx, const ExecSpan& batch, ExecResu
12271227
// ----------------------------------------------------------------------
12281228
// Begin round kernel generation and function registration
12291229

1230-
template <template <typename, RoundMode, typename...> class Op,
1231-
template <typename, typename,
1232-
template <typename, RoundMode, typename...> typename> class Kernel,
1233-
typename OptionsType>
1230+
template <
1231+
template <typename, RoundMode, typename...> class Op,
1232+
template <typename, typename, template <typename, RoundMode, typename...> typename>
1233+
class Kernel,
1234+
typename OptionsType>
12341235
struct RoundKernelGenerator {
12351236
template <typename ArrowType>
12361237
Status Visit(const ArrowType& type, ArrayKernelExec* exec, KernelInit* init) {

cpp/src/arrow/compute/kernels/scalar_temporal_binary.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,11 @@ using NanosecondsBetween = UnitsBetween<std::chrono::nanoseconds, Duration, Loca
313313
// ----------------------------------------------------------------------
314314
// Registration helpers
315315

316-
template <
317-
template <typename...> class Op,
318-
template <template <typename...> class OpExec, typename Duration, typename InType,
319-
typename OutType, typename... Args> class ExecTemplate,
320-
typename OutType>
316+
template <template <typename...> class Op,
317+
template <template <typename...> class OpExec, typename Duration,
318+
typename InType, typename OutType, typename... Args>
319+
class ExecTemplate,
320+
typename OutType>
321321
struct BinaryTemporalFactory {
322322
OutputType out_type;
323323
KernelInit init;

cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,11 +1533,11 @@ struct ISOCalendar {
15331533
// ----------------------------------------------------------------------
15341534
// Registration helpers
15351535

1536-
template <
1537-
template <typename...> class Op,
1538-
template <template <typename...> class OpExec, typename Duration, typename InType,
1539-
typename OutType, typename... Args> class ExecTemplate,
1540-
typename OutType>
1536+
template <template <typename...> class Op,
1537+
template <template <typename...> class OpExec, typename Duration,
1538+
typename InType, typename OutType, typename... Args>
1539+
class ExecTemplate,
1540+
typename OutType>
15411541
struct UnaryTemporalFactory {
15421542
OutputType out_type;
15431543
KernelInit init;

cpp/src/arrow/compute/kernels/temporal_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ using std::chrono::duration_cast;
4545
using ArrowTimeZone = std::variant<const time_zone*, OffsetZone>;
4646

4747
template <class Duration, class Func>
48-
auto ApplyTimeZone(const ArrowTimeZone& tz, sys_time<Duration> st, Func&& func)
49-
-> decltype(func(zoned_time<Duration>{})) {
48+
auto ApplyTimeZone(const ArrowTimeZone& tz, sys_time<Duration> st,
49+
Func&& func) -> decltype(func(zoned_time<Duration>{})) {
5050
return std::visit(
5151
[&](auto&& zone) {
5252
if constexpr (std::is_pointer_v<std::decay_t<decltype(zone)> >) {
@@ -60,8 +60,8 @@ auto ApplyTimeZone(const ArrowTimeZone& tz, sys_time<Duration> st, Func&& func)
6060

6161
template <class Duration, class Func>
6262
auto ApplyTimeZone(const ArrowTimeZone& tz, local_time<Duration> lt,
63-
std::optional<choose> c, Func&& func)
64-
-> decltype(func(zoned_time<Duration>{})) {
63+
std::optional<choose> c,
64+
Func&& func) -> decltype(func(zoned_time<Duration>{})) {
6565
return std::visit(
6666
[&](auto&& zone) {
6767
if constexpr (std::is_pointer_v<std::decay_t<decltype(zone)> >) {

cpp/src/arrow/compute/kernels/vector_sort_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ std::ostream& operator<<(std::ostream& os, NullPlacement null_placement) {
7676
// Tests for NthToIndices
7777

7878
template <typename ArrayType>
79-
auto GetLogicalValue(const ArrayType& array, uint64_t index)
80-
-> decltype(array.GetView(index)) {
79+
auto GetLogicalValue(const ArrayType& array,
80+
uint64_t index) -> decltype(array.GetView(index)) {
8181
return array.GetView(index);
8282
}
8383

0 commit comments

Comments
 (0)