annotate dmd/VoidInitializer.d @ 178:e3afd1303184

Many small bugs fixed Made all classes derive from TObject to detect memory leaks (functionality is disabled for now) Began work on overriding backend memory allocations (to avoid memory leaks)
author korDen
date Sun, 17 Oct 2010 07:42:00 +0400
parents af724d3510d7
children b0d41ff5e0df
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.VoidInitializer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 72
diff changeset
3 import dmd.common;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.Initializer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.Expression;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.backend.dt_t;
68
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
13 import dmd.backend.Util;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 class VoidInitializer : Initializer
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 Type type = null; // type that this will initialize to
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 this(Loc loc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 {
178
e3afd1303184 Many small bugs fixed
korDen
parents: 174
diff changeset
21 register();
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 super(loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
25 override Initializer syntaxCopy()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 {
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 0
diff changeset
27 return new VoidInitializer(loc);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
30 override Initializer semantic(Scope sc, Type t)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 //printf("VoidInitializer.semantic(t = %p)\n", t);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 type = t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
37 override Expression toExpression()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
42 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 {
174
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 114
diff changeset
44 buf.writestring("void");
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
47 override dt_t* toDt()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 {
68
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
49 /* Void initializers are set to 0, just because we need something
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
50 * to set them to in the static data segment.
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
51 */
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
52 dt_t *dt = null;
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
53
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
54 dtnzeros(&dt, cast(uint)type.size());
ee3a9f34dc48 final bits of codegen implementation to compile Phobos
korDen
parents: 51
diff changeset
55 return dt;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
58 override VoidInitializer isVoidInitializer() { return this; }
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 68
diff changeset
59 }