Fix clang-tidy performance-move-const-argument warnings (passing move to const argument)

This commit is contained in:
Tim Wojtulewicz 2025-04-25 15:13:22 -07:00
parent ad4694f529
commit 57c10a6ace
3 changed files with 5 additions and 7 deletions

View file

@ -1417,7 +1417,7 @@ void HTTP_Analyzer::HTTP_Upgrade() {
analyzer_tag_val->GetType<EnumType>()->Lookup(analyzer_tag_val->AsEnum()), analyzer_tag_val->GetType<EnumType>()->Lookup(analyzer_tag_val->AsEnum()),
upgrade_protocol_val->CheckString()); upgrade_protocol_val->CheckString());
auto analyzer_tag = analyzer_mgr->GetComponentTag(analyzer_tag_val.get()); auto analyzer_tag = analyzer_mgr->GetComponentTag(analyzer_tag_val.get());
auto* analyzer = analyzer_mgr->InstantiateAnalyzer(std::move(analyzer_tag), Conn()); auto* analyzer = analyzer_mgr->InstantiateAnalyzer(analyzer_tag, Conn());
if ( analyzer ) { if ( analyzer ) {
AddChildAnalyzer(analyzer); AddChildAnalyzer(analyzer);

View file

@ -741,7 +741,7 @@ std::optional<broker::data> val_to_data(const Val* v) {
s.Prefix().CopyIPv6(&tmp); s.Prefix().CopyIPv6(&tmp);
auto a = broker::address(reinterpret_cast<const uint32_t*>(&tmp), broker::address::family::ipv6, auto a = broker::address(reinterpret_cast<const uint32_t*>(&tmp), broker::address::family::ipv6,
broker::address::byte_order::network); broker::address::byte_order::network);
return {broker::subnet(std::move(a), s.Length())}; return {broker::subnet(a, s.Length())};
} break; } break;
case TYPE_DOUBLE: return {v->AsDouble()}; case TYPE_DOUBLE: return {v->AsDouble()};
case TYPE_TIME: { case TYPE_TIME: {

View file

@ -954,8 +954,7 @@ bool Manager::PublishLogCreate(EnumVal* stream, EnumVal* writer, const logging::
std::string topic = default_log_topic_prefix + stream_id; std::string topic = default_log_topic_prefix + stream_id;
auto bstream_id = broker::enum_value(stream_id); auto bstream_id = broker::enum_value(stream_id);
auto bwriter_id = broker::enum_value(writer_id); auto bwriter_id = broker::enum_value(writer_id);
broker::zeek::LogCreate msg(std::move(bstream_id), std::move(bwriter_id), std::move(writer_info), broker::zeek::LogCreate msg(bstream_id, bwriter_id, writer_info, fields_data);
std::move(fields_data));
DBG_LOG(DBG_BROKER, "Publishing log creation: %s", RenderMessage(topic, msg.as_data()).c_str()); DBG_LOG(DBG_BROKER, "Publishing log creation: %s", RenderMessage(topic, msg.as_data()).c_str());
@ -1031,7 +1030,7 @@ bool Manager::PublishLogWrite(EnumVal* stream, EnumVal* writer, const string& pa
auto bstream_id = broker::enum_value(stream_id); auto bstream_id = broker::enum_value(stream_id);
auto bwriter_id = broker::enum_value(writer_id); auto bwriter_id = broker::enum_value(writer_id);
broker::zeek::LogWrite msg(std::move(bstream_id), std::move(bwriter_id), std::move(path), std::move(serial_data)); broker::zeek::LogWrite msg(bstream_id, bwriter_id, std::move(path), std::move(serial_data));
DBG_LOG(DBG_BROKER, "Buffering log record: %s", RenderMessage(topic, msg.as_data()).c_str()); DBG_LOG(DBG_BROKER, "Buffering log record: %s", RenderMessage(topic, msg.as_data()).c_str());
@ -1302,8 +1301,7 @@ void Manager::ProcessMessages() {
// message. Since `topic` still points into the original memory // message. Since `topic` still points into the original memory
// region, we may no longer access it after this point. // region, we may no longer access it after this point.
auto topic_str = broker::get_topic_str(message); auto topic_str = broker::get_topic_str(message);
broker::zeek::visit_as_message([this, topic_str](auto& msg) { ProcessMessage(topic_str, msg); }, broker::zeek::visit_as_message([this, topic_str](auto& msg) { ProcessMessage(topic_str, msg); }, message);
std::move(message));
} catch ( std::runtime_error& e ) { } catch ( std::runtime_error& e ) {
reporter->Warning("ignoring invalid Broker message: %s", +e.what()); reporter->Warning("ignoring invalid Broker message: %s", +e.what());
continue; continue;