Skip to content

Commit

Permalink
Merge pull request #4163 from nyalldawson/clang_tidyu
Browse files Browse the repository at this point in the history
Fix a bunch of suggestions from clang-tidy
  • Loading branch information
nyalldawson authored Feb 21, 2017
2 parents 4c92689 + db5dd85 commit 4ad077e
Show file tree
Hide file tree
Showing 166 changed files with 442 additions and 612 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions python/core/symbology-ng/qgsfillsymbollayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,10 @@ class QgsImageFillSymbolLayer: QgsFillSymbolLayer
protected:

virtual void applyDataDefinedSettings( QgsSymbolRenderContext& context );

private:

QgsImageFillSymbolLayer( const QgsImageFillSymbolLayer& other );
};

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

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

private:

QgsLinePatternFillSymbolLayer( const QgsLinePatternFillSymbolLayer& other );

};

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

protected:
void applyDataDefinedSettings( QgsSymbolRenderContext& context );

private:

QgsPointPatternFillSymbolLayer( const QgsPointPatternFillSymbolLayer& other );
};

class QgsCentroidFillSymbolLayer : QgsFillSymbolLayer
Expand Down Expand Up @@ -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 );
};
4 changes: 4 additions & 0 deletions python/core/symbology-ng/qgslinesymbollayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
};
4 changes: 4 additions & 0 deletions python/core/symbology-ng/qgsvectorfieldsymbollayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,8 @@ class QgsVectorFieldSymbolLayer : QgsMarkerSymbolLayer
const QgsMapUnitScale& distanceMapUnitScale() const;

QRectF bounds( QPointF point, QgsSymbolRenderContext& context );

private:

QgsVectorFieldSymbolLayer( const QgsVectorFieldSymbolLayer& other );
};
7 changes: 7 additions & 0 deletions src/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 0 additions & 8 deletions src/analysis/interpolation/Point3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
1 change: 0 additions & 1 deletion src/analysis/interpolation/Point3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions src/analysis/interpolation/Vector3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
3 changes: 0 additions & 3 deletions src/analysis/interpolation/Vector3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/analysis/interpolation/qgsinterpolator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ QgsInterpolator::QgsInterpolator()

}

QgsInterpolator::~QgsInterpolator()
{

}

int QgsInterpolator::cacheBaseData()
{
if ( mLayerData.size() < 1 )
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/qgsinterpolator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions src/analysis/network/qgsvectorlayerdirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ QgsVectorLayerDirector::QgsVectorLayerDirector( QgsVectorLayer *myLayer,
mBothDirectionValue = bothDirectionValue;
}

QgsVectorLayerDirector::~QgsVectorLayerDirector()
{

}

QString QgsVectorLayerDirector::name() const
{
return QStringLiteral( "Vector line" );
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/network/qgsvectorlayerdirector.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ANALYSIS_EXPORT QgsVectorLayerDirector : public QgsGraphDirector
const Direction defaultDirection
);

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

/*
* MANDATORY DIRECTOR PROPERTY DECLARATION
Expand Down
5 changes: 0 additions & 5 deletions src/analysis/raster/qgsderivativefilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsderivativefilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions src/analysis/raster/qgsninecellfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ QgsNineCellFilter::QgsNineCellFilter()
{
}

QgsNineCellFilter::~QgsNineCellFilter()
{

}

int QgsNineCellFilter::processRaster( QProgressDialog* p )
{
GDALAllRegister();
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsninecellfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsrastermatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
***************************************************************************/