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