[51587aa] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[1ba88a0] | 7 | // PolyMutator.h -- |
---|
[51587aa] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[4e06c1e] | 11 | // Last Modified By : Peter A. Buhr |
---|
[6b0b624] | 12 | // Last Modified On : Sat Jul 22 09:20:31 2017 |
---|
| 13 | // Update Count : 7 |
---|
[51587aa] | 14 | // |
---|
[51b7345] | 15 | |
---|
[6b0b624] | 16 | #pragma once |
---|
[51b7345] | 17 | |
---|
| 18 | #include <map> |
---|
| 19 | #include <string> |
---|
| 20 | #include <list> |
---|
| 21 | |
---|
| 22 | #include "GenPoly.h" |
---|
| 23 | |
---|
| 24 | #include "SynTree/SynTree.h" |
---|
| 25 | #include "SynTree/Declaration.h" |
---|
| 26 | #include "SynTree/Mutator.h" |
---|
| 27 | |
---|
| 28 | namespace GenPoly { |
---|
[01aeade] | 29 | class PolyMutator : public Mutator { |
---|
| 30 | public: |
---|
[1ba88a0] | 31 | typedef Mutator Parent; |
---|
| 32 | using Parent::mutate; |
---|
| 33 | |
---|
[01aeade] | 34 | PolyMutator(); |
---|
[51b7345] | 35 | |
---|
[01aeade] | 36 | virtual CompoundStmt* mutate(CompoundStmt *compoundStmt); |
---|
| 37 | virtual Statement* mutate(IfStmt *ifStmt); |
---|
| 38 | virtual Statement* mutate(WhileStmt *whileStmt); |
---|
| 39 | virtual Statement* mutate(ForStmt *forStmt); |
---|
| 40 | virtual Statement* mutate(SwitchStmt *switchStmt); |
---|
| 41 | virtual Statement* mutate(CaseStmt *caseStmt); |
---|
| 42 | virtual Statement* mutate(TryStmt *returnStmt); |
---|
| 43 | virtual Statement* mutate(CatchStmt *catchStmt); |
---|
| 44 | virtual Statement* mutate(ExprStmt *catchStmt); |
---|
| 45 | virtual Statement* mutate(ReturnStmt *catchStmt); |
---|
[1ba88a0] | 46 | |
---|
[01aeade] | 47 | virtual Expression* mutate(UntypedExpr *untypedExpr); |
---|
[d9fa60a] | 48 | virtual Expression* mutate( StmtExpr *stmtExpr ); |
---|
[09f800b] | 49 | |
---|
| 50 | virtual Initializer* mutate(SingleInit *SingleInit); |
---|
| 51 | |
---|
[01aeade] | 52 | // template method |
---|
| 53 | virtual void doBeginScope() {} |
---|
| 54 | virtual void doEndScope() {} |
---|
| 55 | protected: |
---|
| 56 | void mutateStatementList( std::list< Statement* > &statements ); |
---|
| 57 | Statement* mutateStatement( Statement *stmt ); |
---|
| 58 | Expression* mutateExpression( Expression *expr ); |
---|
[1ba88a0] | 59 | |
---|
[01aeade] | 60 | TyVarMap scopeTyVars; |
---|
| 61 | TypeSubstitution *env; |
---|
| 62 | std::list< Statement* > stmtsToAdd; |
---|
| 63 | std::list< Statement* > stmtsToAddAfter; |
---|
| 64 | }; |
---|
[1ba88a0] | 65 | } // namespace |
---|
[51b7345] | 66 | |
---|
[51587aa] | 67 | // Local Variables: // |
---|
| 68 | // tab-width: 4 // |
---|
| 69 | // mode: c++ // |
---|
| 70 | // compile-command: "make install" // |
---|
| 71 | // End: // |
---|