Fix a bunch of -Wunqualified-std-cast-call warnings from clang 15

This commit is contained in:
Tim Wojtulewicz 2023-03-24 13:42:05 -07:00
parent 96bbb96b35
commit 7aa310ee50
13 changed files with 98 additions and 93 deletions

View file

@ -86,7 +86,7 @@ void Reporter::InitOptions()
auto k = wle.GetHashKey(); auto k = wle.GetHashKey();
auto index = wl_val->RecreateIndex(*k); auto index = wl_val->RecreateIndex(*k);
std::string key = index->Idx(0)->AsString()->CheckString(); std::string key = index->Idx(0)->AsString()->CheckString();
set->emplace(move(key)); set->emplace(std::move(key));
} }
}; };

View file

@ -237,14 +237,14 @@ struct val_converter
if ( disambiguate ) if ( disambiguate )
{ {
// Disambiguate from composite key w/ multiple vals. // Disambiguate from composite key w/ multiple vals.
composite_key.emplace_back(move(item)); composite_key.emplace_back(std::move(item));
indices = &composite_key; indices = &composite_key;
} }
} }
} }
else else
{ {
composite_key.emplace_back(move(item)); composite_key.emplace_back(std::move(item));
indices = &composite_key; indices = &composite_key;
} }
@ -255,7 +255,8 @@ struct val_converter
for ( size_t i = 0; i < indices->size(); ++i ) for ( size_t i = 0; i < indices->size(); ++i )
{ {
auto index_val = data_to_val(move((*indices)[i]), expected_index_types[i].get()); auto index_val = data_to_val(std::move((*indices)[i]),
expected_index_types[i].get());
if ( ! index_val ) if ( ! index_val )
return nullptr; return nullptr;
@ -292,14 +293,14 @@ struct val_converter
if ( disambiguate ) if ( disambiguate )
{ {
// Disambiguate from composite key w/ multiple vals. // Disambiguate from composite key w/ multiple vals.
composite_key.emplace_back(move(item.first)); composite_key.emplace_back(std::move(item.first));
indices = &composite_key; indices = &composite_key;
} }
} }
} }
else else
{ {
composite_key.emplace_back(move(item.first)); composite_key.emplace_back(std::move(item.first));
indices = &composite_key; indices = &composite_key;
} }
@ -310,7 +311,8 @@ struct val_converter
for ( size_t i = 0; i < indices->size(); ++i ) for ( size_t i = 0; i < indices->size(); ++i )
{ {
auto index_val = data_to_val(move((*indices)[i]), expected_index_types[i].get()); auto index_val = data_to_val(std::move((*indices)[i]),
expected_index_types[i].get());
if ( ! index_val ) if ( ! index_val )
return nullptr; return nullptr;
@ -318,7 +320,7 @@ struct val_converter
list_val->Append(std::move(index_val)); list_val->Append(std::move(index_val));
} }
auto value_val = data_to_val(move(item.second), tt->Yield().get()); auto value_val = data_to_val(std::move(item.second), tt->Yield().get());
if ( ! value_val ) if ( ! value_val )
return nullptr; return nullptr;
@ -338,7 +340,7 @@ struct val_converter
for ( auto& item : a ) for ( auto& item : a )
{ {
auto item_val = data_to_val(move(item), vt->Yield().get()); auto item_val = data_to_val(std::move(item), vt->Yield().get());
if ( ! item_val ) if ( ! item_val )
return nullptr; return nullptr;
@ -364,7 +366,7 @@ struct val_converter
unsigned int pos = 0; unsigned int pos = 0;
for ( auto& item : a ) for ( auto& item : a )
{ {
auto item_val = data_to_val(move(item), auto item_val = data_to_val(std::move(item),
pure ? lt->GetPureType().get() : types[pos].get()); pure ? lt->GetPureType().get() : types[pos].get());
pos++; pos++;
@ -441,7 +443,7 @@ struct val_converter
continue; continue;
} }
auto item_val = data_to_val(move(a[idx]), rt->GetFieldType(i).get()); auto item_val = data_to_val(std::move(a[idx]), rt->GetFieldType(i).get());
if ( ! item_val ) if ( ! item_val )
return nullptr; return nullptr;
@ -814,7 +816,7 @@ static bool data_type_check(const broker::data& d, Type* t)
ValPtr data_to_val(broker::data d, Type* type) ValPtr data_to_val(broker::data d, Type* type)
{ {
if ( type->Tag() == TYPE_ANY ) if ( type->Tag() == TYPE_ANY )
return make_data_val(move(d)); return make_data_val(std::move(d));
return visit(val_converter{type}, d); return visit(val_converter{type}, d);
} }
@ -936,18 +938,18 @@ broker::expected<broker::data> val_to_data(const Val* v)
if ( ! key_part ) if ( ! key_part )
return broker::ec::invalid_data; return broker::ec::invalid_data;
composite_key.emplace_back(move(*key_part)); composite_key.emplace_back(std::move(*key_part));
} }
broker::data key; broker::data key;
if ( composite_key.size() == 1 ) if ( composite_key.size() == 1 )
key = move(composite_key[0]); key = std::move(composite_key[0]);
else else
key = move(composite_key); key = std::move(composite_key);
if ( is_set ) if ( is_set )
get<broker::set>(rval).emplace(move(key)); get<broker::set>(rval).emplace(std::move(key));
else else
{ {
auto val = val_to_data(te.value->GetVal().get()); auto val = val_to_data(te.value->GetVal().get());
@ -955,7 +957,7 @@ broker::expected<broker::data> val_to_data(const Val* v)
if ( ! val ) if ( ! val )
return broker::ec::invalid_data; return broker::ec::invalid_data;
get<broker::table>(rval).emplace(move(key), move(*val)); get<broker::table>(rval).emplace(std::move(key), std::move(*val));
} }
} }
@ -979,7 +981,7 @@ broker::expected<broker::data> val_to_data(const Val* v)
if ( ! item ) if ( ! item )
return broker::ec::invalid_data; return broker::ec::invalid_data;
rval.emplace_back(move(*item)); rval.emplace_back(std::move(*item));
} }
return {std::move(rval)}; return {std::move(rval)};
@ -1004,7 +1006,7 @@ broker::expected<broker::data> val_to_data(const Val* v)
if ( ! item ) if ( ! item )
return broker::ec::invalid_data; return broker::ec::invalid_data;
rval.emplace_back(move(*item)); rval.emplace_back(std::move(*item));
} }
return {std::move(rval)}; return {std::move(rval)};
@ -1031,7 +1033,7 @@ broker::expected<broker::data> val_to_data(const Val* v)
if ( ! item ) if ( ! item )
return broker::ec::invalid_data; return broker::ec::invalid_data;
rval.emplace_back(move(*item)); rval.emplace_back(std::move(*item));
} }
return {std::move(rval)}; return {std::move(rval)};
@ -1067,7 +1069,7 @@ RecordValPtr make_data_val(Val* v)
auto data = val_to_data(v); auto data = val_to_data(v);
if ( data ) if ( data )
rval->Assign(0, make_intrusive<DataVal>(move(*data))); rval->Assign(0, make_intrusive<DataVal>(std::move(*data)));
else else
reporter->Warning("did not get a value from val_to_data"); reporter->Warning("did not get a value from val_to_data");
@ -1077,7 +1079,7 @@ RecordValPtr make_data_val(Val* v)
RecordValPtr make_data_val(broker::data d) RecordValPtr make_data_val(broker::data d)
{ {
auto rval = make_intrusive<RecordVal>(BifType::Record::Broker::Data); auto rval = make_intrusive<RecordVal>(BifType::Record::Broker::Data);
rval->Assign(0, make_intrusive<DataVal>(move(d))); rval->Assign(0, make_intrusive<DataVal>(std::move(d)));
return rval; return rval;
} }

