Changeset 45a4ea7
- Timestamp:
- May 5, 2017, 11:05:45 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 4f9636f
- Parents:
- 262f085f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/PolyMutator.cc
r262f085f r45a4ea7 50 50 51 51 Statement * PolyMutator::mutateStatement( Statement *stmt ) { 52 // don't want statements from outer CompoundStmts to be added to this CompoundStmt 53 ValueGuard< std::list< Statement* > > oldStmtsToAdd( stmtsToAdd ); 54 ValueGuard< std::list< Statement* > > oldStmtsToAddAfter( stmtsToAddAfter ); 55 ValueGuard< TypeSubstitution * > oldEnv( env ); 56 stmtsToAdd.clear(); 57 stmtsToAddAfter.clear(); 58 52 59 Statement *newStmt = maybeMutate( stmt, *this ); 53 60 if ( ! stmtsToAdd.empty() || ! stmtsToAddAfter.empty() ) { … … 83 90 84 91 Statement * PolyMutator::mutate(IfStmt *ifStmt) { 92 ifStmt->set_condition( mutateExpression( ifStmt->get_condition() ) ); 85 93 ifStmt->set_thenPart( mutateStatement( ifStmt->get_thenPart() ) ); 86 94 ifStmt->set_elsePart( mutateStatement( ifStmt->get_elsePart() ) ); 87 ifStmt->set_condition( mutateExpression( ifStmt->get_condition() ) );88 95 return ifStmt; 89 96 } 90 97 91 98 Statement * PolyMutator::mutate(WhileStmt *whileStmt) { 99 whileStmt->set_condition( mutateExpression( whileStmt->get_condition() ) ); 92 100 whileStmt->set_body( mutateStatement( whileStmt->get_body() ) ); 93 whileStmt->set_condition( mutateExpression( whileStmt->get_condition() ) );94 101 return whileStmt; 95 102 } 96 103 97 104 Statement * PolyMutator::mutate(ForStmt *forStmt) { 98 forStmt->set_body( mutateStatement( forStmt->get_body() ) );99 105 mutateAll( forStmt->get_initialization(), *this ); 100 106 forStmt->set_condition( mutateExpression( forStmt->get_condition() ) ); 101 107 forStmt->set_increment( mutateExpression( forStmt->get_increment() ) ); 108 forStmt->set_body( mutateStatement( forStmt->get_body() ) ); 102 109 return forStmt; 103 110 } 104 111 105 112 Statement * PolyMutator::mutate(SwitchStmt *switchStmt) { 113 switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) ); 106 114 mutateStatementList( switchStmt->get_statements() ); 107 switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );108 115 return switchStmt; 109 116 } 110 117 111 118 Statement * PolyMutator::mutate(CaseStmt *caseStmt) { 119 caseStmt->set_condition( mutateExpression( caseStmt->get_condition() ) ); 112 120 mutateStatementList( caseStmt->get_statements() ); 113 caseStmt->set_condition( mutateExpression( caseStmt->get_condition() ) );114 121 return caseStmt; 115 122 }
Note: See TracChangeset
for help on using the changeset viewer.