Ignore:
Timestamp:
Aug 11, 2017, 3:54:44 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
f6cc2096
Parents:
0a5b683 (diff), 33c4b81 (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.
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MLEMutator.cc

    r0a5b683 r70284830  
    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
    156175
    157176        Statement *MLEMutator::mutate( BranchStmt *branchStmt ) throw ( SemanticError ) {
     
    204223                } // switch
    205224
     225                // add unused attribute to label to silence warnings
     226                addUnused( targetEntry->get_controlStructure(), branchStmt->get_originalTarget() );
     227
    206228                // transform break/continue statements into goto to simplify later handling of branches
    207229                delete branchStmt;
Note: See TracChangeset for help on using the changeset viewer.