| [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 | // | 
|---|
|  | 7 | // FunctionFixer.h -- | 
|---|
|  | 8 | // | 
|---|
| [843054c2] | 9 | // Author           : Rodolfo G. Esteves | 
|---|
| [51587aa] | 10 | // Created On       : Mon May 18 07:44:20 2015 | 
|---|
|  | 11 | // Last Modified By : Peter A. Buhr | 
|---|
|  | 12 | // Last Modified On : Mon May 18 14:58:45 2015 | 
|---|
|  | 13 | // Update Count     : 3 | 
|---|
|  | 14 | // | 
|---|
|  | 15 |  | 
|---|
|  | 16 | #ifndef _FUNCTIONFIXER_H_ | 
|---|
|  | 17 | #define _FUNCTIONFIXER_H_ | 
|---|
| [51b73452] | 18 |  | 
|---|
|  | 19 | #include "SynTree/Mutator.h" | 
|---|
|  | 20 |  | 
|---|
|  | 21 | #include "SynTree/Declaration.h" | 
|---|
|  | 22 | #include "SynTree/Expression.h" | 
|---|
|  | 23 | #include "SynTree/Statement.h" | 
|---|
|  | 24 | #include "SynTree/Type.h" | 
|---|
|  | 25 |  | 
|---|
|  | 26 | #include "SymTab/Indexer.h" | 
|---|
|  | 27 | #include "ResolvExpr/Resolver.h" | 
|---|
|  | 28 | #include "ResolvExpr/AlternativeFinder.h" | 
|---|
|  | 29 |  | 
|---|
|  | 30 | namespace Tuples { | 
|---|
| [51587aa] | 31 | class FunctionFixer : public Mutator { | 
|---|
|  | 32 | typedef Mutator Parent; | 
|---|
|  | 33 | public: | 
|---|
|  | 34 | FunctionFixer() {} | 
|---|
|  | 35 | virtual ~FunctionFixer() {} | 
|---|
|  | 36 | virtual Type       *mutate( FunctionType *functionType ); | 
|---|
|  | 37 | virtual Statement  *mutate( ReturnStmt   *retStmt  ); | 
|---|
|  | 38 | virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ); | 
|---|
|  | 39 | virtual Expression *mutate( VariableExpr *variableExpr); | 
|---|
| [51b73452] | 40 |  | 
|---|
| [51587aa] | 41 | // indexer runs | 
|---|
|  | 42 | virtual ObjectDecl     *mutate( ObjectDecl *objectDecl ) | 
|---|
|  | 43 | { index.visit( objectDecl ); return objectDecl; } | 
|---|
|  | 44 | virtual TypeDecl       *mutate( TypeDecl *typeDecl ) | 
|---|
|  | 45 | { index.visit( typeDecl ); return typeDecl; } | 
|---|
|  | 46 | virtual TypedefDecl    *mutate( TypedefDecl *typeDecl ) | 
|---|
|  | 47 | { index.visit( typeDecl ); return typeDecl; } | 
|---|
|  | 48 | virtual StructDecl     *mutate( StructDecl *aggregateDecl ) | 
|---|
|  | 49 | { index.visit( aggregateDecl ); return aggregateDecl; } | 
|---|
|  | 50 | virtual UnionDecl      *mutate( UnionDecl *aggregateDecl ) | 
|---|
|  | 51 | { index.visit( aggregateDecl ); return aggregateDecl; } | 
|---|
|  | 52 | virtual EnumDecl       *mutate( EnumDecl *aggregateDecl ) | 
|---|
|  | 53 | { index.visit( aggregateDecl ); return aggregateDecl; } | 
|---|
| [51b73452] | 54 |  | 
|---|
| [51587aa] | 55 | virtual Type           *mutate( StructInstType *aggrInst ) | 
|---|
|  | 56 | { index.visit( aggrInst ); return aggrInst; } | 
|---|
|  | 57 | virtual Type           *mutate( UnionInstType *aggrInst ) | 
|---|
|  | 58 | { index.visit( aggrInst ); return aggrInst; } | 
|---|
|  | 59 | private: | 
|---|
|  | 60 | std::list< DeclarationWithType * > rets; | 
|---|
|  | 61 | SymTab::Indexer index; | 
|---|
|  | 62 | }; | 
|---|
|  | 63 | } // namespace Tuples | 
|---|
| [51b73452] | 64 |  | 
|---|
| [51587aa] | 65 | #endif // _FUNCTIONFIXER_H_ | 
|---|
| [51b73452] | 66 |  | 
|---|
| [51587aa] | 67 | // Local Variables: // | 
|---|
|  | 68 | // tab-width: 4 // | 
|---|
|  | 69 | // mode: c++ // | 
|---|
|  | 70 | // compile-command: "make install" // | 
|---|
|  | 71 | // End: // | 
|---|