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

Add clang-tidy to libcudf #9860

Merged
merged 50 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9d9cf87
Add .clang-tidy file
codereport Dec 7, 2021
79076d3
Clang-tiday single file
codereport Dec 7, 2021
1f710f7
CMake change
codereport Dec 7, 2021
a79f8e8
Initial script
codereport Dec 8, 2021
77c60d8
Temporary script hacks
codereport Dec 8, 2021
c213e09
Update script from cuml to cudf
codereport Dec 8, 2021
3a9fbed
Merge branch 'branch-22.02' into clang-tidy
codereport Dec 13, 2021
a9b43e0
Temporary incremental changes
codereport Dec 14, 2021
c7285e0
Clang-tidy cpp-coreguideline changes
codereport Dec 14, 2021
dff04d2
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 6, 2022
e772fc3
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 7, 2022
7af0249
modernize- fixes
codereport Jan 10, 2022
9379001
Revert "modernize- fixes"
codereport Jan 10, 2022
49aa922
modernize- fixes
codereport Jan 10, 2022
e557639
Clang-format fix
codereport Jan 10, 2022
c09e357
Pre-cache null count
codereport Jan 11, 2022
b546dc1
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 11, 2022
077ee81
Missing merge change
codereport Jan 11, 2022
d0f5d89
More modernize- changes
codereport Jan 11, 2022
8dad976
Clang-format
codereport Jan 11, 2022
97e1861
Reverst cxxopts changes
codereport Jan 11, 2022
669e828
Fix
codereport Jan 11, 2022
757dbba
Parquet test fix
codereport Jan 11, 2022
2bfa25d
More modernize- changes
codereport Jan 11, 2022
abf7fc9
Clang format
codereport Jan 11, 2022
1e85795
Updated/cleaned up .clang-tidy
codereport Jan 12, 2022
5c094ff
More modernize- changes
codereport Jan 12, 2022
d89566e
Reverse python script commit to isolate
codereport Jan 12, 2022
e2f248f
Clang-format
codereport Jan 12, 2022
b8a7744
Clean up python script
codereport Jan 12, 2022
b4a35c7
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 12, 2022
0cad418
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 12, 2022
6d3fd75
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 13, 2022
8b05ed9
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 14, 2022
c538fc4
Remove script and Cmake changes
codereport Jan 17, 2022
23c6e3a
Fix
codereport Jan 17, 2022
eccdb9e
Fix double [[nodiscard]]
codereport Jan 18, 2022
7b7aa57
Addressing PR comments
codereport Jan 18, 2022
780a799
Reverst nvt3.hpp
codereport Jan 18, 2022
45fc11e
Addressing PR comments
codereport Jan 18, 2022
5599c85
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 18, 2022
346d81f
Remove CamelCase on modernize loop
codereport Jan 18, 2022
8b92e54
Reverted trailing return type
codereport Jan 19, 2022
3b1666a
Revert trailing return type #2
codereport Jan 19, 2022
1726496
Update .clang-tidy file
codereport Jan 19, 2022
b06c7a4
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 19, 2022
5fc4fd7
Modernize changes
codereport Jan 19, 2022
7f8c0d7
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 19, 2022
4724ce6
Addres PR comments
codereport Jan 19, 2022
5bf662a
Merge branch 'branch-22.02' into clang-tidy
codereport Jan 19, 2022
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
2 changes: 1 addition & 1 deletion cpp/benchmarks/io/orc/orc_reader_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void BM_orc_read_varying_input(benchmark::State& state)
cudf::size_type const run_length = state.range(2);
cudf_io::compression_type const compression =
state.range(3) ? cudf_io::compression_type::SNAPPY : cudf_io::compression_type::NONE;
auto const source_type = static_cast<io_type>(state.range(4));
io_type const source_type = static_cast<io_type>(state.range(4));
codereport marked this conversation as resolved.
Show resolved Hide resolved

data_profile table_data_profile;
table_data_profile.set_cardinality(cardinality);
Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/io/orc/orc_writer_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void BM_orc_write_varying_inout(benchmark::State& state)
cudf::size_type const run_length = state.range(2);
cudf_io::compression_type const compression =
state.range(3) ? cudf_io::compression_type::SNAPPY : cudf_io::compression_type::NONE;
auto const sink_type = static_cast<io_type>(state.range(4));
io_type const sink_type = static_cast<io_type>(state.range(4));

