Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MLEMutator.h

    r94e025a2 rd180746  
    2020#include <string>                  // for string
    2121
    22 #include "Common/PassVisitor.h"
    2322#include "Common/SemanticError.h"  // for SemanticError
    2423#include "SynTree/Label.h"         // for Label
     
    2726
    2827namespace ControlStruct {
    29         class LabelGenerator;
     28class LabelGenerator;
    3029
    31         class MLEMutator : public WithVisitorRef<MLEMutator>, public WithShortCircuiting {
     30        class MLEMutator : public Mutator {
    3231                class Entry;
    3332
     33                typedef Mutator Parent;
    3434          public:
    3535                MLEMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {}
    3636                ~MLEMutator();
    3737
    38                 void premutate( CompoundStmt *cmpndStmt );
    39                 Statement * postmutate( BranchStmt *branchStmt ) throw ( SemanticError );
    40                 void premutate( WhileStmt *whileStmt );
    41                 Statement * postmutate( WhileStmt *whileStmt );
    42                 void premutate( ForStmt *forStmt );
    43                 Statement * postmutate( ForStmt *forStmt );
    44                 void premutate( CaseStmt *caseStmt );
    45                 void premutate( IfStmt *ifStmt );
    46                 Statement * postmutate( IfStmt *ifStmt );
    47                 void premutate( SwitchStmt *switchStmt );
    48                 Statement * postmutate( SwitchStmt *switchStmt );
     38                virtual CompoundStmt *mutate( CompoundStmt *cmpndStmt ) override;
     39                virtual Statement *mutate( WhileStmt *whileStmt ) override;
     40                virtual Statement *mutate( ForStmt *forStmt ) override;
     41                virtual Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError ) override;
     42                virtual Statement *mutate( CaseStmt *caseStmt ) override;
     43                virtual Statement *mutate( IfStmt *ifStmt ) override;
     44                virtual Statement *mutate( SwitchStmt *switchStmt ) override;
    4945
    5046                Statement *mutateLoop( Statement *bodyLoop, Entry &e );
     
    5854                                loop( _loop ), breakExit( _breakExit ), contExit( _contExit ), breakUsed(false), contUsed(false) {}
    5955
    60                         bool operator==( const Statement *stmt ) { return loop == stmt; }
    61                         bool operator!=( const Statement *stmt ) { return loop != stmt; }
     56                        bool operator==( const Statement *stmt ) { return ( loop == stmt ); }
     57                        bool operator!=( const Statement *stmt ) { return ( loop != stmt ); }
    6258
    63                         bool operator==( const Entry &other ) { return loop == other.get_controlStructure(); }
     59                        bool operator==( const Entry &other ) { return ( loop == other.get_controlStructure() ); }
    6460
    6561                        Statement *get_controlStructure() const { return loop; }
     
    8278
    8379                template< typename LoopClass >
    84                 void prehandleLoopStmt( LoopClass * loopStmt );
     80                Statement *handleLoopStmt( LoopClass *loopStmt );
    8581
    86                 template< typename LoopClass >
    87                 Statement * posthandleLoopStmt( LoopClass * loopStmt );
     82                template< typename IfClass >
     83                Statement *handleIfStmt( IfClass *switchStmt );
     84
     85                template< typename SwitchClass >
     86                Statement *handleSwitchStmt( SwitchClass *switchStmt );
    8887
    8988                void fixBlock( std::list< Statement * > &kids );
Note: See TracChangeset for help on using the changeset viewer.