Skip to content

Commit c57b0d2

Browse files
Fix performance-noexcept-swap clang-tidy warning (#6931)
1 parent 523ee76 commit c57b0d2

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Checks: >
5959
modernize-use-using,
6060
performance-*,
6161
-performance-noexcept-move-constructor,
62-
-performance-noexcept-swap,
6362
-performance-no-int-to-ptr,
6463
-performance-enum-size,
6564
-performance-avoid-endl,

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- NodeJS:
2525
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
2626
- Misc:
27+
- FIXED: Fix performance-noexcept-swap clang-tidy warning. [#6931](https://github.com/Project-OSRM/osrm-backend/pull/6931)
2728
- CHANGED: Use custom struct instead of std::pair in QueryHeap. [#6921](https://github.com/Project-OSRM/osrm-backend/pull/6921)
2829
- CHANGED: Use std::string_view::starts_with instead of boost::starts_with. [#6918](https://github.com/Project-OSRM/osrm-backend/pull/6918)
2930
- CHANGED: Get rid of boost::math::constants::* and M_PI in favor of std::numbers. [#6916](https://github.com/Project-OSRM/osrm-backend/pull/6916)

include/util/deallocating_vector.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class DeallocatingVectorIterator
166166

167167
template <typename ElementT> class DeallocatingVector;
168168

169-
template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs);
169+
template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs) noexcept;
170170

171171
template <typename ElementT> class DeallocatingVector
172172
{
@@ -221,9 +221,10 @@ template <typename ElementT> class DeallocatingVector
221221

222222
~DeallocatingVector() { clear(); }
223223

224-
friend void swap<>(DeallocatingVector<ElementT> &lhs, DeallocatingVector<ElementT> &rhs);
224+
friend void swap<>(DeallocatingVector<ElementT> &lhs,
225+
DeallocatingVector<ElementT> &rhs) noexcept;
225226

226-
void swap(DeallocatingVector<ElementT> &other)
227+
void swap(DeallocatingVector<ElementT> &other) noexcept
227228
{
228229
std::swap(current_size, other.current_size);
229230
bucket_list.swap(other.bucket_list);
@@ -342,7 +343,7 @@ template <typename ElementT> class DeallocatingVector
342343
}
343344
};
344345

345-
template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs)
346+
template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs) noexcept
346347
{
347348
lhs.swap(rhs);
348349
}

include/util/permutation.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ namespace osrm::util
1010

1111
namespace permutation_detail
1212
{
13-
template <typename T> static inline void swap(T &a, T &b) { std::swap(a, b); }
13+
template <typename T> static inline void swap(T &a, T &b) noexcept { std::swap(a, b); }
1414

15-
static inline void swap(std::vector<bool>::reference a, std::vector<bool>::reference b)
15+
static inline void swap(std::vector<bool>::reference a, std::vector<bool>::reference b) noexcept
1616
{
1717
std::vector<bool>::swap(a, b);
1818
}

0 commit comments

Comments
 (0)