Changes in src/ControlStruct/LabelFixer.cc [1fbeebd:d180746]
- File:
-
- 1 edited
-
src/ControlStruct/LabelFixer.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/LabelFixer.cc
r1fbeebd rd180746 37 37 } 38 38 39 void LabelFixer:: previsit( FunctionDecl *) {39 void LabelFixer::visit( FunctionDecl *functionDecl ) { 40 40 // need to go into a nested function in a fresh state 41 GuardValue( labelTable );41 std::map < Label, Entry *> oldLabelTable = labelTable; 42 42 labelTable.clear(); 43 }44 43 45 void LabelFixer::postvisit( FunctionDecl * functionDecl ) { 44 maybeAccept( functionDecl->get_statements(), *this ); 45 46 46 MLEMutator mlemut( resolveJumps(), generator ); 47 47 functionDecl->acceptMutator( mlemut ); 48 49 // and remember the outer function's labels when 50 // returning to it 51 labelTable = oldLabelTable; 48 52 } 49 53 50 54 // prune to at most one label definition for each statement 51 void LabelFixer:: previsit( Statement *stmt ) {55 void LabelFixer::visit( Statement *stmt ) { 52 56 std::list< Label > &labels = stmt->get_labels(); 53 57 … … 58 62 } 59 63 60 void LabelFixer:: previsit( BranchStmt *branchStmt ) {61 previsit( ( Statement *)branchStmt );64 void LabelFixer::visit( BranchStmt *branchStmt ) { 65 visit ( ( Statement * )branchStmt ); 62 66 63 67 // for labeled branches, add an entry to the label table … … 68 72 } 69 73 70 void LabelFixer::previsit( LabelAddressExpr * addrExpr ) { 71 Label & target = addrExpr->arg; 72 assert( target != "" ); 73 setLabelsUsg( target, addrExpr ); 74 void LabelFixer::visit( UntypedExpr *untyped ) { 75 if ( NameExpr * func = dynamic_cast< NameExpr * >( untyped->get_function() ) ) { 76 if ( func->get_name() == "&&" ) { 77 NameExpr * arg = dynamic_cast< NameExpr * >( untyped->get_args().front() ); 78 Label target = arg->get_name(); 79 assert( target != "" ); 80 setLabelsUsg( target, untyped ); 81 } else { 82 Visitor::visit( untyped ); 83 } 84 } 74 85 } 75 86
Note:
See TracChangeset
for help on using the changeset viewer.