From 27303db33a9bffcb9e5634daf030f478ae47fd43 Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Tue, 25 May 2021 18:03:55 -0400 Subject: [PATCH] [benchmark] Silence 'suggest override' and 'missing override' warnings When building with Clang 11 on Windows, silence the following: F:\aganea\llvm-project\llvm\utils\benchmark\include\benchmark/benchmark.h(955,8): warning: 'Run' overrides a member function but is not marked 'override' [-Wsuggest-override] void Run(State& st); ^ F:\aganea\llvm-project\llvm\utils\benchmark\include\benchmark/benchmark.h(895,16): note: overridden virtual function is here virtual void Run(State& state) = 0; ^ 1 warning generated. --- utils/benchmark/include/benchmark/benchmark.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/utils/benchmark/include/benchmark/benchmark.h b/utils/benchmark/include/benchmark/benchmark.h index 3b535f1b7d5..528aa7f9c8b 100644 --- a/utils/benchmark/include/benchmark/benchmark.h +++ b/utils/benchmark/include/benchmark/benchmark.h @@ -952,7 +952,7 @@ class FunctionBenchmark : public Benchmark { FunctionBenchmark(const char* name, Function* func) : Benchmark(name), func_(func) {} - virtual void Run(State& st); + void Run(State& st) override; private: Function* func_; @@ -962,7 +962,7 @@ class FunctionBenchmark : public Benchmark { template class LambdaBenchmark : public Benchmark { public: - virtual void Run(State& st) { lambda_(st); } + void Run(State& st) override { lambda_(st); } private: template @@ -1013,7 +1013,7 @@ class Fixture : public internal::Benchmark { public: Fixture() : internal::Benchmark("") {} - virtual void Run(State& st) { + void Run(State& st) override { this->SetUp(st); this->BenchmarkCase(st); this->TearDown(st); @@ -1399,8 +1399,8 @@ public: : output_options_(opts_), name_field_width_(0), prev_counters_(), printed_header_(false) {} - virtual bool ReportContext(const Context& context); - virtual void ReportRuns(const std::vector& reports); + bool ReportContext(const Context& context) override; + void ReportRuns(const std::vector& reports) override; protected: virtual void PrintRunData(const Run& report); @@ -1415,9 +1415,9 @@ public: class JSONReporter : public BenchmarkReporter { public: JSONReporter() : first_report_(true) {} - virtual bool ReportContext(const Context& context); - virtual void ReportRuns(const std::vector& reports); - virtual void Finalize(); + bool ReportContext(const Context& context) override; + void ReportRuns(const std::vector& reports) override; + void Finalize() override; private: void PrintRunData(const Run& report); @@ -1428,8 +1428,8 @@ class JSONReporter : public BenchmarkReporter { class CSVReporter : public BenchmarkReporter { public: CSVReporter() : printed_header_(false) {} - virtual bool ReportContext(const Context& context); - virtual void ReportRuns(const std::vector& reports); + bool ReportContext(const Context& context) override; + void ReportRuns(const std::vector& reports) override; private: void PrintRunData(const Run& report);