Skip to content

Commit

Permalink
clang-tidy: add noexcept for move stuff
Browse files Browse the repository at this point in the history
Found with performance-noexcept-move-constructor
  • Loading branch information
neheb committed Jan 9, 2024
1 parent 6da6832 commit 7163379
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pdns/credentials.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ SensitiveData::SensitiveData(std::string&& data) :
#endif
}

SensitiveData& SensitiveData::operator=(SensitiveData&& rhs)
SensitiveData& SensitiveData::operator=(SensitiveData&& rhs) noexcept
{
d_data = std::move(rhs.d_data);
rhs.clear();
Expand Down
2 changes: 1 addition & 1 deletion pdns/credentials.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SensitiveData
public:
SensitiveData(size_t bytes);
SensitiveData(std::string&& data);
SensitiveData& operator=(SensitiveData&&);
SensitiveData& operator=(SensitiveData&&) noexcept;

~SensitiveData();
void clear();
Expand Down
2 changes: 1 addition & 1 deletion pdns/dnsname.hh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public:
}
return *this;
}
DNSName& operator=(DNSName&& rhs)
DNSName& operator=(DNSName&& rhs) noexcept
{
if (this != &rhs) {
d_storage = std::move(rhs.d_storage);
Expand Down
3 changes: 2 additions & 1 deletion pdns/dnsrecords.hh
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,8 @@ public:

return *this;
}
NSECBitmap(NSECBitmap&& rhs): d_bitset(std::move(rhs.d_bitset)), d_set(std::move(rhs.d_set))
NSECBitmap(NSECBitmap&& rhs) noexcept :
d_bitset(std::move(rhs.d_bitset)), d_set(std::move(rhs.d_set))
{
}
bool isSet(uint16_t type) const
Expand Down
3 changes: 2 additions & 1 deletion pdns/iputils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,8 @@ public:
}

//<! swaps the contents with another NetmaskTree
void swap(NetmaskTree& rhs) {
void swap(NetmaskTree& rhs) noexcept
{
std::swap(d_root, rhs.d_root);
std::swap(d_left, rhs.d_left);
std::swap(d_size, rhs.d_size);
Expand Down
6 changes: 4 additions & 2 deletions pdns/lock.hh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public:

ReadLock(const ReadLock& rhs) = delete;
ReadLock& operator=(const ReadLock& rhs) = delete;
ReadLock(ReadLock&& rhs) : d_lock(std::move(rhs.d_lock))
ReadLock(ReadLock&& rhs) noexcept :
d_lock(std::move(rhs.d_lock))
{
}

Expand All @@ -134,7 +135,8 @@ public:

WriteLock(const WriteLock& rhs) = delete;
WriteLock& operator=(const WriteLock& rhs) = delete;
WriteLock(WriteLock&& rhs) : d_lock(std::move(rhs.d_lock))
WriteLock(WriteLock&& rhs) noexcept :
d_lock(std::move(rhs.d_lock))
{
}

Expand Down
5 changes: 3 additions & 2 deletions pdns/sstuff.hh
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ public:
setCloseOnExec(d_socket);
}

Socket(Socket&& rhs): d_buffer(std::move(rhs.d_buffer)), d_socket(rhs.d_socket)
Socket(Socket&& rhs) noexcept :
d_buffer(std::move(rhs.d_buffer)), d_socket(rhs.d_socket)
{
rhs.d_socket = -1;
}

Socket& operator=(Socket&& rhs)
Socket& operator=(Socket&& rhs) noexcept
{
if (d_socket != -1) {
close(d_socket);
Expand Down

0 comments on commit 7163379

Please sign in to comment.