Changeset 6c3744e for translator/ControlStruct/MLEMutator.cc
- Timestamp:
- Jan 19, 2015, 6:29:10 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:
- f7f6785
- Parents:
- 0b8cd722
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/ControlStruct/MLEMutator.cc
r0b8cd722 r6c3744e 12 12 } 13 13 14 CompoundStmt* MLEMutator::mutate( CompoundStmt *cmpndStmt) {14 CompoundStmt* MLEMutator::mutate( CompoundStmt *cmpndStmt ) { 15 15 bool labeledBlock = false; 16 16 if ( !((cmpndStmt->get_labels()).empty()) ) { … … 27 27 if ( next == kids.end() ) { 28 28 std::list<Label> ls; ls.push_back( get_breakLabel() ); 29 kids.push_back( new NullStmt( ls) );29 kids.push_back( new NullStmt( ls ) ); 30 30 } else 31 31 (*next)->get_labels().push_back( get_breakLabel() ); … … 88 88 std::list< Entry >::iterator check; 89 89 if ( ( check = std::find( enclosingLoops.begin(), enclosingLoops.end(), (*targetTable)[branchStmt->get_target()] ) ) == enclosingLoops.end() ) 90 // not in loop, checking if in switch/choose90 // not in loop, checking if in block 91 91 if ( (check = std::find( enclosingBlocks.begin(), enclosingBlocks.end(), (*targetTable)[branchStmt->get_target()] )) == enclosingBlocks.end() ) 92 92 // neither in loop nor in block, checking if in switch/choose … … 95 95 96 96 if ( enclosingLoops.back() == (*check) ) 97 return branchStmt; // exit the innermost loop (labels notnecessary)97 return branchStmt; // exit the innermost loop (labels unnecessary) 98 98 99 99 Label newLabel; … … 102 102 if ( check->get_breakExit() != "" ) 103 103 newLabel = check->get_breakExit(); 104 else { newLabel = generator->newLabel(); check->set_breakExit( newLabel ); } 104 else { 105 newLabel = generator->newLabel(); 106 check->set_breakExit( newLabel ); 107 } // if 105 108 break; 106 109 case BranchStmt::Continue: 107 110 if ( check->get_contExit() != "" ) 108 111 newLabel = check->get_contExit(); 109 else { newLabel = generator->newLabel(); check->set_contExit( newLabel ); } 112 else { 113 newLabel = generator->newLabel(); 114 check->set_contExit( newLabel ); 115 } // if 110 116 break; 111 117 default: 112 // shouldn't be here 113 return 0; 118 return 0; // shouldn't be here 114 119 } // switch 115 120 116 return new BranchStmt( std::list<Label>(), newLabel, BranchStmt::Goto );121 return new BranchStmt( std::list<Label>(), newLabel, BranchStmt::Goto ); 117 122 } 118 123 119 124 120 Statement *MLEMutator::mutate( SwitchStmt *switchStmt) {125 Statement *MLEMutator::mutate( SwitchStmt *switchStmt ) { 121 126 Label brkLabel = generator->newLabel(); 122 127 enclosingSwitches.push_back( Entry(switchStmt, "", brkLabel) ); … … 131 136 } 132 137 133 Statement *MLEMutator::mutate( ChooseStmt *switchStmt) {138 Statement *MLEMutator::mutate( ChooseStmt *switchStmt ) { 134 139 Label brkLabel = generator->newLabel(); 135 140 enclosingSwitches.push_back( Entry(switchStmt,"", brkLabel) );
Note: See TracChangeset
for help on using the changeset viewer.