Merge branch 'topic/vern/use-defs' of github.com:zeek/zeek into topic/vern/use-defs

This commit is contained in:
Vern Paxson 2021-02-10 19:09:28 -08:00
commit f82d443225
3 changed files with 7 additions and 7 deletions

View file

@ -108,7 +108,7 @@ public:
// Tells the reducer to replace the given statement during the // Tells the reducer to replace the given statement during the
// next reduction pass. // next reduction pass.
void AddStmtToReplace(const Stmt* s_old, StmtPtr s_new) void AddStmtToReplace(const Stmt* s_old, StmtPtr s_new)
{ replaced_stmts[s_old] = s_new; } { replaced_stmts[s_old] = std::move(s_new); }
// Tells the reducer that it can reclaim the storage associated // Tells the reducer that it can reclaim the storage associated
// with the omitted statements. // with the omitted statements.

View file

@ -194,7 +194,7 @@ UDs UseDefs::PropagateUDs(const Stmt* s, UDs succ_UDs,
case STMT_LIST: case STMT_LIST:
{ {
auto sl = s->AsStmtList(); auto sl = s->AsStmtList();
auto stmts = sl->Stmts(); const auto& stmts = sl->Stmts();
for ( int i = stmts.length(); --i >= 0; ) for ( int i = stmts.length(); --i >= 0; )
{ {
@ -219,8 +219,8 @@ UDs UseDefs::PropagateUDs(const Stmt* s, UDs succ_UDs,
case STMT_CATCH_RETURN: case STMT_CATCH_RETURN:
{ {
auto cr = s->AsCatchReturnStmt(); auto cr = s->AsCatchReturnStmt();
auto block = cr->Block(); auto block = cr->Block();
auto uds = PropagateUDs(block.get(), succ_UDs, succ_stmt, auto uds = PropagateUDs(block.get(), succ_UDs, succ_stmt,
second_pass); second_pass);
@ -396,7 +396,7 @@ UDs UseDefs::PropagateUDs(const Stmt* s, UDs succ_UDs,
successor2[body.get()] = succ_stmt; successor2[body.get()] = succ_stmt;
auto body_UDs = PropagateUDs(body.get(), succ_UDs, succ.get(), second_pass); auto body_UDs = PropagateUDs(body.get(), succ_UDs, succ.get(), second_pass);
auto cond = w->Condition(); const auto& cond = w->Condition();
auto w_UDs = UD_Union(ExprUDs(cond.get()), body_UDs); auto w_UDs = UD_Union(ExprUDs(cond.get()), body_UDs);
FoldInUDs(w_UDs, body_UDs); FoldInUDs(w_UDs, body_UDs);
@ -404,7 +404,7 @@ UDs UseDefs::PropagateUDs(const Stmt* s, UDs succ_UDs,
{ {
// Create a successor for the cond_stmt // Create a successor for the cond_stmt
// that has the correct UDs associated with it. // that has the correct UDs associated with it.
auto c_as_s = w->ConditionAsStmt(); const auto& c_as_s = w->ConditionAsStmt();
auto c_as_s_UDs = std::make_shared<UseDefSet>(w_UDs); auto c_as_s_UDs = std::make_shared<UseDefSet>(w_UDs);
CreateUDs(c_as_s.get(), c_as_s_UDs); CreateUDs(c_as_s.get(), c_as_s_UDs);

View file

@ -95,7 +95,7 @@ private:
UDs PropagateUDs(const StmtPtr& s, UDs succ_UDs, UDs PropagateUDs(const StmtPtr& s, UDs succ_UDs,
const StmtPtr& succ_stmt, bool second_pass) const StmtPtr& succ_stmt, bool second_pass)
{ {
return PropagateUDs(s.get(), succ_UDs, succ_stmt.get(), return PropagateUDs(s.get(), std::move(succ_UDs), succ_stmt.get(),
second_pass); second_pass);
} }
UDs PropagateUDs(const Stmt* s, UDs succ_UDs, UDs PropagateUDs(const Stmt* s, UDs succ_UDs,