View file

@ -534,7 +534,7 @@ void Manager::FlushPendingQueries()
while ( ! s.second->proxy.mailbox().empty() ) while ( ! s.second->proxy.mailbox().empty() )
{ {
auto response = s.second->proxy.receive(); auto response = s.second->proxy.receive();
ProcessStoreResponse(s.second, move(response)); ProcessStoreResponse(s.second, std::move(response));
} }
} }
} }
@ -653,7 +653,7 @@ bool Manager::PublishEvent(string topic, std::string name, broker::vector args)
DBG_LOG(DBG_BROKER, "Publishing event: %s", RenderEvent(topic, name, args).c_str()); DBG_LOG(DBG_BROKER, "Publishing event: %s", RenderEvent(topic, name, args).c_str());
broker::zeek::Event ev(std::move(name), std::move(args)); broker::zeek::Event ev(std::move(name), std::move(args));
bstate->endpoint.publish(move(topic), ev.move_data()); bstate->endpoint.publish(std::move(topic), ev.move_data());
++statistics.num_events_outgoing; ++statistics.num_events_outgoing;
return true; return true;
} }
@ -713,9 +713,9 @@ bool Manager::PublishIdentifier(std::string topic, std::string id)
return false; return false;
} }
broker::zeek::IdentifierUpdate msg(move(id), move(*data)); broker::zeek::IdentifierUpdate msg(std::move(id), std::move(*data));
DBG_LOG(DBG_BROKER, "Publishing id-update: %s", RenderMessage(topic, msg.as_data()).c_str()); DBG_LOG(DBG_BROKER, "Publishing id-update: %s", RenderMessage(topic, msg.as_data()).c_str());
bstate->endpoint.publish(move(topic), msg.move_data()); bstate->endpoint.publish(std::move(topic), msg.move_data());
++statistics.num_ids_outgoing; ++statistics.num_ids_outgoing;
return true; return true;
} }
@ -757,23 +757,23 @@ bool Manager::PublishLogCreate(EnumVal* stream, EnumVal* writer,
for ( auto i = 0; i < num_fields; ++i ) for ( auto i = 0; i < num_fields; ++i )
{ {
auto field_data = detail::threading_field_to_data(fields[i]); auto field_data = detail::threading_field_to_data(fields[i]);
fields_data.push_back(move(field_data)); fields_data.push_back(std::move(field_data));
} }
std::string topic = default_log_topic_prefix + stream_id; std::string topic = default_log_topic_prefix + stream_id;
auto bstream_id = broker::enum_value(move(stream_id)); auto bstream_id = broker::enum_value(std::move(stream_id));
auto bwriter_id = broker::enum_value(move(writer_id)); auto bwriter_id = broker::enum_value(std::move(writer_id));
broker::zeek::LogCreate msg(move(bstream_id), move(bwriter_id), move(writer_info), broker::zeek::LogCreate msg(std::move(bstream_id), std::move(bwriter_id),
move(fields_data)); std::move(writer_info), 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());
if ( peer.node != NoPeer.node ) if ( peer.node != NoPeer.node )
// Direct message. // Direct message.
bstate->endpoint.publish(peer, move(topic), msg.move_data()); bstate->endpoint.publish(peer, std::move(topic), msg.move_data());
else else
// Broadcast. // Broadcast.
bstate->endpoint.publish(move(topic), msg.move_data()); bstate->endpoint.publish(std::move(topic), msg.move_data());
return true; return true;
} }
@ -848,9 +848,10 @@ bool Manager::PublishLogWrite(EnumVal* stream, EnumVal* writer, string path, int
std::string topic = v->AsString()->CheckString(); std::string topic = v->AsString()->CheckString();
auto bstream_id = broker::enum_value(move(stream_id)); auto bstream_id = broker::enum_value(std::move(stream_id));
auto bwriter_id = broker::enum_value(move(writer_id)); auto bwriter_id = broker::enum_value(std::move(writer_id));
broker::zeek::LogWrite msg(move(bstream_id), move(bwriter_id), move(path), move(serial_data)); broker::zeek::LogWrite msg(std::move(bstream_id), std::move(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());
@ -942,7 +943,7 @@ bool Manager::AutoPublishEvent(string topic, Val* event)
DBG_LOG(DBG_BROKER, "Enabling auto-publishing of event %s to topic %s", handler->Name(), DBG_LOG(DBG_BROKER, "Enabling auto-publishing of event %s to topic %s", handler->Name(),
topic.c_str()); topic.c_str());
handler->AutoPublish(move(topic)); handler->AutoPublish(std::move(topic));
return true; return true;
} }
@ -1215,7 +1216,7 @@ void Manager::Process()
auto responses = s.second->proxy.receive(num_available); auto responses = s.second->proxy.receive(num_available);
for ( auto& r : responses ) for ( auto& r : responses )
ProcessStoreResponse(s.second, move(r)); ProcessStoreResponse(s.second, std::move(r));
} }
} }
@ -1875,7 +1876,7 @@ detail::StoreHandleVal* Manager::MakeMaster(const string& name, broker::backend
it->second = name + suffix; it->second = name + suffix;
} }
auto result = bstate->endpoint.attach_master(name, type, move(opts)); auto result = bstate->endpoint.attach_master(name, type, std::move(opts));
if ( ! result ) if ( ! result )
{ {
Error("Failed to attach master store %s:", to_string(result.error()).c_str()); Error("Failed to attach master store %s:", to_string(result.error()).c_str());

View file

@ -218,7 +218,7 @@ function Broker::__table_insert%(t: Broker::Data, key: any, val: any%): Broker::
try try
{ {
auto& prev = table.at(*k); auto& prev = table.at(*k);
auto rval = zeek::Broker::detail::make_data_val(move(prev)); auto rval = zeek::Broker::detail::make_data_val(std::move(prev));
prev = std::move(*v); prev = std::move(*v);
return rval; return rval;
} }
@ -248,7 +248,7 @@ function Broker::__table_remove%(t: Broker::Data, key: any%): Broker::Data
return zeek::make_intrusive<zeek::RecordVal>(zeek::BifType::Record::Broker::Data); return zeek::make_intrusive<zeek::RecordVal>(zeek::BifType::Record::Broker::Data);
else else
{ {
auto rval = zeek::Broker::detail::make_data_val(move(it->second)); auto rval = zeek::Broker::detail::make_data_val(std::move(it->second));
table.erase(it); table.erase(it);
return rval; return rval;
} }
@ -369,7 +369,7 @@ function Broker::__vector_replace%(v: Broker::Data, idx: count, d: any%): Broker
if ( idx >= vec.size() ) if ( idx >= vec.size() )
return zeek::make_intrusive<zeek::RecordVal>(zeek::BifType::Record::Broker::Data); return zeek::make_intrusive<zeek::RecordVal>(zeek::BifType::Record::Broker::Data);
auto rval = zeek::Broker::detail::make_data_val(move(vec[idx])); auto rval = zeek::Broker::detail::make_data_val(std::move(vec[idx]));
vec[idx] = std::move(*item); vec[idx] = std::move(*item);
return rval; return rval;
%} %}
@ -382,7 +382,7 @@ function Broker::__vector_remove%(v: Broker::Data, idx: count%): Broker::Data
if ( idx >= vec.size() ) if ( idx >= vec.size() )
return zeek::make_intrusive<zeek::RecordVal>(zeek::BifType::Record::Broker::Data); return zeek::make_intrusive<zeek::RecordVal>(zeek::BifType::Record::Broker::Data);
auto rval = zeek::Broker::detail::make_data_val(move(vec[idx])); auto rval = zeek::Broker::detail::make_data_val(std::move(vec[idx]));
vec.erase(vec.begin() + idx); vec.erase(vec.begin() + idx);
return rval; return rval;
%} %}

