Merge remote-tracking branch 'origin/topic/vern/reaching-defs'

* origin/topic/vern/reaching-defs: (36 commits)
  added &is_assigned test case for variable rather than record field
  Speedup ReachingDefs logic by ~15%
  Simplify ReachingDefs::RDMap() accessor
  test for -uu correctly tracking $?, and not misled by conditional assignments
  &is_set => &is_assigned
  remove pending maybe-reconsider-this comment
  fixes for ?$ operator - always track it, and assume subrecords are initialized
  speedup (and more coherent memory management) for tracking RDs
  fixes for generating and evaluating RDs associate with ?$ expressions
  fix for failure to reduce InlineExpr's to CatchReturnStmt's
  inlining fix: propagate identifier attributes (such as &is_set)
  tidier memory management
  fix for an ancient bug - surprising that this hasn't caused problems previously
  Fix IntrusivePtr release leaks in reaching-def logic
  Change dynamic_cast in reaching-def logic to static_cast
  Adjust some reaching-def memory management
  Update a couple baselines for "xform" alternative
  Adjust various reaching-def move/reference semantics
  Change LambdaExpr::OuterIDs() accessor to return const-reference
  Simplify declaration of DefPointType enum
  ...
This commit is contained in:
Jon Siwek 2021-02-05 10:56:23 -08:00
commit 03f74958f3
48 changed files with 4636 additions and 1849 deletions

View file

@ -84,6 +84,18 @@ const InitStmt* Stmt::AsInitStmt() const
return (const InitStmt*) this;
}
const IfStmt* Stmt::AsIfStmt() const
{
CHECK_TAG(tag, STMT_IF, "Stmt::AsIfStmt", stmt_name)
return (const IfStmt*) this;
}
const WhileStmt* Stmt::AsWhileStmt() const
{
CHECK_TAG(tag, STMT_WHILE, "Stmt::AsWhileStmt", stmt_name)
return (const WhileStmt*) this;
}
const WhenStmt* Stmt::AsWhenStmt() const
{
CHECK_TAG(tag, STMT_WHEN, "Stmt::AsWhenStmt", stmt_name)
@ -102,6 +114,18 @@ const ExprStmt* Stmt::AsExprStmt() const
return (const ExprStmt*) this;
}
const PrintStmt* Stmt::AsPrintStmt() const
{
CHECK_TAG(tag, STMT_PRINT, "Stmt::AsPrintStmt", stmt_name)
return (const PrintStmt*) this;
}
const CatchReturnStmt* Stmt::AsCatchReturnStmt() const
{
CHECK_TAG(tag, STMT_CATCH_RETURN, "Stmt::AsCatchReturnStmt", stmt_name)
return (const CatchReturnStmt*) this;
}
const ReturnStmt* Stmt::AsReturnStmt() const
{
CHECK_TAG(tag, STMT_RETURN, "Stmt::AsReturnStmt", stmt_name)
@ -236,12 +260,8 @@ TraversalCode ExprListStmt::Traverse(TraversalCallback* cb) const
TraversalCode tc = cb->PreStmt(this);
HANDLE_TC_STMT_PRE(tc);
const ExprPList& e = l->Exprs();
for ( const auto& expr : e )
{
tc = expr->Traverse(cb);
HANDLE_TC_STMT_PRE(tc);
}
tc = l->Traverse(cb);
HANDLE_TC_STMT_PRE(tc);
tc = cb->PostStmt(this);
HANDLE_TC_STMT_POST(tc);
@ -402,7 +422,9 @@ void ExprStmt::StmtDescribe(ODesc* d) const
if ( d->IsReadable() && Tag() == STMT_IF )
d->Add("(");
e->Describe(d);
if ( e )
e->Describe(d);
if ( Tag() == STMT_IF || Tag() == STMT_SWITCH )
{