Ignore:
Timestamp:
Jun 3, 2015, 3:19:29 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
4162aea9
Parents:
954463b8
Message:

fix multi-level exit code (labeled break and continue)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MLEMutator.h

    r954463b8 r27de955  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue May 26 15:04:21 2015
    13 // Update Count     : 7
     12// Last Modified On : Wed Jun 03 15:06:36 2015
     13// Update Count     : 25
    1414//
    1515
     
    3838                Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError );
    3939
     40                Statement *mutate( CaseStmt *caseStmt );
    4041                Statement *mutate( SwitchStmt *switchStmt );
    4142                Statement *mutate( ChooseStmt *switchStmt );
     
    4849                class Entry {
    4950                  public:
    50                         explicit Entry( Statement *_loop = 0, Label _contExit = Label(""), Label _breakExit = Label("") ) :
    51                                 loop( _loop ), contExit( _contExit ), breakExit( _breakExit ), contExitUsed( false ), breakExitUsed( false ) {}
     51                        explicit Entry( Statement *_loop, Label _breakExit, Label _contExit = Label("") ) :
     52                                loop( _loop ), breakExit( _breakExit ), contExit( _contExit ), breakUsed(false), contUsed(false) {}
    5253
    5354                        bool operator==( const Statement *stmt ) { return ( loop == stmt ); }
     
    5859                        Statement *get_loop() const { return loop; }
    5960
    60                         Label get_contExit() const { return contExit; }
    61                         void set_contExit( Label );
     61                        Label useContExit() { contUsed = true; return contExit; }
     62                        Label useBreakExit() { breakUsed = true; return breakExit; }
    6263
    63                         Label get_breakExit() const { return breakExit; }
    64                         void set_breakExit( Label );
     64                        bool isContUsed() const { return contUsed; }
     65                        bool isBreakUsed() const { return breakUsed; }
    6566
    6667                  private:
    6768                        Statement *loop;
    68                         Label contExit, breakExit;
    69                   public: // hack, provide proper [sg]etters
    70                         bool contExitUsed, breakExitUsed;
     69                        Label breakExit, contExit;
     70                        bool breakUsed, contUsed;
    7171                };
    7272
     
    7676                LabelGenerator *generator;
    7777
     78                template< typename LoopClass >
     79                Statement *handleLoopStmt( LoopClass *loopStmt );
     80
    7881                template< typename SwitchClass >
    79                 friend Statement *handleSwitchStmt( SwitchClass *switchStmt, MLEMutator &mutator );
     82                Statement *handleSwitchStmt( SwitchClass *switchStmt );
     83
     84                void fixBlock( std::list< Statement * > &kids );
    8085        };
    8186} // namespace ControlStruct
Note: See TracChangeset for help on using the changeset viewer.