Ignore:
Timestamp:
Jan 19, 2015, 6:29:10 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
f7f6785
Parents:
0b8cd722
Message:

add list initializer, formatting changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/ControlStruct/MLEMutator.cc

    r0b8cd722 r6c3744e  
    1212    }
    1313
    14     CompoundStmt* MLEMutator::mutate(CompoundStmt *cmpndStmt) {
     14    CompoundStmt* MLEMutator::mutate( CompoundStmt *cmpndStmt ) {
    1515        bool labeledBlock = false;
    1616        if ( !((cmpndStmt->get_labels()).empty()) ) {
     
    2727                if ( next == kids.end() ) {
    2828                    std::list<Label> ls; ls.push_back( get_breakLabel() );
    29                     kids.push_back( new NullStmt(ls) );
     29                    kids.push_back( new NullStmt( ls ) );
    3030                } else
    3131                    (*next)->get_labels().push_back( get_breakLabel() );
     
    8888        std::list< Entry >::iterator check;
    8989        if ( ( check = std::find( enclosingLoops.begin(), enclosingLoops.end(), (*targetTable)[branchStmt->get_target()] ) ) == enclosingLoops.end() )
    90             // not in loop, checking if in switch/choose
     90            // not in loop, checking if in block
    9191            if ( (check = std::find( enclosingBlocks.begin(), enclosingBlocks.end(), (*targetTable)[branchStmt->get_target()] )) == enclosingBlocks.end() )
    9292                // neither in loop nor in block, checking if in switch/choose
     
    9595
    9696        if ( enclosingLoops.back() == (*check) )
    97             return branchStmt;                      // exit the innermost loop (labels not necessary)
     97            return branchStmt;                          // exit the innermost loop (labels unnecessary)
    9898
    9999        Label newLabel;
     
    102102            if ( check->get_breakExit() != "" )
    103103                newLabel = check->get_breakExit();
    104             else { newLabel = generator->newLabel(); check->set_breakExit( newLabel ); }
     104            else {
     105                newLabel = generator->newLabel();
     106                check->set_breakExit( newLabel );
     107            } // if
    105108            break;
    106109          case BranchStmt::Continue:
    107110            if ( check->get_contExit() != "" )
    108111                newLabel = check->get_contExit();
    109             else { newLabel = generator->newLabel(); check->set_contExit( newLabel ); }
     112            else {
     113                newLabel = generator->newLabel();
     114                check->set_contExit( newLabel );
     115            } // if
    110116            break;
    111117          default:
    112             // shouldn't be here
    113             return 0;
     118            return 0;                                   // shouldn't be here
    114119        } // switch
    115120
    116         return new BranchStmt(std::list<Label>(), newLabel, BranchStmt::Goto );
     121        return new BranchStmt( std::list<Label>(), newLabel, BranchStmt::Goto );
    117122    }
    118123
    119124
    120     Statement *MLEMutator::mutate(SwitchStmt *switchStmt) {
     125    Statement *MLEMutator::mutate( SwitchStmt *switchStmt ) {
    121126        Label brkLabel = generator->newLabel();
    122127        enclosingSwitches.push_back( Entry(switchStmt, "", brkLabel) );
     
    131136    }
    132137
    133     Statement *MLEMutator::mutate(ChooseStmt *switchStmt) {
     138    Statement *MLEMutator::mutate( ChooseStmt *switchStmt ) {
    134139        Label brkLabel = generator->newLabel();
    135140        enclosingSwitches.push_back( Entry(switchStmt,"", brkLabel) );
Note: See TracChangeset for help on using the changeset viewer.