Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernized code with clang-tidy [PCL-2731] #4629

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
Checks: '-*,modernize-deprecated-headers,modernize-redundant-void-arg,modernize-replace-random-shuffle,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,modernize-use-using'
WarningsAsErrors: '-*,modernize-deprecated-headers,modernize-redundant-void-arg,modernize-replace-random-shuffle,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,modernize-use-using'
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if(POLICY CMP0074)
endif()

# Set target C++ standard and required compiler features
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The target C++ standard. PCL requires C++14 or higher.")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down
4 changes: 2 additions & 2 deletions apps/cloud_composer/src/project_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ pcl::cloud_composer::ProjectModel::clearSelection ()
foreach (CloudItem* selected_item, selected_item_index_map_.keys())
{
qDebug () << "Setting item color back to black";
selected_item->setForeground (QBrush (Qt::black));;
selected_item->setForeground (QBrush (Qt::black));
}

selected_item_index_map_.clear ();
Expand Down Expand Up @@ -583,7 +583,7 @@ pcl::cloud_composer::ProjectModel::itemSelectionChanged ( const QItemSelection &
//Set all point selected cloud items back to green text, since if they are selected they get changed to white
foreach (CloudItem* selected_item, selected_item_index_map_.keys())
{
selected_item->setForeground (QBrush (Qt::green));;
selected_item->setForeground (QBrush (Qt::green));
}
}

