Replace virtual keyword by override

virtual can be ambiguous. Applied changes correspond to clang-tidy fixes
stemming from the modernize-use-override check.

Change-Id: I973afd4680a5df587419777504aeb94467196b89
diff --git a/include/ceres/autodiff_first_order_function.h b/include/ceres/autodiff_first_order_function.h
index d0280b0..c3c5cb2 100644
--- a/include/ceres/autodiff_first_order_function.h
+++ b/include/ceres/autodiff_first_order_function.h
@@ -110,7 +110,7 @@
     static_assert(kNumParameters > 0, "kNumParameters must be positive");
   }
 
-  virtual ~AutoDiffFirstOrderFunction() {}
+  ~AutoDiffFirstOrderFunction() override {}
 
   bool Evaluate(const double* const parameters,
                 double* cost,
diff --git a/include/ceres/autodiff_local_parameterization.h b/include/ceres/autodiff_local_parameterization.h
index 4ca4a50..38bc45a 100644
--- a/include/ceres/autodiff_local_parameterization.h
+++ b/include/ceres/autodiff_local_parameterization.h
@@ -114,7 +114,7 @@
   explicit AutoDiffLocalParameterization(Functor* functor)
       : functor_(functor) {}
 
-  virtual ~AutoDiffLocalParameterization() {}
+  ~AutoDiffLocalParameterization() override {}
   bool Plus(const double* x,
             const double* delta,
             double* x_plus_delta) const override {
diff --git a/include/ceres/conditioned_cost_function.h b/include/ceres/conditioned_cost_function.h
index a57ee20..8690c83 100644
--- a/include/ceres/conditioned_cost_function.h
+++ b/include/ceres/conditioned_cost_function.h
@@ -82,7 +82,7 @@
   ConditionedCostFunction(CostFunction* wrapped_cost_function,
                           const std::vector<CostFunction*>& conditioners,
                           Ownership ownership);
-  virtual ~ConditionedCostFunction();
+  ~ConditionedCostFunction() override;
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
diff --git a/include/ceres/dynamic_autodiff_cost_function.h b/include/ceres/dynamic_autodiff_cost_function.h
index 7ccf6a8..0531786 100644
--- a/include/ceres/dynamic_autodiff_cost_function.h
+++ b/include/ceres/dynamic_autodiff_cost_function.h
@@ -87,7 +87,7 @@
   explicit DynamicAutoDiffCostFunction(DynamicAutoDiffCostFunction&& other)
       : functor_(std::move(other.functor_)), ownership_(other.ownership_) {}
 
-  virtual ~DynamicAutoDiffCostFunction() {
+  ~DynamicAutoDiffCostFunction() override {
     // Manually release pointer if configured to not take ownership
     // rather than deleting only if ownership is taken.  This is to
     // stay maximally compatible to old user code which may have
diff --git a/include/ceres/dynamic_cost_function.h b/include/ceres/dynamic_cost_function.h
index 6e8a076..2afb08d 100644
--- a/include/ceres/dynamic_cost_function.h
+++ b/include/ceres/dynamic_cost_function.h
@@ -40,7 +40,7 @@
 // parameter blocks and set the number of residuals at run time.
 class CERES_EXPORT DynamicCostFunction : public CostFunction {
  public:
-  ~DynamicCostFunction() {}
+  ~DynamicCostFunction() override {}
 
   virtual void AddParameterBlock(int size) {
     mutable_parameter_block_sizes()->push_back(size);
diff --git a/include/ceres/dynamic_numeric_diff_cost_function.h b/include/ceres/dynamic_numeric_diff_cost_function.h
index ccc8f66..ff02b40 100644
--- a/include/ceres/dynamic_numeric_diff_cost_function.h
+++ b/include/ceres/dynamic_numeric_diff_cost_function.h
@@ -89,7 +89,7 @@
       DynamicNumericDiffCostFunction&& other)
       : functor_(std::move(other.functor_)), ownership_(other.ownership_) {}
 
-  virtual ~DynamicNumericDiffCostFunction() {
+  ~DynamicNumericDiffCostFunction() override {
     if (ownership_ != TAKE_OWNERSHIP) {
       functor_.release();
     }
diff --git a/include/ceres/local_parameterization.h b/include/ceres/local_parameterization.h
index ba7579d..0144e7d 100644
--- a/include/ceres/local_parameterization.h
+++ b/include/ceres/local_parameterization.h
@@ -155,7 +155,7 @@
 class CERES_EXPORT IdentityParameterization : public LocalParameterization {
  public:
   explicit IdentityParameterization(int size);
-  virtual ~IdentityParameterization() {}
+  ~IdentityParameterization() override {}
   bool Plus(const double* x,
             const double* delta,
             double* x_plus_delta) const override;
@@ -176,7 +176,7 @@
  public:
   explicit SubsetParameterization(int size,
                                   const std::vector<int>& constant_parameters);
-  virtual ~SubsetParameterization() {}
+  ~SubsetParameterization() override {}
   bool Plus(const double* x,
             const double* delta,
             double* x_plus_delta) const override;
@@ -201,7 +201,7 @@
 // theta) part.
 class CERES_EXPORT QuaternionParameterization : public LocalParameterization {
  public:
-  virtual ~QuaternionParameterization() {}
+  ~QuaternionParameterization() override {}
   bool Plus(const double* x,
             const double* delta,
             double* x_plus_delta) const override;
@@ -224,7 +224,7 @@
 class CERES_EXPORT EigenQuaternionParameterization
     : public ceres::LocalParameterization {
  public:
-  virtual ~EigenQuaternionParameterization() {}
+  ~EigenQuaternionParameterization() override {}
   bool Plus(const double* x,
             const double* delta,
             double* x_plus_delta) const override;
@@ -250,7 +250,7 @@
     : public LocalParameterization {
  public:
   explicit HomogeneousVectorParameterization(int size);
-  virtual ~HomogeneousVectorParameterization() {}
+  ~HomogeneousVectorParameterization() override {}
   bool Plus(const double* x,
             const double* delta,
             double* x_plus_delta) const override;
@@ -306,7 +306,7 @@
  public:
   ProductParameterization(const ProductParameterization&) = delete;
   ProductParameterization& operator=(const ProductParameterization&) = delete;
-  virtual ~ProductParameterization() {}
+  ~ProductParameterization() override {}
   //
   // NOTE: The constructor takes ownership of the input local
   // parameterizations.
diff --git a/include/ceres/loss_function.h b/include/ceres/loss_function.h
index e48d953..5c7bb85 100644
--- a/include/ceres/loss_function.h
+++ b/include/ceres/loss_function.h
@@ -301,7 +301,7 @@
                         Ownership ownership_f,
                         const LossFunction* g,
                         Ownership ownership_g);
-  virtual ~ComposedLoss();
+  ~ComposedLoss() override;
   void Evaluate(double, double*) const override;
 
  private:
@@ -336,7 +336,7 @@
   ScaledLoss(const ScaledLoss&) = delete;
   void operator=(const ScaledLoss&) = delete;
 
-  virtual ~ScaledLoss() {
+  ~ScaledLoss() override {
     if (ownership_ == DO_NOT_TAKE_OWNERSHIP) {
       rho_.release();
     }
@@ -396,7 +396,7 @@
   LossFunctionWrapper(const LossFunctionWrapper&) = delete;
   void operator=(const LossFunctionWrapper&) = delete;
 
-  virtual ~LossFunctionWrapper() {
+  ~LossFunctionWrapper() override {
     if (ownership_ == DO_NOT_TAKE_OWNERSHIP) {
       rho_.release();
     }
diff --git a/include/ceres/manifold.h b/include/ceres/manifold.h
index ef4b2a7..c3715d9 100644
--- a/include/ceres/manifold.h
+++ b/include/ceres/manifold.h
@@ -231,7 +231,7 @@
 class CERES_EXPORT EuclideanManifold : public Manifold {
  public:
   EuclideanManifold(int size);
-  virtual ~EuclideanManifold() = default;
+  ~EuclideanManifold() override = default;
   int AmbientSize() const override;
   int TangentSize() const override;
   bool Plus(const double* x,
@@ -255,7 +255,7 @@
 class CERES_EXPORT SubsetManifold : public Manifold {
  public:
   SubsetManifold(int size, const std::vector<int>& constant_parameters);
-  virtual ~SubsetManifold() = default;
+  ~SubsetManifold() override = default;
   int AmbientSize() const override;
   int TangentSize() const override;
 
@@ -293,7 +293,7 @@
  public:
   ProductManifold(const ProductManifold&) = delete;
   ProductManifold& operator=(const ProductManifold&) = delete;
-  virtual ~ProductManifold() {}
+  ~ProductManifold() override {}
 
   // NOTE: The constructor takes ownership of the input
   // manifolds.
@@ -369,7 +369,7 @@
 class CERES_EXPORT QuaternionManifold : public Manifold {
  public:
   QuaternionManifold() = default;
-  virtual ~QuaternionManifold() = default;
+  ~QuaternionManifold() override = default;
   int AmbientSize() const override { return 4; }
   int TangentSize() const override { return 3; }
 
@@ -395,7 +395,7 @@
 class CERES_EXPORT EigenQuaternionManifold : public Manifold {
  public:
   EigenQuaternionManifold() = default;
-  virtual ~EigenQuaternionManifold() = default;
+  ~EigenQuaternionManifold() override = default;
   int AmbientSize() const override { return 4; }
   int TangentSize() const override { return 3; }
 
diff --git a/include/ceres/sized_cost_function.h b/include/ceres/sized_cost_function.h
index 8e92f1b..55355bd 100644
--- a/include/ceres/sized_cost_function.h
+++ b/include/ceres/sized_cost_function.h
@@ -61,7 +61,7 @@
     *mutable_parameter_block_sizes() = std::vector<int32_t>{Ns...};
   }
 
-  virtual ~SizedCostFunction() {}
+  ~SizedCostFunction() override {}
 
   // Subclasses must implement Evaluate().
 };
diff --git a/internal/ceres/block_jacobi_preconditioner.h b/internal/ceres/block_jacobi_preconditioner.h
index 18f7495..4f4a493 100644
--- a/internal/ceres/block_jacobi_preconditioner.h
+++ b/internal/ceres/block_jacobi_preconditioner.h
@@ -61,7 +61,7 @@
   BlockJacobiPreconditioner(const BlockJacobiPreconditioner&) = delete;
   void operator=(const BlockJacobiPreconditioner&) = delete;
 
-  virtual ~BlockJacobiPreconditioner();
+  ~BlockJacobiPreconditioner() override;
 
   // Preconditioner interface
   void RightMultiply(const double* x, double* y) const final;
diff --git a/internal/ceres/block_random_access_dense_matrix.h b/internal/ceres/block_random_access_dense_matrix.h
index 9e55524..21007de 100644
--- a/internal/ceres/block_random_access_dense_matrix.h
+++ b/internal/ceres/block_random_access_dense_matrix.h
@@ -61,7 +61,7 @@
 
   // The destructor is not thread safe. It assumes that no one is
   // modifying any cells when the matrix is being destroyed.
-  virtual ~BlockRandomAccessDenseMatrix();
+  ~BlockRandomAccessDenseMatrix() override;
 
   // BlockRandomAccessMatrix interface.
   CellInfo* GetCell(int row_block_id,
diff --git a/internal/ceres/block_random_access_diagonal_matrix.h b/internal/ceres/block_random_access_diagonal_matrix.h
index 3fe7c1e..31e8b0b 100644
--- a/internal/ceres/block_random_access_diagonal_matrix.h
+++ b/internal/ceres/block_random_access_diagonal_matrix.h
@@ -57,7 +57,7 @@
 
   // The destructor is not thread safe. It assumes that no one is
   // modifying any cells when the matrix is being destroyed.
-  virtual ~BlockRandomAccessDiagonalMatrix();
+  ~BlockRandomAccessDiagonalMatrix() override;
 
   // BlockRandomAccessMatrix Interface.
   CellInfo* GetCell(int row_block_id,
diff --git a/internal/ceres/block_random_access_diagonal_matrix_test.cc b/internal/ceres/block_random_access_diagonal_matrix_test.cc
index e384dac..afd95ee 100644
--- a/internal/ceres/block_random_access_diagonal_matrix_test.cc
+++ b/internal/ceres/block_random_access_diagonal_matrix_test.cc
@@ -44,7 +44,7 @@
 
 class BlockRandomAccessDiagonalMatrixTest : public ::testing::Test {
  public:
-  void SetUp() {
+  void SetUp() override {
     std::vector<int> blocks;
     blocks.push_back(3);
     blocks.push_back(4);
diff --git a/internal/ceres/block_random_access_sparse_matrix.h b/internal/ceres/block_random_access_sparse_matrix.h
index 0e58bbb..67041b8 100644
--- a/internal/ceres/block_random_access_sparse_matrix.h
+++ b/internal/ceres/block_random_access_sparse_matrix.h
@@ -65,7 +65,7 @@
 
   // The destructor is not thread safe. It assumes that no one is
   // modifying any cells when the matrix is being destroyed.
-  virtual ~BlockRandomAccessSparseMatrix();
+  ~BlockRandomAccessSparseMatrix() override;
 
   // BlockRandomAccessMatrix Interface.
   CellInfo* GetCell(int row_block_id,
diff --git a/internal/ceres/block_sparse_matrix.h b/internal/ceres/block_sparse_matrix.h
index e5b3634..ecf6263 100644
--- a/internal/ceres/block_sparse_matrix.h
+++ b/internal/ceres/block_sparse_matrix.h
@@ -68,7 +68,7 @@
   BlockSparseMatrix(const BlockSparseMatrix&) = delete;
   void operator=(const BlockSparseMatrix&) = delete;
 
-  virtual ~BlockSparseMatrix();
+  ~BlockSparseMatrix() override;
 
   // Implementation of SparseMatrix interface.
   void SetZero() final;
diff --git a/internal/ceres/c_api.cc b/internal/ceres/c_api.cc
index 251cde4..a813fd4 100644
--- a/internal/ceres/c_api.cc
+++ b/internal/ceres/c_api.cc
@@ -78,7 +78,7 @@
     }
   }
 
-  virtual ~CallbackCostFunction() {}
+  ~CallbackCostFunction() override {}
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
diff --git a/internal/ceres/callbacks.h b/internal/ceres/callbacks.h
index 47112b8..9676287 100644
--- a/internal/ceres/callbacks.h
+++ b/internal/ceres/callbacks.h
@@ -46,7 +46,7 @@
 class StateUpdatingCallback : public IterationCallback {
  public:
   StateUpdatingCallback(Program* program, double* parameters);
-  virtual ~StateUpdatingCallback();
+  ~StateUpdatingCallback() override;
   CallbackReturnType operator()(const IterationSummary& summary) final;
 
  private:
@@ -61,7 +61,7 @@
   GradientProblemSolverStateUpdatingCallback(int num_parameters,
                                              const double* internal_parameters,
                                              double* user_parameters);
-  virtual ~GradientProblemSolverStateUpdatingCallback();
+  ~GradientProblemSolverStateUpdatingCallback() override;
   CallbackReturnType operator()(const IterationSummary& summary) final;
 
  private:
@@ -75,7 +75,7 @@
 class LoggingCallback : public IterationCallback {
  public:
   LoggingCallback(MinimizerType minimizer_type, bool log_to_stdout);
-  virtual ~LoggingCallback();
+  ~LoggingCallback() override;
   CallbackReturnType operator()(const IterationSummary& summary) final;
 
  private:
diff --git a/internal/ceres/cgnr_linear_operator.h b/internal/ceres/cgnr_linear_operator.h
index beb8bbc..82dcf2d 100644
--- a/internal/ceres/cgnr_linear_operator.h
+++ b/internal/ceres/cgnr_linear_operator.h
@@ -82,7 +82,7 @@
  public:
   CgnrLinearOperator(const LinearOperator& A, const double* D)
       : A_(A), D_(D), z_(new double[A.num_rows()]) {}
-  virtual ~CgnrLinearOperator() {}
+  ~CgnrLinearOperator() override {}
 
   void RightMultiply(const double* x, double* y) const final {
     std::fill(z_.get(), z_.get() + A_.num_rows(), 0.0);
diff --git a/internal/ceres/cgnr_solver.h b/internal/ceres/cgnr_solver.h
index bc701c0..99f3cd7 100644
--- a/internal/ceres/cgnr_solver.h
+++ b/internal/ceres/cgnr_solver.h
@@ -54,7 +54,7 @@
   explicit CgnrSolver(const LinearSolver::Options& options);
   CgnrSolver(const CgnrSolver&) = delete;
   void operator=(const CgnrSolver&) = delete;
-  virtual ~CgnrSolver();
+  ~CgnrSolver() override;
 
   Summary SolveImpl(BlockSparseMatrix* A,
                     const double* b,
diff --git a/internal/ceres/compressed_col_sparse_matrix_utils_test.cc b/internal/ceres/compressed_col_sparse_matrix_utils_test.cc
index 339c064..3c71a81 100644
--- a/internal/ceres/compressed_col_sparse_matrix_utils_test.cc
+++ b/internal/ceres/compressed_col_sparse_matrix_utils_test.cc
@@ -168,7 +168,7 @@
 
 class SolveUpperTriangularTest : public ::testing::Test {
  protected:
-  void SetUp() {
+  void SetUp() override {
     cols.resize(5);
     rows.resize(7);
     values.resize(7);
diff --git a/internal/ceres/compressed_row_sparse_matrix.h b/internal/ceres/compressed_row_sparse_matrix.h
index e4eb985..a92fc91 100644
--- a/internal/ceres/compressed_row_sparse_matrix.h
+++ b/internal/ceres/compressed_row_sparse_matrix.h
@@ -100,7 +100,7 @@
   CompressedRowSparseMatrix(const double* diagonal, int num_rows);
 
   // SparseMatrix interface.
-  virtual ~CompressedRowSparseMatrix();
+  ~CompressedRowSparseMatrix() override;
   void SetZero() final;
   void RightMultiply(const double* x, double* y) const final;
   void LeftMultiply(const double* x, double* y) const final;
diff --git a/internal/ceres/context_impl.h b/internal/ceres/context_impl.h
index 574d1ef..384db12 100644
--- a/internal/ceres/context_impl.h
+++ b/internal/ceres/context_impl.h
@@ -51,7 +51,7 @@
   ContextImpl(const ContextImpl&) = delete;
   void operator=(const ContextImpl&) = delete;
 
-  virtual ~ContextImpl() {}
+  ~ContextImpl() override {}
 
   // When compiled with C++ threading support, resize the thread pool to have
   // at min(num_thread, num_hardware_threads) where num_hardware_threads is
diff --git a/internal/ceres/coordinate_descent_minimizer.h b/internal/ceres/coordinate_descent_minimizer.h
index 7d17d53..90ba2cf 100644
--- a/internal/ceres/coordinate_descent_minimizer.h
+++ b/internal/ceres/coordinate_descent_minimizer.h
@@ -66,7 +66,7 @@
             std::string* error);
 
   // Minimizer interface.
-  virtual ~CoordinateDescentMinimizer();
+  ~CoordinateDescentMinimizer() override;
 
   void Minimize(const Minimizer::Options& options,
                 double* parameters,
diff --git a/internal/ceres/cxsparse.h b/internal/ceres/cxsparse.h
index d3f76e0..d1d14ec 100644
--- a/internal/ceres/cxsparse.h
+++ b/internal/ceres/cxsparse.h
@@ -144,7 +144,7 @@
   static std::unique_ptr<SparseCholesky> Create(OrderingType ordering_type);
 
   // SparseCholesky interface.
-  virtual ~CXSparseCholesky();
+  ~CXSparseCholesky() override;
   CompressedRowSparseMatrix::StorageType StorageType() const final;
   LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
                                         std::string* message) final;
diff --git a/internal/ceres/dense_sparse_matrix.h b/internal/ceres/dense_sparse_matrix.h
index e2f4a6e..5963322 100644
--- a/internal/ceres/dense_sparse_matrix.h
+++ b/internal/ceres/dense_sparse_matrix.h
@@ -51,7 +51,7 @@
   explicit DenseSparseMatrix(const Matrix& m);
   DenseSparseMatrix(int num_rows, int num_cols);
 
-  virtual ~DenseSparseMatrix() = default;
+  ~DenseSparseMatrix() override = default;
 
   // SparseMatrix interface.
   void SetZero() final;
diff --git a/internal/ceres/dogleg_strategy.h b/internal/ceres/dogleg_strategy.h
index cc3778e..5042767 100644
--- a/internal/ceres/dogleg_strategy.h
+++ b/internal/ceres/dogleg_strategy.h
@@ -56,7 +56,7 @@
 class CERES_EXPORT_INTERNAL DoglegStrategy : public TrustRegionStrategy {
  public:
   explicit DoglegStrategy(const TrustRegionStrategy::Options& options);
-  virtual ~DoglegStrategy() {}
+  ~DoglegStrategy() override {}
 
   // TrustRegionStrategy interface
   Summary ComputeStep(const PerSolveOptions& per_solve_options,
@@ -65,7 +65,7 @@
                       double* step) final;
   void StepAccepted(double step_quality) final;
   void StepRejected(double step_quality) final;
-  void StepIsInvalid();
+  void StepIsInvalid() override;
   double Radius() const final;
 
   // These functions are predominantly for testing.
diff --git a/internal/ceres/dynamic_sparse_normal_cholesky_solver.h b/internal/ceres/dynamic_sparse_normal_cholesky_solver.h
index 36118ba..04be570 100644
--- a/internal/ceres/dynamic_sparse_normal_cholesky_solver.h
+++ b/internal/ceres/dynamic_sparse_normal_cholesky_solver.h
@@ -58,7 +58,7 @@
  public:
   explicit DynamicSparseNormalCholeskySolver(
       const LinearSolver::Options& options);
-  virtual ~DynamicSparseNormalCholeskySolver() {}
+  ~DynamicSparseNormalCholeskySolver() override {}
 
  private:
   LinearSolver::Summary SolveImpl(CompressedRowSparseMatrix* A,
diff --git a/internal/ceres/eigensparse.cc b/internal/ceres/eigensparse.cc
index 03d7751..f24672c 100644
--- a/internal/ceres/eigensparse.cc
+++ b/internal/ceres/eigensparse.cc
@@ -48,7 +48,7 @@
 class EigenSparseCholeskyTemplate : public SparseCholesky {
  public:
   EigenSparseCholeskyTemplate() : analyzed_(false) {}
-  virtual ~EigenSparseCholeskyTemplate() {}
+  ~EigenSparseCholeskyTemplate() override {}
   CompressedRowSparseMatrix::StorageType StorageType() const final {
     return CompressedRowSparseMatrix::LOWER_TRIANGULAR;
   }
@@ -83,7 +83,7 @@
 
   LinearSolverTerminationType Solve(const double* rhs_ptr,
                                     double* solution_ptr,
-                                    std::string* message) {
+                                    std::string* message) override {
     CHECK(analyzed_) << "Solve called without a call to Factorize first.";
 
     scalar_rhs_ = ConstVectorRef(rhs_ptr, solver_.cols())
diff --git a/internal/ceres/eigensparse.h b/internal/ceres/eigensparse.h
index bb89c2c..a196723 100644
--- a/internal/ceres/eigensparse.h
+++ b/internal/ceres/eigensparse.h
@@ -55,13 +55,13 @@
       const OrderingType ordering_type);
 
   // SparseCholesky interface.
-  virtual ~EigenSparseCholesky();
-  virtual LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
-                                                std::string* message) = 0;
-  virtual CompressedRowSparseMatrix::StorageType StorageType() const = 0;
-  virtual LinearSolverTerminationType Solve(const double* rhs,
-                                            double* solution,
-                                            std::string* message) = 0;
+  ~EigenSparseCholesky() override;
+  LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
+                                        std::string* message) override = 0;
+  CompressedRowSparseMatrix::StorageType StorageType() const override = 0;
+  LinearSolverTerminationType Solve(const double* rhs,
+                                    double* solution,
+                                    std::string* message) override = 0;
 };
 
 // Even though the input is double precision linear system, this class
@@ -73,13 +73,13 @@
       const OrderingType ordering_type);
 
   // SparseCholesky interface.
-  virtual ~FloatEigenSparseCholesky();
-  virtual LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
-                                                std::string* message) = 0;
-  virtual CompressedRowSparseMatrix::StorageType StorageType() const = 0;
-  virtual LinearSolverTerminationType Solve(const double* rhs,
-                                            double* solution,
-                                            std::string* message) = 0;
+  ~FloatEigenSparseCholesky() override;
+  LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
+                                        std::string* message) override = 0;
+  CompressedRowSparseMatrix::StorageType StorageType() const override = 0;
+  LinearSolverTerminationType Solve(const double* rhs,
+                                    double* solution,
+                                    std::string* message) override = 0;
 };
 
 }  // namespace internal
diff --git a/internal/ceres/evaluation_callback_test.cc b/internal/ceres/evaluation_callback_test.cc
index 19a7eb5..3736405 100644
--- a/internal/ceres/evaluation_callback_test.cc
+++ b/internal/ceres/evaluation_callback_test.cc
@@ -72,7 +72,7 @@
         evaluate_num_calls(0),
         evaluate_last_parameter_hash(kUninitialized) {}
 
-  virtual ~WigglyBowlCostFunctionAndEvaluationCallback() {}
+  ~WigglyBowlCostFunctionAndEvaluationCallback() override {}
 
   // Evaluation callback interface. This checks that all the preconditions are
   // met at the point that Ceres calls into it.
diff --git a/internal/ceres/gmock/mock-log.h b/internal/ceres/gmock/mock-log.h
index 54669b7..91b5939 100644
--- a/internal/ceres/gmock/mock-log.h
+++ b/internal/ceres/gmock/mock-log.h
@@ -71,7 +71,7 @@
   ScopedMockLog() { AddLogSink(this); }
 
   // When the object is destructed, it stops intercepting logs.
-  virtual ~ScopedMockLog() { RemoveLogSink(this); }
+  ~ScopedMockLog() override { RemoveLogSink(this); }
 
   // Implements the mock method:
   //
@@ -112,10 +112,10 @@
   // be running simultaneously, we ensure thread-safety of the exchange between
   // send() and WaitTillSent(), and that for each message, LOG(), send(),
   // WaitTillSent() and Log() are executed in the same thread.
-  virtual void send(google::LogSeverity severity,
+  void send(google::LogSeverity severity,
                     const char* full_filename,
                     const char* base_filename, int line, const tm* tm_time,
-                    const char* message, size_t message_len) {
+                    const char* message, size_t message_len) override {
     // We are only interested in the log severity, full file name, and
     // log message.
     message_info_.severity = severity;
@@ -130,7 +130,7 @@
   //
   // LOG(), send(), WaitTillSent() and Log() will occur in the same thread for
   // a given log message.
-  virtual void WaitTillSent() {
+  void WaitTillSent() override {
     // First, and very importantly, we save a copy of the message being
     // processed before calling Log(), since Log() may indirectly call send()
     // and WaitTillSent() in the same thread again.
diff --git a/internal/ceres/gradient_checker_test.cc b/internal/ceres/gradient_checker_test.cc
index 26262ef..1d59e2f 100644
--- a/internal/ceres/gradient_checker_test.cc
+++ b/internal/ceres/gradient_checker_test.cc
@@ -77,7 +77,7 @@
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
-                double** jacobians) const {
+                double** jacobians) const override {
     if (!return_value_) {
       return false;
     }
@@ -136,7 +136,7 @@
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
-                double** jacobians) const {
+                double** jacobians) const override {
     // Compute a . x.
     double ax = 0;
     for (int j = 0; j < arity_; ++j) {
diff --git a/internal/ceres/gradient_checking_cost_function.cc b/internal/ceres/gradient_checking_cost_function.cc
index 4bd5bcc..fbc8ea5 100644
--- a/internal/ceres/gradient_checking_cost_function.cc
+++ b/internal/ceres/gradient_checking_cost_function.cc
@@ -80,7 +80,7 @@
     set_num_residuals(function->num_residuals());
   }
 
-  virtual ~GradientCheckingCostFunction() {}
+  ~GradientCheckingCostFunction() override {}
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
diff --git a/internal/ceres/gradient_checking_cost_function_test.cc b/internal/ceres/gradient_checking_cost_function_test.cc
index 6f99b12..6a6e075 100644
--- a/internal/ceres/gradient_checking_cost_function_test.cc
+++ b/internal/ceres/gradient_checking_cost_function_test.cc
@@ -89,7 +89,7 @@
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
-                double** jacobians) const {
+                double** jacobians) const override {
     // Compute a . x.
     double ax = 0;
     for (int j = 0; j < arity_; ++j) {
@@ -268,7 +268,7 @@
     set_num_residuals(num_residuals);
     mutable_parameter_block_sizes()->push_back(parameter_block_size);
   }
-  virtual ~UnaryCostFunction() {}
+  ~UnaryCostFunction() override {}
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
diff --git a/internal/ceres/gradient_problem_evaluator.h b/internal/ceres/gradient_problem_evaluator.h
index d224dbe..453a390 100644
--- a/internal/ceres/gradient_problem_evaluator.h
+++ b/internal/ceres/gradient_problem_evaluator.h
@@ -47,7 +47,7 @@
  public:
   explicit GradientProblemEvaluator(const GradientProblem& problem)
       : problem_(problem) {}
-  virtual ~GradientProblemEvaluator() {}
+  ~GradientProblemEvaluator() override {}
   SparseMatrix* CreateJacobian() const final { return nullptr; }
   bool Evaluate(const EvaluateOptions& evaluate_options,
                 const double* state,
diff --git a/internal/ceres/gradient_problem_solver_test.cc b/internal/ceres/gradient_problem_solver_test.cc
index f01d206..6d014df 100644
--- a/internal/ceres/gradient_problem_solver_test.cc
+++ b/internal/ceres/gradient_problem_solver_test.cc
@@ -39,7 +39,7 @@
 // Rosenbrock function; see http://en.wikipedia.org/wiki/Rosenbrock_function .
 class Rosenbrock : public ceres::FirstOrderFunction {
  public:
-  virtual ~Rosenbrock() {}
+  ~Rosenbrock() override {}
 
   bool Evaluate(const double* parameters,
                 double* cost,
@@ -73,7 +73,7 @@
 }
 
 class QuadraticFunction : public ceres::FirstOrderFunction {
-  virtual ~QuadraticFunction() {}
+  ~QuadraticFunction() override {}
   bool Evaluate(const double* parameters,
                 double* cost,
                 double* gradient) const final {
@@ -90,7 +90,7 @@
 
 struct RememberingCallback : public IterationCallback {
   explicit RememberingCallback(double* x) : calls(0), x(x) {}
-  virtual ~RememberingCallback() {}
+  ~RememberingCallback() override {}
   CallbackReturnType operator()(const IterationSummary& summary) final {
     x_values.push_back(*x);
     return SOLVER_CONTINUE;
diff --git a/internal/ceres/gradient_problem_test.cc b/internal/ceres/gradient_problem_test.cc
index 70a4557..13508ba 100644
--- a/internal/ceres/gradient_problem_test.cc
+++ b/internal/ceres/gradient_problem_test.cc
@@ -40,7 +40,7 @@
   explicit QuadraticTestFunction(bool* flag_to_set_on_destruction = nullptr)
       : flag_to_set_on_destruction_(flag_to_set_on_destruction) {}
 
-  virtual ~QuadraticTestFunction() {
+  ~QuadraticTestFunction() override {
     if (flag_to_set_on_destruction_) {
       *flag_to_set_on_destruction_ = true;
     }
diff --git a/internal/ceres/gtest/gtest.h b/internal/ceres/gtest/gtest.h
index a8344fe..5affbfd 100644
--- a/internal/ceres/gtest/gtest.h
+++ b/internal/ceres/gtest/gtest.h
@@ -9527,13 +9527,13 @@
    public:
     explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
 
-    virtual void DescribeTo(::std::ostream* os) const { impl_.DescribeTo(os); }
+    void DescribeTo(::std::ostream* os) const override { impl_.DescribeTo(os); }
 
-    virtual void DescribeNegationTo(::std::ostream* os) const {
+    void DescribeNegationTo(::std::ostream* os) const override {
       impl_.DescribeNegationTo(os);
     }
 
-    virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
+    bool MatchAndExplain(T x, MatchResultListener* listener) const override {
       return impl_.MatchAndExplain(x, listener);
     }
 
diff --git a/internal/ceres/implicit_schur_complement.h b/internal/ceres/implicit_schur_complement.h
index e83892a..4ae76e5 100644
--- a/internal/ceres/implicit_schur_complement.h
+++ b/internal/ceres/implicit_schur_complement.h
@@ -100,7 +100,7 @@
   // TODO(sameeragarwal): Get rid of the two bools below and replace
   // them with enums.
   explicit ImplicitSchurComplement(const LinearSolver::Options& options);
-  virtual ~ImplicitSchurComplement();
+  ~ImplicitSchurComplement() override;
 
   // Initialize the Schur complement for a linear least squares
   // problem of the form
diff --git a/internal/ceres/iterative_refiner_test.cc b/internal/ceres/iterative_refiner_test.cc
index 244e7c1..2591375 100644
--- a/internal/ceres/iterative_refiner_test.cc
+++ b/internal/ceres/iterative_refiner_test.cc
@@ -54,7 +54,7 @@
 class FakeSparseMatrix : public SparseMatrix {
  public:
   FakeSparseMatrix(const Matrix& m) : m_(m) {}
-  virtual ~FakeSparseMatrix() {}
+  ~FakeSparseMatrix() override {}
 
   // y += Ax
   void RightMultiply(const double* x, double* y) const final {
@@ -90,7 +90,7 @@
 class FakeSparseCholesky : public SparseCholesky {
  public:
   FakeSparseCholesky(const Matrix& lhs) { lhs_ = lhs.cast<Scalar>(); }
-  virtual ~FakeSparseCholesky() {}
+  ~FakeSparseCholesky() override {}
 
   LinearSolverTerminationType Solve(const double* rhs_ptr,
                                     double* solution_ptr,
@@ -118,7 +118,7 @@
 
 class IterativeRefinerTest : public ::testing::Test {
  public:
-  void SetUp() {
+  void SetUp() override {
     num_cols_ = 5;
     max_num_iterations_ = 30;
     Matrix m(num_cols_, num_cols_);
diff --git a/internal/ceres/iterative_schur_complement_solver.h b/internal/ceres/iterative_schur_complement_solver.h
index 37606b3..909332a 100644
--- a/internal/ceres/iterative_schur_complement_solver.h
+++ b/internal/ceres/iterative_schur_complement_solver.h
@@ -77,7 +77,7 @@
       delete;
   void operator=(const IterativeSchurComplementSolver&) = delete;
 
-  virtual ~IterativeSchurComplementSolver();
+  ~IterativeSchurComplementSolver() override;
 
  private:
   LinearSolver::Summary SolveImpl(BlockSparseMatrix* A,
diff --git a/internal/ceres/levenberg_marquardt_strategy.h b/internal/ceres/levenberg_marquardt_strategy.h
index 12cd463..c67f5ab 100644
--- a/internal/ceres/levenberg_marquardt_strategy.h
+++ b/internal/ceres/levenberg_marquardt_strategy.h
@@ -48,7 +48,7 @@
  public:
   explicit LevenbergMarquardtStrategy(
       const TrustRegionStrategy::Options& options);
-  virtual ~LevenbergMarquardtStrategy();
+  ~LevenbergMarquardtStrategy() override;
 
   // TrustRegionStrategy interface
   TrustRegionStrategy::Summary ComputeStep(
diff --git a/internal/ceres/levenberg_marquardt_strategy_test.cc b/internal/ceres/levenberg_marquardt_strategy_test.cc
index 500f269..c1b88ce 100644
--- a/internal/ceres/levenberg_marquardt_strategy_test.cc
+++ b/internal/ceres/levenberg_marquardt_strategy_test.cc
@@ -58,7 +58,7 @@
   RegularizationCheckingLinearSolver(const int num_cols, const double* diagonal)
       : num_cols_(num_cols), diagonal_(diagonal) {}
 
-  virtual ~RegularizationCheckingLinearSolver() {}
+  ~RegularizationCheckingLinearSolver() override {}
 
  private:
   LinearSolver::Summary SolveImpl(
diff --git a/internal/ceres/line_search.h b/internal/ceres/line_search.h
index 634c971..124cedb 100644
--- a/internal/ceres/line_search.h
+++ b/internal/ceres/line_search.h
@@ -260,7 +260,7 @@
 class ArmijoLineSearch : public LineSearch {
  public:
   explicit ArmijoLineSearch(const LineSearch::Options& options);
-  virtual ~ArmijoLineSearch() {}
+  ~ArmijoLineSearch() override {}
 
  private:
   void DoSearch(double step_size_estimate,
@@ -279,7 +279,7 @@
 class WolfeLineSearch : public LineSearch {
  public:
   explicit WolfeLineSearch(const LineSearch::Options& options);
-  virtual ~WolfeLineSearch() {}
+  ~WolfeLineSearch() override {}
 
   // Returns true iff either a valid point, or valid bracket are found.
   bool BracketingPhase(const FunctionSample& initial_position,
diff --git a/internal/ceres/line_search_direction.cc b/internal/ceres/line_search_direction.cc
index 48e6c98..12c83c8 100644
--- a/internal/ceres/line_search_direction.cc
+++ b/internal/ceres/line_search_direction.cc
@@ -40,10 +40,10 @@
 
 class SteepestDescent : public LineSearchDirection {
  public:
-  virtual ~SteepestDescent() {}
+  ~SteepestDescent() override {}
   bool NextDirection(const LineSearchMinimizer::State& previous,
                      const LineSearchMinimizer::State& current,
-                     Vector* search_direction) {
+                     Vector* search_direction) override {
     *search_direction = -current.gradient;
     return true;
   }
@@ -57,7 +57,7 @@
 
   bool NextDirection(const LineSearchMinimizer::State& previous,
                      const LineSearchMinimizer::State& current,
-                     Vector* search_direction) {
+                     Vector* search_direction) override {
     double beta = 0.0;
     Vector gradient_change;
     switch (type_) {
@@ -105,11 +105,11 @@
                                   use_approximate_eigenvalue_bfgs_scaling),
         is_positive_definite_(true) {}
 
-  virtual ~LBFGS() {}
+  ~LBFGS() override {}
 
   bool NextDirection(const LineSearchMinimizer::State& previous,
                      const LineSearchMinimizer::State& current,
-                     Vector* search_direction) {
+                     Vector* search_direction) override {
     CHECK(is_positive_definite_)
         << "Ceres bug: NextDirection() called on L-BFGS after inverse Hessian "
         << "approximation has become indefinite, please contact the "
@@ -161,11 +161,11 @@
     inverse_hessian_ = Matrix::Identity(num_parameters, num_parameters);
   }
 
-  virtual ~BFGS() {}
+  ~BFGS() override {}
 
   bool NextDirection(const LineSearchMinimizer::State& previous,
                      const LineSearchMinimizer::State& current,
-                     Vector* search_direction) {
+                     Vector* search_direction) override {
     CHECK(is_positive_definite_)
         << "Ceres bug: NextDirection() called on BFGS after inverse Hessian "
         << "approximation has become indefinite, please contact the "
diff --git a/internal/ceres/line_search_minimizer.h b/internal/ceres/line_search_minimizer.h
index 79e8dc9..802b542 100644
--- a/internal/ceres/line_search_minimizer.h
+++ b/internal/ceres/line_search_minimizer.h
@@ -63,7 +63,7 @@
     double step_size;
   };
 
-  ~LineSearchMinimizer() {}
+  ~LineSearchMinimizer() override {}
   void Minimize(const Minimizer::Options& options,
                 double* parameters,
                 Solver::Summary* summary) final;
diff --git a/internal/ceres/line_search_preprocessor.h b/internal/ceres/line_search_preprocessor.h
index bd426c7..1ba7076 100644
--- a/internal/ceres/line_search_preprocessor.h
+++ b/internal/ceres/line_search_preprocessor.h
@@ -39,7 +39,7 @@
 
 class CERES_EXPORT_INTERNAL LineSearchPreprocessor : public Preprocessor {
  public:
-  virtual ~LineSearchPreprocessor();
+  ~LineSearchPreprocessor() override;
   bool Preprocess(const Solver::Options& options,
                   ProblemImpl* problem,
                   PreprocessedProblem* preprocessed_problem) final;
diff --git a/internal/ceres/line_search_preprocessor_test.cc b/internal/ceres/line_search_preprocessor_test.cc
index 68860c5..b64946c 100644
--- a/internal/ceres/line_search_preprocessor_test.cc
+++ b/internal/ceres/line_search_preprocessor_test.cc
@@ -77,7 +77,7 @@
  public:
   bool Evaluate(double const* const* parameters,
                 double* residuals,
-                double** jacobians) const {
+                double** jacobians) const override {
     return false;
   }
 };
@@ -111,7 +111,7 @@
  public:
   bool Evaluate(double const* const* parameters,
                 double* residuals,
-                double** jacobians) const {
+                double** jacobians) const override {
     return true;
   }
 };
diff --git a/internal/ceres/linear_solver.h b/internal/ceres/linear_solver.h
index 49c6527..93aee39 100644
--- a/internal/ceres/linear_solver.h
+++ b/internal/ceres/linear_solver.h
@@ -301,12 +301,12 @@
 template <typename MatrixType>
 class TypedLinearSolver : public LinearSolver {
  public:
-  virtual ~TypedLinearSolver() {}
-  virtual LinearSolver::Summary Solve(
+  ~TypedLinearSolver() override {}
+  LinearSolver::Summary Solve(
       LinearOperator* A,
       const double* b,
       const LinearSolver::PerSolveOptions& per_solve_options,
-      double* x) {
+      double* x) override {
     ScopedExecutionTimer total_time("LinearSolver::Solve", &execution_summary_);
     CHECK(A != nullptr);
     CHECK(b != nullptr);
@@ -314,7 +314,7 @@
     return SolveImpl(down_cast<MatrixType*>(A), b, per_solve_options, x);
   }
 
-  virtual std::map<std::string, CallStatistics> Statistics() const {
+  std::map<std::string, CallStatistics> Statistics() const override {
     return execution_summary_.statistics();
   }
 
diff --git a/internal/ceres/low_rank_inverse_hessian.h b/internal/ceres/low_rank_inverse_hessian.h
index 0028a98..3fabb0c 100644
--- a/internal/ceres/low_rank_inverse_hessian.h
+++ b/internal/ceres/low_rank_inverse_hessian.h
@@ -73,7 +73,7 @@
   LowRankInverseHessian(int num_parameters,
                         int max_num_corrections,
                         bool use_approximate_eigenvalue_scaling);
-  virtual ~LowRankInverseHessian() {}
+  ~LowRankInverseHessian() override {}
 
   // Update the low rank approximation. delta_x is the change in the
   // domain of Hessian, and delta_gradient is the change in the
diff --git a/internal/ceres/manifold_adapter.h b/internal/ceres/manifold_adapter.h
index d19aed8..153dd97 100644
--- a/internal/ceres/manifold_adapter.h
+++ b/internal/ceres/manifold_adapter.h
@@ -15,7 +15,7 @@
     CHECK(local_parameterization != nullptr);
   }
 
-  virtual ~ManifoldAdapter() {}
+  ~ManifoldAdapter() override {}
 
   bool Plus(const double* x,
             const double* delta,
diff --git a/internal/ceres/minimizer_test.cc b/internal/ceres/minimizer_test.cc
index 3de4abe..22b3a19 100644
--- a/internal/ceres/minimizer_test.cc
+++ b/internal/ceres/minimizer_test.cc
@@ -39,7 +39,7 @@
 
 class FakeIterationCallback : public IterationCallback {
  public:
-  virtual ~FakeIterationCallback() {}
+  ~FakeIterationCallback() override {}
   CallbackReturnType operator()(const IterationSummary& summary) final {
     return SOLVER_CONTINUE;
   }
@@ -62,7 +62,7 @@
 
 class AbortingIterationCallback : public IterationCallback {
  public:
-  virtual ~AbortingIterationCallback() {}
+  ~AbortingIterationCallback() override {}
   CallbackReturnType operator()(const IterationSummary& summary) final {
     return SOLVER_ABORT;
   }
@@ -80,7 +80,7 @@
 
 class SucceedingIterationCallback : public IterationCallback {
  public:
-  virtual ~SucceedingIterationCallback() {}
+  ~SucceedingIterationCallback() override {}
   CallbackReturnType operator()(const IterationSummary& summary) final {
     return SOLVER_TERMINATE_SUCCESSFULLY;
   }
diff --git a/internal/ceres/partitioned_matrix_view.h b/internal/ceres/partitioned_matrix_view.h
index 9f204ee..b39aa3e 100644
--- a/internal/ceres/partitioned_matrix_view.h
+++ b/internal/ceres/partitioned_matrix_view.h
@@ -121,7 +121,7 @@
   // num_col_blocks_a column blocks.
   PartitionedMatrixView(const BlockSparseMatrix& matrix, int num_col_blocks_e);
 
-  virtual ~PartitionedMatrixView();
+  ~PartitionedMatrixView() override;
   void LeftMultiplyE(const double* x, double* y) const final;
   void LeftMultiplyF(const double* x, double* y) const final;
   void RightMultiplyE(const double* x, double* y) const final;
diff --git a/internal/ceres/preconditioner.h b/internal/ceres/preconditioner.h
index dd843b0..331cc9c 100644
--- a/internal/ceres/preconditioner.h
+++ b/internal/ceres/preconditioner.h
@@ -115,7 +115,7 @@
   static PreconditionerType PreconditionerForZeroEBlocks(
       PreconditionerType preconditioner_type);
 
-  virtual ~Preconditioner();
+  ~Preconditioner() override;
 
   // Update the numerical value of the preconditioner for the linear
   // system:
@@ -149,7 +149,7 @@
 template <typename MatrixType>
 class TypedPreconditioner : public Preconditioner {
  public:
-  virtual ~TypedPreconditioner() {}
+  ~TypedPreconditioner() override {}
   bool Update(const LinearOperator& A, const double* D) final {
     return UpdateImpl(*down_cast<const MatrixType*>(&A), D);
   }
@@ -171,14 +171,14 @@
  public:
   // Wrapper does NOT take ownership of the matrix pointer.
   explicit SparseMatrixPreconditionerWrapper(const SparseMatrix* matrix);
-  virtual ~SparseMatrixPreconditionerWrapper();
+  ~SparseMatrixPreconditionerWrapper() override;
 
   // Preconditioner interface
-  virtual void RightMultiply(const double* x, double* y) const;
-  virtual int num_rows() const;
+  void RightMultiply(const double* x, double* y) const override;
+  int num_rows() const override;
 
  private:
-  virtual bool UpdateImpl(const SparseMatrix& A, const double* D);
+  bool UpdateImpl(const SparseMatrix& A, const double* D) override;
   const SparseMatrix* matrix_;
 };
 
diff --git a/internal/ceres/problem_test.cc b/internal/ceres/problem_test.cc
index aab43d1..d2ccf63 100644
--- a/internal/ceres/problem_test.cc
+++ b/internal/ceres/problem_test.cc
@@ -67,7 +67,7 @@
     mutable_parameter_block_sizes()->push_back(parameter_block_size);
   }
 
-  virtual ~UnaryCostFunction() {}
+  ~UnaryCostFunction() override {}
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
@@ -334,7 +334,7 @@
   explicit DestructorCountingCostFunction(int* num_destructions)
       : num_destructions_(num_destructions) {}
 
-  virtual ~DestructorCountingCostFunction() { *num_destructions_ += 1; }
+  ~DestructorCountingCostFunction() override { *num_destructions_ += 1; }
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
@@ -1513,7 +1513,7 @@
 
 class ProblemEvaluateTest : public ::testing::Test {
  protected:
-  void SetUp() {
+  void SetUp() override {
     for (int i = 0; i < 6; ++i) {
       parameters_[i] = static_cast<double>(i + 1);
     }
@@ -1535,7 +1535,7 @@
         cost_function, nullptr, parameters_ + 4, parameters_));
   }
 
-  void TearDown() { EXPECT_TRUE(problem_.program().IsValid()); }
+  void TearDown() override { EXPECT_TRUE(problem_.program().IsValid()); }
 
   void EvaluateAndCompare(const Problem::EvaluateOptions& options,
                           const int expected_num_rows,
diff --git a/internal/ceres/program_test.cc b/internal/ceres/program_test.cc
index 1d9f49c..7fdf300 100644
--- a/internal/ceres/program_test.cc
+++ b/internal/ceres/program_test.cc
@@ -331,7 +331,7 @@
     }
   }
 
-  virtual ~NumParameterBlocksCostFunction() {}
+  ~NumParameterBlocksCostFunction() override {}
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
diff --git a/internal/ceres/reorder_program_test.cc b/internal/ceres/reorder_program_test.cc
index 83c867a..37a07cb 100644
--- a/internal/ceres/reorder_program_test.cc
+++ b/internal/ceres/reorder_program_test.cc
@@ -167,7 +167,7 @@
 class ReorderProgramFoSparseCholeskyUsingSuiteSparseTest
     : public ::testing::Test {
  protected:
-  void SetUp() {
+  void SetUp() override {
     problem_.AddResidualBlock(new UnaryCostFunction(), nullptr, &x_);
     problem_.AddResidualBlock(new BinaryCostFunction(), nullptr, &z_, &x_);
     problem_.AddResidualBlock(new BinaryCostFunction(), nullptr, &z_, &y_);
diff --git a/internal/ceres/schur_complement_solver.cc b/internal/ceres/schur_complement_solver.cc
index 9a5ff05..cd62f40 100644
--- a/internal/ceres/schur_complement_solver.cc
+++ b/internal/ceres/schur_complement_solver.cc
@@ -68,7 +68,7 @@
       const BlockRandomAccessSparseMatrix& m)
       : m_(m) {}
 
-  virtual ~BlockRandomAccessSparseMatrixAdapter() {}
+  ~BlockRandomAccessSparseMatrixAdapter() override {}
 
   // y = y + Ax;
   void RightMultiply(const double* x, double* y) const final {
@@ -93,7 +93,7 @@
       const BlockRandomAccessDiagonalMatrix& m)
       : m_(m) {}
 
-  virtual ~BlockRandomAccessDiagonalMatrixAdapter() {}
+  ~BlockRandomAccessDiagonalMatrixAdapter() override {}
 
   // y = y + Ax;
   void RightMultiply(const double* x, double* y) const final {
diff --git a/internal/ceres/schur_complement_solver.h b/internal/ceres/schur_complement_solver.h
index 8b07042..b7cb1d9 100644
--- a/internal/ceres/schur_complement_solver.h
+++ b/internal/ceres/schur_complement_solver.h
@@ -170,7 +170,7 @@
   SparseSchurComplementSolver(const SparseSchurComplementSolver&) = delete;
   void operator=(const SparseSchurComplementSolver&) = delete;
 
-  virtual ~SparseSchurComplementSolver();
+  ~SparseSchurComplementSolver() override;
 
  private:
   void InitStorage(const CompressedRowBlockStructure* bs) final;
diff --git a/internal/ceres/schur_eliminator.h b/internal/ceres/schur_eliminator.h
index a5a4569..2fb59d4 100644
--- a/internal/ceres/schur_eliminator.h
+++ b/internal/ceres/schur_eliminator.h
@@ -230,7 +230,7 @@
   }
 
   // SchurEliminatorBase Interface
-  virtual ~SchurEliminator();
+  ~SchurEliminator() override;
   void Init(int num_eliminate_blocks,
             bool assume_full_rank_ete,
             const CompressedRowBlockStructure* bs) final;
@@ -379,7 +379,7 @@
           int kFBlockSize = Eigen::Dynamic>
 class SchurEliminatorForOneFBlock : public SchurEliminatorBase {
  public:
-  virtual ~SchurEliminatorForOneFBlock() {}
+  ~SchurEliminatorForOneFBlock() override {}
   void Init(int num_eliminate_blocks,
             bool assume_full_rank_ete,
             const CompressedRowBlockStructure* bs) override {
diff --git a/internal/ceres/schur_jacobi_preconditioner.h b/internal/ceres/schur_jacobi_preconditioner.h
index 372b790..7333988 100644
--- a/internal/ceres/schur_jacobi_preconditioner.h
+++ b/internal/ceres/schur_jacobi_preconditioner.h
@@ -85,7 +85,7 @@
   SchurJacobiPreconditioner(const SchurJacobiPreconditioner&) = delete;
   void operator=(const SchurJacobiPreconditioner&) = delete;
 
-  virtual ~SchurJacobiPreconditioner();
+  ~SchurJacobiPreconditioner() override;
 
   // Preconditioner interface.
   void RightMultiply(const double* x, double* y) const final;
diff --git a/internal/ceres/solver_test.cc b/internal/ceres/solver_test.cc
index 98c38fd..465262c 100644
--- a/internal/ceres/solver_test.cc
+++ b/internal/ceres/solver_test.cc
@@ -78,7 +78,7 @@
 
 struct RememberingCallback : public IterationCallback {
   explicit RememberingCallback(double* x) : calls(0), x(x) {}
-  virtual ~RememberingCallback() {}
+  ~RememberingCallback() override {}
   CallbackReturnType operator()(const IterationSummary& summary) final {
     x_values.push_back(*x);
     return SOLVER_CONTINUE;
@@ -89,7 +89,7 @@
 };
 
 struct NoOpEvaluationCallback : EvaluationCallback {
-  virtual ~NoOpEvaluationCallback() {}
+  ~NoOpEvaluationCallback() override {}
   void PrepareForEvaluation(bool evaluate_jacobians,
                             bool new_evaluation_point) final {
     (void)evaluate_jacobians;
@@ -475,7 +475,7 @@
  public:
   bool Evaluate(double const* const* parameters,
                 double* residuals,
-                double** jacobians) const {
+                double** jacobians) const override {
     for (int i = 0; i < kNumResiduals; ++i) {
       residuals[i] = kNumResiduals * kNumResiduals + i;
     }
diff --git a/internal/ceres/sparse_cholesky.h b/internal/ceres/sparse_cholesky.h
index 39670d5..32dfbd5 100644
--- a/internal/ceres/sparse_cholesky.h
+++ b/internal/ceres/sparse_cholesky.h
@@ -118,14 +118,14 @@
  public:
   RefinedSparseCholesky(std::unique_ptr<SparseCholesky> sparse_cholesky,
                         std::unique_ptr<IterativeRefiner> iterative_refiner);
-  virtual ~RefinedSparseCholesky();
+  ~RefinedSparseCholesky() override;
 
-  virtual CompressedRowSparseMatrix::StorageType StorageType() const;
-  virtual LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
-                                                std::string* message);
-  virtual LinearSolverTerminationType Solve(const double* rhs,
-                                            double* solution,
-                                            std::string* message);
+  CompressedRowSparseMatrix::StorageType StorageType() const override;
+  LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
+                                        std::string* message) override;
+  LinearSolverTerminationType Solve(const double* rhs,
+                                    double* solution,
+                                    std::string* message) override;
 
  private:
   std::unique_ptr<SparseCholesky> sparse_cholesky_;
diff --git a/internal/ceres/sparse_matrix.h b/internal/ceres/sparse_matrix.h
index b57f108..3b6b55a 100644
--- a/internal/ceres/sparse_matrix.h
+++ b/internal/ceres/sparse_matrix.h
@@ -66,12 +66,12 @@
 // matrix types.
 class CERES_EXPORT_INTERNAL SparseMatrix : public LinearOperator {
  public:
-  virtual ~SparseMatrix();
+  ~SparseMatrix() override;
 
   // y += Ax;
-  virtual void RightMultiply(const double* x, double* y) const = 0;
+  void RightMultiply(const double* x, double* y) const override = 0;
   // y += A'x;
-  virtual void LeftMultiply(const double* x, double* y) const = 0;
+  void LeftMultiply(const double* x, double* y) const override = 0;
 
   // In MATLAB notation sum(A.*A, 1)
   virtual void SquaredColumnNorm(double* x) const = 0;
@@ -98,8 +98,8 @@
   virtual double* mutable_values() = 0;
   virtual const double* values() const = 0;
 
-  virtual int num_rows() const = 0;
-  virtual int num_cols() const = 0;
+  int num_rows() const override = 0;
+  int num_cols() const override = 0;
   virtual int num_nonzeros() const = 0;
 };
 
diff --git a/internal/ceres/sparse_normal_cholesky_solver.h b/internal/ceres/sparse_normal_cholesky_solver.h
index ef32743..bb4b8de 100644
--- a/internal/ceres/sparse_normal_cholesky_solver.h
+++ b/internal/ceres/sparse_normal_cholesky_solver.h
@@ -58,7 +58,7 @@
   SparseNormalCholeskySolver(const SparseNormalCholeskySolver&) = delete;
   void operator=(const SparseNormalCholeskySolver&) = delete;
 
-  virtual ~SparseNormalCholeskySolver();
+  ~SparseNormalCholeskySolver() override;
 
  private:
   LinearSolver::Summary SolveImpl(BlockSparseMatrix* A,
diff --git a/internal/ceres/subset_preconditioner.h b/internal/ceres/subset_preconditioner.h
index 9844a66..00c3f38 100644
--- a/internal/ceres/subset_preconditioner.h
+++ b/internal/ceres/subset_preconditioner.h
@@ -72,7 +72,7 @@
  public:
   SubsetPreconditioner(const Preconditioner::Options& options,
                        const BlockSparseMatrix& A);
-  virtual ~SubsetPreconditioner();
+  ~SubsetPreconditioner() override;
 
   // Preconditioner interface
   void RightMultiply(const double* x, double* y) const final;
diff --git a/internal/ceres/suitesparse.h b/internal/ceres/suitesparse.h
index 23f539d..a98c946 100644
--- a/internal/ceres/suitesparse.h
+++ b/internal/ceres/suitesparse.h
@@ -293,7 +293,7 @@
   static std::unique_ptr<SparseCholesky> Create(OrderingType ordering_type);
 
   // SparseCholesky interface.
-  virtual ~SuiteSparseCholesky();
+  ~SuiteSparseCholesky() override;
   CompressedRowSparseMatrix::StorageType StorageType() const final;
   LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
                                         std::string* message) final;
diff --git a/internal/ceres/triplet_sparse_matrix.h b/internal/ceres/triplet_sparse_matrix.h
index cc9fee5..daa4643 100644
--- a/internal/ceres/triplet_sparse_matrix.h
+++ b/internal/ceres/triplet_sparse_matrix.h
@@ -60,7 +60,7 @@
 
   TripletSparseMatrix& operator=(const TripletSparseMatrix& rhs);
 
-  virtual ~TripletSparseMatrix();
+  ~TripletSparseMatrix() override;
 
   // Implementation of the SparseMatrix interface.
   void SetZero() final;
diff --git a/internal/ceres/trust_region_minimizer.h b/internal/ceres/trust_region_minimizer.h
index be4d406..440cf69 100644
--- a/internal/ceres/trust_region_minimizer.h
+++ b/internal/ceres/trust_region_minimizer.h
@@ -50,7 +50,7 @@
 // For example usage, see SolverImpl::Minimize.
 class CERES_EXPORT_INTERNAL TrustRegionMinimizer : public Minimizer {
  public:
-  ~TrustRegionMinimizer();
+  ~TrustRegionMinimizer() override;
 
   // This method is not thread safe.
   void Minimize(const Minimizer::Options& options,
diff --git a/internal/ceres/trust_region_minimizer_test.cc b/internal/ceres/trust_region_minimizer_test.cc
index 8f544d6..3181068 100644
--- a/internal/ceres/trust_region_minimizer_test.cc
+++ b/internal/ceres/trust_region_minimizer_test.cc
@@ -76,7 +76,7 @@
   }
   // clang-format on
 
-  virtual ~PowellEvaluator2() {}
+  ~PowellEvaluator2() override {}
 
   // Implementation of Evaluator interface.
   SparseMatrix* CreateJacobian() const final {
@@ -330,7 +330,7 @@
 
   bool Evaluate(double const* const* parameters,
                 double* residuals,
-                double** jacobians) const {
+                double** jacobians) const override {
     residuals[0] = target_length_;
 
     for (int i = 0; i < num_vertices_; ++i) {
diff --git a/internal/ceres/trust_region_preprocessor.h b/internal/ceres/trust_region_preprocessor.h
index 2655abe..af56a98 100644
--- a/internal/ceres/trust_region_preprocessor.h
+++ b/internal/ceres/trust_region_preprocessor.h
@@ -39,7 +39,7 @@
 
 class CERES_EXPORT_INTERNAL TrustRegionPreprocessor : public Preprocessor {
  public:
-  virtual ~TrustRegionPreprocessor();
+  ~TrustRegionPreprocessor() override;
   bool Preprocess(const Solver::Options& options,
                   ProblemImpl* problem,
                   PreprocessedProblem* preprocessed_problem) override;
diff --git a/internal/ceres/trust_region_preprocessor_test.cc b/internal/ceres/trust_region_preprocessor_test.cc
index a2a9523..ee93df3 100644
--- a/internal/ceres/trust_region_preprocessor_test.cc
+++ b/internal/ceres/trust_region_preprocessor_test.cc
@@ -89,7 +89,7 @@
  public:
   bool Evaluate(double const* const* parameters,
                 double* residuals,
-                double** jacobians) const {
+                double** jacobians) const override {
     return false;
   }
 };
@@ -120,7 +120,7 @@
  public:
   bool Evaluate(double const* const* parameters,
                 double* residuals,
-                double** jacobians) const {
+                double** jacobians) const override {
     for (int i = 0; i < kNumResiduals; ++i) {
       residuals[i] = kNumResiduals * kNumResiduals + i;
     }
diff --git a/internal/ceres/visibility_based_preconditioner.h b/internal/ceres/visibility_based_preconditioner.h
index 0457b9a..7146e3f 100644
--- a/internal/ceres/visibility_based_preconditioner.h
+++ b/internal/ceres/visibility_based_preconditioner.h
@@ -137,7 +137,7 @@
   VisibilityBasedPreconditioner(const VisibilityBasedPreconditioner&) = delete;
   void operator=(const VisibilityBasedPreconditioner&) = delete;
 
-  virtual ~VisibilityBasedPreconditioner();
+  ~VisibilityBasedPreconditioner() override;
 
   // Preconditioner interface
   void RightMultiply(const double* x, double* y) const final;