View file

@ -189,7 +189,7 @@ function Reporter::set_weird_sampling_whitelist%(weird_sampling_whitelist: strin
auto index = wl_val->RecreateIndex(*k); auto index = wl_val->RecreateIndex(*k);
string key = index->Idx(0)->AsString()->CheckString(); string key = index->Idx(0)->AsString()->CheckString();
whitelist_set.emplace(move(key)); whitelist_set.emplace(std::move(key));
} }
reporter->SetWeirdSamplingWhitelist(std::move(whitelist_set)); reporter->SetWeirdSamplingWhitelist(std::move(whitelist_set));
return zeek::val_mgr->True(); return zeek::val_mgr->True();
@ -225,7 +225,7 @@ function Reporter::set_weird_sampling_global_list%(weird_sampling_global_list: s
auto k = tble.GetHashKey(); auto k = tble.GetHashKey();
auto index = wl_val->RecreateIndex(*k); auto index = wl_val->RecreateIndex(*k);
string key = index->Idx(0)->AsString()->CheckString(); string key = index->Idx(0)->AsString()->CheckString();
global_list_set.emplace(move(key)); global_list_set.emplace(std::move(key));
} }
reporter->SetWeirdSamplingGlobalList(std::move(global_list_set)); reporter->SetWeirdSamplingGlobalList(std::move(global_list_set));
return zeek::val_mgr->True(); return zeek::val_mgr->True();

