[llvm] 20c9a44 - [benchmark] Silence 'suggest override' and 'missing override' warnings

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Tue May 25 15:46:47 PDT 2021


Author: Alexandre Ganea
Date: 2021-05-25T18:46:37-04:00
New Revision: 20c9a44ac0164a657329020c0b3deabab3625688

URL: https://github.com/llvm/llvm-project/commit/20c9a44ac0164a657329020c0b3deabab3625688
DIFF: https://github.com/llvm/llvm-project/commit/20c9a44ac0164a657329020c0b3deabab3625688.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/utils/benchmark/include/benchmark/benchmark.h

Removed: 
    


################################################################################
diff  --git a/llvm/utils/benchmark/include/benchmark/benchmark.h b/llvm/utils/benchmark/include/benchmark/benchmark.h
index 3b535f1b7d523..528aa7f9c8bb8 100644
--- a/llvm/utils/benchmark/include/benchmark/benchmark.h
+++ b/llvm/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 Lambda>
 class LambdaBenchmark : public Benchmark {
  public:
-  virtual void Run(State& st) { lambda_(st); }
+  void Run(State& st) override { lambda_(st); }
 
  private:
   template <class OLambda>
@@ -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 @@ class ConsoleReporter : public BenchmarkReporter {
       : output_options_(opts_), name_field_width_(0),
         prev_counters_(), printed_header_(false) {}
 
-  virtual bool ReportContext(const Context& context);
-  virtual void ReportRuns(const std::vector<Run>& reports);
+  bool ReportContext(const Context& context) override;
+  void ReportRuns(const std::vector<Run>& reports) override;
 
  protected:
   virtual void PrintRunData(const Run& report);
@@ -1415,9 +1415,9 @@ class ConsoleReporter : public BenchmarkReporter {
 class JSONReporter : public BenchmarkReporter {
  public:
   JSONReporter() : first_report_(true) {}
-  virtual bool ReportContext(const Context& context);
-  virtual void ReportRuns(const std::vector<Run>& reports);
-  virtual void Finalize();
+  bool ReportContext(const Context& context) override;
+  void ReportRuns(const std::vector<Run>& 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<Run>& reports);
+  bool ReportContext(const Context& context) override;
+  void ReportRuns(const std::vector<Run>& reports) override;
 
  private:
   void PrintRunData(const Run& report);


        


More information about the llvm-commits mailing list