Skip to content
Permalink
Browse files
Merge pull request #4163 from nyalldawson/clang_tidyu
Fix a bunch of suggestions from clang-tidy
  • Loading branch information
nyalldawson committed Feb 21, 2017
2 parents 4c92689 + db5dd85 commit 4ad077e391ea7734febd7f7359f3aeb1dbe03c7e
Show file tree
Hide file tree
Showing 166 changed files with 442 additions and 612 deletions.
@@ -671,6 +671,20 @@ INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
# that may be in the same install prefix
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src/core ${CMAKE_BINARY_DIR}/src/gui)

####################################################
# clang-tidy
FIND_PROGRAM(
CLANG_TIDY_EXE
NAMES "clang-tidy"
DOC "Path to clang-tidy executable"
)
IF(NOT CLANG_TIDY_EXE)
MESSAGE(STATUS "clang-tidy not found.")
ELSE(NOT CLANG_TIDY_EXE)
MESSAGE(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
SET(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=*,-clang-analyzer-alpha.*,-cppcoreguidelines*,-readability-implicit-bool-cast,-llvm-include-order,-cert-err58-cpp,-modernize-pass-by-value,-google-readability-braces-around-statements,-modernize-use-auto,-modernize-loop-convert,-readability-else-after-return,-readability-braces-around-statements,-google-runtime-references,-readability-named-parameter,-google-default-arguments,-google-readability-todo,-readability-inconsistent-declaration-parameter-name,-cert-flp30-c,-google-readability-casting,-clang-analyzer-security.FloatLoopCounter,-google-runtime-int,-modernize-use-using,-google-explicit-constructor,-google-build-using-namespace,-cert-err34-c,-clang-analyzer-core.CallAndMessage,-google-readability-function-size,-modernize-make-shared,-modernize-use-nullptr,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-analyzer-core.NonNullParamChecker,performance-unnecessary-copy-initialization,-readability-simplify-boolean-expr,-modernize-raw-string-literal,-performance-unnecessary-copy-initialization")
ENDIF(NOT CLANG_TIDY_EXE)

#############################################################
# create qgsversion.h
IF (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
@@ -487,6 +487,10 @@ class QgsImageFillSymbolLayer: QgsFillSymbolLayer
protected:

virtual void applyDataDefinedSettings( QgsSymbolRenderContext& context );

private:

QgsImageFillSymbolLayer( const QgsImageFillSymbolLayer& other );
};

/** \ingroup core
@@ -844,6 +848,10 @@ class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer

QSet<QString> usedAttributes( const QgsRenderContext& context ) const;

private:

QgsLinePatternFillSymbolLayer( const QgsLinePatternFillSymbolLayer& other );

};

class QgsPointPatternFillSymbolLayer : QgsImageFillSymbolLayer
@@ -945,6 +953,10 @@ class QgsPointPatternFillSymbolLayer : QgsImageFillSymbolLayer

protected:
void applyDataDefinedSettings( QgsSymbolRenderContext& context );

private:

QgsPointPatternFillSymbolLayer( const QgsPointPatternFillSymbolLayer& other );
};

class QgsCentroidFillSymbolLayer : QgsFillSymbolLayer
@@ -1001,4 +1013,8 @@ class QgsCentroidFillSymbolLayer : QgsFillSymbolLayer
/** Returns whether a point is drawn for all parts or only on the biggest part of multi-part features.
* @note added in 2.16 */
bool pointOnAllParts() const;

private:

QgsCentroidFillSymbolLayer( const QgsCentroidFillSymbolLayer& other );
};
@@ -283,4 +283,8 @@ class QgsMarkerLineSymbolLayer : QgsLineSymbolLayer
void renderPolylineVertex( const QPolygonF& points, QgsSymbolRenderContext& context, Placement placement = Vertex );
void renderPolylineCentral( const QPolygonF& points, QgsSymbolRenderContext& context );
double markerAngle( const QPolygonF& points, bool isRing, int vertex );

private:

QgsMarkerLineSymbolLayer( const QgsMarkerLineSymbolLayer& other );
};
@@ -85,4 +85,8 @@ class QgsVectorFieldSymbolLayer : QgsMarkerSymbolLayer
const QgsMapUnitScale& distanceMapUnitScale() const;

QRectF bounds( QPointF point, QgsSymbolRenderContext& context );

private:

QgsVectorFieldSymbolLayer( const QgsVectorFieldSymbolLayer& other );
};
@@ -217,6 +217,13 @@ ENDIF (NOT ANDROID)

TARGET_LINK_LIBRARIES(qgis_analysis qgis_core)

# clang-tidy
IF(CLANG_TIDY_EXE)
SET_TARGET_PROPERTIES(
qgis_analysis PROPERTIES
CXX_CLANG_TIDY "${DO_CLANG_TIDY}"
)
ENDIF(CLANG_TIDY_EXE)

# install

@@ -17,14 +17,6 @@
#include "Point3D.h"
#include "qgslogger.h"

Point3D& Point3D::operator=( const Point3D & p )
{
mX = p.mX;
mY = p.mY;
mZ = p.mZ;
return ( *this );
}

