mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fixup! shift much of the internal use of ID* identifier pointers over to IDPtr objects
This commit is contained in:
parent
7397dc6568
commit
a6f9d69c91
7 changed files with 12 additions and 12 deletions
|
@ -82,7 +82,7 @@ void CPPCompile::GenInitStmt(const InitStmt* init) {
|
|||
auto type_type = TypeType(t);
|
||||
auto type_ind = GenTypeName(t);
|
||||
|
||||
if ( ! locals.contains(aggr.get()) ) {
|
||||
if ( ! locals.contains(aggr) ) {
|
||||
// fprintf(stderr, "aggregate %s unused\n", obj_desc(aggr.get()).c_str());
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -2396,7 +2396,7 @@ bool LambdaExpr::IsReduced(Reducer* c) const {
|
|||
for ( auto& cp : *captures ) {
|
||||
auto& cid = cp.Id();
|
||||
|
||||
if ( ! private_captures.contains(cid.get()) && ! c->ID_IsReduced(cid) )
|
||||
if ( ! private_captures.contains(cid) && ! c->ID_IsReduced(cid) )
|
||||
return NonReduced(this);
|
||||
}
|
||||
|
||||
|
@ -2424,7 +2424,7 @@ void LambdaExpr::UpdateCaptures(Reducer* c) {
|
|||
for ( auto& cp : *captures ) {
|
||||
auto& cid = cp.Id();
|
||||
|
||||
if ( ! private_captures.contains(cid.get()) )
|
||||
if ( ! private_captures.contains(cid) )
|
||||
cp.SetID(c->UpdateID(cid));
|
||||
}
|
||||
|
||||
|
|
|
@ -420,7 +420,7 @@ ExprPtr Inliner::DoInline(ScriptFuncPtr sf, StmtPtr body, ListExprPtr args, Scop
|
|||
for ( int i = 0; i < nparam; ++i ) {
|
||||
auto& vi = vars[i];
|
||||
params.emplace_back(vi);
|
||||
param_is_modified.emplace_back((pf->Assignees().contains(vi.get())));
|
||||
param_is_modified.emplace_back((pf->Assignees().contains(vi)));
|
||||
}
|
||||
|
||||
// Recursively inline the body. This is safe to do because we've
|
||||
|
|
|
@ -330,7 +330,7 @@ StmtPtr Reducer::GenParam(const IDPtr& id, ExprPtr rhs, bool is_modified) {
|
|||
param->SetLocationInfo(rhs->GetLocationInfo());
|
||||
auto rhs_id = rhs->Tag() == EXPR_NAME ? rhs->AsNameExpr()->IdPtr() : nullptr;
|
||||
|
||||
if ( rhs_id && ! pf->Locals().contains(rhs_id.get()) && ! rhs_id->IsConst() )
|
||||
if ( rhs_id && ! pf->Locals().contains(rhs_id) && ! rhs_id->IsConst() )
|
||||
// It's hard to guarantee the RHS won't change during
|
||||
// the inline block's execution.
|
||||
is_modified = true;
|
||||
|
@ -832,20 +832,20 @@ IDPtr Reducer::GenLocal(const IDPtr& orig) {
|
|||
local_id->GetOptInfo()->SetTemp();
|
||||
|
||||
IDPtr prev;
|
||||
if ( orig_to_new_locals.count(orig) )
|
||||
if ( orig_to_new_locals.contains(orig) )
|
||||
prev = orig_to_new_locals[orig];
|
||||
|
||||
AddNewLocal(local_id);
|
||||
om.AddObj(orig.get());
|
||||
orig_to_new_locals[orig] = local_id;
|
||||
|
||||
if ( ! block_locals.empty() && ret_vars.count(orig) == 0 )
|
||||
if ( ! block_locals.empty() && ! ret_vars.contains(orig) )
|
||||
block_locals.back()[orig] = prev;
|
||||
|
||||
return local_id;
|
||||
}
|
||||
|
||||
bool Reducer::IsNewLocal(const IDPtr& id) const { return new_locals.count(id) != 0; }
|
||||
bool Reducer::IsNewLocal(const IDPtr& id) const { return new_locals.contains(id); }
|
||||
|
||||
std::shared_ptr<TempVar> Reducer::FindTemporary(const IDPtr& id) const {
|
||||
auto tmp = ids_to_temps.find(id);
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
bool IsNewLocal(const IDPtr& id) const;
|
||||
|
||||
bool IsTemporary(const IDPtr& id) const { return FindTemporary(id) != nullptr; }
|
||||
bool IsParamTemp(const IDPtr& id) const { return param_temps.count(id) > 0; }
|
||||
bool IsParamTemp(const IDPtr& id) const { return param_temps.contains(id); }
|
||||
|
||||
bool IsConstantVar(const IDPtr& id) const { return constant_vars.find(id) != constant_vars.end(); }
|
||||
|
||||
|
|
|
@ -1101,7 +1101,7 @@ bool WhenInfo::HasUnreducedIDs(Reducer* c) const {
|
|||
for ( auto& cp : *cl ) {
|
||||
const auto& cid = cp.Id();
|
||||
|
||||
if ( when_new_locals.count(cid) == 0 && ! c->ID_IsReduced(cp.Id()) )
|
||||
if ( ! when_new_locals.contains(cid) && ! c->ID_IsReduced(cp.Id()) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1115,7 +1115,7 @@ bool WhenInfo::HasUnreducedIDs(Reducer* c) const {
|
|||
void WhenInfo::UpdateIDs(Reducer* c) {
|
||||
for ( auto& cp : *cl ) {
|
||||
auto& cid = cp.Id();
|
||||
if ( when_new_locals.count(cid) == 0 )
|
||||
if ( ! when_new_locals.contains(cid) )
|
||||
cp.SetID(c->UpdateID(cid));
|
||||
}
|
||||
|
||||
|
|
|
@ -951,7 +951,7 @@ const ZAMStmt ZAMCompiler::BuildLambda(int n_slot, ExprPtr e) {
|
|||
for ( int i = 0; i < ncaptures; ++i ) {
|
||||
auto& id_i = (*captures)[i].Id();
|
||||
|
||||
if ( pf->WhenLocals().count(id_i) > 0 )
|
||||
if ( pf->WhenLocals().contains(id_i) )
|
||||
aux->Add(i, nullptr);
|
||||
else
|
||||
aux->Add(i, FrameSlot(id_i), id_i->GetType());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue