Changeset d9a0e76 for translator/ControlStruct/ForExprMutator.cc
- Timestamp:
- Dec 16, 2014, 9:41:50 PM (10 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:
- 17cd4eb
- Parents:
- 3848e0e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/ControlStruct/ForExprMutator.cc
r3848e0e rd9a0e76 4 4 5 5 namespace ControlStruct { 6 Statement* ForExprMutator::mutate(ForStmt *forStmt) 7 { 8 DeclStmt *decl; 9 if (( decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() )) != 0 ) 10 { 11 // create compound statement, move declaration outside, leave _for_ as-is 12 CompoundStmt *block = new CompoundStmt( std::list< Label >() ); 13 std::list<Statement *> &stmts = block->get_kids(); 6 Statement *ForExprMutator::mutate( ForStmt *forStmt ) { 7 DeclStmt *decl; 8 if (( decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() )) != 0 ) { 9 // create compound statement, move declaration outside, leave _for_ as-is 10 CompoundStmt *block = new CompoundStmt( std::list< Label >() ); 11 std::list<Statement *> &stmts = block->get_kids(); 14 12 15 stmts.push_back( decl );16 forStmt->set_initialization( 0 );17 stmts.push_back( forStmt );13 stmts.push_back( decl ); 14 forStmt->set_initialization( 0 ); 15 stmts.push_back( forStmt ); 18 16 19 return block; 20 } 21 // ForStmt still needs to be fixed 22 else 23 return forStmt; 24 } 25 17 return block; 18 } // if 19 // ForStmt still needs to be fixed 20 else 21 return forStmt; 22 } 26 23 } // namespace ControlStruct
Note: See TracChangeset
for help on using the changeset viewer.