- File:
-
- 1 edited
-
src/ControlStruct/ForExprMutator.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/ForExprMutator.cc
r6d49ea3 rd180746 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : T hu Aug 17 15:32:46 201713 // Update Count : 1 111 // Last Modified By : Rob Schluntz 12 // Last Modified On : Tue Jul 14 12:14:44 2015 13 // Update Count : 10 14 14 // 15 15 … … 21 21 22 22 namespace ControlStruct { 23 Statement *ForExprMutator::postmutate( IfStmt *ifStmt ) {24 std::list<Statement *> &init = ifStmt->get_initialization();25 if ( init.size() == 0 ) {26 return ifStmt;27 } // if28 29 // create compound statement, move initializers outside, leave _for_ as-is30 CompoundStmt *block = new CompoundStmt( std::list< Label >() );31 std::list<Statement *> &stmts = block->get_kids();32 stmts.splice( stmts.end(), init );33 34 // add for to the new block35 stmts.push_back( ifStmt );36 return block;37 }38 39 23 Statement *ForExprMutator::postmutate( ForStmt *forStmt ) { 40 24 // hoist any initializer declarations to make them C89 (rather than C99) … … 47 31 CompoundStmt *block = new CompoundStmt( std::list< Label >() ); 48 32 std::list<Statement *> &stmts = block->get_kids(); 49 stmts.splice( stmts.end(), init ); 33 for ( std::list<Statement *>::iterator it = init.begin(); it != init.end(); ++it ) { 34 stmts.push_back( *it ); 35 } // for 50 36 51 37 // add for to the new block 52 38 stmts.push_back( forStmt ); 39 forStmt->set_initialization( std::list<Statement *>() ); 53 40 return block; 54 41 }
Note:
See TracChangeset
for help on using the changeset viewer.