Changes in / [f6cc2096:c3b96677]


Ignore:
Location:
src
Files:
3 added
9 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MLEMutator.cc

    rf6cc2096 rc3b96677  
    154154                return switchStmt;
    155155        }
    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 
    175156
    176157        Statement *MLEMutator::mutate( BranchStmt *branchStmt ) throw ( SemanticError ) {
     
    223204                } // switch
    224205
    225                 // add unused attribute to label to silence warnings
    226                 addUnused( targetEntry->get_controlStructure(), branchStmt->get_originalTarget() );
    227 
    228206                // transform break/continue statements into goto to simplify later handling of branches
    229207                delete branchStmt;
Note: See TracChangeset for help on using the changeset viewer.