removed use of unnecessary member variable accessors for StmtList methods

This commit is contained in:
Vern Paxson 2023-07-10 13:00:43 -07:00
parent 1b2cd0c767
commit fbdc5e3f29
2 changed files with 15 additions and 15 deletions

View file

@ -1677,7 +1677,7 @@ ValPtr StmtList::Exec(Frame* f, StmtFlowType& flow)
RegisterAccess();
flow = FLOW_NEXT;
for ( const auto& stmt_ptr : Stmts() )
for ( const auto& stmt_ptr : stmts )
{
auto stmt = stmt_ptr.get();
@ -1702,7 +1702,7 @@ ValPtr StmtList::Exec(Frame* f, StmtFlowType& flow)
bool StmtList::IsPure() const
{
for ( const auto& stmt : Stmts() )
for ( const auto& stmt : stmts )
if ( ! stmt->IsPure() )
return false;
return true;
@ -1727,7 +1727,7 @@ void StmtList::StmtDescribe(ODesc* d) const
d->NL();
}
for ( const auto& stmt : Stmts() )
for ( const auto& stmt : stmts )
{
stmt->Describe(d);
d->NL();
@ -1743,7 +1743,7 @@ TraversalCode StmtList::Traverse(TraversalCallback* cb) const
TraversalCode tc = cb->PreStmt(this);
HANDLE_TC_STMT_PRE(tc);
for ( const auto& stmt : Stmts() )
for ( const auto& stmt : stmts )
{
tc = stmt->Traverse(cb);
HANDLE_TC_STMT_PRE(tc);

View file

@ -699,25 +699,25 @@ StmtPtr StmtList::Duplicate()
{
auto new_sl = new StmtList();
for ( auto& stmt : Stmts() )
new_sl->Stmts().push_back(stmt->Duplicate());
for ( auto& stmt : stmts )
new_sl->stmts.push_back(stmt->Duplicate());
return SetSucc(new_sl);
}
void StmtList::Inline(Inliner* inl)
{
for ( const auto& stmt : Stmts() )
for ( const auto& stmt : stmts )
stmt->Inline(inl);
}
bool StmtList::IsReduced(Reducer* c) const
{
auto n = Stmts().size();
auto n = stmts.size();
for ( auto i = 0; i < n; ++i )
{
auto& s_i = Stmts()[i];
auto& s_i = stmts[i];
if ( ! s_i->IsReduced(c) )
return false;
@ -733,14 +733,14 @@ StmtPtr StmtList::DoReduce(Reducer* c)
std::vector<StmtPtr> f_stmts;
bool did_change = false;
auto n = Stmts().size();
auto n = stmts.size();
for ( auto i = 0; i < n; ++i )
{
if ( ReduceStmt(i, f_stmts, c) )
did_change = true;
if ( i < n - 1 && Stmts()[i]->NoFlowAfter(false) )
if ( i < n - 1 && stmts[i]->NoFlowAfter(false) )
{
did_change = true;
break;
@ -768,7 +768,7 @@ StmtPtr StmtList::DoReduce(Reducer* c)
bool StmtList::ReduceStmt(int& s_i, std::vector<StmtPtr>& f_stmts, Reducer* c)
{
bool did_change = false;
auto stmt = Stmts()[s_i];
auto stmt = stmts[s_i];
auto old_stmt = stmt;
stmt = stmt->Reduce(c);
@ -813,10 +813,10 @@ bool StmtList::ReduceStmt(int& s_i, std::vector<StmtPtr>& f_stmts, Reducer* c)
auto var = lhs->AsNameExpr();
auto rhs = a->GetOp2();
if ( s_i < Stmts().size() - 1 )
if ( s_i < stmts.size() - 1 )
{
// See if we can compress an assignment chain.
auto& s_i_succ = Stmts()[s_i + 1];
auto& s_i_succ = stmts[s_i + 1];
// Don't reduce s_i_succ. If it's what we're
// looking for, it's already reduced. Plus
@ -864,7 +864,7 @@ bool StmtList::ReduceStmt(int& s_i, std::vector<StmtPtr>& f_stmts, Reducer* c)
bool StmtList::NoFlowAfter(bool ignore_break) const
{
for ( auto& s : Stmts() )
for ( auto& s : stmts )
{
// For "break" statements, if ignore_break is set then
// by construction flow *does* go to after this statement