Fix clang tidy (#8314)

* Fix clang-tidy

* Exempt clang-tidy from budget check

* Move clang-tidy
This commit is contained in:
Philip Hyunsu Cho 2022-10-06 05:16:06 -08:00 committed by GitHub
parent c24e9d712c
commit bc7a6ec603
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 16 deletions

View File

@ -143,31 +143,31 @@ struct RuntimeFlags {
template <bool _any_missing, template <bool _any_missing,
bool _first_page = false, bool _first_page = false,
bool _read_by_column = false, bool _read_by_column = false,
typename _BinIdxType = uint8_t> typename BinIdxTypeName = uint8_t>
class GHistBuildingManager { class GHistBuildingManager {
public: public:
constexpr static bool kAnyMissing = _any_missing; constexpr static bool kAnyMissing = _any_missing;
constexpr static bool kFirstPage = _first_page; constexpr static bool kFirstPage = _first_page;
constexpr static bool kReadByColumn = _read_by_column; constexpr static bool kReadByColumn = _read_by_column;
using BinIdxType = _BinIdxType; using BinIdxType = BinIdxTypeName;
private: private:
template <bool new_first_page> template <bool new_first_page>
struct set_first_page { struct SetFirstPage {
using type = GHistBuildingManager<kAnyMissing, new_first_page, kReadByColumn, BinIdxType>; using Type = GHistBuildingManager<kAnyMissing, new_first_page, kReadByColumn, BinIdxType>;
}; };
template <bool new_read_by_column> template <bool new_read_by_column>
struct set_read_by_column { struct SetReadByColumn {
using type = GHistBuildingManager<kAnyMissing, kFirstPage, new_read_by_column, BinIdxType>; using Type = GHistBuildingManager<kAnyMissing, kFirstPage, new_read_by_column, BinIdxType>;
}; };
template<typename new_bin_idx_type> template <typename NewBinIdxType>
struct set_bin_idx_type { struct SetBinIdxType {
using type = GHistBuildingManager<kAnyMissing, kFirstPage, kReadByColumn, new_bin_idx_type>; using Type = GHistBuildingManager<kAnyMissing, kFirstPage, kReadByColumn, NewBinIdxType>;
}; };
using type = GHistBuildingManager<kAnyMissing, kFirstPage, kReadByColumn, BinIdxType>; using Type = GHistBuildingManager<kAnyMissing, kFirstPage, kReadByColumn, BinIdxType>;
public: public:
/* Entry point to dispatcher /* Entry point to dispatcher
@ -178,16 +178,16 @@ class GHistBuildingManager {
template <typename Fn> template <typename Fn>
static void DispatchAndExecute(const RuntimeFlags& flags, Fn&& fn) { static void DispatchAndExecute(const RuntimeFlags& flags, Fn&& fn) {
if (flags.first_page != kFirstPage) { 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) { } 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)) { } else if (flags.bin_type_size != sizeof(BinIdxType)) {
DispatchBinType(flags.bin_type_size, [&](auto t) { DispatchBinType(flags.bin_type_size, [&](auto t) {
using NewBinIdxType = decltype(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 { } else {
fn(type()); fn(Type());
} }
} }
}; };

View File

@ -16,6 +16,7 @@ steps:
key: run-clang-tidy key: run-clang-tidy
agents: agents:
queue: linux-amd64-cpu queue: linux-amd64-cpu
- wait
- label: ":console: Build CPU" - label: ":console: Build CPU"
command: "tests/buildkite/build-cpu.sh" command: "tests/buildkite/build-cpu.sh"
key: build-cpu key: build-cpu