Changeset bd7e609 for src/InitTweak
- Timestamp:
- Oct 19, 2017, 11:13:11 AM (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:
- 189d800
- Parents:
- 6137fbb
- git-author:
- Rob Schluntz <rschlunt@…> (10/11/17 16:04:22)
- git-committer:
- Rob Schluntz <rschlunt@…> (10/19/17 11:13:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/GenInit.cc
r6137fbb rbd7e609 129 129 // hands off if the function returns a reference - we don't want to allocate a temporary if a variable's address 130 130 // is being returned 131 if ( returnStmt-> get_expr()&& returnVals.size() == 1 && isConstructable( returnVals.front()->get_type() ) ) {131 if ( returnStmt->expr && returnVals.size() == 1 && isConstructable( returnVals.front()->get_type() ) ) { 132 132 // explicitly construct the return value using the return expression and the retVal object 133 133 assertf( returnVals.front()->get_name() != "", "Function %s has unnamed return value\n", funcName.c_str() ); 134 134 135 stmtsToAddBefore.push_back( genCtorDtor( "?{}", dynamic_cast< ObjectDecl *>( returnVals.front() ), returnStmt->get_expr() ) ); 135 ObjectDecl * retVal = strict_dynamic_cast< ObjectDecl * >( returnVals.front() ); 136 if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( returnStmt->expr ) ) { 137 // return statement has already been mutated - don't need to do it again 138 if ( varExpr->var == retVal ) return; 139 } 140 stmtsToAddBefore.push_back( genCtorDtor( "?{}", retVal, returnStmt->get_expr() ) ); 136 141 137 142 // return the retVal object
Note: See TracChangeset
for help on using the changeset viewer.