Changeset 35a2d47 for src/ControlStruct/ForExprMutator.cc
- Timestamp:
- Mar 13, 2019, 10:18:08 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 1ecee81, 501b08a
- Parents:
- d078afd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/ForExprMutator.cc
rd078afd r35a2d47 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Fri Aug 18 10:22:00 201713 // Update Count : 1 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 11 22:26:52 2019 13 // Update Count : 14 14 14 // 15 15 … … 21 21 22 22 namespace ControlStruct { 23 Statement * hoist( Statement *originalStmt, std::list<Statement *> &init ) {23 Statement * hoist( Statement * originalStmt, std::list<Statement *> & init ) { 24 24 // If no hoisting is needed, skip: 25 25 if ( 0 == init.size() ) { … … 29 29 // Create compound statement, move initializers outside, 30 30 // the resut of the original stays as is. 31 CompoundStmt * block = new CompoundStmt();32 std::list<Statement *> & stmts = block->get_kids();31 CompoundStmt * block = new CompoundStmt(); 32 std::list<Statement *> & stmts = block->get_kids(); 33 33 stmts.splice( stmts.end(), init ); 34 34 … … 38 38 } 39 39 40 Statement * ForExprMutator::postmutate( IfStmt *ifStmt ) {40 Statement * ForExprMutator::postmutate( IfStmt * ifStmt ) { 41 41 return hoist( ifStmt, ifStmt->initialization ); 42 42 } 43 Statement * ForExprMutator::postmutate( ForStmt *forStmt ) {43 Statement * ForExprMutator::postmutate( ForStmt * forStmt ) { 44 44 // hoist any initializer declarations to make them C89 (rather than C99) 45 45 return hoist( forStmt, forStmt->initialization ); 46 46 } 47 Statement * ForExprMutator::postmutate( WhileStmt *whileStmt ) {47 Statement * ForExprMutator::postmutate( WhileStmt * whileStmt ) { 48 48 return hoist( whileStmt, whileStmt->initialization ); 49 49 }
Note: See TracChangeset
for help on using the changeset viewer.