source: translator/InitTweak/InitExpander.h @ d4778a6

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since d4778a6 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#ifndef _INIT_EXPANDER_H_
2#define _INIT_EXPANDER_H_
3
4#include <string>
5
6#include "utility.h"
7#include "SynTree/Mutator.h"
8#include "SymTab/Indexer.h"
9
10#include "SynTree/Statement.h"
11#include "SynTree/Declaration.h"
12#include "SynTree/Type.h"
13
14namespace InitTweak {
15
16  class InitExpander : public Mutator
17  {
18    typedef Mutator Parent;
19
20  public:
21    InitExpander();
22    ~InitExpander();
23
24    virtual ObjectDecl *mutate( ObjectDecl * );
25
26    // indexer runs
27    virtual FunctionDecl   *mutate( FunctionDecl *functionDecl )
28    {
29      functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) );
30      mutateAll( functionDecl->get_oldDecls(), *this );
31      functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
32
33      index.visit( functionDecl );
34      return functionDecl;
35    }
36
37    virtual TypeDecl       *mutate( TypeDecl *typeDecl )
38    { index.visit( typeDecl ); return typeDecl; }
39    virtual TypedefDecl    *mutate( TypedefDecl *typeDecl )
40    { index.visit( typeDecl ); return typeDecl; }
41    virtual StructDecl     *mutate( StructDecl *aggregateDecl )
42    { index.visit( aggregateDecl ); return aggregateDecl; }
43    virtual UnionDecl      *mutate( UnionDecl *aggregateDecl )
44    { index.visit( aggregateDecl ); return aggregateDecl; }
45    virtual EnumDecl       *mutate( EnumDecl *aggregateDecl )
46    { index.visit( aggregateDecl ); return aggregateDecl; }
47
48    virtual Type           *mutate( StructInstType *aggrInst )
49    { index.visit( aggrInst ); return aggrInst; }
50    virtual Type           *mutate( UnionInstType *aggrInst )
51    { index.visit( aggrInst ); return aggrInst; }
52
53  private:
54    SymTab::Indexer index;
55  };  // class InitExpander
56
57} // namespace InitTweak
58
59
60#endif // #ifndef _INIT_EXPANDER_H_
61
62/*
63  Local Variables:
64  mode: c++
65  End:
66*/
Note: See TracBrowser for help on using the repository browser.