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

Modernize with clang-tidy from base subprojects [PCL-2731] #4560

Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
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'
Copy link
Member

@kunaltyagi kunaltyagi Feb 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the following:

WarningsAsErrors: '#same content as in checks, but for errors'

3 changes: 3 additions & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ if(NOT build)
return()
endif()

### ---[ Generate compile_commands.json for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(range_image_incs
include/pcl/range_image/bearing_angle_image.h
include/pcl/range_image/range_image.h
Expand Down
4 changes: 1 addition & 3 deletions common/src/feature_histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ pcl::FeatureHistogram::FeatureHistogram (std::size_t const number_of_bins,
}

pcl::FeatureHistogram::~FeatureHistogram ()
{

}
= default;

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

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

/////////////////////////////////////////////////////////////////////////
void
Expand Down
3 changes: 3 additions & 0 deletions geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ if(NOT build)
return()
endif()

### ---[ Generate compile_commands.json for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(incs
"include/pcl/${SUBSYS_NAME}/boost.h"
"include/pcl/${SUBSYS_NAME}/eigen.h"
Expand Down
3 changes: 3 additions & 0 deletions io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ if(NOT build)
return()
endif()

### ---[ Generate compile_commands.json for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(WITH_OPENNI2)
set(IMAGE_INCLUDES
include/pcl/io/image_metadata_wrapper.h
Expand Down
3 changes: 1 addition & 2 deletions io/src/ascii_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ pcl::ASCIIReader::ASCIIReader ()

//////////////////////////////////////////////////////////////////////////////
pcl::ASCIIReader::~ASCIIReader ()
{
}
= default;

//////////////////////////////////////////////////////////////////////////////
int
Expand Down
24 changes: 12 additions & 12 deletions io/src/ensenso_grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ pcl::EnsensoGrabber::grabSingleCloud (pcl::PointCloud<pcl::PointXYZ> &cloud) con
double timestamp;
std::vector<float> pointMap;
int width, height;
camera_[itmImages][itmRaw][itmLeft].getBinaryDataInfo (0, 0, 0, 0, 0, &timestamp); // Get raw image timestamp
camera_[itmImages][itmPointMap].getBinaryDataInfo (&width, &height, 0, 0, 0, 0);
camera_[itmImages][itmPointMap].getBinaryData (pointMap, 0);
camera_[itmImages][itmRaw][itmLeft].getBinaryDataInfo (nullptr, nullptr, nullptr, nullptr, nullptr, &timestamp); // Get raw image timestamp
camera_[itmImages][itmPointMap].getBinaryDataInfo (&width, &height, nullptr, nullptr, nullptr, nullptr);
camera_[itmImages][itmPointMap].getBinaryData (pointMap, nullptr);

// Copy point cloud and convert in meters
cloud.header.stamp = getPCLStamp (timestamp);
Expand Down Expand Up @@ -971,7 +971,7 @@ pcl::EnsensoGrabber::processGrabbing ()

NxLibCommand (cmdCapture).execute ();
double timestamp;
camera_[itmImages][itmRaw][itmLeft].getBinaryDataInfo (0, 0, 0, 0, 0, &timestamp);
camera_[itmImages][itmRaw][itmLeft].getBinaryDataInfo (nullptr, nullptr, nullptr, nullptr, nullptr, &timestamp);

// Gather images
if (num_slots<sig_cb_ensenso_images> () > 0 || num_slots<sig_cb_ensenso_point_cloud_images> () > 0)
Expand All @@ -995,29 +995,29 @@ pcl::EnsensoGrabber::processGrabbing ()

if (collected_pattern)
{
camera_[itmImages][itmWithOverlay][itmLeft].getBinaryDataInfo (&width, &height, &channels, &bpe, &isFlt, 0);
camera_[itmImages][itmWithOverlay][itmLeft].getBinaryDataInfo (&width, &height, &channels, &bpe, &isFlt, nullptr);
images->first.header.stamp = images->second.header.stamp = getPCLStamp (timestamp);
images->first.width = images->second.width = width;
images->first.height = images->second.height = height;
images->first.data.resize (width * height * sizeof(float));
images->second.data.resize (width * height * sizeof(float));
images->first.encoding = images->second.encoding = getOpenCVType (channels, bpe, isFlt);

camera_[itmImages][itmWithOverlay][itmLeft].getBinaryData (images->first.data.data (), images->first.data.size (), 0, 0);
camera_[itmImages][itmWithOverlay][itmRight].getBinaryData (images->second.data.data (), images->second.data.size (), 0, 0);
camera_[itmImages][itmWithOverlay][itmLeft].getBinaryData (images->first.data.data (), images->first.data.size (), nullptr, nullptr);
camera_[itmImages][itmWithOverlay][itmRight].getBinaryData (images->second.data.data (), images->second.data.size (), nullptr, nullptr);
}
else
{
camera_[itmImages][itmRaw][itmLeft].getBinaryDataInfo (&width, &height, &channels, &bpe, &isFlt, 0);
camera_[itmImages][itmRaw][itmLeft].getBinaryDataInfo (&width, &height, &channels, &bpe, &isFlt, nullptr);
images->first.header.stamp = images->second.header.stamp = getPCLStamp (timestamp);
images->first.width = images->second.width = width;
images->first.height = images->second.height = height;
images->first.data.resize (width * height * sizeof(float));
images->second.data.resize (width * height * sizeof(float));
images->first.encoding = images->second.encoding = getOpenCVType (channels, bpe, isFlt);

camera_[itmImages][itmRaw][itmLeft].getBinaryData (images->first.data.data (), images->first.data.size (), 0, 0);
camera_[itmImages][itmRaw][itmRight].getBinaryData (images->second.data.data (), images->second.data.size (), 0, 0);
camera_[itmImages][itmRaw][itmLeft].getBinaryData (images->first.data.data (), images->first.data.size (), nullptr, nullptr);
camera_[itmImages][itmRaw][itmRight].getBinaryData (images->second.data.data (), images->second.data.size (), nullptr, nullptr);
}
}

