Fix Clang-Tidy warnings related to modernize-use-override (#1523)

This commit is contained in:
SunBlack 2023-01-09 18:52:18 +01:00 committed by GitHub
parent 62edc4fb00
commit 37faf6f975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 65 additions and 65 deletions

View File

@ -1242,7 +1242,7 @@ class BENCHMARK_EXPORT FunctionBenchmark : public Benchmark {
FunctionBenchmark(const char* name, Function* func)
: Benchmark(name), func_(func) {}
virtual void Run(State& st) BENCHMARK_OVERRIDE;
void Run(State& st) BENCHMARK_OVERRIDE;
private:
Function* func_;
@ -1252,7 +1252,7 @@ class BENCHMARK_EXPORT FunctionBenchmark : public Benchmark {
template <class Lambda>
class LambdaBenchmark : public Benchmark {
public:
virtual void Run(State& st) BENCHMARK_OVERRIDE { lambda_(st); }
void Run(State& st) BENCHMARK_OVERRIDE { lambda_(st); }
private:
template <class OLambda>
@ -1302,7 +1302,7 @@ class Fixture : public internal::Benchmark {
public:
Fixture() : internal::Benchmark("") {}
virtual void Run(State& st) BENCHMARK_OVERRIDE {
void Run(State& st) BENCHMARK_OVERRIDE {
this->SetUp(st);
this->BenchmarkCase(st);
this->TearDown(st);
@ -1424,37 +1424,37 @@ class Fixture : public internal::Benchmark {
#define BENCHMARK_TEMPLATE(n, a) BENCHMARK_TEMPLATE1(n, a)
#endif
#define BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \
class BaseClass##_##Method##_Benchmark : public BaseClass { \
public: \
BaseClass##_##Method##_Benchmark() { \
this->SetName(#BaseClass "/" #Method); \
} \
\
protected: \
virtual void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
#define BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \
class BaseClass##_##Method##_Benchmark : public BaseClass { \
public: \
BaseClass##_##Method##_Benchmark() { \
this->SetName(#BaseClass "/" #Method); \
} \
\
protected: \
void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
};
#define BENCHMARK_TEMPLATE1_PRIVATE_DECLARE_F(BaseClass, Method, a) \
class BaseClass##_##Method##_Benchmark : public BaseClass<a> { \
public: \
BaseClass##_##Method##_Benchmark() { \
this->SetName(#BaseClass "<" #a ">/" #Method); \
} \
\
protected: \
virtual void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
#define BENCHMARK_TEMPLATE1_PRIVATE_DECLARE_F(BaseClass, Method, a) \
class BaseClass##_##Method##_Benchmark : public BaseClass<a> { \
public: \
BaseClass##_##Method##_Benchmark() { \
this->SetName(#BaseClass "<" #a ">/" #Method); \
} \
\
protected: \
void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
};
#define BENCHMARK_TEMPLATE2_PRIVATE_DECLARE_F(BaseClass, Method, a, b) \
class BaseClass##_##Method##_Benchmark : public BaseClass<a, b> { \
public: \
BaseClass##_##Method##_Benchmark() { \
this->SetName(#BaseClass "<" #a "," #b ">/" #Method); \
} \
\
protected: \
virtual void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
#define BENCHMARK_TEMPLATE2_PRIVATE_DECLARE_F(BaseClass, Method, a, b) \
class BaseClass##_##Method##_Benchmark : public BaseClass<a, b> { \
public: \
BaseClass##_##Method##_Benchmark() { \
this->SetName(#BaseClass "<" #a "," #b ">/" #Method); \
} \
\
protected: \
void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
};
#ifdef BENCHMARK_HAS_CXX11
@ -1466,7 +1466,7 @@ class Fixture : public internal::Benchmark {
} \
\
protected: \
virtual void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
};
#else
#define BENCHMARK_TEMPLATE_PRIVATE_DECLARE_F(n, a) \
@ -1774,8 +1774,8 @@ class BENCHMARK_EXPORT ConsoleReporter : public BenchmarkReporter {
explicit ConsoleReporter(OutputOptions opts_ = OO_Defaults)
: output_options_(opts_), name_field_width_(0), printed_header_(false) {}
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
protected:
virtual void PrintRunData(const Run& report);
@ -1790,9 +1790,9 @@ class BENCHMARK_EXPORT ConsoleReporter : public BenchmarkReporter {
class BENCHMARK_EXPORT JSONReporter : public BenchmarkReporter {
public:
JSONReporter() : first_report_(true) {}
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
virtual void Finalize() BENCHMARK_OVERRIDE;
bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
void Finalize() BENCHMARK_OVERRIDE;
private:
void PrintRunData(const Run& report);
@ -1805,8 +1805,8 @@ class BENCHMARK_EXPORT BENCHMARK_DEPRECATED_MSG(
: public BenchmarkReporter {
public:
CSVReporter() : printed_header_(false) {}
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
private:
void PrintRunData(const Run& report);

View File

@ -23,7 +23,7 @@ class ArgsProductFixture : public ::benchmark::Fixture {
{2, 15, 10, 9},
{4, 5, 6, 11}}) {}
void SetUp(const ::benchmark::State& state) BENCHMARK_OVERRIDE {
void SetUp(const ::benchmark::State& state) override {
std::vector<int64_t> ranges = {state.range(0), state.range(1),
state.range(2), state.range(3)};
@ -34,7 +34,7 @@ class ArgsProductFixture : public ::benchmark::Fixture {
// NOTE: This is not TearDown as we want to check after _all_ runs are
// complete.
virtual ~ArgsProductFixture() {
~ArgsProductFixture() override {
if (actualValues != expectedValues) {
std::cout << "EXPECTED\n";
for (const auto& v : expectedValues) {

View File

@ -80,11 +80,11 @@ int fixture_setup = 0;
class FIXTURE_BECHMARK_NAME : public ::benchmark::Fixture {
public:
void SetUp(const ::benchmark::State&) BENCHMARK_OVERRIDE {
void SetUp(const ::benchmark::State&) override {
fixture_interaction::fixture_setup++;
}
~FIXTURE_BECHMARK_NAME() {}
~FIXTURE_BECHMARK_NAME() override {}
};
BENCHMARK_F(FIXTURE_BECHMARK_NAME, BM_WithFixture)(benchmark::State& st) {

View File

@ -14,11 +14,11 @@ namespace {
class TestReporter : public benchmark::ConsoleReporter {
public:
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE {
bool ReportContext(const Context& context) override {
return ConsoleReporter::ReportContext(context);
};
virtual void ReportRuns(const std::vector<Run>& report) BENCHMARK_OVERRIDE {
void ReportRuns(const std::vector<Run>& report) override {
++count_;
max_family_index_ = std::max(max_family_index_, report[0].family_index);
ConsoleReporter::ReportRuns(report);
@ -26,7 +26,7 @@ class TestReporter : public benchmark::ConsoleReporter {
TestReporter() : count_(0), max_family_index_(0) {}
virtual ~TestReporter() {}
~TestReporter() override {}
int GetCount() const { return count_; }

View File

@ -8,21 +8,21 @@
class FIXTURE_BECHMARK_NAME : public ::benchmark::Fixture {
public:
void SetUp(const ::benchmark::State& state) BENCHMARK_OVERRIDE {
void SetUp(const ::benchmark::State& state) override {
if (state.thread_index() == 0) {
assert(data.get() == nullptr);
data.reset(new int(42));
}
}
void TearDown(const ::benchmark::State& state) BENCHMARK_OVERRIDE {
void TearDown(const ::benchmark::State& state) override {
if (state.thread_index() == 0) {
assert(data.get() != nullptr);
data.reset();
}
}
~FIXTURE_BECHMARK_NAME() { assert(data == nullptr); }
~FIXTURE_BECHMARK_NAME() override { assert(data == nullptr); }
std::unique_ptr<int> data;
};

View File

@ -34,11 +34,11 @@ BENCHMARK(BM_MapLookup)->Range(1 << 3, 1 << 12);
// Using fixtures.
class MapFixture : public ::benchmark::Fixture {
public:
void SetUp(const ::benchmark::State& st) BENCHMARK_OVERRIDE {
void SetUp(const ::benchmark::State& st) override {
m = ConstructRandomMap(static_cast<int>(st.range(0)));
}
void TearDown(const ::benchmark::State&) BENCHMARK_OVERRIDE { m.clear(); }
void TearDown(const ::benchmark::State&) override { m.clear(); }
std::map<int, int> m;
};

View File

@ -5,8 +5,8 @@
#include "output_test.h"
class TestMemoryManager : public benchmark::MemoryManager {
void Start() BENCHMARK_OVERRIDE {}
void Stop(Result& result) BENCHMARK_OVERRIDE {
void Start() override {}
void Stop(Result& result) override {
result.num_allocs = 42;
result.max_bytes_used = 42000;
}

View File

@ -28,7 +28,7 @@ class MultipleRangesFixture : public ::benchmark::Fixture {
{2, 7, 15},
{7, 6, 3}}) {}
void SetUp(const ::benchmark::State& state) BENCHMARK_OVERRIDE {
void SetUp(const ::benchmark::State& state) override {
std::vector<int64_t> ranges = {state.range(0), state.range(1),
state.range(2)};
@ -39,7 +39,7 @@ class MultipleRangesFixture : public ::benchmark::Fixture {
// NOTE: This is not TearDown as we want to check after _all_ runs are
// complete.
virtual ~MultipleRangesFixture() {
~MultipleRangesFixture() override {
if (actualValues != expectedValues) {
std::cout << "EXPECTED\n";
for (const auto& v : expectedValues) {

View File

@ -143,7 +143,7 @@ class TestReporter : public benchmark::BenchmarkReporter {
TestReporter(std::vector<benchmark::BenchmarkReporter*> reps)
: reporters_(std::move(reps)) {}
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE {
bool ReportContext(const Context& context) override {
bool last_ret = false;
bool first = true;
for (auto rep : reporters_) {
@ -157,10 +157,10 @@ class TestReporter : public benchmark::BenchmarkReporter {
return last_ret;
}
void ReportRuns(const std::vector<Run>& report) BENCHMARK_OVERRIDE {
void ReportRuns(const std::vector<Run>& report) override {
for (auto rep : reporters_) rep->ReportRuns(report);
}
void Finalize() BENCHMARK_OVERRIDE {
void Finalize() override {
for (auto rep : reporters_) rep->Finalize();
}

View File

@ -10,7 +10,7 @@ namespace {
class TestReporter : public benchmark::ConsoleReporter {
public:
virtual void ReportRuns(const std::vector<Run>& report) BENCHMARK_OVERRIDE {
void ReportRuns(const std::vector<Run>& report) override {
all_runs_.insert(all_runs_.end(), begin(report), end(report));
ConsoleReporter::ReportRuns(report);
}

View File

@ -10,17 +10,17 @@ namespace {
class TestReporter : public benchmark::ConsoleReporter {
public:
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE {
bool ReportContext(const Context& context) override {
return ConsoleReporter::ReportContext(context);
};
virtual void ReportRuns(const std::vector<Run>& report) BENCHMARK_OVERRIDE {
void ReportRuns(const std::vector<Run>& report) override {
all_runs_.insert(all_runs_.end(), begin(report), end(report));
ConsoleReporter::ReportRuns(report);
}
TestReporter() {}
virtual ~TestReporter() {}
~TestReporter() override {}
mutable std::vector<Run> all_runs_;
};

View File

@ -17,11 +17,11 @@ namespace {
class TestReporter : public benchmark::ConsoleReporter {
public:
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE {
bool ReportContext(const Context& context) override {
return ConsoleReporter::ReportContext(context);
};
virtual void ReportRuns(const std::vector<Run>& report) BENCHMARK_OVERRIDE {
void ReportRuns(const std::vector<Run>& report) override {
assert(report.size() == 1);
matched_functions.push_back(report[0].run_name.function_name);
ConsoleReporter::ReportRuns(report);
@ -29,7 +29,7 @@ class TestReporter : public benchmark::ConsoleReporter {
TestReporter() {}
virtual ~TestReporter() {}
~TestReporter() override {}
const std::vector<std::string>& GetMatchedFunctions() const {
return matched_functions;

View File

@ -9,7 +9,7 @@ namespace {
class DummyBenchmark : public Benchmark {
public:
DummyBenchmark() : Benchmark("dummy") {}
virtual void Run(State&) override {}
void Run(State&) override {}
};
TEST(DefaultTimeUnitTest, TimeUnitIsNotSet) {