Changeset c13e8dc8 for src/ControlStruct/LabelFixer.cc
- Timestamp:
- Dec 5, 2017, 2:35:03 PM (8 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- f9feab8
- Parents:
- 9c35431 (diff), 65197c2 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/LabelFixer.cc
r9c35431 rc13e8dc8 37 37 } 38 38 39 void LabelFixer:: visit( FunctionDecl *functionDecl) {39 void LabelFixer::previsit( FunctionDecl * ) { 40 40 // need to go into a nested function in a fresh state 41 std::map < Label, Entry *> oldLabelTable = labelTable;41 GuardValue( labelTable ); 42 42 labelTable.clear(); 43 } 43 44 44 maybeAccept( functionDecl->get_statements(), *this ); 45 45 void LabelFixer::postvisit( FunctionDecl * functionDecl ) { 46 46 MLEMutator mlemut( resolveJumps(), generator ); 47 47 functionDecl->acceptMutator( mlemut ); 48 49 // and remember the outer function's labels when50 // returning to it51 labelTable = oldLabelTable;52 48 } 53 49 54 50 // prune to at most one label definition for each statement 55 void LabelFixer:: visit( Statement *stmt ) {51 void LabelFixer::previsit( Statement *stmt ) { 56 52 std::list< Label > &labels = stmt->get_labels(); 57 53 … … 62 58 } 63 59 64 void LabelFixer:: visit( BranchStmt *branchStmt ) {65 visit ( ( Statement *)branchStmt );60 void LabelFixer::previsit( BranchStmt *branchStmt ) { 61 previsit( ( Statement *)branchStmt ); 66 62 67 63 // for labeled branches, add an entry to the label table … … 72 68 } 73 69 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 } 70 void LabelFixer::previsit( LabelAddressExpr * addrExpr ) { 71 Label & target = addrExpr->arg; 72 assert( target != "" ); 73 setLabelsUsg( target, addrExpr ); 85 74 } 86 75
Note:
See TracChangeset
for help on using the changeset viewer.