diff --git a/.clang-tidy b/.clang-tidy index 9c21b52cb8..6689d1d3e4 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -5,6 +5,7 @@ Checks: [-*, performance-faster-string-find, performance-for-range-copy, performance-inefficient-vector-operation, + performance-move-const-argument, # Skipping these temporarily because they are very noisy -bugprone-narrowing-conversions, diff --git a/src/Reassem.cc b/src/Reassem.cc index 9733f5a9a3..e4fdf7fd8c 100644 --- a/src/Reassem.cc +++ b/src/Reassem.cc @@ -52,7 +52,7 @@ void DataBlockList::Delete(DataBlockMap::const_iterator it) { } DataBlock DataBlockList::Remove(DataBlockMap::const_iterator it) { - auto b = std::move(it->second); + auto b = it->second; auto size = b.Size(); block_map.erase(it); diff --git a/src/Type.cc b/src/Type.cc index fcd2945168..b504dfe59f 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -2348,7 +2348,7 @@ TypePtr merge_record_types(const Type* t1, const Type* t2) { attrs3->AddAttrs(td2->attrs); attrs3->AddAttr(make_intrusive(detail::ATTR_OPTIONAL)); - auto td_merge = new TypeDecl(util::copy_string(td2->id), std::move(td2->type), attrs3); + auto td_merge = new TypeDecl(util::copy_string(td2->id), td2->type, attrs3); tdl3->push_back(td_merge); } } diff --git a/src/analyzer/protocol/ssl/SSL.cc b/src/analyzer/protocol/ssl/SSL.cc index d347465847..3e447b9415 100644 --- a/src/analyzer/protocol/ssl/SSL.cc +++ b/src/analyzer/protocol/ssl/SSL.cc @@ -131,7 +131,7 @@ void SSL_Analyzer::SetKeys(const zeek::StringVal& nkeys) { std::copy(nkeys.Bytes(), nkeys.Bytes() + nkeys.Len(), std::back_inserter(keys)); } -void SSL_Analyzer::SetKeys(const std::vector newkeys) { keys = std::move(newkeys); } +void SSL_Analyzer::SetKeys(std::vector newkeys) { keys = std::move(newkeys); } std::optional> SSL_Analyzer::TLS12_PRF(const std::string& secret, const std::string& label, const std::string& rnd1, const std::string& rnd2, diff --git a/src/analyzer/protocol/ssl/SSL.h b/src/analyzer/protocol/ssl/SSL.h index 4a08259fe9..b9ff0dbd2f 100644 --- a/src/analyzer/protocol/ssl/SSL.h +++ b/src/analyzer/protocol/ssl/SSL.h @@ -90,7 +90,7 @@ public: * @param keys The key buffer as derived via TLS PRF (for * AES_GCM this should be 72 bytes in length) */ - void SetKeys(const std::vector newkeys); + void SetKeys(std::vector newkeys); /** * Check if the connection is flipped--meaning that the TLS client is the responder of the diff --git a/src/broker/Data.cc b/src/broker/Data.cc index cadc86fdd2..5cfffd9cce 100644 --- a/src/broker/Data.cc +++ b/src/broker/Data.cc @@ -198,13 +198,13 @@ struct val_converter { if ( disambiguate ) { // Disambiguate from composite key w/ multiple vals. - composite_key.emplace_back(std::move(item)); + composite_key.emplace_back(item); indices = &composite_key; } } } else { - composite_key.emplace_back(std::move(item)); + composite_key.emplace_back(item); indices = &composite_key; } @@ -247,13 +247,13 @@ struct val_converter { if ( disambiguate ) { // Disambiguate from composite key w/ multiple vals. - composite_key.emplace_back(std::move(item.first)); + composite_key.emplace_back(item.first); indices = &composite_key; } } } else { - composite_key.emplace_back(std::move(item.first)); + composite_key.emplace_back(item.first); indices = &composite_key; } @@ -1036,7 +1036,7 @@ IMPLEMENT_OPAQUE_VALUE(zeek::Broker::detail::DataVal) std::optional DataVal::DoSerializeData() const { return BrokerData{data}; } bool DataVal::DoUnserializeData(BrokerDataView dv) { - data = std::move(*dv.value_); + data = *dv.value_; return true; } diff --git a/src/plugin/Manager.cc b/src/plugin/Manager.cc index 580359dbeb..59328b32a6 100644 --- a/src/plugin/Manager.cc +++ b/src/plugin/Manager.cc @@ -317,7 +317,7 @@ void Manager::ActivateDynamicPlugin(const std::string& name) { UpdateInputFiles(); else // Reschedule for another attempt later. - requested_plugins.insert(std::move(name)); + requested_plugins.insert(name); } void Manager::ActivateDynamicPlugins(bool all) { diff --git a/src/script_opt/IDOptInfo.cc b/src/script_opt/IDOptInfo.cc index b1fa228e13..ade8210a4d 100644 --- a/src/script_opt/IDOptInfo.cc +++ b/src/script_opt/IDOptInfo.cc @@ -127,7 +127,7 @@ void IDOptInfo::DefinedAfter(const Stmt* s, const ExprPtr& e, const std::vector< // This needs to come after filling out the confluence // blocks, since they'll create their own (earlier) regions. usage_regions.emplace_back(s, true, stmt_num); - usage_regions.back().SetDefExpr(std::move(e)); + usage_regions.back().SetDefExpr(e); if ( tracing ) DumpBlocks(); diff --git a/src/zeek-setup.cc b/src/zeek-setup.cc index 8f8d88228a..8e79f3a5a8 100644 --- a/src/zeek-setup.cc +++ b/src/zeek-setup.cc @@ -711,7 +711,7 @@ SetupResult setup(int argc, char** argv, Options* zopts) { plugin_mgr->ExtendZeekPathForPlugins(); for ( const auto& x : requested_plugins ) - plugin_mgr->ActivateDynamicPlugin(std::move(x)); + plugin_mgr->ActivateDynamicPlugin(x); plugin_mgr->ActivateDynamicPlugins(! options.bare_mode);