Changes in src/GenPoly/DeclMutator.cc [8ca3a72:8688ce1]
- File:
-
- 1 edited
-
src/GenPoly/DeclMutator.cc (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/DeclMutator.cc
r8ca3a72 r8688ce1 20 20 21 21 namespace GenPoly { 22 namespace { 23 const std::list<Label> noLabels; 24 } 25 22 26 DeclMutator::DeclMutator() : Mutator(), declsToAdd(1), declsToAddAfter(1) {} 23 27 24 28 DeclMutator::~DeclMutator() {} 25 29 26 30 void DeclMutator::mutateDeclarationList( std::list< Declaration* > &decls ) { 27 31 for ( std::list< Declaration* >::iterator decl = decls.begin(); ; ++decl ) { … … 30 34 31 35 if ( decl == decls.end() ) break; 32 36 33 37 // run mutator on declaration 34 38 *decl = maybeMutate( *decl, *this ); … … 51 55 newBack->splice( newBack->end(), *back ); 52 56 declsToAdd.pop_back(); 53 57 54 58 back = declsToAddAfter.rbegin(); 55 59 newBack = back + 1; … … 62 66 CompoundStmt *compoundStmt = dynamic_cast< CompoundStmt* >(stmt); 63 67 if ( compoundStmt ) return mutate( compoundStmt ); 64 68 65 69 doBeginScope(); 66 70 67 71 // run mutator on statement 68 72 stmt = maybeMutate( stmt, *this ); … … 98 102 doBeginScope(); 99 103 100 104 101 105 for ( std::list< Statement* >::iterator stmt = stmts.begin(); ; ++stmt ) { 102 106 // add any new declarations after the previous statement … … 108 112 109 113 if ( stmt == stmts.end() ) break; 110 114 111 115 // run mutator on statement 112 116 *stmt = maybeMutate( *stmt, *this ); … … 119 123 declsToAdd.back().clear(); 120 124 } 121 125 122 126 doEndScope(); 123 127 } … … 135 139 return compoundStmt; 136 140 } 137 141 138 142 Statement* DeclMutator::mutate(IfStmt *ifStmt) { 139 143 ifStmt->set_condition( maybeMutate( ifStmt->get_condition(), *this ) ); … … 142 146 return ifStmt; 143 147 } 144 148 145 149 Statement* DeclMutator::mutate(WhileStmt *whileStmt) { 146 150 whileStmt->set_condition( maybeMutate( whileStmt->get_condition(), *this ) ); … … 148 152 return whileStmt; 149 153 } 150 154 151 155 Statement* DeclMutator::mutate(ForStmt *forStmt) { 152 156 mutateAll( forStmt->get_initialization(), *this ); … … 156 160 return forStmt; 157 161 } 158 162 159 163 Statement* DeclMutator::mutate(SwitchStmt *switchStmt) { 160 164 switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) ); … … 162 166 return switchStmt; 163 167 } 164 168 165 169 Statement* DeclMutator::mutate(CaseStmt *caseStmt) { 166 170 caseStmt->set_condition( maybeMutate( caseStmt->get_condition(), *this ) ); … … 168 172 return caseStmt; 169 173 } 170 174 171 175 Statement* DeclMutator::mutate(TryStmt *tryStmt) { 172 176 tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) ); … … 175 179 return tryStmt; 176 180 } 177 181 178 182 Statement* DeclMutator::mutate(CatchStmt *catchStmt) { 179 183 catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) );
Note:
See TracChangeset
for help on using the changeset viewer.