Mercurial > projects > ldc
annotate dmd/declaration.h @ 1146:1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
* Added #if IN_DMD versioning around DMD backend specific code in the D1 frontend, D2 is currently broken.
* All part of a greater cleanup scheme.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Thu, 26 Mar 2009 20:45:53 +0100 |
parents | eeb8b95ea92e |
children | dbe4af57b240 |
rev | line source |
---|---|
159 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2008 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 DMD_DECLARATION_H | |
12 #define DMD_DECLARATION_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include <set> | |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
19 #include <map> |
443
44f08170f4ef
Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
378
diff
changeset
|
20 #include <string> |
159 | 21 |
22 #include "dsymbol.h" | |
23 #include "lexer.h" | |
24 #include "mtype.h" | |
25 | |
26 struct Expression; | |
27 struct Statement; | |
28 struct LabelDsymbol; | |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
29 struct LabelStatement; |
159 | 30 struct Initializer; |
31 struct Module; | |
32 struct InlineScanState; | |
33 struct ForeachStatement; | |
34 struct FuncDeclaration; | |
35 struct ExpInitializer; | |
36 struct StructDeclaration; | |
37 struct TupleType; | |
38 struct InterState; | |
39 struct IRState; | |
737
041c1596d217
Removed warnings on ignored aligns. Only do aligment on packed structs, align(1) struct Packed { ... }
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
732
diff
changeset
|
40 struct AnonDeclaration; |
159 | 41 |
42 enum PROT; | |
43 enum LINK; | |
44 enum TOK; | |
45 enum MATCH; | |
46 | |
47 enum STC | |
48 { | |
49 STCundefined = 0, | |
50 STCstatic = 1, | |
51 STCextern = 2, | |
52 STCconst = 4, | |
53 STCfinal = 8, | |
54 STCabstract = 0x10, | |
55 STCparameter = 0x20, | |
56 STCfield = 0x40, | |
57 STCoverride = 0x80, | |
58 STCauto = 0x100, | |
59 STCsynchronized = 0x200, | |
60 STCdeprecated = 0x400, | |
61 STCin = 0x800, // in parameter | |
62 STCout = 0x1000, // out parameter | |
63 STClazy = 0x2000, // lazy parameter | |
64 STCforeach = 0x4000, // variable for foreach loop | |
65 STCcomdat = 0x8000, // should go into COMDAT record | |
66 STCvariadic = 0x10000, // variadic function argument | |
67 STCctorinit = 0x20000, // can only be set inside constructor | |
68 STCtemplateparameter = 0x40000, // template parameter | |
69 STCscope = 0x80000, // template parameter | |
70 STCinvariant = 0x100000, | |
71 STCref = 0x200000, | |
72 STCinit = 0x400000, // has explicit initializer | |
73 STCmanifest = 0x800000, // manifest constant | |
74 STCnodtor = 0x1000000, // don't run destructor | |
75 STCnothrow = 0x2000000, // never throws exceptions | |
76 STCpure = 0x4000000, // pure function | |
77 STCtls = 0x8000000, // thread local | |
336 | 78 STCalias = 0x10000000, // alias parameter |
159 | 79 }; |
80 | |
81 struct Match | |
82 { | |
83 int count; // number of matches found | |
84 MATCH last; // match level of lastf | |
85 FuncDeclaration *lastf; // last matching function we found | |
86 FuncDeclaration *nextf; // current matching function | |
87 FuncDeclaration *anyf; // pick a func, any func, to use for error recovery | |
88 }; | |
89 | |
90 void overloadResolveX(Match *m, FuncDeclaration *f, Expressions *arguments); | |
91 int overloadApply(FuncDeclaration *fstart, | |
92 int (*fp)(void *, FuncDeclaration *), | |
93 void *param); | |
94 | |
95 /**************************************************************/ | |
96 | |
97 struct Declaration : Dsymbol | |
98 { | |
99 Type *type; | |
100 Type *originalType; // before semantic analysis | |
101 unsigned storage_class; | |
102 enum PROT protection; | |
103 enum LINK linkage; | |
104 | |
105 Declaration(Identifier *id); | |
106 void semantic(Scope *sc); | |
336 | 107 const char *kind(); |
159 | 108 unsigned size(Loc loc); |
109 void checkModify(Loc loc, Scope *sc, Type *t); | |
110 | |
111 void emitComment(Scope *sc); | |
112 void toDocBuffer(OutBuffer *buf); | |
113 | |
114 char *mangle(); | |
115 int isStatic() { return storage_class & STCstatic; } | |
116 virtual int isStaticConstructor(); | |
117 virtual int isStaticDestructor(); | |
118 virtual int isDelete(); | |
119 virtual int isDataseg(); | |
120 virtual int isCodeseg(); | |
121 int isCtorinit() { return storage_class & STCctorinit; } | |
122 int isFinal() { return storage_class & STCfinal; } | |
123 int isAbstract() { return storage_class & STCabstract; } | |
124 int isConst() { return storage_class & STCconst; } | |
125 int isInvariant() { return 0; } | |
126 int isAuto() { return storage_class & STCauto; } | |
127 int isScope() { return storage_class & (STCscope | STCauto); } | |
128 int isSynchronized() { return storage_class & STCsynchronized; } | |
129 int isParameter() { return storage_class & STCparameter; } | |
130 int isDeprecated() { return storage_class & STCdeprecated; } | |
131 int isOverride() { return storage_class & STCoverride; } | |
132 | |
133 int isIn() { return storage_class & STCin; } | |
134 int isOut() { return storage_class & STCout; } | |
135 int isRef() { return storage_class & STCref; } | |
136 | |
137 enum PROT prot(); | |
138 | |
139 Declaration *isDeclaration() { return this; } | |
140 | |
141 // llvm | |
751
dc8b8b7ea0c1
Fix compile-time warnings. Adjust include in d-asm-i386.
Christian Kamm <kamm incasoftware de>
parents:
737
diff
changeset
|
142 virtual void toObjFile(int unused = 0); // compile to .obj file |
159 | 143 }; |
144 | |
145 /**************************************************************/ | |
146 | |
147 struct TupleDeclaration : Declaration | |
148 { | |
149 Objects *objects; | |
150 int isexp; // 1: expression tuple | |
151 | |
152 TypeTuple *tupletype; // !=NULL if this is a type tuple | |
153 | |
154 TupleDeclaration(Loc loc, Identifier *ident, Objects *objects); | |
155 Dsymbol *syntaxCopy(Dsymbol *); | |
336 | 156 const char *kind(); |
159 | 157 Type *getType(); |
158 int needThis(); | |
159 | |
160 TupleDeclaration *isTupleDeclaration() { return this; } | |
732
6aeaef263289
Fixed tuple fields, thanx downs
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
703
diff
changeset
|
161 |
6aeaef263289
Fixed tuple fields, thanx downs
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
703
diff
changeset
|
162 // LDC we need this |
6aeaef263289
Fixed tuple fields, thanx downs
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
703
diff
changeset
|
163 void toObjFile(int multiobj); // compile to .obj file |
159 | 164 }; |
165 | |
166 /**************************************************************/ | |
167 | |
168 struct TypedefDeclaration : Declaration | |
169 { | |
170 Type *basetype; | |
171 Initializer *init; | |
172 int sem; // 0: semantic() has not been run | |
173 // 1: semantic() is in progress | |
174 // 2: semantic() has been run | |
175 // 3: semantic2() has been run | |
176 int inuse; // used to detect typedef cycles | |
177 | |
178 TypedefDeclaration(Loc loc, Identifier *ident, Type *basetype, Initializer *init); | |
179 Dsymbol *syntaxCopy(Dsymbol *); | |
180 void semantic(Scope *sc); | |
181 void semantic2(Scope *sc); | |
182 char *mangle(); | |
336 | 183 const char *kind(); |
159 | 184 Type *getType(); |
185 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
186 #ifdef _DH | |
187 Type *htype; | |
188 Type *hbasetype; | |
189 #endif | |
190 | |
191 void toDocBuffer(OutBuffer *buf); | |
192 | |
336 | 193 void toObjFile(int multiobj); // compile to .obj file |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
194 #if IN_DMD |
159 | 195 void toDebug(); |
196 int cvMember(unsigned char *p); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
197 #endif |
159 | 198 |
199 TypedefDeclaration *isTypedefDeclaration() { return this; } | |
200 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
201 #if IN_DMD |
159 | 202 Symbol *sinit; |
203 Symbol *toInitializer(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
204 #endif |
159 | 205 }; |
206 | |
207 /**************************************************************/ | |
208 | |
209 struct AliasDeclaration : Declaration | |
210 { | |
211 Dsymbol *aliassym; | |
212 Dsymbol *overnext; // next in overload list | |
213 int inSemantic; | |
214 | |
215 AliasDeclaration(Loc loc, Identifier *ident, Type *type); | |
216 AliasDeclaration(Loc loc, Identifier *ident, Dsymbol *s); | |
217 Dsymbol *syntaxCopy(Dsymbol *); | |
218 void semantic(Scope *sc); | |
219 int overloadInsert(Dsymbol *s); | |
336 | 220 const char *kind(); |
159 | 221 Type *getType(); |
222 Dsymbol *toAlias(); | |
223 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
224 #ifdef _DH | |
225 Type *htype; | |
226 Dsymbol *haliassym; | |
227 #endif | |
228 | |
229 void toDocBuffer(OutBuffer *buf); | |
230 | |
231 AliasDeclaration *isAliasDeclaration() { return this; } | |
232 }; | |
233 | |
234 /**************************************************************/ | |
235 | |
236 struct VarDeclaration : Declaration | |
237 { | |
238 Initializer *init; | |
239 unsigned offset; | |
240 int noauto; // no auto semantics | |
241 int nestedref; // referenced by a lexically nested function | |
242 int inuse; | |
243 int ctorinit; // it has been initialized in a ctor | |
244 int onstack; // 1: it has been allocated on the stack | |
245 // 2: on stack, run destructor anyway | |
246 int canassign; // it can be assigned to | |
247 Dsymbol *aliassym; // if redone as alias to another symbol | |
248 Expression *value; // when interpreting, this is the value | |
249 // (NULL if value not determinable) | |
250 | |
251 VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init); | |
252 Dsymbol *syntaxCopy(Dsymbol *); | |
253 void semantic(Scope *sc); | |
254 void semantic2(Scope *sc); | |
336 | 255 const char *kind(); |
159 | 256 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
257 #ifdef _DH | |
258 Type *htype; | |
259 Initializer *hinit; | |
260 #endif | |
261 int needThis(); | |
262 int isImportedSymbol(); | |
263 int isDataseg(); | |
264 int hasPointers(); | |
265 Expression *callAutoDtor(); | |
266 ExpInitializer *getExpInitializer(); | |
267 void checkCtorConstInit(); | |
268 void checkNestedReference(Scope *sc, Loc loc); | |
269 Dsymbol *toAlias(); | |
270 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
271 void toObjFile(int multiobj); // compile to .obj file |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
272 #if IN_DMD |
159 | 273 Symbol *toSymbol(); |
274 int cvMember(unsigned char *p); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
275 #endif |
159 | 276 |
277 // Eliminate need for dynamic_cast | |
278 VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; } | |
737
041c1596d217
Removed warnings on ignored aligns. Only do aligment on packed structs, align(1) struct Packed { ... }
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
732
diff
changeset
|
279 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
280 #if IN_LLVM |
737
041c1596d217
Removed warnings on ignored aligns. Only do aligment on packed structs, align(1) struct Packed { ... }
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
732
diff
changeset
|
281 // LDC |
041c1596d217
Removed warnings on ignored aligns. Only do aligment on packed structs, align(1) struct Packed { ... }
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
732
diff
changeset
|
282 AnonDeclaration* anonDecl; |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
751
diff
changeset
|
283 unsigned offset2; |
920
545f54041d91
Implemented proper support for naked asm using llvm module level asm. Still not 100% complete, but already 1000 times better that what we had before. Don's BignumX86 implementation from Tango (when turned into a standalone unittest) seems to fully work with no changes, and great performance :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
913
diff
changeset
|
284 bool nakedUse; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
285 #endif |
159 | 286 }; |
287 | |
288 /**************************************************************/ | |
289 | |
913
29c0d1194033
Fix #198 and #199 by making CTFE on static struct initializers work.
Christian Kamm <kamm incasoftware de>
parents:
846
diff
changeset
|
290 // LDC uses this to denote static struct initializers |
159 | 291 |
913
29c0d1194033
Fix #198 and #199 by making CTFE on static struct initializers work.
Christian Kamm <kamm incasoftware de>
parents:
846
diff
changeset
|
292 struct StaticStructInitDeclaration : Declaration |
159 | 293 { |
294 StructDeclaration *dsym; | |
295 | |
913
29c0d1194033
Fix #198 and #199 by making CTFE on static struct initializers work.
Christian Kamm <kamm incasoftware de>
parents:
846
diff
changeset
|
296 StaticStructInitDeclaration(Loc loc, StructDeclaration *dsym); |
159 | 297 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
298 #if IN_DMD |
159 | 299 Symbol *toSymbol(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
300 #endif |
159 | 301 |
302 // Eliminate need for dynamic_cast | |
913
29c0d1194033
Fix #198 and #199 by making CTFE on static struct initializers work.
Christian Kamm <kamm incasoftware de>
parents:
846
diff
changeset
|
303 StaticStructInitDeclaration *isStaticStructInitDeclaration() { return (StaticStructInitDeclaration *)this; } |
159 | 304 }; |
305 | |
306 struct ClassInfoDeclaration : VarDeclaration | |
307 { | |
308 ClassDeclaration *cd; | |
309 | |
310 ClassInfoDeclaration(ClassDeclaration *cd); | |
311 Dsymbol *syntaxCopy(Dsymbol *); | |
312 void semantic(Scope *sc); | |
313 | |
314 void emitComment(Scope *sc); | |
315 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
316 #if IN_DMD |
159 | 317 Symbol *toSymbol(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
318 #endif |
159 | 319 |
320 ClassInfoDeclaration* isClassInfoDeclaration() { return this; } | |
321 }; | |
322 | |
323 struct ModuleInfoDeclaration : VarDeclaration | |
324 { | |
325 Module *mod; | |
326 | |
327 ModuleInfoDeclaration(Module *mod); | |
328 Dsymbol *syntaxCopy(Dsymbol *); | |
329 void semantic(Scope *sc); | |
330 | |
331 void emitComment(Scope *sc); | |
332 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
333 #if IN_DMD |
159 | 334 Symbol *toSymbol(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
335 #endif |
159 | 336 }; |
337 | |
338 struct TypeInfoDeclaration : VarDeclaration | |
339 { | |
340 Type *tinfo; | |
341 | |
342 TypeInfoDeclaration(Type *tinfo, int internal); | |
343 Dsymbol *syntaxCopy(Dsymbol *); | |
344 void semantic(Scope *sc); | |
345 | |
346 void emitComment(Scope *sc); | |
347 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
348 void toObjFile(int multiobj); // compile to .obj file |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
349 #if IN_DMD |
159 | 350 Symbol *toSymbol(); |
351 virtual void toDt(dt_t **pdt); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
352 #endif |
159 | 353 |
354 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; } | |
355 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
356 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
357 // LDC |
159 | 358 virtual void llvmDeclare(); |
359 virtual void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
360 #endif |
159 | 361 }; |
362 | |
363 struct TypeInfoStructDeclaration : TypeInfoDeclaration | |
364 { | |
365 TypeInfoStructDeclaration(Type *tinfo); | |
366 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
367 #if IN_DMD |
159 | 368 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
369 #endif |
159 | 370 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
371 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
372 // LDC |
159 | 373 void llvmDeclare(); |
374 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
375 #endif |
159 | 376 }; |
377 | |
378 struct TypeInfoClassDeclaration : TypeInfoDeclaration | |
379 { | |
380 TypeInfoClassDeclaration(Type *tinfo); | |
381 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
382 #if IN_DMD |
159 | 383 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
384 #endif |
159 | 385 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
386 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
387 // LDC |
159 | 388 void llvmDeclare(); |
389 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
390 #endif |
159 | 391 }; |
392 | |
393 struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration | |
394 { | |
395 TypeInfoInterfaceDeclaration(Type *tinfo); | |
396 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
397 #if IN_DMD |
159 | 398 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
399 #endif |
159 | 400 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
401 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
402 // LDC |
159 | 403 void llvmDeclare(); |
404 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
405 #endif |
159 | 406 }; |
407 | |
408 struct TypeInfoTypedefDeclaration : TypeInfoDeclaration | |
409 { | |
410 TypeInfoTypedefDeclaration(Type *tinfo); | |
411 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
412 #if IN_DMD |
159 | 413 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
414 #endif |
159 | 415 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
416 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
417 // LDC |
159 | 418 void llvmDeclare(); |
419 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
420 #endif |
159 | 421 }; |
422 | |
423 struct TypeInfoPointerDeclaration : TypeInfoDeclaration | |
424 { | |
425 TypeInfoPointerDeclaration(Type *tinfo); | |
426 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
427 #if IN_DMD |
159 | 428 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
429 #endif |
159 | 430 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
431 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
432 // LDC |
159 | 433 void llvmDeclare(); |
434 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
435 #endif |
159 | 436 }; |
437 | |
438 struct TypeInfoArrayDeclaration : TypeInfoDeclaration | |
439 { | |
440 TypeInfoArrayDeclaration(Type *tinfo); | |
441 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
442 #if IN_DMD |
159 | 443 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
444 #endif |
159 | 445 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
446 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
447 // LDC |
159 | 448 void llvmDeclare(); |
449 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
450 #endif |
159 | 451 }; |
452 | |
453 struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration | |
454 { | |
455 TypeInfoStaticArrayDeclaration(Type *tinfo); | |
456 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
457 #if IN_DMD |
159 | 458 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
459 #endif |
159 | 460 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
461 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
462 // LDC |
159 | 463 void llvmDeclare(); |
464 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
465 #endif |
159 | 466 }; |
467 | |
468 struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration | |
469 { | |
470 TypeInfoAssociativeArrayDeclaration(Type *tinfo); | |
471 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
472 #if IN_DMD |
159 | 473 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
474 #endif |
159 | 475 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
476 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
477 // LDC |
159 | 478 void llvmDeclare(); |
479 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
480 #endif |
159 | 481 }; |
482 | |
483 struct TypeInfoEnumDeclaration : TypeInfoDeclaration | |
484 { | |
485 TypeInfoEnumDeclaration(Type *tinfo); | |
486 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
487 #if IN_DMD |
159 | 488 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
489 #endif |
159 | 490 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
491 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
492 // LDC |
159 | 493 void llvmDeclare(); |
494 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
495 #endif |
159 | 496 }; |
497 | |
498 struct TypeInfoFunctionDeclaration : TypeInfoDeclaration | |
499 { | |
500 TypeInfoFunctionDeclaration(Type *tinfo); | |
501 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
502 #if IN_DMD |
159 | 503 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
504 #endif |
159 | 505 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
506 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
507 // LDC |
159 | 508 void llvmDeclare(); |
509 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
510 #endif |
159 | 511 }; |
512 | |
513 struct TypeInfoDelegateDeclaration : TypeInfoDeclaration | |
514 { | |
515 TypeInfoDelegateDeclaration(Type *tinfo); | |
516 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
517 #if IN_DMD |
159 | 518 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
519 #endif |
159 | 520 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
521 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
522 // LDC |
159 | 523 void llvmDeclare(); |
524 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
525 #endif |
159 | 526 }; |
527 | |
528 struct TypeInfoTupleDeclaration : TypeInfoDeclaration | |
529 { | |
530 TypeInfoTupleDeclaration(Type *tinfo); | |
531 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
532 #if IN_DMD |
159 | 533 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
534 #endif |
159 | 535 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
536 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
537 // LDC |
159 | 538 void llvmDeclare(); |
539 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
540 #endif |
159 | 541 }; |
542 | |
336 | 543 #if DMDV2 |
544 struct TypeInfoConstDeclaration : TypeInfoDeclaration | |
545 { | |
546 TypeInfoConstDeclaration(Type *tinfo); | |
547 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
548 #if IN_DMD |
336 | 549 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
550 #endif |
336 | 551 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
552 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
553 // LDC |
336 | 554 void llvmDeclare(); |
555 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
556 #endif |
336 | 557 }; |
558 | |
559 struct TypeInfoInvariantDeclaration : TypeInfoDeclaration | |
560 { | |
561 TypeInfoInvariantDeclaration(Type *tinfo); | |
562 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
563 #if IN_DMD |
336 | 564 void toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
565 #endif |
336 | 566 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
567 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
568 // LDC |
336 | 569 void llvmDeclare(); |
570 void llvmDefine(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
571 #endif |
336 | 572 }; |
573 #endif | |
574 | |
575 /**************************************************************/ | |
576 | |
159 | 577 struct ThisDeclaration : VarDeclaration |
578 { | |
579 ThisDeclaration(Type *t); | |
580 Dsymbol *syntaxCopy(Dsymbol *); | |
581 }; | |
582 | |
583 enum ILS | |
584 { | |
585 ILSuninitialized, // not computed yet | |
586 ILSno, // cannot inline | |
587 ILSyes, // can inline | |
588 }; | |
589 | |
590 /**************************************************************/ | |
336 | 591 #if DMDV2 |
159 | 592 |
593 enum BUILTIN | |
594 { | |
595 BUILTINunknown = -1, // not known if this is a builtin | |
596 BUILTINnot, // this is not a builtin | |
597 BUILTINsin, // std.math.sin | |
598 BUILTINcos, // std.math.cos | |
599 BUILTINtan, // std.math.tan | |
600 BUILTINsqrt, // std.math.sqrt | |
601 BUILTINfabs, // std.math.fabs | |
602 }; | |
603 | |
604 Expression *eval_builtin(enum BUILTIN builtin, Expressions *arguments); | |
605 | |
606 #endif | |
607 | |
608 struct FuncDeclaration : Declaration | |
609 { | |
610 Array *fthrows; // Array of Type's of exceptions (not used) | |
611 Statement *frequire; | |
612 Statement *fensure; | |
613 Statement *fbody; | |
614 | |
615 Identifier *outId; // identifier for out statement | |
616 VarDeclaration *vresult; // variable corresponding to outId | |
617 LabelDsymbol *returnLabel; // where the return goes | |
618 | |
619 DsymbolTable *localsymtab; // used to prevent symbols in different | |
620 // scopes from having the same name | |
621 VarDeclaration *vthis; // 'this' parameter (member and nested) | |
622 VarDeclaration *v_arguments; // '_arguments' parameter | |
623 #if IN_GCC | |
624 VarDeclaration *v_argptr; // '_argptr' variable | |
625 #endif | |
626 Dsymbols *parameters; // Array of VarDeclaration's for parameters | |
627 DsymbolTable *labtab; // statement label symbol table | |
628 Declaration *overnext; // next in overload list | |
629 Loc endloc; // location of closing curly bracket | |
630 int vtblIndex; // for member functions, index into vtbl[] | |
631 int naked; // !=0 if naked | |
632 int inlineAsm; // !=0 if has inline assembler | |
633 ILS inlineStatus; | |
634 int inlineNest; // !=0 if nested inline | |
635 int cantInterpret; // !=0 if cannot interpret function | |
636 int semanticRun; // !=0 if semantic3() had been run | |
637 // this function's frame ptr | |
638 ForeachStatement *fes; // if foreach body, this is the foreach | |
639 int introducing; // !=0 if 'introducing' function | |
640 Type *tintro; // if !=NULL, then this is the type | |
641 // of the 'introducing' function | |
642 // this one is overriding | |
643 int inferRetType; // !=0 if return type is to be inferred | |
644 Scope *scope; // !=NULL means context to use | |
645 | |
646 // Things that should really go into Scope | |
647 int hasReturnExp; // 1 if there's a return exp; statement | |
648 // 2 if there's a throw statement | |
649 // 4 if there's an assert(0) | |
650 // 8 if there's inline asm | |
651 | |
652 // Support for NRVO (named return value optimization) | |
653 int nrvo_can; // !=0 means we can do it | |
654 VarDeclaration *nrvo_var; // variable to replace with shidden | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
655 #if IN_DMD |
159 | 656 Symbol *shidden; // hidden pointer passed to function |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
657 #endif |
159 | 658 |
336 | 659 #if DMDV2 |
159 | 660 enum BUILTIN builtin; // set if this is a known, builtin |
661 // function we can evaluate at compile | |
662 // time | |
663 | |
664 int tookAddressOf; // set if someone took the address of | |
665 // this function | |
666 Dsymbols closureVars; // local variables in this function | |
667 // which are referenced by nested | |
668 // functions | |
669 #else | |
670 int nestedFrameRef; // !=0 if nested variables referenced | |
671 #endif | |
672 | |
673 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type); | |
674 Dsymbol *syntaxCopy(Dsymbol *); | |
675 void semantic(Scope *sc); | |
676 void semantic2(Scope *sc); | |
677 void semantic3(Scope *sc); | |
678 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
679 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
680 int overrides(FuncDeclaration *fd); | |
681 int findVtblIndex(Array *vtbl, int dim); | |
682 int overloadInsert(Dsymbol *s); | |
683 FuncDeclaration *overloadExactMatch(Type *t); | |
684 FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments); | |
685 LabelDsymbol *searchLabel(Identifier *ident); | |
686 AggregateDeclaration *isThis(); | |
687 AggregateDeclaration *isMember2(); | |
688 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference | |
689 void appendExp(Expression *e); | |
690 void appendState(Statement *s); | |
691 char *mangle(); | |
692 int isMain(); | |
693 int isWinMain(); | |
694 int isDllMain(); | |
695 int isExport(); | |
696 int isImportedSymbol(); | |
697 int isAbstract(); | |
698 int isCodeseg(); | |
699 virtual int isNested(); | |
700 int needThis(); | |
701 virtual int isVirtual(); | |
846
bc982f1ad106
Merged DMD 1.037 frontend
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
797
diff
changeset
|
702 virtual int isFinal(); |
159 | 703 virtual int addPreInvariant(); |
704 virtual int addPostInvariant(); | |
705 Expression *interpret(InterState *istate, Expressions *arguments); | |
706 void inlineScan(); | |
707 int canInline(int hasthis, int hdrscan = 0); | |
708 Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); | |
336 | 709 const char *kind(); |
159 | 710 void toDocBuffer(OutBuffer *buf); |
711 | |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
712 // LDC: give argument types to runtime functions |
1133
eeb8b95ea92e
Cleanup DMD 1.041 merge.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
945
diff
changeset
|
713 static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, const char *name); |
378
d8234836b40f
Get rid of runTimeHack and instead add proper argument info to the frontend
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
714 static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, Identifier *id); |
159 | 715 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
716 #if IN_DMD |
159 | 717 Symbol *toSymbol(); |
718 Symbol *toThunkSymbol(int offset); // thunk version | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
719 #endif |
336 | 720 void toObjFile(int multiobj); // compile to .obj file |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
721 #if IN_DMD |
159 | 722 int cvMember(unsigned char *p); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
723 #endif |
159 | 724 |
725 FuncDeclaration *isFuncDeclaration() { return this; } | |
726 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
727 #if IN_LLVM |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
639
diff
changeset
|
728 // LDC stuff |
639
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
729 |
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
730 // vars declared in this function that nested funcs reference |
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
731 // is this is not empty, nestedFrameRef is set and these VarDecls |
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
732 // probably have nestedref set too, see VarDeclaration::checkNestedReference |
159 | 733 std::set<VarDeclaration*> nestedVars; |
639
8aebdf56c455
Move check for access of context for nested class from backend into frontend.
Christian Kamm <kamm incasoftware de>
parents:
468
diff
changeset
|
734 |
443
44f08170f4ef
Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
378
diff
changeset
|
735 std::string intrinsicName; |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
736 |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
443
diff
changeset
|
737 bool isIntrinsic(); |
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
443
diff
changeset
|
738 bool isVaIntrinsic(); |
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
443
diff
changeset
|
739 |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
740 // we keep our own table of label statements as LabelDsymbolS |
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
741 // don't always carry their corresponding statement along ... |
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
742 typedef std::map<const char*, LabelStatement*> LabelMap; |
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
159
diff
changeset
|
743 LabelMap labmap; |
703
06576ece1a1b
Changed premake.lua to work with mingw.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
744 |
06576ece1a1b
Changed premake.lua to work with mingw.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
745 // if this is an array operation it gets a little special attention |
06576ece1a1b
Changed premake.lua to work with mingw.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
663
diff
changeset
|
746 bool isArrayOp; |
945
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
920
diff
changeset
|
747 |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
920
diff
changeset
|
748 // true if overridden with the pragma(allow_inline); stmt |
03d7c4aac654
SWITCHED TO LLVM 2.5 !
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
920
diff
changeset
|
749 bool allowInlining; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
750 #endif |
159 | 751 }; |
752 | |
753 struct FuncAliasDeclaration : FuncDeclaration | |
754 { | |
755 FuncDeclaration *funcalias; | |
756 | |
757 FuncAliasDeclaration(FuncDeclaration *funcalias); | |
758 | |
759 FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
336 | 760 const char *kind(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
761 #if IN_DMD |
159 | 762 Symbol *toSymbol(); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1133
diff
changeset
|
763 #endif |
159 | 764 }; |
765 | |
766 struct FuncLiteralDeclaration : FuncDeclaration | |
767 { | |
768 enum TOK tok; // TOKfunction or TOKdelegate | |
769 | |
770 FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, | |
771 ForeachStatement *fes); | |
772 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
773 Dsymbol *syntaxCopy(Dsymbol *); | |
774 int isNested(); | |
336 | 775 int isVirtual(); |
159 | 776 |
777 FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
336 | 778 const char *kind(); |
159 | 779 }; |
780 | |
781 struct CtorDeclaration : FuncDeclaration | |
782 { Arguments *arguments; | |
783 int varargs; | |
784 | |
785 CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
786 Dsymbol *syntaxCopy(Dsymbol *); | |
787 void semantic(Scope *sc); | |
788 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 789 const char *kind(); |
159 | 790 char *toChars(); |
791 int isVirtual(); | |
792 int addPreInvariant(); | |
793 int addPostInvariant(); | |
794 void toDocBuffer(OutBuffer *buf); | |
795 | |
796 CtorDeclaration *isCtorDeclaration() { return this; } | |
797 }; | |
798 | |
336 | 799 #if DMDV2 |
800 struct PostBlitDeclaration : FuncDeclaration | |
801 { | |
802 PostBlitDeclaration(Loc loc, Loc endloc); | |
803 PostBlitDeclaration(Loc loc, Loc endloc, Identifier *id); | |
804 Dsymbol *syntaxCopy(Dsymbol *); | |
805 void semantic(Scope *sc); | |
806 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
807 int isVirtual(); | |
808 int addPreInvariant(); | |
809 int addPostInvariant(); | |
810 int overloadInsert(Dsymbol *s); | |
811 void emitComment(Scope *sc); | |
812 | |
813 PostBlitDeclaration *isPostBlitDeclaration() { return this; } | |
814 }; | |
815 #endif | |
816 | |
159 | 817 struct DtorDeclaration : FuncDeclaration |
818 { | |
819 DtorDeclaration(Loc loc, Loc endloc); | |
820 DtorDeclaration(Loc loc, Loc endloc, Identifier *id); | |
821 Dsymbol *syntaxCopy(Dsymbol *); | |
822 void semantic(Scope *sc); | |
823 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
824 int isVirtual(); | |
825 int addPreInvariant(); | |
826 int addPostInvariant(); | |
827 int overloadInsert(Dsymbol *s); | |
828 void emitComment(Scope *sc); | |
829 | |
830 DtorDeclaration *isDtorDeclaration() { return this; } | |
831 }; | |
832 | |
833 struct StaticCtorDeclaration : FuncDeclaration | |
834 { | |
835 StaticCtorDeclaration(Loc loc, Loc endloc); | |
836 Dsymbol *syntaxCopy(Dsymbol *); | |
837 void semantic(Scope *sc); | |
838 AggregateDeclaration *isThis(); | |
839 int isStaticConstructor(); | |
840 int isVirtual(); | |
841 int addPreInvariant(); | |
842 int addPostInvariant(); | |
843 void emitComment(Scope *sc); | |
844 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
845 | |
846 StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } | |
847 }; | |
848 | |
849 struct StaticDtorDeclaration : FuncDeclaration | |
336 | 850 { VarDeclaration *vgate; // 'gate' variable |
851 | |
159 | 852 StaticDtorDeclaration(Loc loc, Loc endloc); |
853 Dsymbol *syntaxCopy(Dsymbol *); | |
854 void semantic(Scope *sc); | |
855 AggregateDeclaration *isThis(); | |
856 int isStaticDestructor(); | |
857 int isVirtual(); | |
858 int addPreInvariant(); | |
859 int addPostInvariant(); | |
860 void emitComment(Scope *sc); | |
861 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
862 | |
863 StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } | |
864 }; | |
865 | |
866 struct InvariantDeclaration : FuncDeclaration | |
867 { | |
868 InvariantDeclaration(Loc loc, Loc endloc); | |
869 Dsymbol *syntaxCopy(Dsymbol *); | |
870 void semantic(Scope *sc); | |
871 int isVirtual(); | |
872 int addPreInvariant(); | |
873 int addPostInvariant(); | |
874 void emitComment(Scope *sc); | |
875 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
876 | |
877 InvariantDeclaration *isInvariantDeclaration() { return this; } | |
878 }; | |
879 | |
880 | |
881 struct UnitTestDeclaration : FuncDeclaration | |
882 { | |
883 UnitTestDeclaration(Loc loc, Loc endloc); | |
884 Dsymbol *syntaxCopy(Dsymbol *); | |
885 void semantic(Scope *sc); | |
886 AggregateDeclaration *isThis(); | |
887 int isVirtual(); | |
888 int addPreInvariant(); | |
889 int addPostInvariant(); | |
890 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
891 | |
892 UnitTestDeclaration *isUnitTestDeclaration() { return this; } | |
893 }; | |
894 | |
895 struct NewDeclaration : FuncDeclaration | |
896 { Arguments *arguments; | |
897 int varargs; | |
898 | |
899 NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); | |
900 Dsymbol *syntaxCopy(Dsymbol *); | |
901 void semantic(Scope *sc); | |
902 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 903 const char *kind(); |
159 | 904 int isVirtual(); |
905 int addPreInvariant(); | |
906 int addPostInvariant(); | |
907 | |
908 NewDeclaration *isNewDeclaration() { return this; } | |
909 }; | |
910 | |
911 | |
912 struct DeleteDeclaration : FuncDeclaration | |
913 { Arguments *arguments; | |
914 | |
915 DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); | |
916 Dsymbol *syntaxCopy(Dsymbol *); | |
917 void semantic(Scope *sc); | |
918 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 919 const char *kind(); |
159 | 920 int isDelete(); |
921 int isVirtual(); | |
922 int addPreInvariant(); | |
923 int addPostInvariant(); | |
924 #ifdef _DH | |
925 DeleteDeclaration *isDeleteDeclaration() { return this; } | |
926 #endif | |
927 }; | |
928 | |
929 #endif /* DMD_DECLARATION_H */ |