Changes in / [c3b96677:f6cc2096]
- Location:
- src
- Files:
-
- 9 added
- 3 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/MLEMutator.cc
rc3b96677 rf6cc2096 154 154 return switchStmt; 155 155 } 156 157 void addUnused( Statement * stmt, const Label & originalTarget ) { 158 // break/continue without a label doesn't need unused attribute 159 if ( originalTarget == "" ) return; 160 // add unused attribute to the originalTarget of a labelled break/continue 161 for ( Label & l : stmt->get_labels() ) { 162 // find the label to add unused attribute to 163 if ( l == originalTarget ) { 164 for ( Attribute * attr : l.get_attributes() ) { 165 // ensure attribute isn't added twice 166 if ( attr->get_name() == "unused" ) return; 167 } 168 l.get_attributes().push_back( new Attribute( "unused" ) ); 169 return; 170 } 171 } 172 assertf( false, "Could not find label '%s' on statement %s", originalTarget.get_name().c_str(), toString( stmt ).c_str() ); 173 } 174 156 175 157 176 Statement *MLEMutator::mutate( BranchStmt *branchStmt ) throw ( SemanticError ) { … … 204 223 } // switch 205 224 225 // add unused attribute to label to silence warnings 226 addUnused( targetEntry->get_controlStructure(), branchStmt->get_originalTarget() ); 227 206 228 // transform break/continue statements into goto to simplify later handling of branches 207 229 delete branchStmt;
Note: See TracChangeset
for help on using the changeset viewer.