View file

@ -1352,7 +1352,7 @@ string CPPCompile::GenEnum(const TypePtr& t, const ValPtr& ev)
mapping_slot = num_ev_mappings++; mapping_slot = num_ev_mappings++;
string enum_name = et->Lookup(v); string enum_name = et->Lookup(v);
enum_names.emplace_back(pair(TypeOffset(t), move(enum_name))); enum_names.emplace_back(pair(TypeOffset(t), std::move(enum_name)));
if ( evm != enum_val_mappings.end() ) if ( evm != enum_val_mappings.end() )
{ {

View file

@ -46,9 +46,9 @@ CPPStmt::CPPStmt(const char* _name, const char* filename, int line_num)
} }
CPPLambdaFunc::CPPLambdaFunc(string _name, FuncTypePtr ft, CPPStmtPtr _l_body) CPPLambdaFunc::CPPLambdaFunc(string _name, FuncTypePtr ft, CPPStmtPtr _l_body)
: ScriptFunc(move(_name), move(ft), {_l_body}, {0}) : ScriptFunc(std::move(_name), std::move(ft), {_l_body}, {0})
{ {
l_body = move(_l_body); l_body = std::move(_l_body);
} }
broker::expected<broker::data> CPPLambdaFunc::SerializeCaptures() const broker::expected<broker::data> CPPLambdaFunc::SerializeCaptures() const
@ -67,13 +67,13 @@ broker::expected<broker::data> CPPLambdaFunc::SerializeCaptures() const
return broker::ec::invalid_data; return broker::ec::invalid_data;
TypeTag tag = val->GetType()->Tag(); TypeTag tag = val->GetType()->Tag();
broker::vector val_tuple{move(*expected), static_cast<broker::integer>(tag)}; broker::vector val_tuple{std::move(*expected), static_cast<broker::integer>(tag)};
body.emplace_back(move(val_tuple)); body.emplace_back(std::move(val_tuple));
} }
rval.emplace_back(move(body)); rval.emplace_back(std::move(body));
return {move(rval)}; return {std::move(rval)};
} }
void CPPLambdaFunc::SetCaptures(Frame* f) void CPPLambdaFunc::SetCaptures(Frame* f)

View file

