- 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)
- Location:
- src
- Files:
-
- 2 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 -
src/SymTab/Validate.cc
r6137fbb rbd7e609 153 153 void previsit( ObjectDecl * object ); 154 154 void previsit( FunctionDecl * func ); 155 void previsit( StructDecl * aggrDecl ); 156 void previsit( UnionDecl * aggrDecl ); 155 157 }; 156 158 … … 270 272 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist 271 273 VerifyCtorDtorAssign::verify( translationUnit ); // must happen before autogen, because autogen examines existing ctor/dtors 274 ReturnChecker::checkFunctionReturns( translationUnit ); 275 InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen 272 276 Concurrency::applyKeywords( translationUnit ); 277 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution 273 278 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay 274 279 Concurrency::implementMutexFuncs( translationUnit ); 275 280 Concurrency::implementThreadStarter( translationUnit ); 276 ReturnChecker::checkFunctionReturns( translationUnit );277 281 mutateAll( translationUnit, compoundliteral ); 278 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines279 282 ArrayLength::computeLength( translationUnit ); 280 acceptAll( translationUnit, finder ); 283 acceptAll( translationUnit, finder ); // xxx - remove this pass soon 281 284 mutateAll( translationUnit, labelAddrFixer ); 282 285 } … … 620 623 } 621 624 625 void ForallPointerDecay::previsit( StructDecl * aggrDecl ) { 626 forallFixer( aggrDecl->parameters, aggrDecl ); 627 } 628 629 void ForallPointerDecay::previsit( UnionDecl * aggrDecl ) { 630 forallFixer( aggrDecl->parameters, aggrDecl ); 631 } 632 622 633 void ReturnChecker::checkFunctionReturns( std::list< Declaration * > & translationUnit ) { 623 634 PassVisitor<ReturnChecker> checker;
Note: See TracChangeset
for help on using the changeset viewer.