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

@@ -1,3 +1,6 @@
/**
* Copyright 2020-2024, XGBoost contributors
*/
#include <gtest/gtest.h>
#include <xgboost/intrusive_ptr.h>
@@ -12,10 +15,8 @@ class NotCopyConstructible {
NotCopyConstructible &operator=(NotCopyConstructible const &that) = delete;
NotCopyConstructible(NotCopyConstructible&& that) = default;
};
static_assert(
!std::is_trivially_copy_constructible<NotCopyConstructible>::value);
static_assert(
!std::is_trivially_copy_assignable<NotCopyConstructible>::value);
static_assert(!std::is_trivially_copy_constructible_v<NotCopyConstructible>);
static_assert(!std::is_trivially_copy_assignable_v<NotCopyConstructible>);
class ForIntrusivePtrTest {
public:

View File

@@ -1,5 +1,5 @@
/**
* Copyright 2018-2023, XGBoost contributors
* Copyright 2018-2024, XGBoost contributors
*/
#include "test_span.h"
@@ -174,19 +174,11 @@ TEST(Span, FromFirstLast) {
}
}
struct BaseClass {
virtual void operator()() {}
};
struct DerivedClass : public BaseClass {
void operator()() override {}
};
TEST(Span, FromOther) {
// convert constructor
{
Span<DerivedClass> derived;
Span<BaseClass> base { derived };
Span<int> derived;
Span<int const> base{derived};
ASSERT_EQ(base.size(), derived.size());
ASSERT_EQ(base.data(), derived.data());
}