@ -27,7 +27,7 @@ void CPP_InitsInfo::AddInstance(shared_ptr<CPP_InitInfo> g)
g->SetOffset(this, size++); g->SetOffset(this, size++);
instances[final_init_cohort].push_back(move(g)); instances[final_init_cohort].push_back(std::move(g));
} }
string CPP_InitsInfo::Declare() const string CPP_InitsInfo::Declare() const
@ -353,7 +353,7 @@ AttrsInfo::AttrsInfo(CPPCompile* _c, const AttributesPtr& _attrs) : CompoundItem
} }
GlobalInitInfo::GlobalInitInfo(CPPCompile* c, const ID* g, string _CPP_name) GlobalInitInfo::GlobalInitInfo(CPPCompile* c, const ID* g, string _CPP_name)
: CPP_InitInfo(g), CPP_name(move(_CPP_name)) : CPP_InitInfo(g), CPP_name(std::move(_CPP_name))
{ {
Zeek_name = g->Name(); Zeek_name = g->Name();
@ -392,7 +392,8 @@ void GlobalInitInfo::InitializerVals(std::vector<std::string>& ivs) const
} }
CallExprInitInfo::CallExprInitInfo(CPPCompile* c, ExprPtr _e, string _e_name, string _wrapper_class) CallExprInitInfo::CallExprInitInfo(CPPCompile* c, ExprPtr _e, string _e_name, string _wrapper_class)
: CPP_InitInfo(_e), e(move(_e)), e_name(move(_e_name)), wrapper_class(move(_wrapper_class)) : CPP_InitInfo(_e), e(std::move(_e)), e_name(std::move(_e_name)),
wrapper_class(std::move(_wrapper_class))
{ {
auto gi = c->RegisterType(e->GetType()); auto gi = c->RegisterType(e->GetType());
if ( gi ) if ( gi )
@ -402,7 +403,7 @@ CallExprInitInfo::CallExprInitInfo(CPPCompile* c, ExprPtr _e, string _e_name, st
LambdaRegistrationInfo::LambdaRegistrationInfo(CPPCompile* c, string _name, FuncTypePtr ft, LambdaRegistrationInfo::LambdaRegistrationInfo(CPPCompile* c, string _name, FuncTypePtr ft,
string _wrapper_class, p_hash_type _h, string _wrapper_class, p_hash_type _h,
bool _has_captures) bool _has_captures)
: CPP_InitInfo(ft), name(move(_name)), wrapper_class(move(_wrapper_class)), h(_h), : CPP_InitInfo(ft), name(std::move(_name)), wrapper_class(std::move(_wrapper_class)), h(_h),
has_captures(_has_captures) has_captures(_has_captures)
{ {
auto gi = c->RegisterType(ft); auto gi = c->RegisterType(ft);
@ -436,7 +437,7 @@ void OpaqueTypeInfo::AddInitializerVals(std::vector<std::string>& ivs) const
ivs.emplace_back(Fmt(c->TrackString(t->AsOpaqueType()->Name()))); ivs.emplace_back(Fmt(c->TrackString(t->AsOpaqueType()->Name())));
} }
TypeTypeInfo::TypeTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, move(_t)) TypeTypeInfo::TypeTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, std::move(_t))
{ {
tt = t->AsTypeType()->GetType(); tt = t->AsTypeType()->GetType();
auto gi = c->RegisterType(tt); auto gi = c->RegisterType(tt);
@ -449,7 +450,7 @@ void TypeTypeInfo::AddInitializerVals(std::vector<std::string>& ivs) const
ivs.emplace_back(to_string(c->TypeOffset(tt))); ivs.emplace_back(to_string(c->TypeOffset(tt)));
} }
VectorTypeInfo::VectorTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, move(_t)) VectorTypeInfo::VectorTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, std::move(_t))
{ {
yield = t->Yield(); yield = t->Yield();
auto gi = c->RegisterType(yield); auto gi = c->RegisterType(yield);
@ -463,7 +464,7 @@ void VectorTypeInfo::AddInitializerVals(std::vector<std::string>& ivs) const
} }
ListTypeInfo::ListTypeInfo(CPPCompile* _c, TypePtr _t) ListTypeInfo::ListTypeInfo(CPPCompile* _c, TypePtr _t)
: AbstractTypeInfo(_c, move(_t)), types(t->AsTypeList()->GetTypes()) : AbstractTypeInfo(_c, std::move(_t)), types(t->AsTypeList()->GetTypes())
{ {
// Note, we leave init_cohort at 0 because the skeleton of this type // Note, we leave init_cohort at 0 because the skeleton of this type
// is built in the first cohort. // is built in the first cohort.
@ -488,7 +489,7 @@ void ListTypeInfo::AddInitializerVals(std::vector<std::string>& ivs) const
} }
} }
TableTypeInfo::TableTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, move(_t)) TableTypeInfo::TableTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, std::move(_t))
{ {
// Note, we leave init_cohort at 0 because the skeleton of this type // Note, we leave init_cohort at 0 because the skeleton of this type
// is built in the first cohort. // is built in the first cohort.
@ -516,7 +517,7 @@ void TableTypeInfo::AddInitializerVals(std::vector<std::string>& ivs) const
ivs.emplace_back(Fmt(yield ? c->TypeOffset(yield) : -1)); ivs.emplace_back(Fmt(yield ? c->TypeOffset(yield) : -1));
} }
FuncTypeInfo::FuncTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, move(_t)) FuncTypeInfo::FuncTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, std::move(_t))
{ {
auto f = t->AsFuncType(); auto f = t->AsFuncType();
@ -543,7 +544,7 @@ void FuncTypeInfo::AddInitializerVals(std::vector<std::string>& ivs) const
ivs.emplace_back(Fmt(static_cast<int>(flavor))); ivs.emplace_back(Fmt(static_cast<int>(flavor)));
} }
RecordTypeInfo::RecordTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, move(_t)) RecordTypeInfo::RecordTypeInfo(CPPCompile* _c, TypePtr _t) : AbstractTypeInfo(_c, std::move(_t))
{ {
// Note, we leave init_cohort at 0 because the skeleton of this type // Note, we leave init_cohort at 0 because the skeleton of this type
// is built in the first cohort. // is built in the first cohort.

View file

@ -52,7 +52,7 @@ void register_type__CPP(TypePtr t, const string& name)
void register_body__CPP(CPPStmtPtr body, int priority, p_hash_type hash, vector<string> events, void register_body__CPP(CPPStmtPtr body, int priority, p_hash_type hash, vector<string> events,
void (*finish_init)()) void (*finish_init)())
{ {
compiled_scripts[hash] = {move(body), priority, move(events), finish_init}; compiled_scripts[hash] = {std::move(body), priority, std::move(events), finish_init};
} }
static unordered_map<p_hash_type, CompiledScript> compiled_standalone_scripts; static unordered_map<p_hash_type, CompiledScript> compiled_standalone_scripts;
@ -62,7 +62,7 @@ void register_standalone_body__CPP(CPPStmtPtr body, int priority, p_hash_type ha
{ {
// For standalone scripts we don't actually need finish_init, but // For standalone scripts we don't actually need finish_init, but
// we keep it for symmetry with compiled_scripts. // we keep it for symmetry with compiled_scripts.
compiled_standalone_scripts[hash] = {move(body), priority, move(events), finish_init}; compiled_standalone_scripts[hash] = {std::move(body), priority, std::move(events), finish_init};
} }
void register_lambda__CPP(CPPStmtPtr body, p_hash_type hash, const char* name, TypePtr t, void register_lambda__CPP(CPPStmtPtr body, p_hash_type hash, const char* name, TypePtr t,
@ -75,8 +75,8 @@ void register_lambda__CPP(CPPStmtPtr body, p_hash_type hash, const char* name, T
auto func = make_intrusive<CPPLambdaFunc>(name, ft, body); auto func = make_intrusive<CPPLambdaFunc>(name, ft, body);
func->SetName(name); func->SetName(name);
auto v = make_intrusive<FuncVal>(move(func)); auto v = make_intrusive<FuncVal>(std::move(func));
id->SetVal(move(v)); id->SetVal(std::move(v));
id->SetType(ft); id->SetType(ft);
// Lambdas used in initializing global functions need to // Lambdas used in initializing global functions need to
@ -118,7 +118,7 @@ void activate_bodies__CPP(const char* fn, const char* module, bool exported, Typ
vector<int> no_priorities; vector<int> no_priorities;
auto sf = make_intrusive<ScriptFunc>(fn, ft, no_bodies, no_priorities); auto sf = make_intrusive<ScriptFunc>(fn, ft, no_bodies, no_priorities);
v = make_intrusive<FuncVal>(move(sf)); v = make_intrusive<FuncVal>(std::move(sf));
fg->SetVal(v); fg->SetVal(v);
} }
@ -221,9 +221,10 @@ FuncValPtr lookup_func__CPP(string name, int num_bodies, vector<p_hash_type> has
} }
} }
auto sf = make_intrusive<ScriptFunc>(move(name), move(ft), move(bodies), move(priorities)); auto sf = make_intrusive<ScriptFunc>(std::move(name), std::move(ft), std::move(bodies),
std::move(priorities));
return make_intrusive<FuncVal>(move(sf)); return make_intrusive<FuncVal>(std::move(sf));
} }
IDPtr find_global__CPP(const char* g) IDPtr find_global__CPP(const char* g)
@ -259,7 +260,7 @@ EnumTypePtr get_enum_type__CPP(const string& enum_type_name)
EnumValPtr make_enum__CPP(TypePtr t, zeek_int_t i) EnumValPtr make_enum__CPP(TypePtr t, zeek_int_t i)
{ {
auto et = cast_intrusive<EnumType>(move(t)); auto et = cast_intrusive<EnumType>(std::move(t));
return make_intrusive<EnumVal>(et, i); return make_intrusive<EnumVal>(et, i);
} }

