Changeset 6dfa2e1
- Timestamp:
- Dec 22, 2017, 1:49:14 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:
- 05a0ff2
- Parents:
- 9fe33947
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r9fe33947 r6dfa2e1 480 480 static UniqueName retNamer("_tmp_stmtexpr_ret"); 481 481 482 // create variable that will hold the result of the stmt expr483 482 result = result->clone(); 484 483 env->apply( result ); 484 if ( ! InitTweak::isConstructable( result ) ) { 485 delete result; 486 return; 487 } 488 489 // create variable that will hold the result of the stmt expr 485 490 ObjectDecl * ret = ObjectDecl::newObject( retNamer.newName(), result, nullptr ); 486 491 ret->type->set_const( false ); … … 611 616 // must have a non-empty body, otherwise it wouldn't have a result 612 617 assert( ! stmts.empty() ); 613 assertf( ! stmtExpr->get_returnDecls().empty(), "StmtExpr returns non-void, but no return decls: %s", toString( stmtExpr ).c_str() ); 614 stmts.push_back( new ExprStmt( new VariableExpr( stmtExpr->returnDecls.front() ) ) ); 618 assertf( ! stmtExpr->returnDecls.empty() || stmtExpr->dtors.empty(), "StmtExpr returns non-void, but no return decls: %s", toString( stmtExpr ).c_str() ); 619 // if there is a return decl, add a use as the last statement; will not have return decl on non-constructable returns 620 if ( ! stmtExpr->returnDecls.empty() ) { 621 stmts.push_back( new ExprStmt( new VariableExpr( stmtExpr->returnDecls.front() ) ) ); 622 } 615 623 stmtExpr->returnDecls.clear(); 616 624 stmtExpr->dtors.clear();
Note: See TracChangeset
for help on using the changeset viewer.