[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 | //
|
---|
[a08ba92] | 7 | // InitExpander.h --
|
---|
[51587aa] | 8 | //
|
---|
[843054c2] | 9 | // Author : Rodolfo G. Esteves
|
---|
[51587aa] | 10 | // Created On : Mon May 18 07:44:20 2015
|
---|
[a08ba92] | 11 | // Last Modified By : Peter A. Buhr
|
---|
| 12 | // Last Modified On : Tue May 19 16:35:33 2015
|
---|
| 13 | // Update Count : 2
|
---|
[51587aa] | 14 | //
|
---|
[a08ba92] | 15 |
|
---|
[51b73452] | 16 | #ifndef _INIT_EXPANDER_H_
|
---|
| 17 | #define _INIT_EXPANDER_H_
|
---|
| 18 |
|
---|
| 19 | #include <string>
|
---|
| 20 |
|
---|
[d3b7937] | 21 | #include "Common/utility.h"
|
---|
[51b73452] | 22 | #include "SynTree/Mutator.h"
|
---|
| 23 | #include "SymTab/Indexer.h"
|
---|
| 24 |
|
---|
| 25 | #include "SynTree/Statement.h"
|
---|
| 26 | #include "SynTree/Declaration.h"
|
---|
| 27 | #include "SynTree/Type.h"
|
---|
| 28 |
|
---|
| 29 | namespace InitTweak {
|
---|
[a08ba92] | 30 | class InitExpander : public Mutator {
|
---|
| 31 | typedef Mutator Parent;
|
---|
| 32 | public:
|
---|
| 33 | InitExpander();
|
---|
| 34 | ~InitExpander();
|
---|
| 35 |
|
---|
| 36 | virtual ObjectDecl *mutate( ObjectDecl * );
|
---|
| 37 |
|
---|
| 38 | // indexer runs
|
---|
| 39 | virtual FunctionDecl *mutate( FunctionDecl *functionDecl ) {
|
---|
| 40 | functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) );
|
---|
| 41 | mutateAll( functionDecl->get_oldDecls(), *this );
|
---|
| 42 | functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
|
---|
| 43 |
|
---|
| 44 | index.visit( functionDecl );
|
---|
| 45 | return functionDecl;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | virtual TypeDecl *mutate( TypeDecl *typeDecl )
|
---|
| 49 | { index.visit( typeDecl ); return typeDecl; }
|
---|
| 50 | virtual TypedefDecl *mutate( TypedefDecl *typeDecl )
|
---|
| 51 | { index.visit( typeDecl ); return typeDecl; }
|
---|
| 52 | virtual StructDecl *mutate( StructDecl *aggregateDecl )
|
---|
| 53 | { index.visit( aggregateDecl ); return aggregateDecl; }
|
---|
| 54 | virtual UnionDecl *mutate( UnionDecl *aggregateDecl )
|
---|
| 55 | { index.visit( aggregateDecl ); return aggregateDecl; }
|
---|
| 56 | virtual EnumDecl *mutate( EnumDecl *aggregateDecl )
|
---|
| 57 | { index.visit( aggregateDecl ); return aggregateDecl; }
|
---|
| 58 |
|
---|
| 59 | virtual Type *mutate( StructInstType *aggrInst )
|
---|
| 60 | { index.visit( aggrInst ); return aggrInst; }
|
---|
| 61 | virtual Type *mutate( UnionInstType *aggrInst )
|
---|
| 62 | { index.visit( aggrInst ); return aggrInst; }
|
---|
| 63 | private:
|
---|
| 64 | SymTab::Indexer index;
|
---|
| 65 | }; // class InitExpander
|
---|
[51b73452] | 66 | } // namespace InitTweak
|
---|
| 67 |
|
---|
[a08ba92] | 68 | #endif // _INIT_EXPANDER_H_
|
---|
[51b73452] | 69 |
|
---|
[51587aa] | 70 | // Local Variables: //
|
---|
| 71 | // tab-width: 4 //
|
---|
| 72 | // mode: c++ //
|
---|
| 73 | // compile-command: "make install" //
|
---|
| 74 | // End: //
|
---|