Changeset 9fe33947
- Timestamp:
- Dec 22, 2017, 1:48:44 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 6dfa2e1
- Parents:
- 523232d
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r523232d r9fe33947 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FixInit. h--7 // FixInit.cc -- 8 8 // 9 9 // Author : Rob Schluntz … … 365 365 // arrays are not copy constructed, so this should always be an ExprStmt 366 366 ImplicitCtorDtorStmt * stmt = genCtorDtor( fname, var, cpArg ); 367 ExprStmt * exprStmt = strict_dynamic_cast< ExprStmt * >( stmt->get_callStmt() ); 367 assertf( stmt, "ResolveCopyCtors: genCtorDtor returned nullptr: %s / %s / %s", fname.c_str(), toString( var ).c_str(), toString( cpArg ).c_str() ); 368 ExprStmt * exprStmt = strict_dynamic_cast< ExprStmt * >( stmt->callStmt ); 368 369 Expression * resolved = exprStmt->expr; 369 370 exprStmt->expr = nullptr; // take ownership of expr … … 594 595 // to the outer context, rather than inside of the statement expression. 595 596 visit_children = false; 596 std::list< Statement * > & stmts = stmtExpr-> get_statements()->get_kids();597 std::list< Statement * > & stmts = stmtExpr->statements->get_kids(); 597 598 for ( Statement *& stmt : stmts ) { 598 599 stmt = stmt->acceptMutator( *visitor ); 599 600 } // for 600 assert( stmtExpr-> get_result());601 Type * result = stmtExpr-> get_result();601 assert( stmtExpr->result ); 602 Type * result = stmtExpr->result; 602 603 if ( ! result->isVoid() ) { 603 for ( ObjectDecl * obj : stmtExpr-> get_returnDecls()) {604 for ( ObjectDecl * obj : stmtExpr->returnDecls ) { 604 605 stmtsToAddBefore.push_back( new DeclStmt( obj ) ); 605 606 } // for 606 607 // add destructors after current statement 607 for ( Expression * dtor : stmtExpr-> get_dtors()) {608 for ( Expression * dtor : stmtExpr->dtors ) { 608 609 stmtsToAddAfter.push_back( new ExprStmt( dtor ) ); 609 610 } // for … … 611 612 assert( ! stmts.empty() ); 612 613 assertf( ! stmtExpr->get_returnDecls().empty(), "StmtExpr returns non-void, but no return decls: %s", toString( stmtExpr ).c_str() ); 613 stmts.push_back( new ExprStmt( new VariableExpr( stmtExpr-> get_returnDecls().front() ) ) );614 stmtExpr-> get_returnDecls().clear();615 stmtExpr-> get_dtors().clear();616 } 617 assert( stmtExpr-> get_returnDecls().empty() );618 assert( stmtExpr-> get_dtors().empty() );614 stmts.push_back( new ExprStmt( new VariableExpr( stmtExpr->returnDecls.front() ) ) ); 615 stmtExpr->returnDecls.clear(); 616 stmtExpr->dtors.clear(); 617 } 618 assert( stmtExpr->returnDecls.empty() ); 619 assert( stmtExpr->dtors.empty() ); 619 620 } 620 621 -
src/InitTweak/GenInit.cc
r523232d r9fe33947 135 135 if ( varExpr->var == retVal ) return; 136 136 } 137 stmtsToAddBefore.push_back( genCtorDtor( "?{}", retVal, returnStmt->get_expr() ) ); 137 Statement * stmt = genCtorDtor( "?{}", retVal, returnStmt->expr ); 138 assertf( stmt, "ReturnFixer: genCtorDtor returned nullptr: %s / %s", toString( retVal ).c_str(), toString( returnStmt->expr ).c_str() ); 139 stmtsToAddBefore.push_back( stmt ); 138 140 139 141 // return the retVal object -
src/SynTree/Expression.cc
r523232d r9fe33947 589 589 if ( ! body.empty() ) { 590 590 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) { 591 set_result( maybeClone( exprStmt->get_expr()->get_result() ));591 result = maybeClone( exprStmt->expr->result ); 592 592 } 593 593 } 594 594 // ensure that StmtExpr has a result type 595 595 if ( ! result ) { 596 set_result( new VoidType( Type::Qualifiers()) );596 result = new VoidType( Type::Qualifiers() ); 597 597 } 598 598 }
Note: See TracChangeset
for help on using the changeset viewer.