Changeset 9bdb8b7
- Timestamp:
- Oct 25, 2019, 5:44:25 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- c3a2007
- Parents:
- 89124ff
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/MLEMutator.cc
r89124ff r9bdb8b7 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 8 17:08:25 201813 // Update Count : 2 1912 // Last Modified On : Tue Oct 22 17:22:44 2019 13 // Update Count : 220 14 14 // 15 15 … … 313 313 } 314 314 315 void MLEMutator::premutate( TryStmt * tryStmt ) { 316 // generate a label for breaking out of a labeled if 317 bool labeledBlock = !(tryStmt->get_labels().empty()); 318 if ( labeledBlock ) { 319 Label brkLabel = generator->newLabel("blockBreak", tryStmt); 320 enclosingControlStructures.push_back( Entry( tryStmt, brkLabel ) ); 321 GuardAction( [this]() { enclosingControlStructures.pop_back(); } ); 322 } // if 323 } 324 325 Statement * MLEMutator::postmutate( TryStmt * tryStmt ) { 326 bool labeledBlock = !(tryStmt->get_labels().empty()); 327 if ( labeledBlock ) { 328 if ( ! enclosingControlStructures.back().useBreakExit().empty() ) { 329 set_breakLabel( enclosingControlStructures.back().useBreakExit() ); 330 } // if 331 } // if 332 return tryStmt; 333 } 334 315 335 void MLEMutator::premutate( CaseStmt *caseStmt ) { 316 336 visit_children = false; -
src/ControlStruct/MLEMutator.h
r89124ff r9bdb8b7 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 8 16:42:32 201813 // Update Count : 4 112 // Last Modified On : Tue Oct 22 17:22:47 2019 13 // Update Count : 45 14 14 // 15 15 … … 47 47 void premutate( SwitchStmt *switchStmt ); 48 48 Statement * postmutate( SwitchStmt *switchStmt ); 49 void premutate( TryStmt *tryStmt ); 50 Statement * postmutate( TryStmt *tryStmt ); 49 51 50 52 Statement *mutateLoop( Statement *bodyLoop, Entry &e ); … … 73 75 explicit Entry( SwitchStmt *stmt, Label breakExit, Label fallDefaultExit ) : 74 76 stmt( stmt ), breakExit( breakExit ), fallDefaultExit( fallDefaultExit ) {} 77 78 explicit Entry( TryStmt *stmt, Label breakExit ) : 79 stmt( stmt ), breakExit( breakExit ) {} 75 80 76 81 bool operator==( const Statement *other ) { return stmt == other; } -
tests/labelledExit.cfa
r89124ff r9bdb8b7 10 10 // Created On : Wed Aug 10 07:29:39 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Nov 6 17:57:42 201813 // Update Count : 412 // Last Modified On : Fri Oct 25 17:41:51 2019 13 // Update Count : 7 14 14 // 15 15 … … 136 136 } 137 137 138 // all nested control options, labelled exits 139 140 Comp: { 141 Try: try { 142 For: for ( ;; ) { 143 While: while ( true ) { 144 Do: do { 145 If: if ( true ) { 146 Switch2: switch ( 3 ) { 147 case 3: 148 break Try; 149 break Comp; 150 break For; continue For; 151 break While; continue While; 152 break Do; continue Do; 153 break If; 154 break Switch2; 155 } // switch 156 } // if 157 } while ( true ); 158 } // while 159 } // for 160 } finally {} // always executed 161 } // compound 162 138 163 // computed goto 139 164 // {
Note: See TracChangeset
for help on using the changeset viewer.