-
-
Notifications
You must be signed in to change notification settings - Fork 267
Expand file tree
/
Copy pathEduCfrontTest7.expect
More file actions
155 lines (124 loc) · 3.14 KB
/
Copy pathEduCfrontTest7.expect
File metadata and controls
155 lines (124 loc) · 3.14 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*************************************************************************************
* NOTE: This an educational hand-rolled transformation. Things can be incorrect or *
* buggy. *
*************************************************************************************/
void __cxa_start(void);
void __cxa_atexit(void);
typedef int (*__vptp)();
struct __mptr
{
short d;
short i;
__vptp f;
};
extern struct __mptr* __vtbl_array[];
typedef struct Type
{
int tint;
int oint;
} Type;
inline Type * Constructor_Type(Type * __this, int v)
{
__this->tint = 7;
__this->oint = v;
return __this;
}
inline void Destructor_Type(Type * __this)
{
}
typedef struct DefaultCtorType
{
char __dummy;
} DefaultCtorType;
typedef struct Base
{
__mptr * __vptrBase;
Type mX;
} Base;
inline void Destructor_Base(Base * __this)
{
__this->__vptrBase = __vtbl_array[0];
}
inline Base * Constructor_Base(Base * __this)
{
__this->__vptrBase = __vtbl_array[0];
Constructor_Type(&__this->mX, 5);
return __this;
}
typedef struct BaseSecond
{
__mptr * __vptrBase;
Type mX;
Type mY;
} BaseSecond;
inline void Destructor_BaseSecond(BaseSecond * __this)
{
__this->__vptrBase = __vtbl_array[1];
Destructor_Base((Base *)__this);
}
inline BaseSecond * Constructor_BaseSecond(BaseSecond * __this)
{
Constructor_Base((Base *)__this);
__this->__vptrBase = __vtbl_array[1];
Constructor_Type(&__this->mY, 5);
return __this;
}
typedef struct BaseThird
{
__mptr * __vptrBaseThird;
Type mZ;
} BaseThird;
inline void Destructor_BaseThird(BaseThird * __this)
{
__this->__vptrBaseThird = __vtbl_array[2];
}
inline BaseThird * Constructor_BaseThird(BaseThird * __this)
{
__this->__vptrBaseThird = __vtbl_array[2];
Constructor_Type(&__this->mZ, 5);
return __this;
}
typedef struct Derived
{
__mptr * __vptrBase;
Type mX;
Type mY;
__mptr * __vptrBaseThird;
Type mZ;
double mD;
DefaultCtorType dt;
int g;
} Derived;
inline void Destructor_Derived(Derived * __this)
{
__this->__vptrBaseThird = __vtbl_array[4];
__this->__vptrBase = __vtbl_array[3];
__this->mD = 7;
Destructor_BaseThird((BaseThird *)__this);
Destructor_BaseSecond((BaseSecond *)__this);
}
inline Derived * Constructor_Derived(Derived * __this)
{
Constructor_BaseSecond((BaseSecond *)__this);
Constructor_BaseThird((BaseThird *)__this);
__this->__vptrBase = __vtbl_array[3];
__this->__vptrBaseThird = __vtbl_array[4];
/* dt // trivial type, maybe uninitialized */
__this->g = 4;
return __this;
}
Derived d;
__mptr __vtbl_Base[1] = {0, 0, (__vptp)Destructor_Base};
__mptr __vtbl_BaseSecond[1] = {0, 0, (__vptp)Destructor_BaseSecond};
__mptr __vtbl_BaseThird[1] = {0, 0, (__vptp)Destructor_BaseThird};
__mptr __vtbl_DerivedBaseSecond[1] = {0, 0, (__vptp)Destructor_Derived};
__mptr __vtbl_DerivedBaseThird[1] = {-24, 0, (__vptp)Destructor_Derived};
__mptr * __vtbl_array[5] = {__vtbl_Base, __vtbl_BaseSecond, __vtbl_BaseThird, __vtbl_DerivedBaseSecond, __vtbl_DerivedBaseThird};
void __cxa_start(void)
{
Constructor_Derived(&d);
}
void __cxa_atexit(void)
{
Destructor_Derived(&d);
}