Skip to content

Commit 30124ee

Browse files
authored
clang-tidy: add modernize-make-unique and modernize-use-noexcept (#5618)
* Streamlined modernize clang-tidy checks * Fixed clang-tidy escapes * Reverted to explicit check list per review * Commented odd-looking use of this-> * Reverted explicit this-> per review * Reverted this-> qualifier, changed per review
1 parent 885c450 commit 30124ee

27 files changed

+173
-169
lines changed

.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Checks: >
66
google-readability-casting,
77
modernize-deprecated-headers,
88
modernize-loop-convert,
9+
modernize-make-unique,
910
modernize-redundant-void-arg,
1011
modernize-replace-random-shuffle,
1112
modernize-return-braced-init-list,
@@ -14,6 +15,7 @@ Checks: >
1415
modernize-use-emplace,
1516
modernize-use-equals-default,
1617
modernize-use-equals-delete,
18+
modernize-use-noexcept,
1719
modernize-use-nullptr,
1820
modernize-use-override,
1921
modernize-use-using,

common/include/pcl/exceptions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,25 @@ namespace pcl
7878
{}
7979

8080
const char*
81-
getFileName () const throw ()
81+
getFileName () const noexcept
8282
{
8383
return (file_name_);
8484
}
8585

8686
const char*
87-
getFunctionName () const throw ()
87+
getFunctionName () const noexcept
8888
{
8989
return (function_name_);
9090
}
9191

9292
unsigned
93-
getLineNumber () const throw ()
93+
getLineNumber () const noexcept
9494
{
9595
return (line_number_);
9696
}
9797

9898
const char*
99-
detailedMessage () const throw ()
99+
detailedMessage () const noexcept
100100
{
101101
return (what ());
102102
}

filters/include/pcl/filters/impl/grid_minimum.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pcl::GridMinimum<PointT>::applyFilterIndices (Indices &indices)
135135

136136
// Second pass: sort the index_vector vector using value representing target cell as index
137137
// in effect all points belonging to the same output cell will be next to each other
138-
std::sort (index_vector.begin (), index_vector.end (), std::less<point_index_idx> ());
138+
std::sort (index_vector.begin (), index_vector.end (), std::less<> ());
139139

140140
// Third pass: count output cells
141141
// we need to skip all the same, adjacenent idx values

filters/src/voxel_grid_label.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ pcl::VoxelGridLabel::applyFilter (PointCloud &output)
189189

190190
// Second pass: sort the index_vector vector using value representing target cell as index
191191
// in effect all points belonging to the same output cell will be next to each other
192-
std::sort (index_vector.begin (), index_vector.end (), std::less<cloud_point_index_idx> ());
192+
std::sort (index_vector.begin (), index_vector.end (), std::less<> ());
193193

194194
// Third pass: count output cells
195195
// we need to skip all the same, adjacenent idx values

io/include/pcl/io/io_exception.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ namespace pcl
7373
operator= (const IOException& exception);
7474

7575
const char*
76-
what () const throw () override;
76+
what () const noexcept override;
7777

7878
const std::string&
7979
getFunctionName () const;

io/include/pcl/io/openni_camera/openni_depth_image.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace openni_wrapper
7777
* \return the actual depth data of type xn::DepthMetaData.
7878
*/
7979
inline const xn::DepthMetaData&
80-
getDepthMetaData () const throw ();
80+
getDepthMetaData () const noexcept;
8181

8282
/** \brief fills a user given block of memory with the disparity values with additional nearest-neighbor down-scaling.
8383
* \param[in] width the width of the desired disparity image.
@@ -113,46 +113,46 @@ namespace openni_wrapper
113113
* \return baseline in meters
114114
*/
115115
inline float
116-
getBaseline () const throw ();
116+
getBaseline () const noexcept;
117117

118118
/** \brief method to access the focal length of the "stereo" frame that was used to retrieve the depth image.
119119
* \return focal length in pixels
120120
*/
121121
inline float
122-
getFocalLength () const throw ();
122+
getFocalLength () const noexcept;
123123

124124
/** \brief method to access the shadow value, that indicates pixels lying in shadow in the depth image.
125125
* \return shadow value
126126
*/
127127
inline XnUInt64
128-
getShadowValue () const throw ();
128+
getShadowValue () const noexcept;
129129

130130
/** \brief method to access the no-sample value, that indicates pixels where no disparity could be determined for the depth image.
131131
* \return no-sample value
132132
*/
133133
inline XnUInt64
134-
getNoSampleValue () const throw ();
134+
getNoSampleValue () const noexcept;
135135

136136
/** \return the width of the depth image */
137137
inline unsigned
138-
getWidth () const throw ();
138+
getWidth () const noexcept;
139139

140140
/** \return the height of the depth image */
141141
inline unsigned
142-
getHeight () const throw ();
142+
getHeight () const noexcept;
143143

144144
/** \return an ascending id for the depth frame
145145
* \attention not necessarily synchronized with other streams
146146
*/
147147
inline unsigned
148-
getFrameID () const throw ();
148+
getFrameID () const noexcept;
149149

150150
/** \return a ascending timestamp for the depth frame
151151
* \attention its not the system time, thus can not be used directly to synchronize different sensors.
152152
* But definitely synchronized with other streams
153153
*/
154154
inline unsigned long
155-
getTimeStamp () const throw ();
155+
getTimeStamp () const noexcept;
156156

157157
protected:
158158
pcl::shared_ptr<xn::DepthMetaData> depth_md_;
@@ -172,55 +172,55 @@ namespace openni_wrapper
172172
DepthImage::~DepthImage () noexcept = default;
173173

174174
const xn::DepthMetaData&
175-
DepthImage::getDepthMetaData () const throw ()
175+
DepthImage::getDepthMetaData () const noexcept
176176
{
177177
return *depth_md_;
178178
}
179179

180180
float
181-
DepthImage::getBaseline () const throw ()
181+
DepthImage::getBaseline () const noexcept
182182
{
183183
return baseline_;
184184
}
185185

186186
float
187-
DepthImage::getFocalLength () const throw ()
187+
DepthImage::getFocalLength () const noexcept
188188
{
189189
return focal_length_;
190190
}
191191

192192
XnUInt64
193-
DepthImage::getShadowValue () const throw ()
193+
DepthImage::getShadowValue () const noexcept
194194
{
195195
return shadow_value_;
196196
}
197197

198198
XnUInt64
199-
DepthImage::getNoSampleValue () const throw ()
199+
DepthImage::getNoSampleValue () const noexcept
200200
{
201201
return no_sample_value_;
202202
}
203203

204204
unsigned
205-
DepthImage::getWidth () const throw ()
205+
DepthImage::getWidth () const noexcept
206206
{
207207
return depth_md_->XRes ();
208208
}
209209

210210
unsigned
211-
DepthImage::getHeight () const throw ()
211+
DepthImage::getHeight () const noexcept
212212
{
213213
return depth_md_->YRes ();
214214
}
215215

216216
unsigned
217-
DepthImage::getFrameID () const throw ()
217+
DepthImage::getFrameID () const noexcept
218218
{
219219
return depth_md_->FrameID ();
220220
}
221221

222222
unsigned long
223-
DepthImage::getTimeStamp () const throw ()
223+
DepthImage::getTimeStamp () const noexcept
224224
{
225225
return static_cast<unsigned long> (depth_md_->Timestamp ());
226226
}

0 commit comments

Comments
 (0)