mirror of https://github.com/google/benchmark.git
Fix Clang-Tidy warnings related to modernize-use-override (#1523)
This commit is contained in:
parent
62edc4fb00
commit
37faf6f975
|
@ -1242,7 +1242,7 @@ class BENCHMARK_EXPORT FunctionBenchmark : public Benchmark {
|
||||||
FunctionBenchmark(const char* name, Function* func)
|
FunctionBenchmark(const char* name, Function* func)
|
||||||
: Benchmark(name), func_(func) {}
|
: Benchmark(name), func_(func) {}
|
||||||
|
|
||||||
virtual void Run(State& st) BENCHMARK_OVERRIDE;
|
void Run(State& st) BENCHMARK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Function* func_;
|
Function* func_;
|
||||||
|
@ -1252,7 +1252,7 @@ class BENCHMARK_EXPORT FunctionBenchmark : public Benchmark {
|
||||||
template <class Lambda>
|
template <class Lambda>
|
||||||
class LambdaBenchmark : public Benchmark {
|
class LambdaBenchmark : public Benchmark {
|
||||||
public:
|
public:
|
||||||
virtual void Run(State& st) BENCHMARK_OVERRIDE { lambda_(st); }
|
void Run(State& st) BENCHMARK_OVERRIDE { lambda_(st); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <class OLambda>
|
template <class OLambda>
|
||||||
|
@ -1302,7 +1302,7 @@ class Fixture : public internal::Benchmark {
|
||||||
public:
|
public:
|
||||||
Fixture() : internal::Benchmark("") {}
|
Fixture() : internal::Benchmark("") {}
|
||||||
|
|
||||||
virtual void Run(State& st) BENCHMARK_OVERRIDE {
|
void Run(State& st) BENCHMARK_OVERRIDE {
|
||||||
this->SetUp(st);
|
this->SetUp(st);
|
||||||
this->BenchmarkCase(st);
|
this->BenchmarkCase(st);
|
||||||
this->TearDown(st);
|
this->TearDown(st);
|
||||||
|
@ -1424,37 +1424,37 @@ class Fixture : public internal::Benchmark {
|
||||||
#define BENCHMARK_TEMPLATE(n, a) BENCHMARK_TEMPLATE1(n, a)
|
#define BENCHMARK_TEMPLATE(n, a) BENCHMARK_TEMPLATE1(n, a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \
|
#define BENCHMARK_PRIVATE_DECLARE_F(BaseClass, Method) \
|
||||||
class BaseClass##_##Method##_Benchmark : public BaseClass { \
|
class BaseClass##_##Method##_Benchmark : public BaseClass { \
|
||||||
public: \
|
public: \
|
||||||
BaseClass##_##Method##_Benchmark() { \
|
BaseClass##_##Method##_Benchmark() { \
|
||||||
this->SetName(#BaseClass "/" #Method); \
|
this->SetName(#BaseClass "/" #Method); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
protected: \
|
protected: \
|
||||||
virtual void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
|
void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BENCHMARK_TEMPLATE1_PRIVATE_DECLARE_F(BaseClass, Method, a) \
|
#define BENCHMARK_TEMPLATE1_PRIVATE_DECLARE_F(BaseClass, Method, a) \
|
||||||
class BaseClass##_##Method##_Benchmark : public BaseClass<a> { \
|
class BaseClass##_##Method##_Benchmark : public BaseClass<a> { \
|
||||||
public: \
|
public: \
|
||||||
BaseClass##_##Method##_Benchmark() { \
|
BaseClass##_##Method##_Benchmark() { \
|
||||||
this->SetName(#BaseClass "<" #a ">/" #Method); \
|
this->SetName(#BaseClass "<" #a ">/" #Method); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
protected: \
|
protected: \
|
||||||
virtual void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
|
void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BENCHMARK_TEMPLATE2_PRIVATE_DECLARE_F(BaseClass, Method, a, b) \
|
#define BENCHMARK_TEMPLATE2_PRIVATE_DECLARE_F(BaseClass, Method, a, b) \
|
||||||
class BaseClass##_##Method##_Benchmark : public BaseClass<a, b> { \
|
class BaseClass##_##Method##_Benchmark : public BaseClass<a, b> { \
|
||||||
public: \
|
public: \
|
||||||
BaseClass##_##Method##_Benchmark() { \
|
BaseClass##_##Method##_Benchmark() { \
|
||||||
this->SetName(#BaseClass "<" #a "," #b ">/" #Method); \
|
this->SetName(#BaseClass "<" #a "," #b ">/" #Method); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
protected: \
|
protected: \
|
||||||
virtual void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
|
void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef BENCHMARK_HAS_CXX11
|
#ifdef BENCHMARK_HAS_CXX11
|
||||||
|
@ -1466,7 +1466,7 @@ class Fixture : public internal::Benchmark {
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
protected: \
|
protected: \
|
||||||
virtual void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
|
void BenchmarkCase(::benchmark::State&) BENCHMARK_OVERRIDE; \
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
#define BENCHMARK_TEMPLATE_PRIVATE_DECLARE_F(n, a) \
|
#define BENCHMARK_TEMPLATE_PRIVATE_DECLARE_F(n, a) \
|
||||||
|
@ -1774,8 +1774,8 @@ class BENCHMARK_EXPORT ConsoleReporter : public BenchmarkReporter {
|
||||||
explicit ConsoleReporter(OutputOptions opts_ = OO_Defaults)
|
explicit ConsoleReporter(OutputOptions opts_ = OO_Defaults)
|
||||||
: output_options_(opts_), name_field_width_(0), printed_header_(false) {}
|
: output_options_(opts_), name_field_width_(0), printed_header_(false) {}
|
||||||
|
|
||||||
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
|
bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
|
||||||
virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
|
void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void PrintRunData(const Run& report);
|
virtual void PrintRunData(const Run& report);
|
||||||
|
@ -1790,9 +1790,9 @@ class BENCHMARK_EXPORT ConsoleReporter : public BenchmarkReporter {
|
||||||
class BENCHMARK_EXPORT JSONReporter : public BenchmarkReporter {
|
class BENCHMARK_EXPORT JSONReporter : public BenchmarkReporter {
|
||||||
public:
|
public:
|
||||||
JSONReporter() : first_report_(true) {}
|
JSONReporter() : first_report_(true) {}
|
||||||
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
|
bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
|
||||||
virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
|
void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
|
||||||
virtual void Finalize() BENCHMARK_OVERRIDE;
|
void Finalize() BENCHMARK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PrintRunData(const Run& report);
|
void PrintRunData(const Run& report);
|
||||||
|
@ -1805,8 +1805,8 @@ class BENCHMARK_EXPORT BENCHMARK_DEPRECATED_MSG(
|
||||||
: public BenchmarkReporter {
|
: public BenchmarkReporter {
|
||||||
public:
|
public:
|
||||||
CSVReporter() : printed_header_(false) {}
|
CSVReporter() : printed_header_(false) {}
|
||||||
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
|
bool ReportContext(const Context& context) BENCHMARK_OVERRIDE;
|
||||||
virtual void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
|
void ReportRuns(const std::vector<Run>& reports) BENCHMARK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PrintRunData(const Run& report);
|
void PrintRunData(const Run& report);
|
||||||
|
|
|
@ -23,7 +23,7 @@ class ArgsProductFixture : public ::benchmark::Fixture {
|
||||||
{2, 15, 10, 9},
|
{2, 15, 10, 9},
|
||||||
{4, 5, 6, 11}}) {}
|
{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),
|
std::vector<int64_t> ranges = {state.range(0), state.range(1),
|
||||||
state.range(2), state.range(3)};
|
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
|
// NOTE: This is not TearDown as we want to check after _all_ runs are
|
||||||
// complete.
|
// complete.
|
||||||
virtual ~ArgsProductFixture() {
|
~ArgsProductFixture() override {
|
||||||
if (actualValues != expectedValues) {
|
if (actualValues != expectedValues) {
|
||||||
std::cout << "EXPECTED\n";
|
std::cout << "EXPECTED\n";
|
||||||
for (const auto& v : expectedValues) {
|
for (const auto& v : expectedValues) {
|
||||||
|
|
|
@ -80,11 +80,11 @@ int fixture_setup = 0;
|
||||||
|
|
||||||
class FIXTURE_BECHMARK_NAME : public ::benchmark::Fixture {
|
class FIXTURE_BECHMARK_NAME : public ::benchmark::Fixture {
|
||||||
public:
|
public:
|
||||||
void SetUp(const ::benchmark::State&) BENCHMARK_OVERRIDE {
|
void SetUp(const ::benchmark::State&) override {
|
||||||
fixture_interaction::fixture_setup++;
|
fixture_interaction::fixture_setup++;
|
||||||
}
|
}
|
||||||
|
|
||||||
~FIXTURE_BECHMARK_NAME() {}
|
~FIXTURE_BECHMARK_NAME() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
BENCHMARK_F(FIXTURE_BECHMARK_NAME, BM_WithFixture)(benchmark::State& st) {
|
BENCHMARK_F(FIXTURE_BECHMARK_NAME, BM_WithFixture)(benchmark::State& st) {
|
||||||
|
|
|
@ -14,11 +14,11 @@ namespace {
|
||||||
|
|
||||||
class TestReporter : public benchmark::ConsoleReporter {
|
class TestReporter : public benchmark::ConsoleReporter {
|
||||||
public:
|
public:
|
||||||
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE {
|
bool ReportContext(const Context& context) override {
|
||||||
return ConsoleReporter::ReportContext(context);
|
return ConsoleReporter::ReportContext(context);
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void ReportRuns(const std::vector<Run>& report) BENCHMARK_OVERRIDE {
|
void ReportRuns(const std::vector<Run>& report) override {
|
||||||
++count_;
|
++count_;
|
||||||
max_family_index_ = std::max(max_family_index_, report[0].family_index);
|
max_family_index_ = std::max(max_family_index_, report[0].family_index);
|
||||||
ConsoleReporter::ReportRuns(report);
|
ConsoleReporter::ReportRuns(report);
|
||||||
|
@ -26,7 +26,7 @@ class TestReporter : public benchmark::ConsoleReporter {
|
||||||
|
|
||||||
TestReporter() : count_(0), max_family_index_(0) {}
|
TestReporter() : count_(0), max_family_index_(0) {}
|
||||||
|
|
||||||
virtual ~TestReporter() {}
|
~TestReporter() override {}
|
||||||
|
|
||||||
int GetCount() const { return count_; }
|
int GetCount() const { return count_; }
|
||||||
|
|
||||||
|
|
|
@ -8,21 +8,21 @@
|
||||||
|
|
||||||
class FIXTURE_BECHMARK_NAME : public ::benchmark::Fixture {
|
class FIXTURE_BECHMARK_NAME : public ::benchmark::Fixture {
|
||||||
public:
|
public:
|
||||||
void SetUp(const ::benchmark::State& state) BENCHMARK_OVERRIDE {
|
void SetUp(const ::benchmark::State& state) override {
|
||||||
if (state.thread_index() == 0) {
|
if (state.thread_index() == 0) {
|
||||||
assert(data.get() == nullptr);
|
assert(data.get() == nullptr);
|
||||||
data.reset(new int(42));
|
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) {
|
if (state.thread_index() == 0) {
|
||||||
assert(data.get() != nullptr);
|
assert(data.get() != nullptr);
|
||||||
data.reset();
|
data.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~FIXTURE_BECHMARK_NAME() { assert(data == nullptr); }
|
~FIXTURE_BECHMARK_NAME() override { assert(data == nullptr); }
|
||||||
|
|
||||||
std::unique_ptr<int> data;
|
std::unique_ptr<int> data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,11 +34,11 @@ BENCHMARK(BM_MapLookup)->Range(1 << 3, 1 << 12);
|
||||||
// Using fixtures.
|
// Using fixtures.
|
||||||
class MapFixture : public ::benchmark::Fixture {
|
class MapFixture : public ::benchmark::Fixture {
|
||||||
public:
|
public:
|
||||||
void SetUp(const ::benchmark::State& st) BENCHMARK_OVERRIDE {
|
void SetUp(const ::benchmark::State& st) override {
|
||||||
m = ConstructRandomMap(static_cast<int>(st.range(0)));
|
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;
|
std::map<int, int> m;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
#include "output_test.h"
|
#include "output_test.h"
|
||||||
|
|
||||||
class TestMemoryManager : public benchmark::MemoryManager {
|
class TestMemoryManager : public benchmark::MemoryManager {
|
||||||
void Start() BENCHMARK_OVERRIDE {}
|
void Start() override {}
|
||||||
void Stop(Result& result) BENCHMARK_OVERRIDE {
|
void Stop(Result& result) override {
|
||||||
result.num_allocs = 42;
|
result.num_allocs = 42;
|
||||||
result.max_bytes_used = 42000;
|
result.max_bytes_used = 42000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ class MultipleRangesFixture : public ::benchmark::Fixture {
|
||||||
{2, 7, 15},
|
{2, 7, 15},
|
||||||
{7, 6, 3}}) {}
|
{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),
|
std::vector<int64_t> ranges = {state.range(0), state.range(1),
|
||||||
state.range(2)};
|
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
|
// NOTE: This is not TearDown as we want to check after _all_ runs are
|
||||||
// complete.
|
// complete.
|
||||||
virtual ~MultipleRangesFixture() {
|
~MultipleRangesFixture() override {
|
||||||
if (actualValues != expectedValues) {
|
if (actualValues != expectedValues) {
|
||||||
std::cout << "EXPECTED\n";
|
std::cout << "EXPECTED\n";
|
||||||
for (const auto& v : expectedValues) {
|
for (const auto& v : expectedValues) {
|
||||||
|
|
|
@ -143,7 +143,7 @@ class TestReporter : public benchmark::BenchmarkReporter {
|
||||||
TestReporter(std::vector<benchmark::BenchmarkReporter*> reps)
|
TestReporter(std::vector<benchmark::BenchmarkReporter*> reps)
|
||||||
: reporters_(std::move(reps)) {}
|
: reporters_(std::move(reps)) {}
|
||||||
|
|
||||||
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE {
|
bool ReportContext(const Context& context) override {
|
||||||
bool last_ret = false;
|
bool last_ret = false;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto rep : reporters_) {
|
for (auto rep : reporters_) {
|
||||||
|
@ -157,10 +157,10 @@ class TestReporter : public benchmark::BenchmarkReporter {
|
||||||
return last_ret;
|
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);
|
for (auto rep : reporters_) rep->ReportRuns(report);
|
||||||
}
|
}
|
||||||
void Finalize() BENCHMARK_OVERRIDE {
|
void Finalize() override {
|
||||||
for (auto rep : reporters_) rep->Finalize();
|
for (auto rep : reporters_) rep->Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace {
|
||||||
|
|
||||||
class TestReporter : public benchmark::ConsoleReporter {
|
class TestReporter : public benchmark::ConsoleReporter {
|
||||||
public:
|
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));
|
all_runs_.insert(all_runs_.end(), begin(report), end(report));
|
||||||
ConsoleReporter::ReportRuns(report);
|
ConsoleReporter::ReportRuns(report);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,17 +10,17 @@ namespace {
|
||||||
|
|
||||||
class TestReporter : public benchmark::ConsoleReporter {
|
class TestReporter : public benchmark::ConsoleReporter {
|
||||||
public:
|
public:
|
||||||
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE {
|
bool ReportContext(const Context& context) override {
|
||||||
return ConsoleReporter::ReportContext(context);
|
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));
|
all_runs_.insert(all_runs_.end(), begin(report), end(report));
|
||||||
ConsoleReporter::ReportRuns(report);
|
ConsoleReporter::ReportRuns(report);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestReporter() {}
|
TestReporter() {}
|
||||||
virtual ~TestReporter() {}
|
~TestReporter() override {}
|
||||||
|
|
||||||
mutable std::vector<Run> all_runs_;
|
mutable std::vector<Run> all_runs_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,11 +17,11 @@ namespace {
|
||||||
|
|
||||||
class TestReporter : public benchmark::ConsoleReporter {
|
class TestReporter : public benchmark::ConsoleReporter {
|
||||||
public:
|
public:
|
||||||
virtual bool ReportContext(const Context& context) BENCHMARK_OVERRIDE {
|
bool ReportContext(const Context& context) override {
|
||||||
return ConsoleReporter::ReportContext(context);
|
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);
|
assert(report.size() == 1);
|
||||||
matched_functions.push_back(report[0].run_name.function_name);
|
matched_functions.push_back(report[0].run_name.function_name);
|
||||||
ConsoleReporter::ReportRuns(report);
|
ConsoleReporter::ReportRuns(report);
|
||||||
|
@ -29,7 +29,7 @@ class TestReporter : public benchmark::ConsoleReporter {
|
||||||
|
|
||||||
TestReporter() {}
|
TestReporter() {}
|
||||||
|
|
||||||
virtual ~TestReporter() {}
|
~TestReporter() override {}
|
||||||
|
|
||||||
const std::vector<std::string>& GetMatchedFunctions() const {
|
const std::vector<std::string>& GetMatchedFunctions() const {
|
||||||
return matched_functions;
|
return matched_functions;
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace {
|
||||||
class DummyBenchmark : public Benchmark {
|
class DummyBenchmark : public Benchmark {
|
||||||
public:
|
public:
|
||||||
DummyBenchmark() : Benchmark("dummy") {}
|
DummyBenchmark() : Benchmark("dummy") {}
|
||||||
virtual void Run(State&) override {}
|
void Run(State&) override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(DefaultTimeUnitTest, TimeUnitIsNotSet) {
|
TEST(DefaultTimeUnitTest, TimeUnitIsNotSet) {
|
||||||
|
|
Loading…
Reference in New Issue