mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
Tweak minor const-ref/std::move things in script-opt code
This commit is contained in:
parent
4b6369a333
commit
b66f4ad500
4 changed files with 9 additions and 9 deletions
|
@ -90,7 +90,7 @@ bool Reducer::ID_IsReduced(const ID* id) const
|
||||||
IsNewLocal(id);
|
IsNewLocal(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NameExprPtr Reducer::GenInlineBlockName(IDPtr id)
|
NameExprPtr Reducer::GenInlineBlockName(const IDPtr& id)
|
||||||
{
|
{
|
||||||
return make_intrusive<NameExpr>(GenLocal(id));
|
return make_intrusive<NameExpr>(GenLocal(id));
|
||||||
}
|
}
|
||||||
|
@ -1004,7 +1004,7 @@ bool CSE_ValidityChecker::CheckID(const std::vector<const ID*>& ids,
|
||||||
bool CSE_ValidityChecker::CheckAggrMod(const std::vector<const ID*>& ids,
|
bool CSE_ValidityChecker::CheckAggrMod(const std::vector<const ID*>& ids,
|
||||||
const Expr* e) const
|
const Expr* e) const
|
||||||
{
|
{
|
||||||
auto e_i_t = e->GetType();
|
const auto& e_i_t = e->GetType();
|
||||||
if ( IsAggr(e_i_t) )
|
if ( IsAggr(e_i_t) )
|
||||||
{
|
{
|
||||||
// This assignment sets an aggregate value.
|
// This assignment sets an aggregate value.
|
||||||
|
|
|
@ -20,8 +20,8 @@ public:
|
||||||
|
|
||||||
StmtPtr Reduce(StmtPtr s)
|
StmtPtr Reduce(StmtPtr s)
|
||||||
{
|
{
|
||||||
reduction_root = s;
|
reduction_root = std::move(s);
|
||||||
return s->Reduce(this);
|
return reduction_root->Reduce(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DefSetsMgr* GetDefSetsMgr() const { return mgr; }
|
const DefSetsMgr* GetDefSetsMgr() const { return mgr; }
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
|
|
||||||
// This is called *prior* to pushing a new inline block, in
|
// This is called *prior* to pushing a new inline block, in
|
||||||
// order to generate the equivalent of function parameters.
|
// order to generate the equivalent of function parameters.
|
||||||
NameExprPtr GenInlineBlockName(IDPtr id);
|
NameExprPtr GenInlineBlockName(const IDPtr& id);
|
||||||
|
|
||||||
int NumNewLocals() const { return new_locals.size(); }
|
int NumNewLocals() const { return new_locals.size(); }
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public:
|
||||||
// one (meant for calls in an Expr context) does not, to avoid
|
// one (meant for calls in an Expr context) does not, to avoid
|
||||||
// circularity.
|
// circularity.
|
||||||
ExprPtr OptExpr(Expr* e);
|
ExprPtr OptExpr(Expr* e);
|
||||||
ExprPtr OptExpr(ExprPtr e)
|
ExprPtr OptExpr(const ExprPtr& e)
|
||||||
{ return OptExpr(e.get()); }
|
{ return OptExpr(e.get()); }
|
||||||
|
|
||||||
// This one for expressions appearing in an Expr context.
|
// This one for expressions appearing in an Expr context.
|
||||||
|
|
|
@ -11,7 +11,7 @@ TempVar::TempVar(int num, const TypePtr& t, ExprPtr _rhs) : type(t)
|
||||||
char buf[8192];
|
char buf[8192];
|
||||||
snprintf(buf, sizeof buf, "#%d", num);
|
snprintf(buf, sizeof buf, "#%d", num);
|
||||||
name = buf;
|
name = buf;
|
||||||
rhs = _rhs;
|
rhs = std::move(_rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TempVar::SetAlias(IDPtr _alias, const DefPoints* _dps)
|
void TempVar::SetAlias(IDPtr _alias, const DefPoints* _dps)
|
||||||
|
@ -28,7 +28,7 @@ void TempVar::SetAlias(IDPtr _alias, const DefPoints* _dps)
|
||||||
if ( alias == id )
|
if ( alias == id )
|
||||||
reporter->InternalError("Creating alias loop");
|
reporter->InternalError("Creating alias loop");
|
||||||
|
|
||||||
alias = _alias;
|
alias = std::move(_alias);
|
||||||
dps = _dps;
|
dps = _dps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
void SetDPs(const DefPoints* _dps);
|
void SetDPs(const DefPoints* _dps);
|
||||||
|
|
||||||
const RDPtr& MaxRDs() const { return max_rds; }
|
const RDPtr& MaxRDs() const { return max_rds; }
|
||||||
void SetMaxRDs(RDPtr rds) { max_rds = rds; }
|
void SetMaxRDs(RDPtr rds) { max_rds = std::move(rds); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue