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