Expand All @@ -1033,8 +1033,8 @@ pcl::EnsensoGrabber::processGrabbing ()
// Get info about the computed point map and copy it into a std::vector
std::vector<float> pointMap;
int width, height;
camera_[itmImages][itmPointMap].getBinaryDataInfo (&width, &height, 0, 0, 0, 0);
camera_[itmImages][itmPointMap].getBinaryData (pointMap, 0);
camera_[itmImages][itmPointMap].getBinaryDataInfo (&width, &height, nullptr, nullptr, nullptr, nullptr);
camera_[itmImages][itmPointMap].getBinaryData (pointMap, nullptr);

// Copy point cloud and convert in meters
cloud->header.stamp = getPCLStamp (timestamp);
Expand Down
3 changes: 1 addition & 2 deletions io/src/io_exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ pcl::io::IOException::IOException (const std::string& function_name, const std::
}

pcl::io::IOException::~IOException () noexcept
{
}
= default;

pcl::io::IOException&
pcl::io::IOException::operator = (const IOException& exception)
Expand Down
9 changes: 2 additions & 7 deletions io/src/openni_camera/openni_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,7 @@ openni_wrapper::OpenNIDriver::DeviceContext::DeviceContext (const xn::NodeInfo&

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
openni_wrapper::OpenNIDriver::DeviceContext::DeviceContext (const DeviceContext& other)
: device_node (other.device_node)
, image_node (other.image_node)
, depth_node (other.depth_node)
, ir_node (other.ir_node)
, device (other.device)
{
}

= default;

#endif
3 changes: 1 addition & 2 deletions io/src/openni_camera/openni_exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ OpenNIException::OpenNIException (const std::string& function_name, const std::s
}

OpenNIException::~OpenNIException () noexcept
{
}
= default;

OpenNIException& OpenNIException::operator = (const OpenNIException& exception) noexcept
{
Expand Down
3 changes: 1 addition & 2 deletions io/src/openni_camera/openni_image_bayer_grbg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ openni_wrapper::ImageBayerGRBG::ImageBayerGRBG (pcl::shared_ptr<xn::ImageMetaDat

//////////////////////////////////////////////////////////////////////////////
openni_wrapper::ImageBayerGRBG::~ImageBayerGRBG () noexcept
{
}
= default;

//////////////////////////////////////////////////////////////////////////////
bool
Expand Down
3 changes: 1 addition & 2 deletions io/src/openni_camera/openni_image_rgb24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ ImageRGB24::ImageRGB24 (pcl::shared_ptr<xn::ImageMetaData> image_meta_data) noex
}

ImageRGB24::~ImageRGB24 () noexcept
{
}
= default;

void ImageRGB24::fillGrayscale (unsigned width, unsigned height, unsigned char* gray_buffer, unsigned gray_line_step) const
{
Expand Down
3 changes: 1 addition & 2 deletions io/src/openni_camera/openni_image_yuv_422.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ ImageYUV422::ImageYUV422 (pcl::shared_ptr<xn::ImageMetaData> image_meta_data) no
}

ImageYUV422::~ImageYUV422 () noexcept
{
}
= default;

bool ImageYUV422::isResizingSupported (unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const
{
Expand Down
3 changes: 1 addition & 2 deletions io/src/vlp_grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ pcl::VLPGrabber::VLPGrabber (const boost::asio::ip::address& ipAddress,

/////////////////////////////////////////////////////////////////////////////
pcl::VLPGrabber::~VLPGrabber () noexcept
{
}
= default;

/////////////////////////////////////////////////////////////////////////////
void
Expand Down
2 changes: 1 addition & 1 deletion io/tools/openni_pcd_recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ template <typename PointT>
class PCDBuffer
{
public:
PCDBuffer () {}
PCDBuffer () = default;

bool
pushBack (typename PointCloud<PointT>::ConstPtr); // thread-save wrapper for push_back() method of ciruclar_buffer
Expand Down
3 changes: 3 additions & 0 deletions kdtree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ if(NOT build)
return()
endif()

### ---[ Generate compile_commands.json for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(srcs
src/kdtree_flann.cpp
)
Expand Down
3 changes: 3 additions & 0 deletions ml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ if(NOT build)
return()
endif()

### ---[ Generate compile_commands.json for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(incs
"include/pcl/${SUBSYS_NAME}/branch_estimator.h"
"include/pcl/${SUBSYS_NAME}/feature_handler.h"
Expand Down
2 changes: 1 addition & 1 deletion ml/src/kmeans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pcl::Kmeans::Kmeans(unsigned int num_points, unsigned int num_dimensions)
{}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
pcl::Kmeans::~Kmeans() {}
pcl::Kmeans::~Kmeans() = default;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void
Expand Down
16 changes: 8 additions & 8 deletions ml/src/svm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ class QMatrix {
get_QD() const = 0;
virtual void
swap_index(int i, int j) const = 0;
virtual ~QMatrix() {}
virtual ~QMatrix() = default;
};

class Kernel : public QMatrix {

public:
Kernel(int l, svm_node* const* x, const svm_parameter& param);
~Kernel();
~Kernel() override;

static double
k_function(const svm_node* x, const svm_node* y, const svm_parameter& param);
Expand Down Expand Up @@ -520,9 +520,9 @@ Kernel::k_function(const svm_node* x, const svm_node* y, const svm_parameter& pa
class Solver {

public:
Solver(){};
Solver() = default;

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

struct SolutionInfo {
double obj;
Expand Down Expand Up @@ -1173,7 +1173,7 @@ Solver::calculate_rho()
class Solver_NU : public Solver {

public:
Solver_NU() {}
Solver_NU() = default;

void
Solve(int l,
Expand Down Expand Up @@ -1477,7 +1477,7 @@ class SVC_Q : public Kernel {
swap(QD[i], QD[j]);
}

~SVC_Q()
~SVC_Q() override
{
delete[] y;
delete cache;
Expand Down Expand Up @@ -1531,7 +1531,7 @@ class ONE_CLASS_Q : public Kernel {
swap(QD[i], QD[j]);
}

~ONE_CLASS_Q()
~ONE_CLASS_Q() override
{
delete cache;
delete[] QD;
Expand Down Expand Up @@ -1607,7 +1607,7 @@ class SVR_Q : public Kernel {
return QD;
}

~SVR_Q()
~SVR_Q() override
{
delete cache;
delete[] sign;
Expand Down
3 changes: 3 additions & 0 deletions octree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ if(NOT build)
return()
endif()

### ---[ Generate compile_commands.json for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(srcs
src/octree_inst.cpp
)
Expand Down
3 changes: 3 additions & 0 deletions sample_consensus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ if(NOT build)
return()
endif()

### ---[ Generate compile_commands.json for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(srcs
src/sac.cpp
src/sac_model_circle.cpp
Expand Down
3 changes: 3 additions & 0 deletions search/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ if(NOT build)
return()
endif()

### ---[ Generate compile_commands.json for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(srcs
src/search.cpp
src/kdtree.cpp
Expand Down