mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Clang-tidy fixes for recent IDPtr changes
This commit is contained in:
parent
e3b22cd21f
commit
26ea7cc655
18 changed files with 50 additions and 51 deletions
|
@ -30,7 +30,7 @@ void CPPCompile::DeclareLambda(const LambdaExpr* l, const ProfileFunc* pf) {
|
|||
auto l_id = l->Ingredients()->GetID();
|
||||
auto& ids = l->OuterIDs();
|
||||
|
||||
for ( auto lid : ids ) {
|
||||
for ( const auto& lid : ids ) {
|
||||
if ( lambda_names.contains(lid) ) {
|
||||
ASSERT(lambda_names[lid] == CaptureName(lid));
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ void CPPCompile::BuildLambda(const FuncTypePtr& ft, const ProfileFunc* pf, const
|
|||
Emit("void SetLambdaCaptures(Frame* f) override");
|
||||
StartBlock();
|
||||
for ( size_t i = 0; i < nl; ++i ) {
|
||||
auto l_i = (*lambda_ids)[i];
|
||||
const auto& l_i = (*lambda_ids)[i];
|
||||
const auto& t_i = l_i->GetType();
|
||||
auto cap_i = string("f->GetElement(") + Fmt(static_cast<int>(i)) + ")";
|
||||
Emit("%s = %s;", lambda_names[l_i], GenericValPtrToGT(cap_i, t_i, GEN_NATIVE));
|
||||
|
@ -239,7 +239,7 @@ void CPPCompile::BuildLambda(const FuncTypePtr& ft, const ProfileFunc* pf, const
|
|||
StartBlock();
|
||||
Emit("std::vector<ValPtr> vals;");
|
||||
for ( size_t i = 0; i < nl; ++i ) {
|
||||
auto l_i = (*lambda_ids)[i];
|
||||
const auto& l_i = (*lambda_ids)[i];
|
||||
const auto& t_i = l_i->GetType();
|
||||
Emit("vals.emplace_back(%s);", NativeToGT(lambda_names[l_i], t_i, GEN_VAL_PTR));
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ void CPPCompile::DeclareLocals(const ProfileFunc* pf, const IDPList* lambda_ids)
|
|||
// latter can be inconsistent when inlining.
|
||||
set<string> capture_names;
|
||||
if ( lambda_ids )
|
||||
for ( auto li : *lambda_ids )
|
||||
for ( const auto& li : *lambda_ids )
|
||||
capture_names.insert(CaptureName(li));
|
||||
|
||||
const auto& ls = pf->Locals();
|
||||
|
|
|
@ -178,7 +178,7 @@ void CPPCompile::GenTypeSwitchStmt(const Expr* e, const case_list* cases) {
|
|||
for ( const auto& c : *cases ) {
|
||||
auto tc = c->TypeCases();
|
||||
if ( tc )
|
||||
for ( auto id : *tc )
|
||||
for ( const auto& id : *tc )
|
||||
Emit(Fmt(TypeOffset(id->GetType())) + ",");
|
||||
}
|
||||
EndBlock(true);
|
||||
|
@ -206,7 +206,7 @@ void CPPCompile::GenTypeSwitchStmt(const Expr* e, const case_list* cases) {
|
|||
auto tc = c->TypeCases();
|
||||
if ( tc ) {
|
||||
bool is_multi = tc->size() > 1;
|
||||
for ( auto id : *tc )
|
||||
for ( const auto& id : *tc )
|
||||
GenTypeSwitchCase(id, case_offset++, is_multi);
|
||||
}
|
||||
else
|
||||
|
@ -432,7 +432,7 @@ void CPPCompile::GenForOverTable(const ExprPtr& tbl, const IDPtr& value_var, con
|
|||
|
||||
int n = static_cast<int>(loop_vars->size());
|
||||
for ( int i = 0; i < n; ++i ) {
|
||||
auto var = (*loop_vars)[i];
|
||||
const auto& var = (*loop_vars)[i];
|
||||
if ( var->IsBlank() )
|
||||
continue;
|
||||
|
||||
|
@ -454,7 +454,7 @@ void CPPCompile::GenForOverVector(const ExprPtr& vec, const IDPtr& value_var, co
|
|||
|
||||
Emit("if ( ! vv__CPP->Has(i__CPP) ) continue;");
|
||||
|
||||
auto lv0 = (*loop_vars)[0];
|
||||
const auto& lv0 = (*loop_vars)[0];
|
||||
|
||||
if ( ! lv0->IsBlank() )
|
||||
Emit("%s = i__CPP;", IDName(lv0));
|
||||
|
@ -475,7 +475,7 @@ void CPPCompile::GenForOverString(const ExprPtr& str, const IDPList* loop_vars)
|
|||
|
||||
Emit("auto sv__CPP = make_intrusive<StringVal>(1, (const char*) sval__CPP->Bytes() + i__CPP);");
|
||||
|
||||
auto lv0 = (*loop_vars)[0];
|
||||
const auto& lv0 = (*loop_vars)[0];
|
||||
if ( ! lv0->IsBlank() )
|
||||
Emit("%s = std::move(sv__CPP);", IDName(lv0));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue