Changeset 7416d46a for src/ControlStruct/MLEMutator.h
- Timestamp:
- Jan 30, 2018, 3:54:32 PM (8 years ago)
- 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:
- 633a642
- Parents:
- f792cb8 (diff), 42be3c3 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/MLEMutator.h
rf792cb8 r7416d46a 20 20 #include <string> // for string 21 21 22 #include "Common/PassVisitor.h" 22 23 #include "Common/SemanticError.h" // for SemanticError 23 24 #include "SynTree/Label.h" // for Label … … 26 27 27 28 namespace ControlStruct { 28 class LabelGenerator;29 class LabelGenerator; 29 30 30 class MLEMutator : public Mutator{31 class MLEMutator : public WithVisitorRef<MLEMutator>, public WithShortCircuiting { 31 32 class Entry; 32 33 33 typedef Mutator Parent;34 34 public: 35 35 MLEMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {} 36 36 ~MLEMutator(); 37 37 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; 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 ); 45 49 46 50 Statement *mutateLoop( Statement *bodyLoop, Entry &e ); … … 54 58 loop( _loop ), breakExit( _breakExit ), contExit( _contExit ), breakUsed(false), contUsed(false) {} 55 59 56 bool operator==( const Statement *stmt ) { return ( loop == stmt ); }57 bool operator!=( const Statement *stmt ) { return ( loop != stmt ); }60 bool operator==( const Statement *stmt ) { return loop == stmt; } 61 bool operator!=( const Statement *stmt ) { return loop != stmt; } 58 62 59 bool operator==( const Entry &other ) { return ( loop == other.get_controlStructure()); }63 bool operator==( const Entry &other ) { return loop == other.get_controlStructure(); } 60 64 61 65 Statement *get_controlStructure() const { return loop; } … … 78 82 79 83 template< typename LoopClass > 80 Statement *handleLoopStmt( LoopClass *loopStmt );84 void prehandleLoopStmt( LoopClass * loopStmt ); 81 85 82 template< typename IfClass > 83 Statement *handleIfStmt( IfClass *switchStmt ); 84 85 template< typename SwitchClass > 86 Statement *handleSwitchStmt( SwitchClass *switchStmt ); 86 template< typename LoopClass > 87 Statement * posthandleLoopStmt( LoopClass * loopStmt ); 87 88 88 89 void fixBlock( std::list< Statement * > &kids );
Note:
See TracChangeset
for help on using the changeset viewer.