Skip to content

Commit

Permalink
Fix clang tidy (#8314)
Browse files Browse the repository at this point in the history
* Fix clang-tidy

* Exempt clang-tidy from budget check

* Move clang-tidy
  • Loading branch information
hcho3 committed Oct 6, 2022
1 parent c24e9d7 commit bc7a6ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/common/hist_util.cc
Expand Up @@ -143,31 +143,31 @@ struct RuntimeFlags {
template <bool _any_missing,
bool _first_page = false,
bool _read_by_column = false,
typename _BinIdxType = uint8_t>
typename BinIdxTypeName = uint8_t>
class GHistBuildingManager {
public:
constexpr static bool kAnyMissing = _any_missing;
constexpr static bool kFirstPage = _first_page;
constexpr static bool kReadByColumn = _read_by_column;
using BinIdxType = _BinIdxType;
using BinIdxType = BinIdxTypeName;

private:
template<bool new_first_page>
struct set_first_page {
using type = GHistBuildingManager<kAnyMissing, new_first_page, kReadByColumn, BinIdxType>;
template <bool new_first_page>
struct SetFirstPage {
using Type = GHistBuildingManager<kAnyMissing, new_first_page, kReadByColumn, BinIdxType>;
};

template<bool new_read_by_column>
struct set_read_by_column {
using type = GHistBuildingManager<kAnyMissing, kFirstPage, new_read_by_column, BinIdxType>;
template <bool new_read_by_column>
struct SetReadByColumn {
using Type = GHistBuildingManager<kAnyMissing, kFirstPage, new_read_by_column, BinIdxType>;
};

template<typename new_bin_idx_type>
struct set_bin_idx_type {
using type = GHistBuildingManager<kAnyMissing, kFirstPage, kReadByColumn, new_bin_idx_type>;
template <typename NewBinIdxType>
struct SetBinIdxType {
using Type = GHistBuildingManager<kAnyMissing, kFirstPage, kReadByColumn, NewBinIdxType>;
};

using type = GHistBuildingManager<kAnyMissing, kFirstPage, kReadByColumn, BinIdxType>;
using Type = GHistBuildingManager<kAnyMissing, kFirstPage, kReadByColumn, BinIdxType>;

public:
/* Entry point to dispatcher
Expand All @@ -178,16 +178,16 @@ class GHistBuildingManager {
template <typename Fn>
static void DispatchAndExecute(const RuntimeFlags& flags, Fn&& fn) {
if (flags.first_page != kFirstPage) {
set_first_page<true>::type::DispatchAndExecute(flags, std::forward<Fn>(fn));
SetFirstPage<true>::Type::DispatchAndExecute(flags, std::forward<Fn>(fn));
} else if (flags.read_by_column != kReadByColumn) {
set_read_by_column<true>::type::DispatchAndExecute(flags, std::forward<Fn>(fn));
SetReadByColumn<true>::Type::DispatchAndExecute(flags, std::forward<Fn>(fn));
} else if (flags.bin_type_size != sizeof(BinIdxType)) {
DispatchBinType(flags.bin_type_size, [&](auto t) {
using NewBinIdxType = decltype(t);
set_bin_idx_type<NewBinIdxType>::type::DispatchAndExecute(flags, std::forward<Fn>(fn));
SetBinIdxType<NewBinIdxType>::Type::DispatchAndExecute(flags, std::forward<Fn>(fn));
});
} else {
fn(type());
fn(Type());
}
}
};
Expand Down
1 change: 1 addition & 0 deletions tests/buildkite/pipeline.yml
Expand Up @@ -16,6 +16,7 @@ steps:
key: run-clang-tidy
agents:
queue: linux-amd64-cpu
- wait
- label: ":console: Build CPU"
command: "tests/buildkite/build-cpu.sh"
key: build-cpu
Expand Down

0 comments on commit bc7a6ec

Please sign in to comment.