Update clang-tidy. (#10730)

- Install cmake using pip.
- Fix compile command generation.
- Clean up the tidy script and remove the need to load the yaml file.
- Fix modernized type traits.
- Fix span class. Polymorphism support is dropped
This commit is contained in:
Jiaming Yuan
2024-08-22 04:12:18 +08:00
committed by GitHub
parent 03bd1183bc
commit cb54374550
34 changed files with 361 additions and 387 deletions

View File

@@ -93,11 +93,11 @@ TEST(Adapter, CSCAdapterColsMoreThanRows) {
// A mock for JVM data iterator.
class CSRIterForTest {
std::vector<float> data_ {1, 2, 3, 4, 5};
std::vector<std::remove_pointer<decltype(std::declval<XGBoostBatchCSR>().index)>::type>
feature_idx_ {0, 1, 0, 1, 1};
std::vector<std::remove_pointer<decltype(std::declval<XGBoostBatchCSR>().offset)>::type>
row_ptr_ {0, 2, 4, 5, 5};
std::vector<float> data_{1, 2, 3, 4, 5};
std::vector<std::remove_pointer_t<decltype(std::declval<XGBoostBatchCSR>().index)>> feature_idx_{
0, 1, 0, 1, 1};
std::vector<std::remove_pointer_t<decltype(std::declval<XGBoostBatchCSR>().offset)>> row_ptr_{
0, 2, 4, 5, 5};
size_t iter_ {0};
public:

View File

@@ -49,7 +49,7 @@ void TestSparseDMatrixLoadFile(Context const* ctx) {
1};
Page out;
for (auto const &page : m.GetBatches<Page>(ctx)) {
if (std::is_same<Page, SparsePage>::value) {
if (std::is_same_v<Page, SparsePage>) {
out.Push(page);
} else {
out.PushCSC(page);
@@ -89,7 +89,7 @@ void TestRetainPage() {
for (auto it = begin; it != end; ++it) {
iterators.push_back(it.Page());
pages.emplace_back(Page{});
if (std::is_same<Page, SparsePage>::value) {
if (std::is_same_v<Page, SparsePage>) {
pages.back().Push(*it);
} else {
pages.back().PushCSC(*it);
@@ -105,7 +105,7 @@ void TestRetainPage() {
// make sure it's const and the caller can not modify the content of page.
for (auto &page : p_fmat->GetBatches<Page>({&ctx})) {
static_assert(std::is_const<std::remove_reference_t<decltype(page)>>::value);
static_assert(std::is_const_v<std::remove_reference_t<decltype(page)>>);
}
}

View File

@@ -166,7 +166,7 @@ TEST(SparsePageDMatrix, RetainEllpackPage) {
// make sure it's const and the caller can not modify the content of page.
for (auto& page : m->GetBatches<EllpackPage>(&ctx, param)) {
static_assert(std::is_const<std::remove_reference_t<decltype(page)>>::value);
static_assert(std::is_const_v<std::remove_reference_t<decltype(page)>>);
}
// The above iteration clears out all references inside DMatrix.