Mercurial > projects > ldc
annotate dmd/statement.h @ 81:3587401b6eeb trunk
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
Changed: Renamed all the LLVM_Dto... helper function to just Dto...
author | lindquist |
---|---|
date | Thu, 01 Nov 2007 17:27:18 +0100 |
parents | 77cdca8c210f |
children | fd32135dca3e |
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 DMD_STATEMENT_H | |
12 #define DMD_STATEMENT_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "root.h" | |
19 | |
20 #include "arraytypes.h" | |
21 #include "dsymbol.h" | |
22 #include "lexer.h" | |
23 | |
24 struct OutBuffer; | |
25 struct Scope; | |
26 struct Expression; | |
27 struct LabelDsymbol; | |
28 struct Identifier; | |
29 struct IfStatement; | |
30 struct DeclarationStatement; | |
31 struct DefaultStatement; | |
32 struct VarDeclaration; | |
33 struct Condition; | |
34 struct Module; | |
35 struct Token; | |
36 struct InlineCostState; | |
37 struct InlineDoState; | |
38 struct InlineScanState; | |
39 struct ReturnStatement; | |
40 struct CompoundStatement; | |
41 struct Argument; | |
42 struct StaticAssert; | |
43 struct AsmStatement; | |
44 struct GotoStatement; | |
45 struct ScopeStatement; | |
46 struct TryCatchStatement; | |
47 struct HdrGenState; | |
48 struct InterState; | |
49 | |
50 enum TOK; | |
51 | |
52 namespace llvm | |
53 { | |
37
77cdca8c210f
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
lindquist
parents:
1
diff
changeset
|
54 class Value; |
77cdca8c210f
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
lindquist
parents:
1
diff
changeset
|
55 class BasicBlock; |
1 | 56 } |
57 | |
58 // Back end | |
59 struct IRState; | |
60 struct Blockx; | |
61 #if IN_GCC | |
62 union tree_node; typedef union tree_node block; | |
63 union tree_node; typedef union tree_node elem; | |
64 #else | |
65 struct block; | |
66 struct elem; | |
67 #endif | |
68 struct code; | |
69 | |
70 struct Statement : Object | |
71 { | |
72 Loc loc; | |
73 | |
74 Statement(Loc loc); | |
75 virtual Statement *syntaxCopy(); | |
76 | |
77 void print(); | |
78 char *toChars(); | |
79 | |
80 void error(const char *format, ...); | |
81 virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
82 virtual TryCatchStatement *isTryCatchStatement() { return NULL; } | |
83 virtual GotoStatement *isGotoStatement() { return NULL; } | |
84 virtual AsmStatement *isAsmStatement() { return NULL; } | |
85 #ifdef _DH | |
86 int incontract; | |
87 #endif | |
88 virtual ScopeStatement *isScopeStatement() { return NULL; } | |
89 virtual Statement *semantic(Scope *sc); | |
90 Statement *semanticScope(Scope *sc, Statement *sbreak, Statement *scontinue); | |
91 virtual int hasBreak(); | |
92 virtual int hasContinue(); | |
93 virtual int usesEH(); | |
94 virtual int fallOffEnd(); | |
95 virtual int comeFrom(); | |
96 virtual void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
97 virtual Statements *flatten(Scope *sc); | |
98 virtual Expression *interpret(InterState *istate); | |
99 | |
100 virtual int inlineCost(InlineCostState *ics); | |
101 virtual Expression *doInline(InlineDoState *ids); | |
102 virtual Statement *inlineScan(InlineScanState *iss); | |
103 | |
104 // Back end | |
105 virtual void toIR(IRState *irs); | |
106 | |
107 // Avoid dynamic_cast | |
108 virtual DeclarationStatement *isDeclarationStatement() { return NULL; } | |
109 virtual CompoundStatement *isCompoundStatement() { return NULL; } | |
110 virtual ReturnStatement *isReturnStatement() { return NULL; } | |
111 virtual IfStatement *isIfStatement() { return NULL; } | |
112 }; | |
113 | |
114 struct ExpStatement : Statement | |
115 { | |
116 Expression *exp; | |
117 | |
118 ExpStatement(Loc loc, Expression *exp); | |
119 Statement *syntaxCopy(); | |
120 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
121 Statement *semantic(Scope *sc); | |
122 Expression *interpret(InterState *istate); | |
123 int fallOffEnd(); | |
124 | |
125 int inlineCost(InlineCostState *ics); | |
126 Expression *doInline(InlineDoState *ids); | |
127 Statement *inlineScan(InlineScanState *iss); | |
128 | |
129 void toIR(IRState *irs); | |
130 }; | |
131 | |
132 struct CompileStatement : Statement | |
133 { | |
134 Expression *exp; | |
135 | |
136 CompileStatement(Loc loc, Expression *exp); | |
137 Statement *syntaxCopy(); | |
138 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
139 Statement *semantic(Scope *sc); | |
140 }; | |
141 | |
142 struct DeclarationStatement : ExpStatement | |
143 { | |
144 // Doing declarations as an expression, rather than a statement, | |
145 // makes inlining functions much easier. | |
146 | |
147 DeclarationStatement(Loc loc, Dsymbol *s); | |
148 DeclarationStatement(Loc loc, Expression *exp); | |
149 Statement *syntaxCopy(); | |
150 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
151 void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
152 | |
153 DeclarationStatement *isDeclarationStatement() { return this; } | |
154 }; | |
155 | |
156 struct CompoundStatement : Statement | |
157 { | |
158 Statements *statements; | |
159 | |
160 CompoundStatement(Loc loc, Statements *s); | |
161 CompoundStatement(Loc loc, Statement *s1, Statement *s2); | |
162 Statement *syntaxCopy(); | |
163 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
164 Statement *semantic(Scope *sc); | |
165 int usesEH(); | |
166 int fallOffEnd(); | |
167 int comeFrom(); | |
168 Statements *flatten(Scope *sc); | |
169 ReturnStatement *isReturnStatement(); | |
170 Expression *interpret(InterState *istate); | |
171 | |
172 int inlineCost(InlineCostState *ics); | |
173 Expression *doInline(InlineDoState *ids); | |
174 Statement *inlineScan(InlineScanState *iss); | |
175 | |
176 void toIR(IRState *irs); | |
177 | |
178 CompoundStatement *isCompoundStatement() { return this; } | |
179 }; | |
180 | |
181 /* The purpose of this is so that continue will go to the next | |
182 * of the statements, and break will go to the end of the statements. | |
183 */ | |
184 struct UnrolledLoopStatement : Statement | |
185 { | |
186 Statements *statements; | |
187 | |
188 UnrolledLoopStatement(Loc loc, Statements *statements); | |
189 Statement *syntaxCopy(); | |
190 Statement *semantic(Scope *sc); | |
191 int hasBreak(); | |
192 int hasContinue(); | |
193 int usesEH(); | |
194 int fallOffEnd(); | |
195 int comeFrom(); | |
196 Expression *interpret(InterState *istate); | |
197 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
198 | |
199 int inlineCost(InlineCostState *ics); | |
200 Expression *doInline(InlineDoState *ids); | |
201 Statement *inlineScan(InlineScanState *iss); | |
202 | |
203 void toIR(IRState *irs); | |
204 }; | |
205 | |
206 struct ScopeStatement : Statement | |
207 { | |
208 Statement *statement; | |
209 | |
210 ScopeStatement(Loc loc, Statement *s); | |
211 Statement *syntaxCopy(); | |
212 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
213 ScopeStatement *isScopeStatement() { return this; } | |
214 Statement *semantic(Scope *sc); | |
215 int hasBreak(); | |
216 int hasContinue(); | |
217 int usesEH(); | |
218 int fallOffEnd(); | |
219 int comeFrom(); | |
220 Expression *interpret(InterState *istate); | |
221 | |
222 Statement *inlineScan(InlineScanState *iss); | |
223 | |
224 void toIR(IRState *irs); | |
225 }; | |
226 | |
227 struct WhileStatement : Statement | |
228 { | |
229 Expression *condition; | |
230 Statement *body; | |
231 | |
232 WhileStatement(Loc loc, Expression *c, Statement *b); | |
233 Statement *syntaxCopy(); | |
234 Statement *semantic(Scope *sc); | |
235 int hasBreak(); | |
236 int hasContinue(); | |
237 int usesEH(); | |
238 int fallOffEnd(); | |
239 int comeFrom(); | |
240 Expression *interpret(InterState *istate); | |
241 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
242 | |
243 Statement *inlineScan(InlineScanState *iss); | |
244 | |
245 void toIR(IRState *irs); | |
246 }; | |
247 | |
248 struct DoStatement : Statement | |
249 { | |
250 Statement *body; | |
251 Expression *condition; | |
252 | |
253 DoStatement(Loc loc, Statement *b, Expression *c); | |
254 Statement *syntaxCopy(); | |
255 Statement *semantic(Scope *sc); | |
256 int hasBreak(); | |
257 int hasContinue(); | |
258 int usesEH(); | |
259 int fallOffEnd(); | |
260 int comeFrom(); | |
261 Expression *interpret(InterState *istate); | |
262 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
263 | |
264 Statement *inlineScan(InlineScanState *iss); | |
265 | |
266 void toIR(IRState *irs); | |
267 }; | |
268 | |
269 struct ForStatement : Statement | |
270 { | |
271 Statement *init; | |
272 Expression *condition; | |
273 Expression *increment; | |
274 Statement *body; | |
275 | |
276 ForStatement(Loc loc, Statement *init, Expression *condition, Expression *increment, Statement *body); | |
277 Statement *syntaxCopy(); | |
278 Statement *semantic(Scope *sc); | |
279 void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
280 int hasBreak(); | |
281 int hasContinue(); | |
282 int usesEH(); | |
283 int fallOffEnd(); | |
284 int comeFrom(); | |
285 Expression *interpret(InterState *istate); | |
286 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
287 | |
288 Statement *inlineScan(InlineScanState *iss); | |
289 | |
290 void toIR(IRState *irs); | |
291 }; | |
292 | |
293 struct ForeachStatement : Statement | |
294 { | |
295 enum TOK op; // TOKforeach or TOKforeach_reverse | |
296 Arguments *arguments; // array of Argument*'s | |
297 Expression *aggr; | |
298 Statement *body; | |
299 | |
300 VarDeclaration *key; | |
301 VarDeclaration *value; | |
302 | |
303 FuncDeclaration *func; // function we're lexically in | |
304 | |
305 Array cases; // put breaks, continues, gotos and returns here | |
306 Array gotos; // forward referenced goto's go here | |
307 | |
308 ForeachStatement(Loc loc, enum TOK op, Arguments *arguments, Expression *aggr, Statement *body); | |
309 Statement *syntaxCopy(); | |
310 Statement *semantic(Scope *sc); | |
311 int hasBreak(); | |
312 int hasContinue(); | |
313 int usesEH(); | |
314 int fallOffEnd(); | |
315 int comeFrom(); | |
316 Expression *interpret(InterState *istate); | |
317 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
318 | |
319 Statement *inlineScan(InlineScanState *iss); | |
320 | |
321 void toIR(IRState *irs); | |
322 }; | |
323 | |
324 struct IfStatement : Statement | |
325 { | |
326 Argument *arg; | |
327 Expression *condition; | |
328 Statement *ifbody; | |
329 Statement *elsebody; | |
330 | |
331 VarDeclaration *match; // for MatchExpression results | |
332 | |
333 IfStatement(Loc loc, Argument *arg, Expression *condition, Statement *ifbody, Statement *elsebody); | |
334 Statement *syntaxCopy(); | |
335 Statement *semantic(Scope *sc); | |
336 Expression *interpret(InterState *istate); | |
337 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
338 int usesEH(); | |
339 int fallOffEnd(); | |
340 IfStatement *isIfStatement() { return this; } | |
341 | |
342 int inlineCost(InlineCostState *ics); | |
343 Expression *doInline(InlineDoState *ids); | |
344 Statement *inlineScan(InlineScanState *iss); | |
345 | |
346 void toIR(IRState *irs); | |
347 }; | |
348 | |
349 struct ConditionalStatement : Statement | |
350 { | |
351 Condition *condition; | |
352 Statement *ifbody; | |
353 Statement *elsebody; | |
354 | |
355 ConditionalStatement(Loc loc, Condition *condition, Statement *ifbody, Statement *elsebody); | |
356 Statement *syntaxCopy(); | |
357 Statement *semantic(Scope *sc); | |
358 Statements *flatten(Scope *sc); | |
359 int usesEH(); | |
360 | |
361 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
362 }; | |
363 | |
364 struct PragmaStatement : Statement | |
365 { | |
366 Identifier *ident; | |
367 Expressions *args; // array of Expression's | |
368 Statement *body; | |
369 | |
370 PragmaStatement(Loc loc, Identifier *ident, Expressions *args, Statement *body); | |
371 Statement *syntaxCopy(); | |
372 Statement *semantic(Scope *sc); | |
373 int usesEH(); | |
374 int fallOffEnd(); | |
375 | |
376 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
377 }; | |
378 | |
379 struct StaticAssertStatement : Statement | |
380 { | |
381 StaticAssert *sa; | |
382 | |
383 StaticAssertStatement(StaticAssert *sa); | |
384 Statement *syntaxCopy(); | |
385 Statement *semantic(Scope *sc); | |
386 | |
387 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
388 }; | |
389 | |
390 struct SwitchStatement : Statement | |
391 { | |
392 Expression *condition; | |
393 Statement *body; | |
394 DefaultStatement *sdefault; | |
395 | |
396 Array gotoCases; // array of unresolved GotoCaseStatement's | |
397 Array *cases; // array of CaseStatement's | |
398 int hasNoDefault; // !=0 if no default statement | |
399 | |
400 SwitchStatement(Loc loc, Expression *c, Statement *b); | |
401 Statement *syntaxCopy(); | |
402 Statement *semantic(Scope *sc); | |
403 int hasBreak(); | |
404 int usesEH(); | |
405 int fallOffEnd(); | |
406 Expression *interpret(InterState *istate); | |
407 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
408 | |
409 Statement *inlineScan(InlineScanState *iss); | |
410 | |
411 void toIR(IRState *irs); | |
412 }; | |
413 | |
414 struct CaseStatement : Statement | |
415 { | |
416 Expression *exp; | |
417 Statement *statement; | |
418 int index; // which case it is (since we sort this) | |
419 block *cblock; // back end: label for the block | |
420 | |
421 CaseStatement(Loc loc, Expression *exp, Statement *s); | |
422 Statement *syntaxCopy(); | |
423 Statement *semantic(Scope *sc); | |
424 int compare(Object *obj); | |
425 int usesEH(); | |
426 int fallOffEnd(); | |
427 int comeFrom(); | |
428 Expression *interpret(InterState *istate); | |
429 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
430 | |
431 Statement *inlineScan(InlineScanState *iss); | |
432 | |
433 void toIR(IRState *irs); | |
434 }; | |
435 | |
436 struct DefaultStatement : Statement | |
437 { | |
438 Statement *statement; | |
439 #if IN_GCC | |
440 block *cblock; // back end: label for the block | |
441 #endif | |
442 | |
443 DefaultStatement(Loc loc, Statement *s); | |
444 Statement *syntaxCopy(); | |
445 Statement *semantic(Scope *sc); | |
446 int usesEH(); | |
447 int fallOffEnd(); | |
448 int comeFrom(); | |
449 Expression *interpret(InterState *istate); | |
450 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
451 | |
452 Statement *inlineScan(InlineScanState *iss); | |
453 | |
454 void toIR(IRState *irs); | |
455 }; | |
456 | |
457 struct GotoDefaultStatement : Statement | |
458 { | |
459 SwitchStatement *sw; | |
460 | |
461 GotoDefaultStatement(Loc loc); | |
462 Statement *syntaxCopy(); | |
463 Statement *semantic(Scope *sc); | |
464 Expression *interpret(InterState *istate); | |
465 int fallOffEnd(); | |
466 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
467 | |
468 void toIR(IRState *irs); | |
469 }; | |
470 | |
471 struct GotoCaseStatement : Statement | |
472 { | |
473 Expression *exp; // NULL, or which case to goto | |
474 CaseStatement *cs; // case statement it resolves to | |
475 | |
476 GotoCaseStatement(Loc loc, Expression *exp); | |
477 Statement *syntaxCopy(); | |
478 Statement *semantic(Scope *sc); | |
479 Expression *interpret(InterState *istate); | |
480 int fallOffEnd(); | |
481 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
482 | |
483 void toIR(IRState *irs); | |
484 }; | |
485 | |
486 struct SwitchErrorStatement : Statement | |
487 { | |
488 SwitchErrorStatement(Loc loc); | |
489 int fallOffEnd(); | |
490 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
491 | |
492 void toIR(IRState *irs); | |
493 }; | |
494 | |
495 struct ReturnStatement : Statement | |
496 { | |
497 Expression *exp; | |
498 | |
499 ReturnStatement(Loc loc, Expression *exp); | |
500 Statement *syntaxCopy(); | |
501 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
502 Statement *semantic(Scope *sc); | |
503 int fallOffEnd(); | |
504 Expression *interpret(InterState *istate); | |
505 | |
506 int inlineCost(InlineCostState *ics); | |
507 Expression *doInline(InlineDoState *ids); | |
508 Statement *inlineScan(InlineScanState *iss); | |
509 | |
510 void toIR(IRState *irs); | |
511 | |
512 ReturnStatement *isReturnStatement() { return this; } | |
513 }; | |
514 | |
515 struct BreakStatement : Statement | |
516 { | |
517 Identifier *ident; | |
518 | |
519 BreakStatement(Loc loc, Identifier *ident); | |
520 Statement *syntaxCopy(); | |
521 Statement *semantic(Scope *sc); | |
522 Expression *interpret(InterState *istate); | |
523 int fallOffEnd(); | |
524 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
525 | |
526 void toIR(IRState *irs); | |
527 }; | |
528 | |
529 struct ContinueStatement : Statement | |
530 { | |
531 Identifier *ident; | |
532 | |
533 ContinueStatement(Loc loc, Identifier *ident); | |
534 Statement *syntaxCopy(); | |
535 Statement *semantic(Scope *sc); | |
536 Expression *interpret(InterState *istate); | |
537 int fallOffEnd(); | |
538 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
539 | |
540 void toIR(IRState *irs); | |
541 }; | |
542 | |
543 struct SynchronizedStatement : Statement | |
544 { | |
545 Expression *exp; | |
546 Statement *body; | |
547 | |
548 SynchronizedStatement(Loc loc, Expression *exp, Statement *body); | |
549 Statement *syntaxCopy(); | |
550 Statement *semantic(Scope *sc); | |
551 int hasBreak(); | |
552 int hasContinue(); | |
553 int usesEH(); | |
554 int fallOffEnd(); | |
555 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
556 | |
557 Statement *inlineScan(InlineScanState *iss); | |
558 | |
559 // Back end | |
560 elem *esync; | |
561 SynchronizedStatement(Loc loc, elem *esync, Statement *body); | |
562 void toIR(IRState *irs); | |
563 }; | |
564 | |
565 struct WithStatement : Statement | |
566 { | |
567 Expression *exp; | |
568 Statement *body; | |
569 VarDeclaration *wthis; | |
570 | |
571 WithStatement(Loc loc, Expression *exp, Statement *body); | |
572 Statement *syntaxCopy(); | |
573 Statement *semantic(Scope *sc); | |
574 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
575 int usesEH(); | |
576 int fallOffEnd(); | |
577 | |
578 Statement *inlineScan(InlineScanState *iss); | |
579 | |
580 void toIR(IRState *irs); | |
581 }; | |
582 | |
583 struct TryCatchStatement : Statement | |
584 { | |
585 Statement *body; | |
586 Array *catches; | |
587 | |
588 TryCatchStatement(Loc loc, Statement *body, Array *catches); | |
589 Statement *syntaxCopy(); | |
590 Statement *semantic(Scope *sc); | |
591 int hasBreak(); | |
592 int usesEH(); | |
593 int fallOffEnd(); | |
594 | |
595 Statement *inlineScan(InlineScanState *iss); | |
596 | |
597 void toIR(IRState *irs); | |
598 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
599 TryCatchStatement *isTryCatchStatement() { return this; } | |
600 }; | |
601 | |
602 struct Catch : Object | |
603 { | |
604 Loc loc; | |
605 Type *type; | |
606 Identifier *ident; | |
607 VarDeclaration *var; | |
608 Statement *handler; | |
609 | |
610 Catch(Loc loc, Type *t, Identifier *id, Statement *handler); | |
611 Catch *syntaxCopy(); | |
612 void semantic(Scope *sc); | |
613 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
614 }; | |
615 | |
616 struct TryFinallyStatement : Statement | |
617 { | |
618 Statement *body; | |
619 Statement *finalbody; | |
620 | |
621 TryFinallyStatement(Loc loc, Statement *body, Statement *finalbody); | |
622 Statement *syntaxCopy(); | |
623 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
624 Statement *semantic(Scope *sc); | |
625 int hasBreak(); | |
626 int hasContinue(); | |
627 int usesEH(); | |
628 int fallOffEnd(); | |
629 | |
630 Statement *inlineScan(InlineScanState *iss); | |
631 | |
632 void toIR(IRState *irs); | |
633 }; | |
634 | |
635 struct OnScopeStatement : Statement | |
636 { | |
637 TOK tok; | |
638 Statement *statement; | |
639 | |
640 OnScopeStatement(Loc loc, TOK tok, Statement *statement); | |
641 Statement *syntaxCopy(); | |
642 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
643 Statement *semantic(Scope *sc); | |
644 int usesEH(); | |
645 void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
646 | |
647 void toIR(IRState *irs); | |
648 }; | |
649 | |
650 struct ThrowStatement : Statement | |
651 { | |
652 Expression *exp; | |
653 | |
654 ThrowStatement(Loc loc, Expression *exp); | |
655 Statement *syntaxCopy(); | |
656 Statement *semantic(Scope *sc); | |
657 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
658 int fallOffEnd(); | |
659 | |
660 Statement *inlineScan(InlineScanState *iss); | |
661 | |
662 void toIR(IRState *irs); | |
663 }; | |
664 | |
665 struct VolatileStatement : Statement | |
666 { | |
667 Statement *statement; | |
668 | |
669 VolatileStatement(Loc loc, Statement *statement); | |
670 Statement *syntaxCopy(); | |
671 Statement *semantic(Scope *sc); | |
672 Statements *flatten(Scope *sc); | |
673 int fallOffEnd(); | |
674 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
675 | |
676 Statement *inlineScan(InlineScanState *iss); | |
677 | |
678 void toIR(IRState *irs); | |
679 }; | |
680 | |
681 struct GotoStatement : Statement | |
682 { | |
683 Identifier *ident; | |
684 LabelDsymbol *label; | |
685 TryFinallyStatement *tf; | |
686 | |
687 GotoStatement(Loc loc, Identifier *ident); | |
688 Statement *syntaxCopy(); | |
689 Statement *semantic(Scope *sc); | |
690 int fallOffEnd(); | |
691 Expression *interpret(InterState *istate); | |
692 | |
693 void toIR(IRState *irs); | |
694 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
695 GotoStatement *isGotoStatement() { return this; } | |
696 }; | |
697 | |
698 struct LabelStatement : Statement | |
699 { | |
700 Identifier *ident; | |
701 Statement *statement; | |
702 TryFinallyStatement *tf; | |
703 block *lblock; // back end | |
704 int isReturnLabel; | |
705 | |
706 LabelStatement(Loc loc, Identifier *ident, Statement *statement); | |
707 Statement *syntaxCopy(); | |
708 Statement *semantic(Scope *sc); | |
709 Statements *flatten(Scope *sc); | |
710 int usesEH(); | |
711 int fallOffEnd(); | |
712 int comeFrom(); | |
713 Expression *interpret(InterState *istate); | |
714 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
715 | |
716 Statement *inlineScan(InlineScanState *iss); | |
717 | |
37
77cdca8c210f
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
lindquist
parents:
1
diff
changeset
|
718 void toIR(IRState *irs); |
77cdca8c210f
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
lindquist
parents:
1
diff
changeset
|
719 |
77cdca8c210f
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
lindquist
parents:
1
diff
changeset
|
720 llvm::BasicBlock* llvmBB; |
1 | 721 }; |
722 | |
723 struct LabelDsymbol : Dsymbol | |
724 { | |
725 LabelStatement *statement; | |
726 #if IN_GCC | |
727 unsigned asmLabelNum; // GCC-specific | |
728 #endif | |
729 | |
730 LabelDsymbol(Identifier *ident); | |
731 LabelDsymbol *isLabel(); | |
732 }; | |
733 | |
734 struct AsmStatement : Statement | |
735 { | |
736 Token *tokens; | |
737 code *asmcode; | |
738 unsigned asmalign; // alignment of this statement | |
739 unsigned refparam; // !=0 if function parameter is referenced | |
740 unsigned naked; // !=0 if function is to be naked | |
741 unsigned regs; // mask of registers modified | |
742 | |
743 AsmStatement(Loc loc, Token *tokens); | |
744 Statement *syntaxCopy(); | |
745 Statement *semantic(Scope *sc); | |
746 int comeFrom(); | |
747 | |
748 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
749 virtual AsmStatement *isAsmStatement() { return this; } | |
750 | |
751 void toIR(IRState *irs); | |
752 }; | |
753 | |
754 #endif /* DMD_STATEMENT_H */ |