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 | // |
---|
7 | // PolyMutator.h -- |
---|
8 | // |
---|
9 | // Author : Richard C. Bilson |
---|
10 | // Created On : Mon May 18 07:44:20 2015 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Tue Jul 12 17:39:41 2016 |
---|
13 | // Update Count : 6 |
---|
14 | // |
---|
15 | |
---|
16 | #ifndef _POLYMUTATOR_H |
---|
17 | #define _POLYMUTATOR_H |
---|
18 | |
---|
19 | #include <map> |
---|
20 | #include <string> |
---|
21 | #include <list> |
---|
22 | |
---|
23 | #include "GenPoly.h" |
---|
24 | |
---|
25 | #include "SynTree/SynTree.h" |
---|
26 | #include "SynTree/Declaration.h" |
---|
27 | #include "SynTree/Mutator.h" |
---|
28 | |
---|
29 | namespace GenPoly { |
---|
30 | class PolyMutator : public Mutator { |
---|
31 | public: |
---|
32 | typedef Mutator Parent; |
---|
33 | using Parent::mutate; |
---|
34 | |
---|
35 | PolyMutator(); |
---|
36 | |
---|
37 | virtual CompoundStmt* mutate(CompoundStmt *compoundStmt); |
---|
38 | virtual Statement* mutate(IfStmt *ifStmt); |
---|
39 | virtual Statement* mutate(WhileStmt *whileStmt); |
---|
40 | virtual Statement* mutate(ForStmt *forStmt); |
---|
41 | virtual Statement* mutate(SwitchStmt *switchStmt); |
---|
42 | virtual Statement* mutate(CaseStmt *caseStmt); |
---|
43 | virtual Statement* mutate(TryStmt *returnStmt); |
---|
44 | virtual Statement* mutate(CatchStmt *catchStmt); |
---|
45 | virtual Statement* mutate(ExprStmt *catchStmt); |
---|
46 | virtual Statement* mutate(ReturnStmt *catchStmt); |
---|
47 | |
---|
48 | virtual Expression* mutate(UntypedExpr *untypedExpr); |
---|
49 | |
---|
50 | virtual Initializer* mutate(SingleInit *SingleInit); |
---|
51 | |
---|
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 ); |
---|
59 | |
---|
60 | TyVarMap scopeTyVars; |
---|
61 | TypeSubstitution *env; |
---|
62 | std::list< Statement* > stmtsToAdd; |
---|
63 | std::list< Statement* > stmtsToAddAfter; |
---|
64 | }; |
---|
65 | } // namespace |
---|
66 | |
---|
67 | #endif // _POLYMUTATOR_H |
---|
68 | |
---|
69 | // Local Variables: // |
---|
70 | // tab-width: 4 // |
---|
71 | // mode: c++ // |
---|
72 | // compile-command: "make install" // |
---|
73 | // End: // |
---|