bool Point3D::operator==( const Point3D& p ) const
{
return ( mX == p.getX() && mY == p.getY() && mZ == p.getZ() );
@@ -36,7 +36,6 @@ class ANALYSIS_EXPORT Point3D
//! Constructor with the x-, y- and z-coordinate as arguments
Point3D( double x, double y, double z );
Point3D( const Point3D& p );
Point3D& operator=( const Point3D& p );
bool operator==( const Point3D& p ) const;
bool operator!=( const Point3D& p ) const;
//! Calculates the three-dimensional distance to another point
@@ -29,21 +29,6 @@ void Vector3D::standardise()
setZ( getZ() / length );
}

Vector3D::Vector3D( const Vector3D& v )
: mX( v.mX )
, mY( v.mY )
, mZ( v.mZ )
{
}

Vector3D& Vector3D::operator=( const Vector3D & v )
{
mX = v.mX;
mY = v.mY;
mZ = v.mZ;
return ( *this );
}

bool Vector3D::operator==( const Vector3D& v ) const
{
return ( mX == v.getX() && mY == v.getY() && mZ == v.getZ() );
@@ -41,10 +41,7 @@ class ANALYSIS_EXPORT Vector3D
Vector3D( double x, double y, double z );
//! Default constructor
Vector3D();
//! Copy constructor
Vector3D( const Vector3D& v );

Vector3D& operator=( const Vector3D& v );
bool operator==( const Vector3D& v ) const;
bool operator!=( const Vector3D& v ) const;
//! Returns the x-component of the vector
@@ -35,11 +35,6 @@ QgsInterpolator::QgsInterpolator()

}

QgsInterpolator::~QgsInterpolator()
{

}

int QgsInterpolator::cacheBaseData()
{
if ( mLayerData.size() < 1 )
@@ -57,7 +57,7 @@ class ANALYSIS_EXPORT QgsInterpolator

QgsInterpolator( const QList<LayerData>& layerData );

virtual ~QgsInterpolator();
virtual ~QgsInterpolator() = default;

/** Calculates interpolation value for map coordinates x, y
@param x x-coordinate (in map units)
@@ -118,11 +118,6 @@ QgsVectorLayerDirector::QgsVectorLayerDirector( QgsVectorLayer *myLayer,
mBothDirectionValue = bothDirectionValue;
}

QgsVectorLayerDirector::~QgsVectorLayerDirector()
{

}

QString QgsVectorLayerDirector::name() const
{
return QStringLiteral( "Vector line" );
@@ -65,7 +65,7 @@ class ANALYSIS_EXPORT QgsVectorLayerDirector : public QgsGraphDirector
const Direction defaultDirection
);

virtual ~QgsVectorLayerDirector();
virtual ~QgsVectorLayerDirector() = default;

/*
* MANDATORY DIRECTOR PROPERTY DECLARATION
@@ -23,11 +23,6 @@ QgsDerivativeFilter::QgsDerivativeFilter( const QString& inputFile, const QStrin

}

QgsDerivativeFilter::~QgsDerivativeFilter()
{

}

float QgsDerivativeFilter::calcFirstDerX( float* x11, float* x21, float* x31, float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 )
{
//the basic formula would be simple, but we need to test for nodata values...
@@ -27,7 +27,7 @@ class ANALYSIS_EXPORT QgsDerivativeFilter : public QgsNineCellFilter
{
public:
QgsDerivativeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
virtual ~QgsDerivativeFilter();
virtual ~QgsDerivativeFilter() = default;
//to be implemented by subclasses
virtual float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
@@ -43,11 +43,6 @@ QgsNineCellFilter::QgsNineCellFilter()
{
}

QgsNineCellFilter::~QgsNineCellFilter()
{

}

int QgsNineCellFilter::processRaster( QProgressDialog* p )
{
GDALAllRegister();
@@ -34,7 +34,7 @@ class ANALYSIS_EXPORT QgsNineCellFilter
public:
//! Constructor that takes input file, output file and output format (GDAL string)
QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
virtual ~QgsNineCellFilter();
virtual ~QgsNineCellFilter() = default;

/** Starts the calculation, reads from mInputFile and stores the result in mOutputFile
@param p progress dialog that receives update and that is checked for abort. 0 if no progress bar is needed.
@@ -16,7 +16,7 @@
***************************************************************************/

#include "qgsrastermatrix.h"
#include <string.h>
#include <cstring>
#include <qmath.h>

QgsRasterMatrix::QgsRasterMatrix()
@@ -27,12 +27,6 @@ QgsRuggednessFilter::QgsRuggednessFilter(): QgsNineCellFilter( QLatin1String( ""

}


QgsRuggednessFilter::~QgsRuggednessFilter()
{

}

float QgsRuggednessFilter::processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 )
{
@@ -28,7 +28,7 @@ class ANALYSIS_EXPORT QgsRuggednessFilter: public QgsNineCellFilter
{
public:
QgsRuggednessFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsRuggednessFilter();
~QgsRuggednessFilter() = default;

protected:

@@ -23,11 +23,6 @@ QgsSlopeFilter::QgsSlopeFilter( const QString& inputFile, const QString& outputF

}

QgsSlopeFilter::~QgsSlopeFilter()
{

}

float QgsSlopeFilter::processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 )
{
@@ -27,7 +27,7 @@ class ANALYSIS_EXPORT QgsSlopeFilter: public QgsDerivativeFilter