Mercurial > projects > ldc
annotate dmd/init.h @ 1138:4c8bb03e4fbc
Update DtoConstFP() to be correct after LLVM r67562, which changed the way the
APFloat constructor expects its i80 APInts to be formatted. (They're now
actually consistent with the x87 format)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Tue, 24 Mar 2009 15:24:59 +0100 |
parents | eeb8b95ea92e |
children | 1860414bf3b7 |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2007 by Digital Mars | |
4 // All Rights Reserved | |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #ifndef INIT_H | |
12 #define INIT_H | |
13 | |
14 #include "root.h" | |
15 | |
16 #include "mars.h" | |
17 #include "arraytypes.h" | |
18 | |
19 struct Identifier; | |
20 struct Expression; | |
21 struct Scope; | |
22 struct Type; | |
23 struct dt_t; | |
24 struct AggregateDeclaration; | |
25 struct VoidInitializer; | |
19 | 26 struct StructInitializer; |
1 | 27 struct ArrayInitializer; |
28 struct ExpInitializer; | |
29 #ifdef _DH | |
30 struct HdrGenState; | |
31 #endif | |
32 | |
33 struct Initializer : Object | |
34 { | |
35 Loc loc; | |
36 | |
37 Initializer(Loc loc); | |
38 virtual Initializer *syntaxCopy(); | |
39 virtual Initializer *semantic(Scope *sc, Type *t); | |
40 virtual Type *inferType(Scope *sc); | |
41 virtual Expression *toExpression() = 0; | |
42 virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs) = 0; | |
43 char *toChars(); | |
44 | |
45 static Initializers *arraySyntaxCopy(Initializers *ai); | |
46 | |
47 virtual dt_t *toDt(); | |
48 | |
49 virtual VoidInitializer *isVoidInitializer() { return NULL; } | |
19 | 50 virtual StructInitializer *isStructInitializer() { return NULL; } |
1 | 51 virtual ArrayInitializer *isArrayInitializer() { return NULL; } |
52 virtual ExpInitializer *isExpInitializer() { return NULL; } | |
53 }; | |
54 | |
55 struct VoidInitializer : Initializer | |
56 { | |
57 Type *type; // type that this will initialize to | |
58 | |
59 VoidInitializer(Loc loc); | |
60 Initializer *syntaxCopy(); | |
61 Initializer *semantic(Scope *sc, Type *t); | |
62 Expression *toExpression(); | |
63 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
64 | |
65 dt_t *toDt(); | |
66 | |
67 virtual VoidInitializer *isVoidInitializer() { return this; } | |
68 }; | |
69 | |
70 struct StructInitializer : Initializer | |
71 { | |
72 Identifiers field; // of Identifier *'s | |
73 Initializers value; // parallel array of Initializer *'s | |
74 | |
75 Array vars; // parallel array of VarDeclaration *'s | |
76 AggregateDeclaration *ad; // which aggregate this is for | |
77 | |
78 StructInitializer(Loc loc); | |
79 Initializer *syntaxCopy(); | |
80 void addInit(Identifier *field, Initializer *value); | |
81 Initializer *semantic(Scope *sc, Type *t); | |
82 Expression *toExpression(); | |
83 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
84 | |
85 dt_t *toDt(); | |
86 | |
1133
eeb8b95ea92e
Cleanup DMD 1.041 merge.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
19
diff
changeset
|
87 StructInitializer *isStructInitializer() { return this; } |
1 | 88 }; |
89 | |
90 struct ArrayInitializer : Initializer | |
91 { | |
92 Expressions index; // indices | |
93 Initializers value; // of Initializer *'s | |
94 unsigned dim; // length of array being initialized | |
95 Type *type; // type that array will be used to initialize | |
96 int sem; // !=0 if semantic() is run | |
97 | |
98 ArrayInitializer(Loc loc); | |
99 Initializer *syntaxCopy(); | |
100 void addInit(Expression *index, Initializer *value); | |
101 Initializer *semantic(Scope *sc, Type *t); | |
102 Type *inferType(Scope *sc); | |
103 Expression *toExpression(); | |
104 Initializer *toAssocArrayInitializer(); | |
105 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
106 | |
107 dt_t *toDt(); | |
108 dt_t *toDtBit(); // for bit arrays | |
109 | |
110 ArrayInitializer *isArrayInitializer() { return this; } | |
111 }; | |
112 | |
113 struct ExpInitializer : Initializer | |
114 { | |
115 Expression *exp; | |
116 | |
117 ExpInitializer(Loc loc, Expression *exp); | |
118 Initializer *syntaxCopy(); | |
119 Initializer *semantic(Scope *sc, Type *t); | |
120 Type *inferType(Scope *sc); | |
121 Expression *toExpression(); | |
122 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
123 | |
124 dt_t *toDt(); | |
125 | |
126 virtual ExpInitializer *isExpInitializer() { return this; } | |
127 }; | |
128 | |
129 #endif |