File: Transformer.h

package info (click to toggle)
aspectc%2B%2B 1%3A2.2%2Bgit20181008-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,704 kB
  • sloc: cpp: 110,629; ansic: 7,644; sh: 2,192; makefile: 1,317; pascal: 634; python: 402; xml: 349
file content (114 lines) | stat: -rw-r--r-- 4,152 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// This file is part of the AspectC++ compiler 'ac++'.
// Copyright (C) 1999-2003  The 'ac++' developers (see aspectc.org)
//                                                                
// This program is free software;  you can redistribute it and/or 
// modify it under the terms of the GNU General Public License as 
// published by the Free Software Foundation; either version 2 of 
// the License, or (at your option) any later version.            
//                                                                
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
// GNU General Public License for more details.                   
//                                                                
// You should have received a copy of the GNU General Public      
// License along with this program; if not, write to the Free     
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
// MA  02111-1307  USA                                            

#ifndef __Transformer_h__
#define __Transformer_h__

#include "CodeWeaver.h"
#ifdef FRONTEND_PUMA
#include "Puma/CCParser.h"
#include "Puma/CCSemVisitor.h"
#else
#include "clang/Basic/SourceManager.h"
#endif
#include "ACErrorStream.h"
#include "ACToken.h"
#include "AspectIncludeCluster.h"


#include <list>
using std::list;

namespace Puma {
  class VerboseMgr;
  class CTranslationUnit;
} // namespace Puma

class PointCut;
class Repository;
class Plan;
class ModelBuilder;
class ACConfig;
class ACProject;
class IncludeGraph;

class Transformer
 {
      Puma::VerboseMgr &_vm;
      ACErrorStream &_err;
      ACProject &_project;
      Repository &_repo;
      CodeWeaver _code_weaver;
#ifdef FRONTEND_PUMA
      Puma::CCParser _parser;
      Puma::CCSemVisitor _sem_visitor;
#else
      clang::SourceManager *_phase1_sm;
#endif
      ACConfig &_conf;
      list<AspectIncludeCluster> _aspect_include_clusters;
      string _aspect_includes;
      string _aspect_fwd_decls;
      set<ACFileID> _touched_files;
      set<ACFileID> _virtual_files;
      
      bool phase1 (Puma::Unit *&unit, const string &tunit_name,
          ModelBuilder &, IncludeGraph&);
      bool phase2 (Puma::Unit *unit, const string &tunit_name,
          ModelBuilder &, IncludeGraph&);
      void include_aspect (const char *name);
      void determine_aspect_includes (const IncludeGraph &ig);
      void determine_aspect_fwd_decls (ModelBuilder &);
      void aspect_include_cluster (const char *ah_file, const IncludeGraph &ig);
      void determine_aspect_cluster (ACFileID ah_unit,
        const IncludeGraph &ig, set<ACFileID> &cluster);
      void prepare_dynamic_weaving (ModelBuilder &jpm);
      void update_intros_in_repo (ModelBuilder &);
      void cleanup (ModelBuilder &jpm);
      void insert_bypass_class (ModelBuilder &);
      void join_points (Puma::CTranslationUnit &, ModelBuilder &, Plan &);

      // add references to the introduced elements to the plan
      void link_members (ACM_Class &jpl);
      // add references to the introduced base classes to the plan
      void link_bases (ACM_Class &jpl);
#ifdef FRONTEND_CLANG
      void reinitializeSourceManager(clang::CompilerInstance *ci,
          CodeWeaver &cwb, const char *name);
#else
      void update_touched_files ();
#endif

   public:

      Transformer (Puma::VerboseMgr &vm, ACErrorStream &e, ACProject &p, Repository &r,
                   ACConfig &c, LineDirectiveMgr &ldm):
        _vm (vm), _err (e), _project (p), _repo (r),
        _code_weaver (p, ldm, c),
#ifdef FRONTEND_PUMA
        _sem_visitor (e),
#endif
        _conf (c) {}
      ACFileID work (const string &tunit_name);
      list<AspectIncludeCluster> aspect_include_clusters () const { return _aspect_include_clusters; }
      const string &aspect_includes () const { return _aspect_includes; }
      const string &aspect_fwd_decls () const { return _aspect_fwd_decls; }
      const set<ACFileID> &touched_files () const { return _touched_files; }
 };

#endif // __Transformer_h__