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 | // InitExpander.h -- |
---|
8 | // |
---|
9 | // Author : Rodolfo G. Esteves |
---|
10 | // Created On : Mon May 18 07:44:20 2015 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Tue May 19 16:35:33 2015 |
---|
13 | // Update Count : 2 |
---|
14 | // |
---|
15 | |
---|
16 | #ifndef _INIT_EXPANDER_H_ |
---|
17 | #define _INIT_EXPANDER_H_ |
---|
18 | |
---|
19 | #include <string> |
---|
20 | |
---|
21 | #include "Common/utility.h" |
---|
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 { |
---|
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 |
---|
66 | } // namespace InitTweak |
---|
67 | |
---|
68 | #endif // _INIT_EXPANDER_H_ |
---|
69 | |
---|
70 | // Local Variables: // |
---|
71 | // tab-width: 4 // |
---|
72 | // mode: c++ // |
---|
73 | // compile-command: "make install" // |
---|
74 | // End: // |
---|