View file

@ -526,7 +526,7 @@ void CPP_GlobalInit::Generate(InitsManager* im, std::vector<void*>& /* inits_vec
auto sf = make_intrusive<ScriptFunc>(fn, ft, no_bodies, no_priorities); auto sf = make_intrusive<ScriptFunc>(fn, ft, no_bodies, no_priorities);
auto v = make_intrusive<FuncVal>(move(sf)); auto v = make_intrusive<FuncVal>(std::move(sf));
global->SetVal(v); global->SetVal(v);
} }
} }
@ -561,7 +561,7 @@ void generate_indices_set(int* inits, std::vector<std::vector<int>>& indices_set
indices.push_back(i_ptr[i]); indices.push_back(i_ptr[i]);
i_ptr += n; i_ptr += n;
indices_set.emplace_back(move(indices)); indices_set.emplace_back(std::move(indices));
} }
} }

View file

@ -43,7 +43,7 @@ ListValPtr index_val__CPP(vector<ValPtr> indices)
ValPtr index_table__CPP(const TableValPtr& t, vector<ValPtr> indices) ValPtr index_table__CPP(const TableValPtr& t, vector<ValPtr> indices)
{ {
auto v = t->FindOrDefault(index_val__CPP(move(indices))); auto v = t->FindOrDefault(index_val__CPP(std::move(indices)));
if ( ! v ) if ( ! v )
reporter->CPPRuntimeError("no such index"); reporter->CPPRuntimeError("no such index");
return v; return v;
@ -59,7 +59,7 @@ ValPtr index_vec__CPP(const VectorValPtr& vec, int index)
ValPtr index_string__CPP(const StringValPtr& svp, vector<ValPtr> indices) ValPtr index_string__CPP(const StringValPtr& svp, vector<ValPtr> indices)
{ {
return index_string(svp->AsString(), index_val__CPP(move(indices)).get()); return index_string(svp->AsString(), index_val__CPP(std::move(indices)).get());
} }
ValPtr when_index_table__CPP(const TableValPtr& t, vector<ValPtr> indices) ValPtr when_index_table__CPP(const TableValPtr& t, vector<ValPtr> indices)
@ -168,7 +168,7 @@ static void check_iterators__CPP(bool invalid)
template <typename T> ValPtr assign_to_index__CPP(T v1, ValPtr v2, ValPtr v3) template <typename T> ValPtr assign_to_index__CPP(T v1, ValPtr v2, ValPtr v3)
{ {
bool iterators_invalidated = false; bool iterators_invalidated = false;
auto err_msg = assign_to_index(move(v1), move(v2), v3, iterators_invalidated); auto err_msg = assign_to_index(std::move(v1), std::move(v2), v3, iterators_invalidated);
check_iterators__CPP(iterators_invalidated); check_iterators__CPP(iterators_invalidated);
@ -180,15 +180,15 @@ template <typename T> ValPtr assign_to_index__CPP(T v1, ValPtr v2, ValPtr v3)
ValPtr assign_to_index__CPP(TableValPtr v1, ValPtr v2, ValPtr v3) ValPtr assign_to_index__CPP(TableValPtr v1, ValPtr v2, ValPtr v3)
{ {
return assign_to_index__CPP<TableValPtr>(move(v1), move(v2), move(v3)); return assign_to_index__CPP<TableValPtr>(std::move(v1), std::move(v2), std::move(v3));
} }
ValPtr assign_to_index__CPP(VectorValPtr v1, ValPtr v2, ValPtr v3) ValPtr assign_to_index__CPP(VectorValPtr v1, ValPtr v2, ValPtr v3)
{ {
return assign_to_index__CPP<VectorValPtr>(move(v1), move(v2), move(v3)); return assign_to_index__CPP<VectorValPtr>(std::move(v1), std::move(v2), std::move(v3));
} }
ValPtr assign_to_index__CPP(StringValPtr v1, ValPtr v2, ValPtr v3) ValPtr assign_to_index__CPP(StringValPtr v1, ValPtr v2, ValPtr v3)
{ {
return assign_to_index__CPP<StringValPtr>(move(v1), move(v2), move(v3)); return assign_to_index__CPP<StringValPtr>(std::move(v1), std::move(v2), std::move(v3));
} }
void add_element__CPP(TableValPtr aggr, ListValPtr indices) void add_element__CPP(TableValPtr aggr, ListValPtr indices)
@ -225,17 +225,17 @@ static AttributesPtr build_attrs__CPP(vector<int> attr_tags, vector<ValPtr> attr
attrs.emplace_back(make_intrusive<Attr>(t_i, e)); attrs.emplace_back(make_intrusive<Attr>(t_i, e));
} }
return make_intrusive<Attributes>(move(attrs), nullptr, false, false); return make_intrusive<Attributes>(std::move(attrs), nullptr, false, false);
} }
TableValPtr set_constructor__CPP(vector<ValPtr> elements, TableTypePtr t, vector<int> attr_tags, TableValPtr set_constructor__CPP(vector<ValPtr> elements, TableTypePtr t, vector<int> attr_tags,
vector<ValPtr> attr_vals) vector<ValPtr> attr_vals)
{ {
auto attrs = build_attrs__CPP(move(attr_tags), move(attr_vals)); auto attrs = build_attrs__CPP(std::move(attr_tags), std::move(attr_vals));
auto aggr = make_intrusive<TableVal>(move(t), move(attrs)); auto aggr = make_intrusive<TableVal>(std::move(t), std::move(attrs));
for ( auto& elem : elements ) for ( auto& elem : elements )
aggr->Assign(move(elem), nullptr); aggr->Assign(std::move(elem), nullptr);
return aggr; return aggr;
} }
@ -246,14 +246,14 @@ TableValPtr table_constructor__CPP(vector<ValPtr> indices, vector<ValPtr> vals,
const auto& yt = t->Yield(); const auto& yt = t->Yield();
auto n = indices.size(); auto n = indices.size();
auto attrs = build_attrs__CPP(move(attr_tags), move(attr_vals)); auto attrs = build_attrs__CPP(std::move(attr_tags), std::move(attr_vals));
auto aggr = make_intrusive<TableVal>(move(t), move(attrs)); auto aggr = make_intrusive<TableVal>(std::move(t), std::move(attrs));
for ( auto i = 0u; i < n; ++i ) for ( auto i = 0u; i < n; ++i )
{ {
auto v = check_and_promote(vals[i], yt, true); auto v = check_and_promote(vals[i], yt, true);
if ( v ) if ( v )
aggr->Assign(move(indices[i]), move(v)); aggr->Assign(std::move(indices[i]), std::move(v));
} }
return aggr; return aggr;
@ -261,7 +261,7 @@ TableValPtr table_constructor__CPP(vector<ValPtr> indices, vector<ValPtr> vals,
void assign_attrs__CPP(IDPtr id, std::vector<int> attr_tags, std::vector<ValPtr> attr_vals) void assign_attrs__CPP(IDPtr id, std::vector<int> attr_tags, std::vector<ValPtr> attr_vals)
{ {
id->SetAttrs(build_attrs__CPP(move(attr_tags), move(attr_vals))); id->SetAttrs(build_attrs__CPP(std::move(attr_tags), std::move(attr_vals)));
} }
RecordValPtr record_constructor__CPP(vector<ValPtr> vals, RecordTypePtr t) RecordValPtr record_constructor__CPP(vector<ValPtr> vals, RecordTypePtr t)
@ -309,7 +309,7 @@ RecordValPtr record_constructor_map__CPP(vector<ValPtr> vals, vector<int> map, R
VectorValPtr vector_constructor__CPP(vector<ValPtr> vals, VectorTypePtr t) VectorValPtr vector_constructor__CPP(vector<ValPtr> vals, VectorTypePtr t)
{ {
auto vv = make_intrusive<VectorVal>(move(t)); auto vv = make_intrusive<VectorVal>(std::move(t));
auto n = vals.size(); auto n = vals.size();
for ( auto i = 0u; i < n; ++i ) for ( auto i = 0u; i < n; ++i )
@ -321,7 +321,7 @@ VectorValPtr vector_constructor__CPP(vector<ValPtr> vals, VectorTypePtr t)
ValPtr schedule__CPP(double dt, EventHandlerPtr event, vector<ValPtr> args) ValPtr schedule__CPP(double dt, EventHandlerPtr event, vector<ValPtr> args)
{ {
if ( ! run_state::terminating ) if ( ! run_state::terminating )
timer_mgr->Add(new ScheduleTimer(event, move(args), dt)); timer_mgr->Add(new ScheduleTimer(event, std::move(args), dt));
return nullptr; return nullptr;
} }

View file

@ -251,7 +251,7 @@ VectorValPtr vec_op_add__CPP(VectorValPtr v, int incr)
VectorValPtr vec_op_sub__CPP(VectorValPtr v, int i) VectorValPtr vec_op_sub__CPP(VectorValPtr v, int i)
{ {
return vec_op_add__CPP(move(v), -i); return vec_op_add__CPP(std::move(v), -i);
} }
// This function provides the core functionality. The arguments // This function provides the core functionality. The arguments
@ -381,7 +381,7 @@ VectorValPtr vector_select__CPP(const VectorValPtr& v1, VectorValPtr v2, VectorV
for ( unsigned int i = 0; i < n; ++i ) for ( unsigned int i = 0; i < n; ++i )
{ {
auto vr_i = v1->BoolAt(i) ? v2->ValAt(i) : v3->ValAt(i); auto vr_i = v1->BoolAt(i) ? v2->ValAt(i) : v3->ValAt(i);
v_result->Assign(i, move(vr_i)); v_result->Assign(i, std::move(vr_i));
} }
return v_result; return v_result;
@ -390,7 +390,7 @@ VectorValPtr vector_select__CPP(const VectorValPtr& v1, VectorValPtr v2, VectorV
VectorValPtr vector_coerce_to__CPP(const VectorValPtr& v, const TypePtr& targ) VectorValPtr vector_coerce_to__CPP(const VectorValPtr& v, const TypePtr& targ)
{ {
auto res_t = cast_intrusive<VectorType>(targ); auto res_t = cast_intrusive<VectorType>(targ);
auto v_result = make_intrusive<VectorVal>(move(res_t)); auto v_result = make_intrusive<VectorVal>(std::move(res_t));
auto n = v->Size(); auto n = v->Size();
auto yt = targ->Yield(); auto yt = targ->Yield();
auto ytag = yt->Tag(); auto ytag = yt->Tag();
@ -455,7 +455,7 @@ VectorValPtr vector_coerce_to__CPP(const VectorValPtr& v, const TypePtr& targ)
reporter->InternalError("bad vector type in vector_coerce_to__CPP"); reporter->InternalError("bad vector type in vector_coerce_to__CPP");
} }
v_result->Assign(i, move(r_i)); v_result->Assign(i, std::move(r_i));
} }
return v_result; return v_result;

View file

@ -104,7 +104,7 @@ bool CPPCompile::AddGlobal(const string& g, const char* suffix)
void CPPCompile::RegisterEvent(string ev_name) void CPPCompile::RegisterEvent(string ev_name)
{ {
body_events[body_name].emplace_back(move(ev_name)); body_events[body_name].emplace_back(std::move(ev_name));
} }
const string& CPPCompile::IDNameStr(const ID* id) const string& CPPCompile::IDNameStr(const ID* id)