data_profile table_data_profile;
table_data_profile.set_cardinality(cardinality);
Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/io/parquet/parquet_reader_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void BM_parq_read_varying_input(benchmark::State& state)
cudf::size_type const run_length = state.range(2);
cudf_io::compression_type const compression =
state.range(3) ? cudf_io::compression_type::SNAPPY : cudf_io::compression_type::NONE;
auto const source_type = static_cast<io_type>(state.range(4));
io_type const source_type = static_cast<io_type>(state.range(4));

data_profile table_data_profile;
table_data_profile.set_cardinality(cardinality);
Expand Down
2 changes: 1 addition & 1 deletion cpp/benchmarks/io/parquet/parquet_writer_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void BM_parq_write_varying_inout(benchmark::State& state)
cudf::size_type const run_length = state.range(2);
cudf_io::compression_type const compression =
state.range(3) ? cudf_io::compression_type::SNAPPY : cudf_io::compression_type::NONE;
auto const sink_type = static_cast<io_type>(state.range(4));
io_type const sink_type = static_cast<io_type>(state.range(4));

data_profile table_data_profile;
table_data_profile.set_cardinality(cardinality);
Expand Down
14 changes: 7 additions & 7 deletions cpp/include/cudf/io/text/data_chunk_source_factories.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class device_span_data_chunk : public device_data_chunk {
public:
device_span_data_chunk(device_span<char const> data) : _data(data) {}

[[nodiscard]] char const* data() const override { return _data.data(); }
[[nodiscard]] std::size_t size() const override { return _data.size(); }
char const* data() const override { return _data.data(); }
std::size_t size() const override { return _data.size(); }
operator device_span<char const>() const override { return _data; }

private:
Expand All @@ -53,8 +53,8 @@ class device_uvector_data_chunk : public device_data_chunk {
public:
device_uvector_data_chunk(rmm::device_uvector<char>&& data) : _data(std::move(data)) {}

[[nodiscard]] char const* data() const override { return _data.data(); }
[[nodiscard]] std::size_t size() const override { return _data.size(); }
char const* data() const override { return _data.data(); }
std::size_t size() const override { return _data.size(); }
operator device_span<char const>() const override { return _data; }

private:
Expand Down Expand Up @@ -171,7 +171,7 @@ class device_span_data_chunk_reader : public data_chunk_reader {
class file_data_chunk_source : public data_chunk_source {
public:
file_data_chunk_source(std::string filename) : _filename(filename) {}
[[nodiscard]] std::unique_ptr<data_chunk_reader> create_reader() const override
std::unique_ptr<data_chunk_reader> create_reader() const override
{
return std::make_unique<istream_data_chunk_reader>(
std::make_unique<std::ifstream>(_filename, std::ifstream::in));
Expand All @@ -187,7 +187,7 @@ class file_data_chunk_source : public data_chunk_source {
class string_data_chunk_source : public data_chunk_source {
public:
string_data_chunk_source(std::string const& data) : _data(data) {}
[[nodiscard]] std::unique_ptr<data_chunk_reader> create_reader() const override
std::unique_ptr<data_chunk_reader> create_reader() const override
{
return std::make_unique<istream_data_chunk_reader>(std::make_unique<std::istringstream>(_data));
}
Expand All @@ -202,7 +202,7 @@ class string_data_chunk_source : public data_chunk_source {
class device_span_data_chunk_source : public data_chunk_source {
public:
device_span_data_chunk_source(device_span<char const> data) : _data(data) {}
[[nodiscard]] std::unique_ptr<data_chunk_reader> create_reader() const override
std::unique_ptr<data_chunk_reader> create_reader() const override
{
return std::make_unique<device_span_data_chunk_reader>(_data);
}
Expand Down
20 changes: 10 additions & 10 deletions cpp/include/cudf/strings/string_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ class string_view {
/**
* @brief Return the number of bytes in this string
*/
CUDF_HOST_DEVICE [[nodiscard]] inline size_type size_bytes() const { return _bytes; }
CUDF_HOST_DEVICE inline size_type size_bytes() const { return _bytes; }
/**
* @brief Return the number of characters in this string
*/
__device__ [[nodiscard]] inline size_type length() const;
__device__ inline size_type length() const;
/**
* @brief Return a pointer to the internal device array
*/
CUDF_HOST_DEVICE [[nodiscard]] inline const char* data() const { return _data; }
CUDF_HOST_DEVICE inline const char* data() const { return _data; }

/**
* @brief Return true if string has no characters
*/
CUDF_HOST_DEVICE [[nodiscard]] inline bool empty() const { return size_bytes() == 0; }
CUDF_HOST_DEVICE inline bool empty() const { return size_bytes() == 0; }

/**
* @brief Handy iterator for navigating through encoded characters.
Expand Down Expand Up @@ -109,11 +109,11 @@ class string_view {
/**
* @brief Return new iterator pointing to the beginning of this string
*/
__device__ [[nodiscard]] inline const_iterator begin() const;
__device__ inline const_iterator begin() const;
/**
* @brief Return new iterator pointing past the end of this string
*/
__device__ [[nodiscard]] inline const_iterator end() const;
__device__ inline const_iterator end() const;

/**
* @brief Return single UTF-8 character at the given character position
Expand All @@ -126,7 +126,7 @@ class string_view {
*
* @param pos Character position
*/
__device__ [[nodiscard]] inline size_type byte_offset(size_type pos) const;
__device__ inline size_type byte_offset(size_type pos) const;

/**
* @brief Comparing target string with this string. Each character is compared
Expand All @@ -141,7 +141,7 @@ class string_view {
* not match is greater in the arg string, or all compared characters
* match but the arg string is longer.
*/
__device__ [[nodiscard]] inline int compare(const string_view& str) const;
__device__ inline int compare(const string_view& str) const;
/**
* @brief Comparing target string with this string. Each character is compared
* as a UTF-8 code-point value.
Expand Down Expand Up @@ -274,7 +274,7 @@ class string_view {
* @param length Number of characters from start to include in the sub-string.
* @return New instance pointing to a subset of the characters within this instance.
*/
__device__ [[nodiscard]] inline string_view substr(size_type start, size_type length) const;
__device__ inline string_view substr(size_type start, size_type length) const;

/**
* @brief Return minimum value associated with the string type
Expand Down Expand Up @@ -330,7 +330,7 @@ class string_view {
* @param bytepos Byte position from start of _data.
* @return The character position for the specified byte.
*/
__device__ [[nodiscard]] inline size_type character_offset(size_type bytepos) const;
__device__ inline size_type character_offset(size_type bytepos) const;
};

namespace strings {
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/structs/structs_column_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class structs_column_view : public column_view {
*
* @throw cudf::logic error if this is an empty column
*/
[[nodiscard]] column_view get_sliced_child(int index) const;
column_view get_sliced_child(int index) const;
}; // class structs_column_view;
/** @} */ // end of group
} // namespace cudf
14 changes: 7 additions & 7 deletions cpp/include/cudf/tdigest/tdigest_column_view.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,28 @@ class tdigest_column_view : private column_view {
/**
* @brief Returns the parent column.
*/
[[nodiscard]] column_view parent() const;
column_view parent() const;

/**
* @brief Returns the column of centroids
*/
[[nodiscard]] lists_column_view centroids() const;
lists_column_view centroids() const;

/**
* @brief Returns the internal column of mean values
*/
[[nodiscard]] column_view means() const;
column_view means() const;

/**
* @brief Returns the internal column of weight values
*/
[[nodiscard]] column_view weights() const;
column_view weights() const;

/**
* @brief Returns an iterator that returns the size of each tdigest
* in the column (each row is 1 digest)
*/
[[nodiscard]] auto size_begin() const
auto size_begin() const
{
return cudf::detail::make_counting_transform_iterator(
0, tdigest_size{centroids().offsets_begin()});
Expand All @@ -113,13 +113,13 @@ class tdigest_column_view : private column_view {
* @brief Returns the first min value for the column. Each row corresponds
* to the minimum value for the accompanying digest.
*/
[[nodiscard]] double const* min_begin() const;
double const* min_begin() const;

/**
* @brief Returns the first max value for the column. Each row corresponds
* to the maximum value for the accompanying digest.
*/
[[nodiscard]] double const* max_begin() const;
double const* max_begin() const;
};

} // namespace tdigest
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/binaryop/compiled/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ template <typename BinaryOperator>
struct is_binary_operation_supported {
// For types where Out type is fixed. (eg. comparison types)
template <typename TypeLhs, typename TypeRhs>
inline constexpr auto operator()() -> bool
inline constexpr bool operator()(void)
{
if constexpr (column_device_view::has_element_accessor<TypeLhs>() and
column_device_view::has_element_accessor<TypeRhs>()) {
Expand All @@ -79,7 +79,7 @@ struct is_binary_operation_supported {
}

template <typename TypeOut, typename TypeLhs, typename TypeRhs>
inline constexpr auto operator()() -> bool
inline constexpr bool operator()(void)
{
if constexpr (column_device_view::has_element_accessor<TypeLhs>() and
column_device_view::has_element_accessor<TypeRhs>() and
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/groupby/sort/functors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct store_result_functor {
/**
* @brief Check if the groupby keys are presorted
*/
[[nodiscard]] bool is_presorted() const { return keys_are_sorted == sorted::YES; }
bool is_presorted() const { return keys_are_sorted == sorted::YES; }

/**
* @brief Get the grouped values
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/io/avro/avro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include "avro.h"
#include <cstring>
#include <string.h>
#include <unordered_map>

namespace cudf {
Expand Down Expand Up @@ -75,7 +75,7 @@ auto container::parse(file_metadata* md, size_t max_num_rows, size_t first_row)
sig4 |= get_raw<uint8_t>() << 24;
if (sig4 != avro_magic) { return false; }
for (;;) {
auto num_md_items = static_cast<uint32_t>(get_encoded<int64_t>());
uint32_t num_md_items = static_cast<uint32_t>(get_encoded<int64_t>());
if (num_md_items == 0) { break; }
for (uint32_t i = 0; i < num_md_items; i++) {
auto const key = get_encoded<std::string>();
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/io/comp/brotli_dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ THE SOFTWARE.
*/

#include "brotli_dict.h"
#include <cstdint>
#include <stdint.h>

namespace cudf {
namespace io {
Expand Down Expand Up @@ -6528,7 +6528,7 @@ static const brotli_dictionary_s g_dictionary = {
136, 224, 164, 184, 224, 164, 149, 224, 165, 141, 224, 164, 176, 224, 164, 191, 224, 164, 175,
224, 164, 164, 224, 164, 190}};

auto get_brotli_dictionary() -> const brotli_dictionary_s* { return &g_dictionary; }
const brotli_dictionary_s* get_brotli_dictionary(void) { return &g_dictionary; }

} // namespace io
} // namespace cudf
12 changes: 6 additions & 6 deletions cpp/src/io/comp/cpu_unbz2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ For more information on these sources, see the manual.

#include "io_uncomp.h"
#include "unbz2.h"
#include <cstdio>
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
#include <vector>

namespace cudf {
Expand Down Expand Up @@ -111,15 +111,15 @@ namespace io {

#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE))

using huff_s = struct {
typedef struct {
int32_t minLen;
int32_t limit[BZ_MAX_CODE_LEN];
int32_t base[BZ_MAX_CODE_LEN];
uint16_t perm[BZ_MAX_ALPHA_SIZE];
};
} huff_s;

// Decoder state
using unbz_state_s = struct {
typedef struct {
// Input
const uint8_t* cur;
const uint8_t* end;
Expand Down Expand Up @@ -153,7 +153,7 @@ using unbz_state_s = struct {
uint8_t len[BZ_MAX_ALPHA_SIZE];

huff_s ht[BZ_N_GROUPS];
};
} unbz_state_s;

// return next 32 bits
static inline auto next32bits(const unbz_state_s* s) -> uint32_t
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/io/comp/uncomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <cuda_runtime.h>

#include <cstring> // memset
#include <string.h> // memset

#include <zlib.h> // uncompress

Expand Down Expand Up @@ -196,7 +196,7 @@ auto OpenZipArchive(zip_archive_s* dst, const uint8_t* raw, size_t len) -> bool
for (ptrdiff_t i = len - sizeof(zip_eocd_s) - 2;
i + sizeof(zip_eocd_s) + 2 + 0xffff >= len && i >= 0;
i--) {
const auto* eocd = reinterpret_cast<zip_eocd_s const*>(raw + i);
const zip_eocd_s* eocd = reinterpret_cast<zip_eocd_s const*>(raw + i);
if (eocd->sig == 0x06054b50 &&
eocd->disk_id == eocd->start_disk // multi-file archives not supported
&& eocd->num_entries == eocd->total_entries &&
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/io/orc/timezone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ struct timezone_file {
std::vector<localtime_type_record_s> ttype;
std::vector<char> posix_tz_string;

[[nodiscard]] auto timecnt() const { return header.timecnt; }
[[nodiscard]] auto typecnt() const { return header.typecnt; }
auto timecnt() const { return header.timecnt; }
auto typecnt() const { return header.typecnt; }

// Based on https://tools.ietf.org/id/draft-murchison-tzdist-tzif-00.html
static constexpr auto leap_second_rec_size(bool is_64bit) noexcept
Expand Down Expand Up @@ -222,7 +222,7 @@ class posix_parser {
/**
* @brief Returns the next character in the input.
*/
[[nodiscard]] auto next_character() const -> char { return *cur; }
[[nodiscard]] char next_character() const { return *cur; }

private:
typename Container::const_iterator cur;
Expand Down
Loading