From b945e6475d063a9969c4379d69e36d7ecf6e5e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkovsky@mmg.fjfi.cvut.cz> Date: Mon, 27 Dec 2021 13:35:03 +0100 Subject: [PATCH] clang-tidy: annotate functions with 'override' [modernize-use-override] See https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-override.html --- src/TNL/Config/ConfigDelimiter.h | 4 ++-- src/TNL/Config/ConfigEntry.h | 8 ++++---- src/TNL/Exceptions/CudaBadAlloc.h | 2 +- src/TNL/Matrices/Matrix.h | 8 ++++---- src/TNL/Matrices/MatrixView.h | 4 ++-- .../DistributedMeshes/DistributedMeshSynchronizer.h | 6 +++--- src/TNL/Meshes/Readers/NetgenReader.h | 2 +- src/TNL/Meshes/Readers/PVTIReader.h | 8 ++++---- src/TNL/Meshes/Readers/PVTUReader.h | 8 ++++---- src/TNL/Meshes/Readers/VTIReader.h | 2 +- src/TNL/Meshes/Readers/VTKReader.h | 8 ++++---- src/TNL/Meshes/Readers/VTUReader.h | 2 +- src/TNL/Meshes/Readers/XMLVTK.h | 6 +++--- src/TNL/Pointers/DevicePointer.h | 8 ++++---- src/TNL/Pointers/SharedPointerCuda.h | 4 ++-- src/TNL/Pointers/SharedPointerHost.h | 4 ++-- src/TNL/Pointers/UniquePointer.h | 8 ++++---- src/TNL/Solvers/IterativeSolverMonitor.h | 4 ++-- 18 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/TNL/Config/ConfigDelimiter.h b/src/TNL/Config/ConfigDelimiter.h index 3b61f2b765..8eac7300f7 100644 --- a/src/TNL/Config/ConfigDelimiter.h +++ b/src/TNL/Config/ConfigDelimiter.h @@ -18,13 +18,13 @@ class ConfigDelimiter : public ConfigEntryBase public: ConfigDelimiter( const std::string& delimiter ) : ConfigEntryBase( "", delimiter, false ) {} - virtual bool + bool isDelimiter() const override { return true; }; - virtual std::string + std::string getUIEntryType() const override { return ""; diff --git a/src/TNL/Config/ConfigEntry.h b/src/TNL/Config/ConfigEntry.h index 17c7307b7f..bc42ac20f8 100644 --- a/src/TNL/Config/ConfigEntry.h +++ b/src/TNL/Config/ConfigEntry.h @@ -41,13 +41,13 @@ public: _hasDefaultValue = true; } - virtual std::string + std::string getUIEntryType() const override { return Config::getUIEntryType< DefaultValueType >(); } - virtual std::string + std::string printDefaultValue() const override { // printDefaultValue must be compilable even if DefaultValueType is std::vector, @@ -55,7 +55,7 @@ public: return _print_value( defaultValue ); } - virtual bool + bool hasEnumValues() const override { if( enumValues.size() > 0 ) @@ -63,7 +63,7 @@ public: return false; } - virtual void + void printEnumValues( std::ostream& str ) const override { str << "- Can be: "; diff --git a/src/TNL/Exceptions/CudaBadAlloc.h b/src/TNL/Exceptions/CudaBadAlloc.h index 0577a2402f..c9ddab619c 100644 --- a/src/TNL/Exceptions/CudaBadAlloc.h +++ b/src/TNL/Exceptions/CudaBadAlloc.h @@ -25,7 +25,7 @@ struct CudaBadAlloc : public std::bad_alloc } const char* - what() const throw() + what() const throw() override { return "Failed to allocate memory on the CUDA device: " "most likely there is not enough space on the device memory."; diff --git a/src/TNL/Matrices/Matrix.h b/src/TNL/Matrices/Matrix.h index cb57f0b2d7..1b6231e9ea 100644 --- a/src/TNL/Matrices/Matrix.h +++ b/src/TNL/Matrices/Matrix.h @@ -210,16 +210,16 @@ public: * * \param file is the output file. */ - virtual void - save( File& file ) const; + void + save( File& file ) const override; /** * \brief Method for loading the matrix from a file. * * \param file is the input file. */ - virtual void - load( File& file ); + void + load( File& file ) override; /** * \brief Method for printing the matrix to output stream. diff --git a/src/TNL/Matrices/MatrixView.h b/src/TNL/Matrices/MatrixView.h index 7c79fc5892..451214607c 100644 --- a/src/TNL/Matrices/MatrixView.h +++ b/src/TNL/Matrices/MatrixView.h @@ -195,8 +195,8 @@ public: * * \param file is the output file. */ - virtual void - save( File& file ) const; + void + save( File& file ) const override; /** * \brief Method for printing the matrix view to output stream. diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h b/src/TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h index 679d494136..45b84a9b1e 100644 --- a/src/TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h +++ b/src/TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h @@ -39,7 +39,7 @@ public: using ByteArrayView = typename Base::ByteArrayView; using RequestsVector = typename Base::RequestsVector; - ~DistributedMeshSynchronizer() + ~DistributedMeshSynchronizer() override { // wait for pending async operation, otherwise it would crash if( this->async_op.valid() ) @@ -193,14 +193,14 @@ public: synchronizeByteArray( view, sizeof( ValueType ) * valuesPerElement ); } - virtual void + void synchronizeByteArray( ByteArrayView array, int bytesPerValue ) override { auto requests = synchronizeByteArrayAsyncWorker( array, bytesPerValue ); MPI::Waitall( requests.data(), requests.size() ); } - virtual RequestsVector + RequestsVector synchronizeByteArrayAsyncWorker( ByteArrayView array, int bytesPerValue ) override { TNL_ASSERT_EQ( array.getSize(), diff --git a/src/TNL/Meshes/Readers/NetgenReader.h b/src/TNL/Meshes/Readers/NetgenReader.h index 1183e9b1a2..3a221d5cce 100644 --- a/src/TNL/Meshes/Readers/NetgenReader.h +++ b/src/TNL/Meshes/Readers/NetgenReader.h @@ -29,7 +29,7 @@ public: NetgenReader( const std::string& fileName ) : MeshReader( fileName ) {} - virtual void + void detectMesh() override { reset(); diff --git a/src/TNL/Meshes/Readers/PVTIReader.h b/src/TNL/Meshes/Readers/PVTIReader.h index d433ff5e01..608365b6ff 100644 --- a/src/TNL/Meshes/Readers/PVTIReader.h +++ b/src/TNL/Meshes/Readers/PVTIReader.h @@ -178,7 +178,7 @@ public: : XMLVTK( fileName ), communicator( communicator ) {} - virtual void + void detectMesh() override { #ifdef HAVE_TINYXML2 @@ -296,19 +296,19 @@ public: throw MeshReaderError( "MeshReader", "the PVTI reader cannot be used to load a distributed unstructured mesh." ); } - virtual VariantVector + VariantVector readPointData( std::string arrayName ) override { return localReader.readPointData( arrayName ); } - virtual VariantVector + VariantVector readCellData( std::string arrayName ) override { return localReader.readCellData( arrayName ); } - virtual void + void reset() override { resetBase(); diff --git a/src/TNL/Meshes/Readers/PVTUReader.h b/src/TNL/Meshes/Readers/PVTUReader.h index 15dc4cbe5f..a4d608569c 100644 --- a/src/TNL/Meshes/Readers/PVTUReader.h +++ b/src/TNL/Meshes/Readers/PVTUReader.h @@ -105,7 +105,7 @@ public: : XMLVTK( fileName ), communicator( communicator ) {} - virtual void + void detectMesh() override { #ifdef HAVE_TINYXML2 @@ -239,19 +239,19 @@ public: } } - virtual VariantVector + VariantVector readPointData( std::string arrayName ) override { return localReader.readPointData( arrayName ); } - virtual VariantVector + VariantVector readCellData( std::string arrayName ) override { return localReader.readCellData( arrayName ); } - virtual void + void reset() override { resetBase(); diff --git a/src/TNL/Meshes/Readers/VTIReader.h b/src/TNL/Meshes/Readers/VTIReader.h index 31b1d8d9ba..69568b8405 100644 --- a/src/TNL/Meshes/Readers/VTIReader.h +++ b/src/TNL/Meshes/Readers/VTIReader.h @@ -121,7 +121,7 @@ public: VTIReader( const std::string& fileName ) : XMLVTK( fileName ) {} - virtual void + void detectMesh() override { #ifdef HAVE_TINYXML2 diff --git a/src/TNL/Meshes/Readers/VTKReader.h b/src/TNL/Meshes/Readers/VTKReader.h index 3fe5a53f93..a51cc7879f 100644 --- a/src/TNL/Meshes/Readers/VTKReader.h +++ b/src/TNL/Meshes/Readers/VTKReader.h @@ -28,7 +28,7 @@ public: VTKReader( const std::string& fileName ) : MeshReader( fileName ) {} - virtual void + void detectMesh() override { reset(); @@ -373,19 +373,19 @@ public: meshType = "Meshes::Mesh"; } - virtual VariantVector + VariantVector readPointData( std::string arrayName ) override { return readPointOrCellData( "POINT_DATA", arrayName ); } - virtual VariantVector + VariantVector readCellData( std::string arrayName ) override { return readPointOrCellData( "CELL_DATA", arrayName ); } - virtual void + void reset() override { resetBase(); diff --git a/src/TNL/Meshes/Readers/VTUReader.h b/src/TNL/Meshes/Readers/VTUReader.h index 2908a79a2a..7864d9aeaf 100644 --- a/src/TNL/Meshes/Readers/VTUReader.h +++ b/src/TNL/Meshes/Readers/VTUReader.h @@ -246,7 +246,7 @@ public: VTUReader( const std::string& fileName ) : XMLVTK( fileName ) {} - virtual void + void detectMesh() override { #ifdef HAVE_TINYXML2 diff --git a/src/TNL/Meshes/Readers/XMLVTK.h b/src/TNL/Meshes/Readers/XMLVTK.h index f12313798b..415668d029 100644 --- a/src/TNL/Meshes/Readers/XMLVTK.h +++ b/src/TNL/Meshes/Readers/XMLVTK.h @@ -405,7 +405,7 @@ public: #endif } - virtual VariantVector + VariantVector readPointData( std::string arrayName ) override { #ifdef HAVE_TINYXML2 @@ -415,7 +415,7 @@ public: #endif } - virtual VariantVector + VariantVector readCellData( std::string arrayName ) override { #ifdef HAVE_TINYXML2 @@ -425,7 +425,7 @@ public: #endif } - virtual void + void reset() override { resetBase(); diff --git a/src/TNL/Pointers/DevicePointer.h b/src/TNL/Pointers/DevicePointer.h index e605778fff..282402afd9 100644 --- a/src/TNL/Pointers/DevicePointer.h +++ b/src/TNL/Pointers/DevicePointer.h @@ -328,7 +328,7 @@ public: * \return true. */ bool - synchronize() + synchronize() override { return true; } @@ -347,7 +347,7 @@ public: /** * \brief Destructor. */ - ~DevicePointer() {} + ~DevicePointer() override {} protected: Object* pointer; @@ -718,7 +718,7 @@ public: * \return true if the synchronization was successful, false otherwise. */ bool - synchronize() + synchronize() override { if( ! this->pd ) return true; @@ -753,7 +753,7 @@ public: /** * \brief Destructor. */ - ~DevicePointer() + ~DevicePointer() override { this->free(); getSmartPointersRegister< DeviceType >().remove( this ); diff --git a/src/TNL/Pointers/SharedPointerCuda.h b/src/TNL/Pointers/SharedPointerCuda.h index 362d17bb9f..e08b1e95f8 100644 --- a/src/TNL/Pointers/SharedPointerCuda.h +++ b/src/TNL/Pointers/SharedPointerCuda.h @@ -465,7 +465,7 @@ public: * \return true if the synchronization was successful, false otherwise. */ bool - synchronize() + synchronize() override { if( ! this->pd ) return true; @@ -512,7 +512,7 @@ public: /** * \brief Destructor. */ - ~SharedPointer() + ~SharedPointer() override { this->free(); getSmartPointersRegister< DeviceType >().remove( this ); diff --git a/src/TNL/Pointers/SharedPointerHost.h b/src/TNL/Pointers/SharedPointerHost.h index 81aee71359..328a3a998c 100644 --- a/src/TNL/Pointers/SharedPointerHost.h +++ b/src/TNL/Pointers/SharedPointerHost.h @@ -384,7 +384,7 @@ public: * \return true. */ bool - synchronize() + synchronize() override { return true; } @@ -412,7 +412,7 @@ public: /** * \brief Destructor. */ - ~SharedPointer() + ~SharedPointer() override { this->free(); } diff --git a/src/TNL/Pointers/UniquePointer.h b/src/TNL/Pointers/UniquePointer.h index fdbeda091d..9cf9c1f85f 100644 --- a/src/TNL/Pointers/UniquePointer.h +++ b/src/TNL/Pointers/UniquePointer.h @@ -262,7 +262,7 @@ public: * \return true. */ bool - synchronize() + synchronize() override { return true; } @@ -270,7 +270,7 @@ public: /** * \brief Destructor. */ - ~UniquePointer() + ~UniquePointer() override { if( this->pointer ) delete this->pointer; @@ -516,7 +516,7 @@ public: * \return true if the synchronization was successful, false otherwise. */ bool - synchronize() + synchronize() override { if( ! this->pd ) return true; @@ -536,7 +536,7 @@ public: /** * \brief Destructor. */ - ~UniquePointer() + ~UniquePointer() override { this->free(); getSmartPointersRegister< DeviceType >().remove( this ); diff --git a/src/TNL/Solvers/IterativeSolverMonitor.h b/src/TNL/Solvers/IterativeSolverMonitor.h index 2a9ea18297..bcad033e46 100644 --- a/src/TNL/Solvers/IterativeSolverMonitor.h +++ b/src/TNL/Solvers/IterativeSolverMonitor.h @@ -119,8 +119,8 @@ public: /** * \brief Causes that the monitor prints out the status of the solver. */ - virtual void - refresh(); + void + refresh() override; protected: int -- GitLab