annotate dmd/TypeInfoDeclaration.d @ 79:43073c7c7769

updated to 2.035 also implemented a few missing functions still crashes in Import.importAll though
author Trass3r
date Mon, 30 Aug 2010 03:57:51 +0200
parents 2e2a5c3f943a
children 8e1e220cebb3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.TypeInfoDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 import dmd.VarDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.Dsymbol;
22
fd4acc376c45 Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
6 import dmd.Module;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.STC;
79
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
10 import dmd.OutBuffer;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 import dmd.PROT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.LINK;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.backend.Symbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.backend.dt_t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.backend.DT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.backend.SC;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 import dmd.backend.FL;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 import dmd.backend.glue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 import dmd.backend.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 import dmd.backend.TYPE;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 22
diff changeset
22
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 import core.stdc.stdio;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 class TypeInfoDeclaration : VarDeclaration
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 Type tinfo;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 this(Type tinfo, int internal)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 super(Loc(0), Type.typeinfo.type, tinfo.getTypeInfoIdent(internal), null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 this.tinfo = tinfo;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 storage_class = STC.STCstatic | STC.STCgshared;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 protection = PROT.PROTpublic;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 linkage = LINK.LINKc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 version (DumbClone) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 } else {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 Type clone()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 22
diff changeset
45 override Dsymbol syntaxCopy(Dsymbol)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 22
diff changeset
50 override void semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 22
diff changeset
55 override void emitComment(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 22
diff changeset
60 override Symbol* toSymbol()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 //printf("TypeInfoDeclaration::toSymbol(%s), linkage = %d\n", toChars(), linkage);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 return VarDeclaration.toSymbol();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65
79
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
66 override void toJsonBuffer(OutBuffer buf)
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
67 {
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
68 }
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
69
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 22
diff changeset
70 override void toObjFile(int multiobj) // compile to .obj file
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 Symbol* s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 uint sz;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 Dsymbol parent;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 //printf("TypeInfoDeclaration.toObjFile(%p '%s') protection %d\n", this, toChars(), protection);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 if (multiobj)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 obj_append(this);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 return;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 s = toSymbol();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 sz = cast(uint)type.size();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 parent = this.toParent();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88 s.Sclass = SC.SCcomdat;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 s.Sfl = FL.FLdata;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 toDt(&s.Sdt);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 dt_optimize(s.Sdt);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 // See if we can convert a comdat to a comdef,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 // which saves on exe file space.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 if (s.Sclass == SC.SCcomdat &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 s.Sdt.dt == DT.DT_azeros &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 s.Sdt.DTnext == null)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 s.Sclass = SC.SCglobal;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 s.Sdt.dt = DT.DT_common;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104
22
fd4acc376c45 Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
105 version (ELFOBJ_OR_MACHOBJ) { ///ELFOBJ || MACHOBJ // Burton
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106 if (s.Sdt && s.Sdt.dt == DT_azeros && s.Sdt.DTnext == null)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 s.Sseg = Segment.UDATA;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 s.Sseg = Segment.DATA;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 outdata(s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 if (isExport())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 obj_export(s,0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 void toDt(dt_t** pdt)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 22
diff changeset
120 }