17
17
// MA 02111-1307 USA
19
19
#include "PointCutContext.h"
20
#include "TrackerDog.h"
21
20
#include "JoinPoint.h"
22
21
#include "IntroductionUnit.h"
22
#include "TransformInfo.h"
24
24
#include "Puma/ErrorStream.h"
25
25
#include "Puma/CFunctionInfo.h"
30
30
#include "Puma/CTree.h"
31
31
#include "Puma/Filter.h"
33
void PointCutContext::setup(CTranslationUnit& tunit) {
35
TrackerDog tracker (tunit, _world);
39
void PointCutContext::scopes (CTranslationUnit& tunit) {
40
CClassDatabase &db = tunit.db ();
42
for (unsigned int c = 0; c < db.ClassInfos (); c++) {
43
CClassInfo *ci = db.ClassInfo (c);
46
// * anonymous classes like template instances(?)
47
// * the generated class JoinPoint
48
// * classes defined in the special namespace AC
49
if (strncmp (ci->Name (), "%", 1) == 0 ||
50
strcmp (ci->QualName (), "JoinPoint") == 0 ||
51
strncmp (ci->QualName (), "AC::", 4) == 0)
54
// Templates and classes nested in template class are not considered for
55
// matching, only instances
57
bool in_template = false;
59
assert (oi->ClassInfo ());
60
if (oi->ClassInfo ()->insideTemplate ()) {
64
oi = oi->NextObject ();
69
ci = (CClassInfo*)TrackerDog::unique_object (ci);
71
ACAspectInfo *ai = db.AspectInfo (ci);
73
_world.new_aspect (ai);
75
_world.new_class (ci);
79
for (unsigned f = 0; f < db.FunctionInfos (); f++) {
80
CFunctionInfo *fi = db.FunctionInfo (f);
81
fi = TrackerDog::filter_func (fi);
84
fi = (CFunctionInfo*)TrackerDog::unique_object (fi);
86
_world.new_function (fi);
90
33
CFunctionInfo *PointCutContext::lookup_pointcut(ACAspectInfo *ai,
91
34
CFunctionInfo *fi) {
92
35
CFunctionInfo *result = 0;
154
97
// the class where the referenced pointcut is located in ...
155
98
CClassInfo *ref_class = func->ClassScope ()->ClassInfo ();
100
ACAspectInfo *ai = TI_Aspect::of (*_aspect)->aspect_info ();
157
101
// if the pointcut is declared virtual, find the real definition
158
if (ref_class != _aspect->ClassInfo () && func->isVirtual ()) {
159
result = lookup_pointcut (_aspect, func);
102
if (ref_class != ai->ClassInfo () && func->isVirtual ()) {
103
result = lookup_pointcut (ai, func);