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

Fix performance-noexcept-swap clang-tidy warning #6931

Merged
merged 4 commits into from
Jun 7, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Checks: >
modernize-use-using,
performance-*,
-performance-noexcept-move-constructor,
-performance-noexcept-swap,
-performance-no-int-to-ptr,
-performance-enum-size,
-performance-avoid-endl,
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- NodeJS:
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
- Misc:
- FIXED: Fix performance-noexcept-swap clang-tidy warning. [#6931](https://github.com/Project-OSRM/osrm-backend/pull/6931)
- CHANGED: Use custom struct instead of std::pair in QueryHeap. [#6921](https://github.com/Project-OSRM/osrm-backend/pull/6921)
- CHANGED: Use std::string_view::starts_with instead of boost::starts_with. [#6918](https://github.com/Project-OSRM/osrm-backend/pull/6918)
- 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)
Expand Down
9 changes: 5 additions & 4 deletions include/util/deallocating_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class DeallocatingVectorIterator

template <typename ElementT> class DeallocatingVector;

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

template <typename ElementT> class DeallocatingVector
{
Expand Down Expand Up @@ -221,9 +221,10 @@ template <typename ElementT> class DeallocatingVector

~DeallocatingVector() { clear(); }

friend void swap<>(DeallocatingVector<ElementT> &lhs, DeallocatingVector<ElementT> &rhs);
friend void swap<>(DeallocatingVector<ElementT> &lhs,
DeallocatingVector<ElementT> &rhs) noexcept;

void swap(DeallocatingVector<ElementT> &other)
void swap(DeallocatingVector<ElementT> &other) noexcept
{
std::swap(current_size, other.current_size);
bucket_list.swap(other.bucket_list);
Expand Down Expand Up @@ -342,7 +343,7 @@ template <typename ElementT> class DeallocatingVector
}
};

template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs)
template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs) noexcept
{
lhs.swap(rhs);
}
Expand Down
4 changes: 2 additions & 2 deletions include/util/permutation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace osrm::util

namespace permutation_detail
{
template <typename T> static inline void swap(T &a, T &b) { std::swap(a, b); }
template <typename T> static inline void swap(T &a, T &b) noexcept { std::swap(a, b); }

static inline void swap(std::vector<bool>::reference a, std::vector<bool>::reference b)
static inline void swap(std::vector<bool>::reference a, std::vector<bool>::reference b) noexcept
{
std::vector<bool>::swap(a, b);
}
Expand Down
Loading