Expand Down
4 changes: 1 addition & 3 deletions common/include/pcl/ModelCoefficients.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ namespace pcl
{
struct ModelCoefficients
{
ModelCoefficients ()
{
}
ModelCoefficients () = default;

::pcl::PCLHeader header;

Expand Down
3 changes: 1 addition & 2 deletions common/include/pcl/PointIndices.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ namespace pcl
using Ptr = shared_ptr< ::pcl::PointIndices>;
using ConstPtr = shared_ptr<const ::pcl::PointIndices>;

PointIndices ()
{}
PointIndices () = default;

::pcl::PCLHeader header;

Expand Down
3 changes: 1 addition & 2 deletions common/include/pcl/PolygonMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ namespace pcl
{
struct PolygonMesh
{
PolygonMesh ()
{}
PolygonMesh () = default;

::pcl::PCLHeader header;

Expand Down
3 changes: 1 addition & 2 deletions common/include/pcl/Vertices.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ namespace pcl
*/
struct Vertices
{
Vertices ()
{}
Vertices () = default;

Indices vertices;

Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/cloud_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace pcl
class Iterator
{
public:
virtual ~Iterator () {}
virtual ~Iterator () = default;

virtual void operator ++ () = 0;

Expand Down Expand Up @@ -158,7 +158,7 @@ namespace pcl
class Iterator
{
public:
virtual ~Iterator () {}
virtual ~Iterator () = default;

virtual void operator ++ () = 0;

Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/console/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace pcl
{
public:

TicToc () {}
TicToc () = default;

void
tic ()
Expand Down
12 changes: 4 additions & 8 deletions common/include/pcl/impl/cloud_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ namespace pcl
{
}

~DefaultIterator ()
{
}
~DefaultIterator () = default;

void operator ++ ()
{
Expand Down Expand Up @@ -130,7 +128,7 @@ namespace pcl
{
}

virtual ~IteratorIdx () {}
virtual ~IteratorIdx () = default;

void operator ++ ()
{
Expand Down Expand Up @@ -196,9 +194,7 @@ namespace pcl
{
}

~DefaultConstIterator ()
{
}
~DefaultConstIterator () override = default;

void operator ++ () override
{
Expand Down Expand Up @@ -272,7 +268,7 @@ namespace pcl
{
}

~ConstIteratorIdx () {}
~ConstIteratorIdx () override = default;

void operator ++ () override
{
Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/point_representation.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace pcl
trivial_ = true;
}

~DefaultPointRepresentation () {}
~DefaultPointRepresentation () override = default;

inline Ptr
makeShared () const
Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/range_image/range_image_planar.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace pcl
/** Constructor */
PCL_EXPORTS RangeImagePlanar ();
/** Destructor */
PCL_EXPORTS ~RangeImagePlanar ();
PCL_EXPORTS ~RangeImagePlanar () override;

/** Return a newly created RangeImagePlanar.
* Reimplementation to return an image of the same type. */
Expand Down
5 changes: 1 addition & 4 deletions common/src/feature_histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ pcl::FeatureHistogram::FeatureHistogram (std::size_t const number_of_bins,
number_of_bins_ = number_of_bins;
}

pcl::FeatureHistogram::~FeatureHistogram ()
{

}
pcl::FeatureHistogram::~FeatureHistogram () = default;

float
pcl::FeatureHistogram::getThresholdMin () const
Expand Down
4 changes: 1 addition & 3 deletions common/src/range_image_planar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ namespace pcl
}

/////////////////////////////////////////////////////////////////////////
RangeImagePlanar::~RangeImagePlanar ()
{
}
RangeImagePlanar::~RangeImagePlanar () = default;

/////////////////////////////////////////////////////////////////////////
void
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/3dsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ namespace pcl
rng_.seed (12345u);
}

~ShapeContext3DEstimation() {}
~ShapeContext3DEstimation() override = default;

//inline void
//setAzimuthBins (std::size_t bins) { azimuth_bins_ = bins; }
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace pcl
}

/** \brief Empty destructor */
~BOARDLocalReferenceFrameEstimation () {}
~BOARDLocalReferenceFrameEstimation () override = default;

//Getters/Setters

Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/don.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace pcl
feature_name_ = "DifferenceOfNormalsEstimation";
}

~DifferenceOfNormalsEstimation ()
~DifferenceOfNormalsEstimation () override
{
//
}
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/esf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ pcl::ESFEstimation<PointInT, PointOutT>::lci (
int err_2 = dz2 - l;
for (int i = 1; i<l; i++)
{
voxelcount++;;
voxelcount++;
voxel_in += static_cast<int>(lut_[act_voxel[0]][act_voxel[1]][act_voxel[2]] == 1);
if (err_1 > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename PointOutT>
pcl::LinearLeastSquaresNormalEstimation<PointInT, PointOutT>::~LinearLeastSquaresNormalEstimation ()
{
}
pcl::LinearLeastSquaresNormalEstimation<PointInT, PointOutT>::~LinearLeastSquaresNormalEstimation () = default;

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename PointOutT> void
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/vfh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pcl::VFHEstimation<PointInT, PointNT, PointOutT>::computePointSPFHSignature (con
if (normalize_bins_)
hist_incr = 100.0f / static_cast<float> (indices.size () - 1);

float hist_incr_size_component = 0;;
float hist_incr_size_component = 0;
if (size_component_)
hist_incr_size_component = hist_incr;

Expand Down
4 changes: 2 additions & 2 deletions features/include/pcl/features/integral_image2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace pcl

/** \brief Destructor */
virtual
~IntegralImage2D () { }
~IntegralImage2D () = default;

/** \brief sets the computation for second order integral images on or off.
* \param compute_second_order_integral_images
Expand Down Expand Up @@ -254,7 +254,7 @@ namespace pcl

/** \brief Destructor */
virtual
~IntegralImage2D () { }
~IntegralImage2D () = default;

/** \brief Set the input data to compute the integral image for
* \param[in] data the input data
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/integral_image_normal.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace pcl
}

/** \brief Destructor **/
~IntegralImageNormalEstimation ();
~IntegralImageNormalEstimation () override;

/** \brief Set the regions size which is considered for normal estimation.
* \param[in] width the width of the search rectangle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace pcl
};

/** \brief Destructor */
~LinearLeastSquaresNormalEstimation ();
~LinearLeastSquaresNormalEstimation () override;

/** \brief Computes the normal at the specified position.
* \param[in] pos_x x position (pixel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace pcl

/** \brief Virtual destructor which frees the memory. */

~MomentOfInertiaEstimation ();
~MomentOfInertiaEstimation () override;

/** \brief This method allows to set the angle step. It is used for the rotation
* of the axis which is used for moment of inertia/eccentricity calculation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace pcl
MultiscaleFeaturePersistence ();

/** \brief Empty destructor */
~MultiscaleFeaturePersistence () {}
~MultiscaleFeaturePersistence () override = default;

/** \brief Method that calls computeFeatureAtScale () for each scale parameter */
void
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/narf.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ namespace pcl
using PointT = Narf *;
FeaturePointRepresentation(int nr_dimensions) { this->nr_dimensions_ = nr_dimensions; }
/** \brief Empty destructor */
~FeaturePointRepresentation () {}
~FeaturePointRepresentation () override = default;
void copyToFloatArray (const PointT& p, float* out) const override { memcpy(out, p->getDescriptor(), sizeof(*p->getDescriptor())*this->nr_dimensions_); }
};

Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/narf_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace pcl
/** Constructor */
NarfDescriptor (const RangeImage* range_image=nullptr, const pcl::Indices* indices=nullptr);
/** Destructor */
~NarfDescriptor();
~NarfDescriptor() override;

// =====METHODS=====
//! Set input data
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/normal_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ namespace pcl
};

/** \brief Empty destructor */
~NormalEstimation () {}
~NormalEstimation () override = default;

/** \brief Compute the Least-Squares plane fit for a given set of points, using their indices,
* and return the estimated plane parameters together with the surface curvature.
Expand Down
16 changes: 4 additions & 12 deletions features/include/pcl/features/organized_edge_detection.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ namespace pcl

/** \brief Destructor for OrganizedEdgeBase */

~OrganizedEdgeBase ()
{
}
~OrganizedEdgeBase () override = default;

/** \brief Perform the 3D edge detection (edges from depth discontinuities)
* \param[out] labels a PointCloud of edge labels
Expand Down Expand Up @@ -212,9 +210,7 @@ namespace pcl

/** \brief Destructor for OrganizedEdgeFromRGB */

~OrganizedEdgeFromRGB ()
{
}
~OrganizedEdgeFromRGB () override = default;

/** \brief Perform the 3D edge detection (edges from depth discontinuities and RGB Canny edge) and assign point indices for each edge label
* \param[out] labels a PointCloud of edge labels
Expand Down Expand Up @@ -303,9 +299,7 @@ namespace pcl

/** \brief Destructor for OrganizedEdgeFromNormals */

~OrganizedEdgeFromNormals ()
{
}
~OrganizedEdgeFromNormals () override = default;

/** \brief Perform the 3D edge detection (edges from depth discontinuities and high curvature regions) and assign point indices for each edge label
* \param[out] labels a PointCloud of edge labels
Expand Down Expand Up @@ -412,9 +406,7 @@ namespace pcl

/** \brief Destructor for OrganizedEdgeFromRGBNormals */

~OrganizedEdgeFromRGBNormals ()
{
}
~OrganizedEdgeFromRGBNormals () override = default;

/** \brief Perform the 3D edge detection (edges from depth discontinuities, RGB Canny edge, and high curvature regions) and assign point indices for each edge label
* \param[out] labels a PointCloud of edge labels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace pcl
/** Constructor */
RangeImageBorderExtractor (const RangeImage* range_image=nullptr);
/** Destructor */
~RangeImageBorderExtractor ();
~RangeImageBorderExtractor () override;

// =====METHODS=====
/** \brief Provide a pointer to the range image
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/rops_estimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace pcl

/** \brief Virtual destructor. */

~ROPSEstimation ();
~ROPSEstimation () override;

/** \brief Allows to set the number of partition bins that is used for distribution matrix calculation.
* \param[in] number_of_bins number of partition bins
Expand Down
Loading