Changeset 724c2b6 for src/ControlStruct
- Timestamp:
- Jul 15, 2015, 4:47:48 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 1db21619
- Parents:
- 9163b9c (diff), 1ab4ce2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/ControlStruct
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/ForExprMutator.cc
r9163b9c r724c2b6 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 : Tue May 19 15:31:47201513 // Update Count : 211 // Last Modified By : Rob Schluntz 12 // Last Modified On : Tue Jul 14 12:14:44 2015 13 // Update Count : 10 14 14 // 15 15 … … 22 22 // recurse down all nest for loops to hoist any initializer declarations to make them C89 (rather than C99) 23 23 forStmt->set_body( forStmt->get_body()->acceptMutator( *this ) ); 24 if ( DeclStmt *decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() ) ) {25 // create compound statement, move initializer declaration outside, leave _for_ as-is26 CompoundStmt *block = new CompoundStmt( std::list< Label >() );27 std::list<Statement *> &stmts = block->get_kids();28 24 29 stmts.push_back( decl ); 30 forStmt->set_initialization( 0 ); 31 stmts.push_back( forStmt ); 25 std::list<Statement *> &init = forStmt->get_initialization(); 26 if ( init.size() == 0 ) { 27 return forStmt; 28 } // if 32 29 33 return block; 34 } // if 30 // create compound statement, move initializers outside, leave _for_ as-is 31 CompoundStmt *block = new CompoundStmt( std::list< Label >() ); 32 std::list<Statement *> &stmts = block->get_kids(); 33 for ( std::list<Statement *>::iterator it = init.begin(); it != init.end(); ++it ) { 34 stmts.push_back( *it ); 35 } // for 36 37 // add for to the new block 38 stmts.push_back( forStmt ); 39 forStmt->set_initialization( std::list<Statement *>() ); 40 return block; 35 41 36 42 return forStmt; -
src/ControlStruct/Mutate.cc
r9163b9c r724c2b6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Ju n 03 23:08:43201513 // Update Count : 512 // Last Modified On : Wed Jul 15 14:50:04 2015 13 // Update Count : 7 14 14 // 15 15 … … 36 36 namespace ControlStruct { 37 37 void mutate( std::list< Declaration * > translationUnit ) { 38 // ForExprMutator formut; 38 // hoist initialization out of for statements 39 ForExprMutator formut; 39 40 40 41 // normalizes label definitions and generates multi-level … … 51 52 // LabelTypeChecker lbl; 52 53 53 //mutateAll( translationUnit, formut );54 mutateAll( translationUnit, formut ); 54 55 acceptAll( translationUnit, lfix ); 55 56 mutateAll( translationUnit, chmut );
Note: See TracChangeset
for help on using the changeset viewer.