Skip to content

Commit

Permalink
Ran clang-tidy on optional modules (PointCloudLibrary#5318)
Browse files Browse the repository at this point in the history
* Ran clang-tidy on apps, apps_3d_rec_framework [PCL-5304]

* Ran clang-tidy on apps_cloud_composer through apps_point_cloud_editor

* Ran clang-tidy on benchmarks through global_tests

* Fixed issues flagged by clang-format [PCL-5304]

* Fixed remaining clang-format issue [PCL-5304]

* Added first set of optional modules to clang-tidy, and fixes

* Fixed clang-tidy issues from optional modules [PCL-5304]

* Added NOLINT to work around clang-tidy issue [PCL-5304]

* Omitted apps module to test effect on clang-tidy [PCL-5304]

* Enabled apps* modules for clang-tidy

* Switched to tidy non-apps* optional modules [PCL-5304]
  • Loading branch information
gnawme authored Jul 13, 2022
1 parent 31564ba commit 6a4d872
Show file tree
Hide file tree
Showing 89 changed files with 139 additions and 182 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ jobs:
- name: Run clang-tidy
run: |
bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_COMPILER=/usr/bin/clang-14 -DCMAKE_C_COMPILER=/usr/bin/clang-14 .
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_COMPILER=/usr/bin/clang-14 -DCMAKE_C_COMPILER=/usr/bin/clang-14 . \
-DBUILD_benchmarks=ON \
-DBUILD_examples=ON \
-DBUILD_simulation=ON \
-DBUILD_global_tests=ON
run-clang-tidy -header-filter='.*'
2 changes: 1 addition & 1 deletion 2d/include/pcl/2d/keypoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Keypoint {
Convolution<ImageType> conv_2d;

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

void
harrisCorner(ImageType& output,
Expand Down
2 changes: 1 addition & 1 deletion 2d/include/pcl/2d/morphology.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Morphology : public PCLBase<PointT> {
public:
using PCLBase<PointT>::input_;

Morphology() {}
Morphology() = default;

/** \brief This function performs erosion followed by dilation.
* It is useful for removing noise in the form of small blobs and patches.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CRHEstimation : public GlobalEstimator<PointInT, FeatureT> {
std::vector<CRHPointCloud::Ptr> crh_histograms_;

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

void
setFeatureEstimator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class SIFTSurfaceKeypointExtractor : public KeypointExtractor<PointInT> {
void
compute(PointInTPtr& keypoints)
{
if (normals_ == 0 || (normals_->size() != input_->size()))
if (normals_ == nullptr || (normals_->size() != input_->size()))
PCL_WARN("SIFTSurfaceKeypointExtractor -- Normals are not valid\n");

keypoints.reset(new pcl::PointCloud<PointInT>);
Expand Down Expand Up @@ -297,7 +297,7 @@ class HarrisKeypointExtractor : public KeypointExtractor<PointInT> {
{
keypoints.reset(new pcl::PointCloud<PointInT>);

if (normals_ == 0 || (normals_->size() != input_->size()))
if (normals_ == nullptr || (normals_->size() != input_->size()))
PCL_WARN("HarrisKeypointExtractor -- Normals are not valid\n");

typename pcl::PointCloud<pcl::PointXYZI>::Ptr intensity_keypoints(
Expand Down Expand Up @@ -327,7 +327,7 @@ class SUSANKeypointExtractor : public KeypointExtractor<PointInT> {
using KeypointExtractor<PointInT>::radius_;

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

bool
needNormals()
Expand All @@ -346,7 +346,7 @@ class SUSANKeypointExtractor : public KeypointExtractor<PointInT> {
{
keypoints.reset(new pcl::PointCloud<PointInT>);

if (normals_ == 0 || (normals_->size() != input_->size()))
if (normals_ == nullptr || (normals_->size() != input_->size()))
PCL_WARN("SUSANKeypointExtractor -- Normals are not valid\n");

typename pcl::PointCloud<pcl::PointXYZI>::Ptr intensity_keypoints(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class PCL_EXPORTS GlobalNNPipeline
public:
GlobalNNPipeline() { NN_ = 1; }

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

void
setNN(int nn) override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class PCL_EXPORTS GlobalNNCRHRecognizer {
do_CRH_ = true;
}

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

void
setNoise(float n)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class PCL_EXPORTS GlobalNNCVFHRecognizer {
use_single_categories_ = false;
}

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

void
getDescriptorDistances(std::vector<float>& ds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class PCL_EXPORTS LocalRecognitionPipeline {
threshold_accept_model_hypothesis_ = t;
}

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

void
setKdtreeSplits(int n)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class HelpWindow : public QDialog {

public:
explicit HelpWindow(QWidget* parent = nullptr);
~HelpWindow();
~HelpWindow() override;

private:
Ui::HelpWindow* ui;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class PCL_EXPORTS InHandScanner : public pcl::ihs::OpenGLViewer {
explicit InHandScanner(Base* parent = nullptr);

/** \brief Destructor. */
~InHandScanner();
~InHandScanner() override;

/** \brief Get the input data processing. */
inline InputDataProcessing&
Expand Down Expand Up @@ -224,16 +224,16 @@ public Q_SLOTS:
* documentation of calcFPS. */
class ComputationFPS : public Base::FPS {
public:
ComputationFPS() {}
~ComputationFPS() {}
ComputationFPS() = default;
~ComputationFPS() = default;
};

/** \brief Helper object for the visualization thread. Please have a look at the
* documentation of calcFPS. */
class VisualizationFPS : public Base::FPS {
public:
VisualizationFPS() {}
~VisualizationFPS() {}
VisualizationFPS() = default;
~VisualizationFPS() = default;
};

/** \brief Called when new data arries from the grabber. The grabbing - registration -
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MainWindow : public QMainWindow {
using RunningMode = InHandScanner::RunningMode;

explicit MainWindow(QWidget* parent = nullptr);
~MainWindow();
~MainWindow() override;

public Q_SLOTS:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class PCL_EXPORTS OfflineIntegration : public pcl::ihs::OpenGLViewer {
explicit OfflineIntegration(Base* parent = nullptr);

/** \brief Destructor. */
~OfflineIntegration();
~OfflineIntegration() override;

public Q_SLOTS:

Expand Down Expand Up @@ -126,16 +126,16 @@ private Q_SLOTS:
* documentation of calcFPS. */
class ComputationFPS : public Base::FPS {
public:
ComputationFPS() {}
~ComputationFPS() {}
ComputationFPS() = default;
~ComputationFPS() = default;
};

/** \brief Helper object for the visualization thread. Please have a look at the
* documentation of calcFPS. */
class VisualizationFPS : public Base::FPS {
public:
VisualizationFPS() {}
~VisualizationFPS() {}
VisualizationFPS() = default;
~VisualizationFPS() = default;
};

/** \brief Get a list of files with from a given directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class PCL_EXPORTS OpenGLViewer : public QGLWidget {
explicit OpenGLViewer(QWidget* parent = nullptr);

/** \brief Destructor. */
~OpenGLViewer();
~OpenGLViewer() override;

/** \brief Add a mesh to be drawn.
*
Expand Down Expand Up @@ -324,7 +324,7 @@ public Q_SLOTS:
}

protected:
~FPS() {}
~FPS() = default;

private:
double fps_;
Expand Down
2 changes: 1 addition & 1 deletion apps/in_hand_scanner/src/mesh_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

////////////////////////////////////////////////////////////////////////////////

pcl::ihs::MeshProcessing::MeshProcessing() {}
pcl::ihs::MeshProcessing::MeshProcessing() = default;

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion apps/include/pcl/apps/manual_registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ManualRegistration : public QMainWindow {

ManualRegistration();

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

void
setSrcCloud(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_src)
Expand Down
2 changes: 1 addition & 1 deletion apps/include/pcl/apps/openni_passthrough.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class OpenNIPassthrough : public QMainWindow {

OpenNIPassthrough(pcl::OpenNIGrabber& grabber);

~OpenNIPassthrough()
~OpenNIPassthrough() override
{
if (grabber_.isRunning())
grabber_.stop();
Expand Down
2 changes: 1 addition & 1 deletion apps/include/pcl/apps/organized_segmentation_demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class OrganizedSegmentationDemo : public QMainWindow {

OrganizedSegmentationDemo(pcl::Grabber& grabber);

~OrganizedSegmentationDemo()
~OrganizedSegmentationDemo() override
{
if (grabber_.isRunning())
grabber_.stop();
Expand Down
2 changes: 1 addition & 1 deletion apps/include/pcl/apps/pcd_video_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class PCDVideoPlayer : public QMainWindow {

PCDVideoPlayer();

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

protected:
void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class CloudEditorWidget : public QGLWidget
CloudEditorWidget (QWidget *parent = nullptr);

/// @brief Destructor
~CloudEditorWidget ();
~CloudEditorWidget () override;

/// @brief Attempts to load the point cloud designated by the passed file
/// name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CloudTransformTool : public ToolInterface
CloudTransformTool (CloudPtr cloud_ptr);

/// @brief Destructor
~CloudTransformTool ();
~CloudTransformTool () override;

/// @brief Initialize the current transform with mouse screen coordinates
/// and key modifiers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class Command
public:
/// @brief Destructor
virtual ~Command ()
{
}
= default;

protected:
/// Allows command queues to be the only objects which are able to execute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ class CommandQueue

/// @brief Destructor
~CommandQueue ()
{
}
= default;

/// @brief Executes a command. If the command has an undo function, then
/// adds the command to the queue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class CutCommand : public Command
operator= (const CutCommand&) = delete;

/// @brief Destructor
~CutCommand ();
~CutCommand () override;

protected:
/// @brief Moves the selected points to the copy buffer and removes them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DenoiseParameterForm : public QDialog
DenoiseParameterForm();

/// @brief Destructor
~DenoiseParameterForm ();
~DenoiseParameterForm () override;

/// @brief Returns the mean
inline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MainWindow : public QMainWindow
MainWindow (int argc, char **argv);

/// @brief Destructor
~MainWindow ();
~MainWindow () override;

/// @brief Increase the value of the spinbox by 1.
void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ class Select1DTool : public ToolInterface
Select1DTool (SelectionPtr selection_ptr, CloudPtr cloud_ptr);

/// @brief Destructor
~Select1DTool ()
{
}
~Select1DTool () override
= default;

/// @brief Does nothing for 1D selection.
/// @sa end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Select2DTool : public ToolInterface
Select2DTool (SelectionPtr selection_ptr, CloudPtr cloud_ptr);

/// @brief Destructor
~Select2DTool ();
~Select2DTool () override;

/// @brief Initializes the selection tool with the initial mouse screen
/// coordinates and key modifiers. The passed coordinates are used for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ class SelectionTransformTool : public ToolInterface
CommandQueuePtr command_queue_ptr);

/// @brief Destructor
~SelectionTransformTool ()
{
}
~SelectionTransformTool () override
= default;

/// @brief Initialize the transform tool with mouse screen coordinates
/// and key modifiers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class Statistics
public:
/// @brief Destructor
virtual ~Statistics ()
{
}
= default;

/// @brief Returns the strings of the statistics.
static
Expand All @@ -64,8 +63,7 @@ class Statistics
protected:
/// @brief The default constructor.
Statistics ()
{
}
= default;

/// @brief Copy Constructor
Statistics (const Statistics&)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class StatisticsDialog : public QDialog
/// @brief Default Constructor
StatisticsDialog(QWidget *parent = nullptr);
/// @brief Destructor
~StatisticsDialog ();
~StatisticsDialog () override;

public Q_SLOTS:
/// @brief update the dialog box.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class ToolInterface
public:
/// @brief Destructor.
virtual ~ToolInterface ()
{
}
= default;

/// @brief set the initial state of the tool from the screen coordinates
/// of the mouse as well as the value of the modifier.
Expand Down Expand Up @@ -102,8 +101,7 @@ class ToolInterface
protected:
/// @brief Default constructor
ToolInterface ()
{
}
= default;

private:
/// @brief Copy constructor - tools are non-copyable
Expand Down
Loading

0 comments on commit 6a4d872

Please sign in to comment.