diff --git a/.clang-tidy b/.clang-tidy index 043a93e6ff9..fb307a2be75 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,8 +3,11 @@ Checks: 'modernize-*, -modernize-use-equals-default, -modernize-concat-nested-namespaces, - -modernize-use-trailing-return-type' - + -modernize-use-trailing-return-type, + cppcoreguidelines-*, + -cppcoreguidelines-init-variables, + -cppcoreguidelines-pro-type-member-init' + # -modernize-use-equals-default # auto-fix is broken (doesn't insert =default correctly) # -modernize-concat-nested-namespaces # auto-fix is broken (can delete code) # -modernize-use-trailing-return-type # just a preference diff --git a/cpp/include/cudf/lists/detail/scatter.cuh b/cpp/include/cudf/lists/detail/scatter.cuh index 94b0e830b15..5718b63c1d6 100644 --- a/cpp/include/cudf/lists/detail/scatter.cuh +++ b/cpp/include/cudf/lists/detail/scatter.cuh @@ -223,7 +223,7 @@ std::unique_ptr scatter( auto const num_rows = target.size(); if (num_rows == 0) { return cudf::empty_like(target); } - auto lv = static_cast(&slr); + auto lv = dynamic_cast(&slr); bool slr_valid = slr.is_valid(stream); rmm::device_buffer null_mask = slr_valid ? cudf::detail::create_null_mask(1, mask_state::UNALLOCATED, stream, mr) diff --git a/cpp/src/copying/copy.cpp b/cpp/src/copying/copy.cpp index 8cc5549b3c5..a28203cafd5 100644 --- a/cpp/src/copying/copy.cpp +++ b/cpp/src/copying/copy.cpp @@ -62,7 +62,7 @@ template <> struct scalar_empty_like_functor_impl { std::unique_ptr operator()(scalar const& input) { - auto ls = static_cast(&input); + auto ls = dynamic_cast(&input); // TODO: add a manual constructor for lists_column_view. column_view offsets{cudf::data_type{cudf::type_id::INT32}, 0, nullptr}; @@ -79,7 +79,7 @@ template <> struct scalar_empty_like_functor_impl { std::unique_ptr operator()(scalar const& input) { - auto ss = static_cast(&input); + auto ss = dynamic_cast(&input); // TODO: add a manual constructor for structs_column_view // TODO: add cudf::get_element() support for structs diff --git a/cpp/src/interop/from_arrow.cu b/cpp/src/interop/from_arrow.cu index 99b657fb9d5..8bae581ba86 100644 --- a/cpp/src/interop/from_arrow.cu +++ b/cpp/src/interop/from_arrow.cu @@ -55,7 +55,7 @@ data_type arrow_to_cudf_type(arrow::DataType const& arrow_type) case arrow::Type::DOUBLE: return data_type(type_id::FLOAT64); case arrow::Type::DATE32: return data_type(type_id::TIMESTAMP_DAYS); case arrow::Type::TIMESTAMP: { - auto type = static_cast(&arrow_type); + auto type = dynamic_cast(&arrow_type); switch (type->unit()) { case arrow::TimeUnit::type::SECOND: return data_type(type_id::TIMESTAMP_SECONDS); case arrow::TimeUnit::type::MILLI: return data_type(type_id::TIMESTAMP_MILLISECONDS); @@ -65,7 +65,7 @@ data_type arrow_to_cudf_type(arrow::DataType const& arrow_type) } } case arrow::Type::DURATION: { - auto type = static_cast(&arrow_type); + auto type = dynamic_cast(&arrow_type); switch (type->unit()) { case arrow::TimeUnit::type::SECOND: return data_type(type_id::DURATION_SECONDS); case arrow::TimeUnit::type::MILLI: return data_type(type_id::DURATION_MILLISECONDS); @@ -78,7 +78,7 @@ data_type arrow_to_cudf_type(arrow::DataType const& arrow_type) case arrow::Type::DICTIONARY: return data_type(type_id::DICTIONARY32); case arrow::Type::LIST: return data_type(type_id::LIST); case arrow::Type::DECIMAL: { - auto const type = static_cast(&arrow_type); + auto const type = dynamic_cast(&arrow_type); return data_type{type_id::DECIMAL128, -type->scale()}; } case arrow::Type::STRUCT: return data_type(type_id::STRUCT); @@ -298,7 +298,7 @@ std::unique_ptr dispatch_to_cudf_column::operator()( rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - auto dict_array = static_cast(&array); + auto dict_array = dynamic_cast(&array); auto dict_type = arrow_to_cudf_type(*(dict_array->dictionary()->type())); auto keys_column = get_column(*(dict_array->dictionary()), dict_type, true, stream, mr); auto ind_type = arrow_to_cudf_type(*(dict_array->indices()->type())); @@ -328,7 +328,7 @@ std::unique_ptr dispatch_to_cudf_column::operator()( rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - auto struct_array = static_cast(&array); + auto struct_array = dynamic_cast(&array); std::vector> child_columns; // Offsets have already been applied to child arrow::ArrayVector array_children = struct_array->fields(); diff --git a/cpp/src/strings/copying/shift.cu b/cpp/src/strings/copying/shift.cu index 024c8d2924d..9d70d636af1 100644 --- a/cpp/src/strings/copying/shift.cu +++ b/cpp/src/strings/copying/shift.cu @@ -92,7 +92,7 @@ std::unique_ptr shift(strings_column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - auto d_fill_str = static_cast(fill_value).value(stream); + auto d_fill_str = dynamic_cast(fill_value).value(stream); // output offsets column is the same size as the input auto const input_offsets =