Skip to content

Commit 52f2450

Browse files
authored
Merge pull request #1989 from su2code/feature_clang-tidy
Add clang-tidy checks and apply them
2 parents 9fb797a + 2ce3fcc commit 52f2450

162 files changed

Lines changed: 1523 additions & 1613 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-tidy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Checks: '-*,modernize-avoid-bind,modernize-deprecated-headers,modernize-deprecated-ios-base-aliases,modernize-macro-to-enum,modernize-pass-by-value,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-replace-auto-ptr,modernize-replace-disallow-copy-and-assign-macro,modernize-replace-random-shuffle,modernize-return-braced-init-list,modernize-shrink-to-fit,modernize-unary-static-assert,modernize-use-auto,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-emplace,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-override,modernize-use-transparent-functors,modernize-use-using,readability-const-return-type,readability-avoid-const-params-in-decls,readability-container-data-pointer,readability-container-size-empty,readability-delete-null-pointer,readability-duplicate-include,readability-non-const-parameter,readability-redundant-access-specifiers,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-smartptr-get,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-simplify-subscript-expr,readability-else-after-return,performance-*'
2+
CheckOptions:
3+
- {key: modernize-use-override.AllowOverrideAndFinal, value: 'true'}
4+
- {key: performance-unnecessary-copy-initialization.AllowedTypes, value: 'su2double'}
5+
- {key: performance-unnecessary-value-param.AllowedTypes, value: 'su2double'}

Common/include/CConfig.hpp

Lines changed: 162 additions & 162 deletions
Large diffs are not rendered by default.

Common/include/containers/CLookUpTable.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class CLookUpTable {
271271
const su2double val_CV3);
272272

273273
public:
274-
CLookUpTable(const std::string& file_name_lut, const std::string& name_CV1_in, const std::string& name_CV2_in);
274+
CLookUpTable(const std::string& file_name_lut, std::string name_CV1_in, std::string name_CV2_in);
275275

276276
/*!
277277
* \brief print information to screen.

Common/include/geometry/CGeometry.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ extern "C" {
4545
#include <sstream>
4646
#include <cmath>
4747
#include <algorithm>
48-
#include <string.h>
49-
#include <stdio.h>
50-
#include <stdlib.h>
48+
#include <cstring>
49+
#include <cstdio>
50+
#include <cstdlib>
5151
#include <climits>
5252
#include <memory>
5353
#include <unordered_map>

Common/include/geometry/CPhysicalGeometry.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ class CPhysicalGeometry final : public CGeometry {
282282
* \param[in] val_iZone - Domain to be read from the grid file.
283283
* \param[in] val_nZone - Total number of domains in the grid file.
284284
*/
285-
void Read_Mesh_FVM(CConfig* config, string val_mesh_filename, unsigned short val_iZone, unsigned short val_nZone);
285+
void Read_Mesh_FVM(CConfig* config, const string& val_mesh_filename, unsigned short val_iZone,
286+
unsigned short val_nZone);
286287

