Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply clang-tidy autofixes #16949

Merged
merged 3 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cpp/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Checks:
'modernize-*,
-modernize-use-equals-default,
-modernize-concat-nested-namespaces,
-modernize-use-trailing-return-type'
-modernize-use-trailing-return-type,
-modernize-use-bool-literals'

# -modernize-use-equals-default # auto-fix is broken (doesn't insert =default correctly)
# -modernize-concat-nested-namespaces # auto-fix is broken (can delete code)
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/io/parquet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ class parquet_writer_options : public parquet_writer_options_base {
* @param sink The sink used for writer output
* @param table Table to be written to output
*/
explicit parquet_writer_options(sink_info const& sink, table_view const& table);
explicit parquet_writer_options(sink_info const& sink, table_view table);

public:
/**
Expand Down
5 changes: 2 additions & 3 deletions cpp/include/cudf_test/type_list_utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,8 @@ struct RemoveIfImpl<PRED, Types<>> {

template <class PRED, class HEAD, class... TAIL>
struct RemoveIfImpl<PRED, Types<HEAD, TAIL...>> {
using type =
Concat<typename std::conditional<PRED::template Call<HEAD>::value, Types<>, Types<HEAD>>::type,
typename RemoveIfImpl<PRED, Types<TAIL...>>::type>;
using type = Concat<std::conditional_t<PRED::template Call<HEAD>::value, Types<>, Types<HEAD>>,
typename RemoveIfImpl<PRED, Types<TAIL...>>::type>;
};
// @endcond

Expand Down
5 changes: 3 additions & 2 deletions cpp/src/io/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <cudf/utilities/memory_resource.hpp>

#include <algorithm>
#include <utility>

namespace cudf::io {

Expand Down Expand Up @@ -852,8 +853,8 @@ void parquet_writer_options_base::set_sorting_columns(std::vector<sorting_column
_sorting_columns = std::move(sorting_columns);
}

parquet_writer_options::parquet_writer_options(sink_info const& sink, table_view const& table)
: parquet_writer_options_base(sink), _table(table)
parquet_writer_options::parquet_writer_options(sink_info const& sink, table_view table)
: parquet_writer_options_base(sink), _table(std::move(table))
vyasr marked this conversation as resolved.
Show resolved Hide resolved
{
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/io/utilities/output_builder.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ class output_builder {
* @param mr The memory resource used to allocate the output vector.
* @return The output vector.
*/
rmm::device_uvector<T> gather(rmm::cuda_stream_view stream,
rmm::device_async_resource_ref mr) const
[[nodiscard]] rmm::device_uvector<T> gather(rmm::cuda_stream_view stream,
rmm::device_async_resource_ref mr) const
{
rmm::device_uvector<T> output{size(), stream, mr};
auto output_it = output.begin();
Expand Down
6 changes: 3 additions & 3 deletions cpp/tests/ast/transform_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ TEST_F(TransformTest, DeeplyNestedArithmeticLogicalExpression)
auto expressions = std::list<cudf::ast::operation>();

auto op = arithmetic_operator;
expressions.push_back(cudf::ast::operation(op, col_ref, col_ref));
expressions.emplace_back(op, col_ref, col_ref);

for (int64_t i = 0; i < depth_level - 1; i++) {
if (i == depth_level - 2) {
Expand All @@ -387,9 +387,9 @@ TEST_F(TransformTest, DeeplyNestedArithmeticLogicalExpression)
op = arithmetic_operator;
}
if (nested_left_tree) {
expressions.push_back(cudf::ast::operation(op, expressions.back(), col_ref));
expressions.emplace_back(op, expressions.back(), col_ref);
} else {
expressions.push_back(cudf::ast::operation(op, col_ref, expressions.back()));
expressions.emplace_back(op, col_ref, expressions.back());
}
}
return expressions;
Expand Down
44 changes: 21 additions & 23 deletions cpp/tests/binaryop/util/operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct Add {
void>* = nullptr>
OutT operator()(TypeLhs lhs, TypeRhs rhs) const
{
using TypeCommon = typename std::common_type<OutT, TypeLhs, TypeRhs>::type;
using TypeCommon = std::common_type_t<OutT, TypeLhs, TypeRhs>;
return static_cast<OutT>(static_cast<TypeCommon>(lhs) + static_cast<TypeCommon>(rhs));
}
};
Expand All @@ -72,7 +72,7 @@ struct Sub {
void>* = nullptr>
OutT operator()(TypeLhs lhs, TypeRhs rhs) const
{
using TypeCommon = typename std::common_type<OutT, TypeLhs, TypeRhs>::type;
using TypeCommon = std::common_type_t<OutT, TypeLhs, TypeRhs>;
return static_cast<OutT>(static_cast<TypeCommon>(lhs) - static_cast<TypeCommon>(rhs));
}
};
Expand All @@ -83,7 +83,7 @@ struct Mul {
std::enable_if_t<!cudf::is_duration_t<OutT>::value, void>* = nullptr>
TypeOut operator()(TypeLhs lhs, TypeRhs rhs) const
{
using TypeCommon = typename std::common_type<TypeOut, TypeLhs, TypeRhs>::type;
using TypeCommon = std::common_type_t<TypeOut, TypeLhs, TypeRhs>;
return static_cast<TypeOut>(static_cast<TypeCommon>(lhs) * static_cast<TypeCommon>(rhs));
}

Expand Down Expand Up @@ -112,7 +112,7 @@ struct Div {
std::enable_if_t<!cudf::is_duration_t<LhsT>::value, void>* = nullptr>
TypeOut operator()(TypeLhs lhs, TypeRhs rhs)
{
using TypeCommon = typename std::common_type<TypeOut, TypeLhs, TypeRhs>::type;
using TypeCommon = std::common_type_t<TypeOut, TypeLhs, TypeRhs>;
return static_cast<TypeOut>(static_cast<TypeCommon>(lhs) / static_cast<TypeCommon>(rhs));
}

Expand Down Expand Up @@ -191,33 +191,31 @@ struct FloorDiv {

template <typename TypeOut, typename TypeLhs, typename TypeRhs>
struct Mod {
template <typename OutT = TypeOut,
typename LhsT = TypeLhs,
typename RhsT = TypeRhs,
std::enable_if_t<
(std::is_integral_v<typename std::common_type<OutT, LhsT, RhsT>::type>)>* = nullptr>
template <typename OutT = TypeOut,
typename LhsT = TypeLhs,
typename RhsT = TypeRhs,
std::enable_if_t<(std::is_integral_v<std::common_type_t<OutT, LhsT, RhsT>>)>* = nullptr>
TypeOut operator()(TypeLhs lhs, TypeRhs rhs)
{
using TypeCommon = typename std::common_type<TypeOut, TypeLhs, TypeRhs>::type;
using TypeCommon = std::common_type_t<TypeOut, TypeLhs, TypeRhs>;
return static_cast<TypeOut>(static_cast<TypeCommon>(lhs) % static_cast<TypeCommon>(rhs));
}

template <typename OutT = TypeOut,
typename LhsT = TypeLhs,
typename RhsT = TypeRhs,
std::enable_if_t<(
std::is_same_v<typename std::common_type<OutT, LhsT, RhsT>::type, float>)>* = nullptr>
template <
typename OutT = TypeOut,
typename LhsT = TypeLhs,
typename RhsT = TypeRhs,
std::enable_if_t<(std::is_same_v<std::common_type_t<OutT, LhsT, RhsT>, float>)>* = nullptr>
TypeOut operator()(TypeLhs lhs, TypeRhs rhs)
{
return static_cast<TypeOut>(fmod(static_cast<float>(lhs), static_cast<float>(rhs)));
}

template <
typename OutT = TypeOut,
typename LhsT = TypeLhs,
typename RhsT = TypeRhs,
std::enable_if_t<(std::is_same_v<typename std::common_type<OutT, LhsT, RhsT>::type, double>)>* =
nullptr>
typename OutT = TypeOut,
typename LhsT = TypeLhs,
typename RhsT = TypeRhs,
std::enable_if_t<(std::is_same_v<std::common_type_t<OutT, LhsT, RhsT>, double>)>* = nullptr>
TypeOut operator()(TypeLhs lhs, TypeRhs rhs)
{
return static_cast<TypeOut>(fmod(static_cast<double>(lhs), static_cast<double>(rhs)));
Expand Down Expand Up @@ -326,7 +324,7 @@ struct LogBase {

template <typename TypeOut, typename TypeLhs, typename TypeRhs>
struct PMod {
using CommonArgsT = typename std::common_type<TypeLhs, TypeRhs>::type;
using CommonArgsT = std::common_type_t<TypeLhs, TypeRhs>;

TypeOut operator()(TypeLhs x, TypeRhs y) const
{
Expand All @@ -351,8 +349,8 @@ struct PyMod {
TypeOut operator()(TypeLhs x, TypeRhs y) const
{
if constexpr (std::is_floating_point_v<TypeLhs> or std::is_floating_point_v<TypeRhs>) {
double x1 = static_cast<double>(x);
double y1 = static_cast<double>(y);
auto x1 = static_cast<double>(x);
auto y1 = static_cast<double>(y);
return fmod(fmod(x1, y1) + y1, y1);
} else {
return ((x % y) + y) % y;
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/groupby/mean_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TYPED_TEST(groupby_mean_test, basic)
{
using V = TypeParam;
using R = cudf::detail::target_type_t<V, cudf::aggregation::MEAN>;
using RT = typename std::conditional<cudf::is_duration<R>(), int, double>::type;
using RT = std::conditional_t<cudf::is_duration<R>(), int, double>;

cudf::test::fixed_width_column_wrapper<K> keys{1, 2, 3, 1, 2, 2, 1, 3, 3, 2};
cudf::test::fixed_width_column_wrapper<V> vals{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
Expand Down Expand Up @@ -114,7 +114,7 @@ TYPED_TEST(groupby_mean_test, null_keys_and_values)
{
using V = TypeParam;
using R = cudf::detail::target_type_t<V, cudf::aggregation::MEAN>;
using RT = typename std::conditional<cudf::is_duration<R>(), int, double>::type;
using RT = std::conditional_t<cudf::is_duration<R>(), int, double>;

cudf::test::fixed_width_column_wrapper<K> keys(
{1, 2, 3, 1, 2, 2, 1, 3, 3, 2, 4},
Expand Down
3 changes: 1 addition & 2 deletions cpp/tests/io/json/json_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,7 @@ TEST_P(JsonReaderRecordTest, JsonLinesObjects)

TEST_P(JsonReaderRecordTest, JsonLinesObjectsStrings)
{
auto const test_opt = GetParam();
auto test_json_objects = [test_opt](std::string const& data) {
auto test_json_objects = [](std::string const& data) {
cudf::io::json_reader_options in_options =
cudf::io::json_reader_options::builder(cudf::io::source_info{data.data(), data.size()})
.lines(true);
Expand Down
6 changes: 3 additions & 3 deletions cpp/tests/io/parquet_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

template <typename T, typename SourceElementT = T>
using column_wrapper =
typename std::conditional<std::is_same_v<T, cudf::string_view>,
cudf::test::strings_column_wrapper,
cudf::test::fixed_width_column_wrapper<T, SourceElementT>>::type;
std::conditional_t<std::is_same_v<T, cudf::string_view>,
cudf::test::strings_column_wrapper,
cudf::test::fixed_width_column_wrapper<T, SourceElementT>>;
using column = cudf::column;
using table = cudf::table;
using table_view = cudf::table_view;
Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/io/text/multibyte_split_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ TEST_F(MultibyteSplitTest, LargeInput)

for (auto i = 0; i < (2 * 32 * 128 * 1024); i++) {
host_input += "...:|";
host_expected.emplace_back(std::string("...:|"));
host_expected.emplace_back("...:|");
}

auto expected = strings_column_wrapper{host_expected.begin(), host_expected.end()};
Expand Down
Loading