Lint for performance-move-constructor-init

This checks when a move constructor for an object copy constructs its
member classes or parent classes. Copying unnecessary as all of the
members of the moved-from object can be clobbered by the move.
This commit is contained in:
JJ Marr 2024-09-23 09:00:08 -04:00 committed by Charles Dang
parent 259160e1e4
commit 15acd0c00a
3 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
---
Checks: '-*,bugprone-move-forwarding-reference,bugprone-use-after-move,cppcoreguidelines-rvalue-reference-param-not-moved,modernize-use-nullptr,performance-move-const-arg,performance-unnecessary-value-param'
Checks: '-*,bugprone-move-forwarding-reference,bugprone-use-after-move,cppcoreguidelines-rvalue-reference-param-not-moved,modernize-use-nullptr,performance-move-const-arg,performance-move-constructor-init,performance-unnecessary-value-param''
WarningsAsErrors: true
...

View File

@ -361,10 +361,10 @@ terrain_label::terrain_label(const map_labels& parent, const config& cfg)
terrain_label::terrain_label(terrain_label&& l)
: handle_(l.handle_)
, tooltip_handle_(l.tooltip_handle_)
, text_(l.text_)
, tooltip_(l.tooltip_)
, category_(l.category_)
, team_name_(l.team_name_)
, text_(std::move(l.text_))
, tooltip_(std::move(l.tooltip_))
, category_(std::move(l.category_))
, team_name_(std::move(l.team_name_))
, visible_in_fog_(l.visible_in_fog_)
, visible_in_shroud_(l.visible_in_shroud_)
, immutable_(l.immutable_)

View File

@ -1225,7 +1225,7 @@ attack_type::specials_context_t::~specials_context_t()
}
attack_type::specials_context_t::specials_context_t(attack_type::specials_context_t&& other)
: parent(other.parent)
: parent(std::move(other.parent))
{
other.was_moved = true;
}