Changeset b2152e7a
- Timestamp:
- Jun 2, 2015, 1:42:10 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- d939274
- Parents:
- 2b6c1e0
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/MLEMutator.cc
r2b6c1e0 rb2152e7a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed May 27 16:19:32201513 // Update Count : 4412 // Last Modified On : Tue Jun 02 13:35:49 2015 13 // Update Count : 91 14 14 // 15 15 … … 154 154 Label brkLabel = generator->newLabel(); 155 155 enclosingSwitches.push_back( Entry(switchStmt, "", brkLabel) ); 156 mutateAll( switchStmt->get_branches(), mutator ); { 156 mutateAll( switchStmt->get_branches(), mutator ); 157 { 157 158 // check if this is necessary (if there is a break to this point, otherwise do not generate 158 std::list<Label> temp; temp.push_back( brkLabel ); 159 switchStmt->get_branches().push_back( new BranchStmt( temp, Label(""), BranchStmt::Break ) ); 159 160 // for the purposes of keeping switch statements uniform (i.e. all statements that are 161 // direct children of a switch should be CastStmts), append the exit label + break to the 162 // last case statement; create a default case if there are no cases 163 std::list< Statement * > &branches = switchStmt->get_branches(); 164 if ( branches.empty() ) { 165 branches.push_back( CaseStmt::makeDefault() ); 166 } 167 168 if ( CaseStmt * c = dynamic_cast< CaseStmt * >( branches.back() ) ) { 169 std::list<Label> temp; temp.push_back( brkLabel ); 170 c->get_statements().push_back( new BranchStmt( temp, Label(""), BranchStmt::Break ) ); 171 } else assert(0); 160 172 } 161 173 assert ( enclosingSwitches.back() == switchStmt ); -
src/SynTree/Statement.cc
r2b6c1e0 rb2152e7a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed May 27 15:41:13201513 // Update Count : 812 // Last Modified On : Tue Jun 02 13:07:09 2015 13 // Update Count : 14 14 14 // 15 15 … … 124 124 CaseStmt::~CaseStmt() { 125 125 delete condition; 126 } 127 128 CaseStmt * CaseStmt::makeDefault( std::list<Label> labels, std::list<Statement *> branches ) { 129 return new CaseStmt( labels, 0, branches, true ); 126 130 } 127 131 -
src/SynTree/Statement.h
r2b6c1e0 rb2152e7a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed May 27 15:40:43201513 // Update Count : 512 // Last Modified On : Tue Jun 02 13:07:25 2015 13 // Update Count : 13 14 14 // 15 15 … … 149 149 std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError); 150 150 virtual ~CaseStmt(); 151 152 static CaseStmt * makeDefault( std::list<Label> labels = std::list<Label>(), 153 std::list<Statement *> stmts = std::list<Statement *>() ); 151 154 152 155 bool isDefault() { return _isDefault; }
Note: See TracChangeset
for help on using the changeset viewer.