Mercurial > projects > ddmd
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 |
rev | line source |
---|---|
0 | 1 module dmd.TypeInfoDeclaration; |
2 | |
3 import dmd.VarDeclaration; | |
4 import dmd.Type; | |
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 | 7 import dmd.Scope; |
8 import dmd.Loc; | |
9 import dmd.STC; | |
79 | 10 import dmd.OutBuffer; |
0 | 11 import dmd.PROT; |
12 import dmd.LINK; | |
13 | |
14 import dmd.backend.Symbol; | |
15 import dmd.backend.dt_t; | |
16 import dmd.backend.DT; | |
17 import dmd.backend.SC; | |
18 import dmd.backend.FL; | |
19 import dmd.backend.glue; | |
20 import dmd.backend.Util; | |
21 import dmd.backend.TYPE; | |
72 | 22 |
0 | 23 import core.stdc.stdio; |
24 | |
25 class TypeInfoDeclaration : VarDeclaration | |
26 { | |
27 Type tinfo; | |
28 | |
29 this(Type tinfo, int internal) | |
30 { | |
31 super(Loc(0), Type.typeinfo.type, tinfo.getTypeInfoIdent(internal), null); | |
32 this.tinfo = tinfo; | |
33 storage_class = STC.STCstatic | STC.STCgshared; | |
34 protection = PROT.PROTpublic; | |
35 linkage = LINK.LINKc; | |
36 } | |
37 | |
38 version (DumbClone) { | |
39 } else { | |
40 Type clone() | |
41 { | |
42 assert(false); | |
43 } | |
44 } | |
72 | 45 override Dsymbol syntaxCopy(Dsymbol) |
0 | 46 { |
47 assert(false); | |
48 } | |
49 | |
72 | 50 override void semantic(Scope sc) |
0 | 51 { |
52 assert(false); | |
53 } | |
54 | |
72 | 55 override void emitComment(Scope sc) |
0 | 56 { |
57 assert(false); | |
58 } | |
59 | |
72 | 60 override Symbol* toSymbol() |
0 | 61 { |
62 //printf("TypeInfoDeclaration::toSymbol(%s), linkage = %d\n", toChars(), linkage); | |
63 return VarDeclaration.toSymbol(); | |
64 } | |
65 | |
79 | 66 override void toJsonBuffer(OutBuffer buf) |
67 { | |
68 } | |
69 | |
72 | 70 override void toObjFile(int multiobj) // compile to .obj file |
0 | 71 { |
72 Symbol* s; | |
73 uint sz; | |
74 Dsymbol parent; | |
75 | |
76 //printf("TypeInfoDeclaration.toObjFile(%p '%s') protection %d\n", this, toChars(), protection); | |
77 | |
78 if (multiobj) | |
79 { | |
80 obj_append(this); | |
81 return; | |
82 } | |
83 | |
84 s = toSymbol(); | |
85 sz = cast(uint)type.size(); | |
86 | |
87 parent = this.toParent(); | |
88 s.Sclass = SC.SCcomdat; | |
89 s.Sfl = FL.FLdata; | |
90 | |
91 toDt(&s.Sdt); | |
92 | |
93 dt_optimize(s.Sdt); | |
94 | |
95 // See if we can convert a comdat to a comdef, | |
96 // which saves on exe file space. | |
97 if (s.Sclass == SC.SCcomdat && | |
98 s.Sdt.dt == DT.DT_azeros && | |
99 s.Sdt.DTnext == null) | |
100 { | |
101 s.Sclass = SC.SCglobal; | |
102 s.Sdt.dt = DT.DT_common; | |
103 } | |
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 | 106 if (s.Sdt && s.Sdt.dt == DT_azeros && s.Sdt.DTnext == null) |
107 s.Sseg = Segment.UDATA; | |
108 else | |
109 s.Sseg = Segment.DATA; | |
110 } | |
111 outdata(s); | |
112 if (isExport()) | |
113 obj_export(s,0); | |
114 } | |
115 | |
116 void toDt(dt_t** pdt) | |
117 { | |
118 assert(false); | |
119 } | |
72 | 120 } |