-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcallback.cpp
109 lines (96 loc) · 1.92 KB
/
callback.cpp
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
/*
*
*/
#include <iostream>
#include <vector>
#include <gcc-plugin.h>
#include <coretypes.h>
#include <tree.h>
#include "record_context.hpp"
#include <string.h>
#include "introspection.hpp"
#include "callback.hpp"
#include "callbacks.hpp"
using namespace std;
union tree_node;
typedef union tree_node *tree;
CallBack::CallBack ()
{
}
CallBack::~CallBack ()
{
}
void
CallBack::check_type (tree f)
{
if (!f)
return;
enum tree_code tc = f->typed.base.code;
CallBack *pT = callbacks[tc];
if (pT)
{
cerr << "ct(\"" << get_tree_code_name (tc) << "\")";
}
else
{
cerr << "no callback defined for tc (" << tc << ") ";
cerr << get_tree_code_name (tc);
}
// cerr << endl;
}
void
CallBack::finish_type (tree t)
{
cerr << "finish type :unhandled pure virtual : ";
check_type (t);
cerr << endl;
}
void
CallBack::finish_decl (tree t)
{
cerr << "finish decl :unhandled pure virtual : ";
check_type (t);
cerr << endl;
}
void
CallBack::finish_unit (tree t)
{
cerr << "finish unit:unhandled pure virtual : ";
enum tree_code tc = t->typed.base.code;
cerr << "check field tc (" << tc << ") ";
cerr << get_tree_code_name (tc) << endl;
}
void
CallBack::check ()
{
std::cerr << "base class" << std::endl;
}
int
CallBack::finish_type_callback (CallBack * c, tree_node * t)
{
std::cerr << "CallBack::finish_type_callback(";
CallBack::check_type (t);
if (c)
{
std::cerr << ",call(finish_type(";
c->finish_type (t);
std::cerr << "))";
}
std::cerr << ")";
}
int
CallBack::finish_decl_callback (CallBack * c, tree_node * t)
{
std::
cerr << "CallBack::finish_decl_callback(CallBack:" << c << ",Node:" << t;
CallBack::check_type (t);
// if(c) c->finish_decl(t);
cerr << ")";
}
int
CallBack::finish_unit_callback (CallBack * c, tree_node * t)
{
std::cerr << "finish unit callback: " << c << " Node:" << t;
CallBack::check_type (t);
//if(c) c->finish_unit(t);
}