Mercurial > projects > ldc
comparison ir/irlandingpad.h @ 320:d772927ca496 trunk
[svn r341] Fix all regressions between [332] and [340]:
- fixed assert on empty catch body
- fixed(?) typedefed classes in catch specification
- fixed assert with catchall
Added some documentation.
author | ChristianK |
---|---|
date | Sat, 05 Jul 2008 13:05:29 +0200 |
parents | e9c93739bc4c |
children | d97b017a8aef |
comparison
equal
deleted
inserted
replaced
319:e9c93739bc4c | 320:d772927ca496 |
---|---|
5 #include "statement.h" | 5 #include "statement.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <stack> | 8 #include <stack> |
9 | 9 |
10 // only to be used within IRLandingPad | |
11 // holds information about a single catch or finally | |
10 struct IRLandingPadInfo | 12 struct IRLandingPadInfo |
11 { | 13 { |
12 // default constructor for being able to store in a vector | 14 // default constructor for being able to store in a vector |
13 IRLandingPadInfo() | 15 IRLandingPadInfo() |
14 : target(NULL), finallyBody(NULL), catchType(NULL) | 16 : target(NULL), finallyBody(NULL), catchType(NULL) |
15 {} | 17 {} |
16 | 18 |
19 // constructor for catch | |
17 IRLandingPadInfo(Catch* catchstmt, llvm::BasicBlock* end); | 20 IRLandingPadInfo(Catch* catchstmt, llvm::BasicBlock* end); |
21 | |
22 // constructor for finally | |
18 IRLandingPadInfo(Statement* finallystmt); | 23 IRLandingPadInfo(Statement* finallystmt); |
19 | 24 |
20 // the target catch bb if this is a catch | 25 // the target catch bb if this is a catch |
21 // or the target finally bb if this is a finally | 26 // or the target finally bb if this is a finally |
22 llvm::BasicBlock* target; | 27 llvm::BasicBlock* target; |
26 | 31 |
27 // nonzero if this is a catch | 32 // nonzero if this is a catch |
28 ClassDeclaration* catchType; | 33 ClassDeclaration* catchType; |
29 }; | 34 }; |
30 | 35 |
36 | |
37 // holds information about all possible catch and finally actions | |
38 // and can emit landing pads to be called from the unwind runtime | |
31 struct IRLandingPad | 39 struct IRLandingPad |
32 { | 40 { |
33 IRLandingPad() : catch_var(NULL) {} | 41 IRLandingPad() : catch_var(NULL) {} |
34 | 42 |
35 // builds a new landing pad according to given infos | 43 // builds a new landing pad according to given infos |
36 // and the ones on the stack. also stores it as invoke target | 44 // and the ones on the stack. also stores it as invoke target |
37 void push(llvm::BasicBlock* inBB); | 45 void push(llvm::BasicBlock* inBB); |
38 | 46 |
47 // add catch information, will be used in next call to push | |
39 void addCatch(Catch* catchstmt, llvm::BasicBlock* end); | 48 void addCatch(Catch* catchstmt, llvm::BasicBlock* end); |
49 // add finally information, will be used in next call to push | |
40 void addFinally(Statement* finallystmt); | 50 void addFinally(Statement* finallystmt); |
41 | 51 |
42 // pops the most recently constructed landing pad bb | 52 // pops the most recently constructed landing pad bb |
43 // and its infos | 53 // and its infos |
44 void pop(); | 54 void pop(); |