287288
/*!
288289
* \brief Reads for the FEM solver the geometry of the grid and adjust the boundary
@@ -292,7 +293,7 @@ class CPhysicalGeometry final : public CGeometry {
292293
* \param[in] val_iZone - Domain to be read from the grid file.
293294
* \param[in] val_nZone - Total number of domains in the grid file.
294295
*/
295-
void Read_SU2_Format_Parallel_FEM(CConfig* config, string val_mesh_filename, unsigned short val_iZone,
296+
void Read_SU2_Format_Parallel_FEM(CConfig* config, const string& val_mesh_filename, unsigned short val_iZone,
296297
unsigned short val_nZone);
297298

298299
/*!
@@ -303,7 +304,7 @@ class CPhysicalGeometry final : public CGeometry {
303304
* \param[in] val_iZone - Domain to be read from the grid file.
304305
* \param[in] val_nZone - Total number of domains in the grid file.
305306
*/
306-
void Read_CGNS_Format_Parallel_FEM(CConfig* config, string val_mesh_filename, unsigned short val_iZone,
307+
void Read_CGNS_Format_Parallel_FEM(CConfig* config, const string& val_mesh_filename, unsigned short val_iZone,
307308
unsigned short val_nZone);
308309

309310
/*!

Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class CCGNSMeshReaderFVM : public CMeshReaderFVM {
6363
* \brief Open the CGNS file and checks for errors.
6464
* \param[in] val_filename - string name of the CGNS file to be read.
6565
*/
66-
void OpenCGNSFile(string val_filename);
66+
void OpenCGNSFile(const string& val_filename);
6767

6868
/*!
6969
* \brief Reads all CGNS database metadata and checks for errors.

Common/include/grid_movement/CFreeFormDefBox.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ class CFreeFormDefBox : public CGridMovement {
710710
* which? diff_thiss will tell us ; E.G.: dim=2, diff_this=1 => we use the third coordinate of the control
711711
* points, and derivate de v-Bersntein polynomial (use m-1 when summing!!).
712712
*/
713-
su2double GetDerivative3(su2double* uvw, unsigned short dim, unsigned short diff_this, unsigned short* lmn);
713+
su2double GetDerivative3(su2double* uvw, unsigned short dim, unsigned short diff_this, unsigned short* lmn) const;
714714

715715
/*!
716716
* \brief An auxiliary routine to help us compute the Hessian of F(u, v, w) = ||X(u, v, w)-(x, y, z)||^2 =
@@ -742,7 +742,7 @@ class CFreeFormDefBox : public CGridMovement {
742742
* \return __________.
743743
*/
744744
su2double GetDerivative5(su2double* uvw, unsigned short dim, unsigned short diff_this, unsigned short diff_this_also,
745-
unsigned short* lmn);
745+
unsigned short* lmn) const;
746746

747747
/*!
748748
* \brief Euclidean norm of a vector.

Common/include/grid_movement/CSurfaceMovement.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ class CSurfaceMovement : public CGridMovement {
433433
* \param[in] FFDBox - Array with all the free forms FFDBoxes of the computation.
434434
* \param[in] val_mesh_filename - Name of the grid input file.
435435
*/
436-
void ReadFFDInfo(CGeometry* geometry, CConfig* config, CFreeFormDefBox** FFDBox, string val_mesh_filename);
436+
void ReadFFDInfo(CGeometry* geometry, CConfig* config, CFreeFormDefBox** FFDBox, const string& val_mesh_filename);
437437

438438
/*!
439439
* \brief Read the free form information from the grid input file.

Common/include/linear_algebra/CSysSolve.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class CSysSolve {
191191
*
192192
* \pre the ostream object os should be open
193193
*/
194-
void WriteHeader(std::string solver, ScalarType restol, ScalarType resinit) const;
194+
void WriteHeader(const std::string& solver, ScalarType restol, ScalarType resinit) const;
195195

196196
/*!
197197
* \brief writes residual convergence data for one iteration to a stream
@@ -208,7 +208,7 @@ class CSysSolve {
208208
* \param[in] iter - current iteration
209209
* \param[in] res - the residual norm
210210
*/
211-
void WriteFinalResidual(std::string solver, unsigned long iter, ScalarType res) const;
211+
void WriteFinalResidual(const std::string& solver, unsigned long iter, ScalarType res) const;
212212

213213
/*!
214214
* \brief writes the convergence warning

Common/include/parallelization/mpi_structure.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int CBaseMPIWrapper::MinRankError;
4444
bool CBaseMPIWrapper::winMinRankErrorInUse = false;
4545
CBaseMPIWrapper::Win CBaseMPIWrapper::winMinRankError;
4646

47-
void CBaseMPIWrapper::Error(std::string ErrorMsg, std::string FunctionName) {
47+
void CBaseMPIWrapper::Error(const std::string& ErrorMsg, const std::string& FunctionName) {
4848
/* Set MinRankError to Rank, as the error message is called on this rank. */
4949
MinRankError = Rank;
5050
int flag = 0;

0 commit comments

Comments
 (0)