chore: enable modernize-use-override and fix existing violations (#419)
Add modernize-use-override to .clang-tidy and apply fixes across src/ and tests/: replace redundant virtual with override, annotate missing override on derived methods, and drop redundant virtual on already-overridden methods.
This commit is contained in:
@@ -36,8 +36,8 @@ static inline size_t RandomDimension(void) {
|
||||
static size_t DIMENSION = RandomDimension();
|
||||
class FlatBuilderTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
|
||||
public:
|
||||
static std::string dir_;
|
||||
|
||||
@@ -22,8 +22,8 @@ constexpr size_t static dim = 16;
|
||||
|
||||
class FlatStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
void hybrid_scale(std::vector<float> &dense_value,
|
||||
std::vector<float> &sparse_value, float alpha_scale);
|
||||
|
||||
@@ -171,7 +171,8 @@ TEST_F(FlatStreamerTest, TestLinearSearch) {
|
||||
TEST_F(FlatStreamerTest, TestLinearSearchWithLRU) {
|
||||
MemoryLimitPool::get_instance().init(100 * 1024UL * 1024UL);
|
||||
#ifdef __ANDROID__
|
||||
GTEST_SKIP() << "Skipped on Android: requires ~6GB memory/disk (emulator limit)";
|
||||
GTEST_SKIP()
|
||||
<< "Skipped on Android: requires ~6GB memory/disk (emulator limit)";
|
||||
#endif
|
||||
constexpr size_t static dim = 1600;
|
||||
IndexStreamer::Pointer write_streamer =
|
||||
|
||||
@@ -22,8 +22,8 @@ constexpr size_t static dim = 128;
|
||||
|
||||
class FlatStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
void hybrid_scale(std::vector<float> &dense_value,
|
||||
std::vector<float> &sparse_value, float alpha_scale);
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ constexpr size_t static dim = 16;
|
||||
|
||||
class FlatStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
void hybrid_scale(std::vector<float> &dense_value,
|
||||
std::vector<float> &sparse_value, float alpha_scale);
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ using namespace std;
|
||||
|
||||
class FlatSparseBuilderTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
|
||||
static std::string _dir;
|
||||
static shared_ptr<IndexMeta> _index_meta_ptr;
|
||||
|
||||
@@ -37,8 +37,8 @@ constexpr size_t static sparse_dim_count = 16;
|
||||
|
||||
class FlatSparseSearcherTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
void generate_sparse_data(
|
||||
size_t cnt, uint32_t sparse_dim_count,
|
||||
std::vector<NumericalVector<uint32_t>> &sparse_indices_list,
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace core {
|
||||
|
||||
class FlatSparseStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
void generate_sparse_data(
|
||||
size_t cnt, uint32_t sparse_dim_count,
|
||||
std::vector<NumericalVector<uint32_t>> &sparse_indices_list,
|
||||
|
||||
@@ -39,8 +39,8 @@ constexpr static size_t sparse_dim_count = 16;
|
||||
|
||||
class FlatSparseStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
void generate_sparse_data(
|
||||
size_t cnt, uint32_t sparse_dim_count,
|
||||
std::vector<NumericalVector<uint32_t>> &sparse_indices_list,
|
||||
|
||||
@@ -23,8 +23,8 @@ constexpr size_t static dim = 16;
|
||||
|
||||
class HnswStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
void hybrid_scale(std::vector<float> &dense_value,
|
||||
std::vector<float> &sparse_value, float alpha_scale);
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ constexpr size_t static dim = 16;
|
||||
|
||||
class HnswStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
|
||||
static std::string dir_;
|
||||
static shared_ptr<IndexMeta> index_meta_ptr_;
|
||||
@@ -1595,27 +1595,27 @@ TEST_F(HnswStreamerTest, TestCheckDuplicateAndGetVector) {
|
||||
}
|
||||
|
||||
class TestDumper : public IndexDumper {
|
||||
virtual int init(const ailego::Params &) {
|
||||
int init(const ailego::Params &) override {
|
||||
return 0;
|
||||
}
|
||||
virtual int cleanup(void) {
|
||||
int cleanup(void) override {
|
||||
return 0;
|
||||
}
|
||||
virtual int create(const std::string &path) {
|
||||
int create(const std::string &path) override {
|
||||
return 0;
|
||||
}
|
||||
virtual uint32_t magic(void) const {
|
||||
uint32_t magic(void) const override {
|
||||
return 0;
|
||||
}
|
||||
virtual int close(void) {
|
||||
int close(void) override {
|
||||
return 0;
|
||||
}
|
||||
virtual int append(const std::string &id, size_t data_size,
|
||||
size_t padding_size, uint32_t crc) {
|
||||
int append(const std::string &id, size_t data_size, size_t padding_size,
|
||||
uint32_t crc) override {
|
||||
usleep(100000);
|
||||
return 0;
|
||||
}
|
||||
virtual size_t write(const void *data, size_t len) {
|
||||
size_t write(const void *data, size_t len) override {
|
||||
return len;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,8 +34,8 @@ constexpr size_t static dim = 128;
|
||||
|
||||
class HnswRabitqStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
|
||||
static std::string dir_;
|
||||
static shared_ptr<IndexMeta> index_meta_ptr_;
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace core {
|
||||
|
||||
class HnswSparseBuilderTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
|
||||
static std::string _dir;
|
||||
static shared_ptr<IndexMeta> _index_meta_ptr;
|
||||
|
||||
@@ -43,8 +43,8 @@ constexpr size_t static sparse_dim_count = 16;
|
||||
|
||||
class HnswSparseStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
void generate_sparse_data(
|
||||
size_t cnt, uint32_t sparse_dim_count,
|
||||
std::vector<NumericalVector<uint32_t>> &sparse_indices_list,
|
||||
@@ -1681,27 +1681,27 @@ TEST_F(HnswSparseStreamerTest, TestCheckDuplicateAndGetVector) {
|
||||
}
|
||||
|
||||
class TestDumper : public IndexDumper {
|
||||
virtual int init(const ailego::Params &) {
|
||||
int init(const ailego::Params &) override {
|
||||
return 0;
|
||||
}
|
||||
virtual int cleanup(void) {
|
||||
int cleanup(void) override {
|
||||
return 0;
|
||||
}
|
||||
virtual int create(const std::string &path) {
|
||||
int create(const std::string &path) override {
|
||||
return 0;
|
||||
}
|
||||
virtual uint32_t magic(void) const {
|
||||
uint32_t magic(void) const override {
|
||||
return 0;
|
||||
}
|
||||
virtual int close(void) {
|
||||
int close(void) override {
|
||||
return 0;
|
||||
}
|
||||
virtual int append(const std::string &id, size_t data_size,
|
||||
size_t padding_size, uint32_t crc) {
|
||||
int append(const std::string &id, size_t data_size, size_t padding_size,
|
||||
uint32_t crc) override {
|
||||
usleep(100000);
|
||||
return 0;
|
||||
}
|
||||
virtual size_t write(const void *data, size_t len) {
|
||||
size_t write(const void *data, size_t len) override {
|
||||
return len;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,8 +24,8 @@ using namespace std;
|
||||
|
||||
class IVFBuilderTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
|
||||
void prepare_index_holder(uint32_t base_key, uint32_t num);
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ using namespace std;
|
||||
class IVFSearcherTest : public testing::Test {
|
||||
public:
|
||||
protected:
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
void prepare_index_holder(uint32_t base_key, uint32_t num);
|
||||
|
||||
void prepare_rand_index_holder(uint32_t base_key, uint32_t num);
|
||||
|
||||
@@ -41,8 +41,8 @@ constexpr size_t kDim = 16;
|
||||
|
||||
class VamanaStreamerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp(void);
|
||||
void TearDown(void);
|
||||
void SetUp(void) override;
|
||||
void TearDown(void) override;
|
||||
|
||||
IndexStreamer::Pointer CreateVamanaStreamer(
|
||||
const ailego::Params &extra_params = ailego::Params());
|
||||
|
||||
Reference in New Issue
Block a user