Mercurial > projects > ldc
comparison gen/llvmhelpers.cpp @ 356:44daf304421c trunk
[svn r377] The previous check was too strict, it completely disallowed gotos within finally blocks. This reenables them as long as they don't cross a finally boundary.
author | ChristianK |
---|---|
date | Mon, 14 Jul 2008 12:00:24 +0200 |
parents | d8357f7004ca |
children | 82af71383b8a |
comparison
equal
deleted
inserted
replaced
355:d8357f7004ca | 356:44daf304421c |
---|---|
173 | 173 |
174 /****************************************************************************************/ | 174 /****************************************************************************************/ |
175 /*//////////////////////////////////////////////////////////////////////////////////////// | 175 /*//////////////////////////////////////////////////////////////////////////////////////// |
176 // GOTO HELPER | 176 // GOTO HELPER |
177 ////////////////////////////////////////////////////////////////////////////////////////*/ | 177 ////////////////////////////////////////////////////////////////////////////////////////*/ |
178 void DtoGoto(Loc* loc, Identifier* target, EnclosingHandler* enclosinghandler) | 178 void DtoGoto(Loc* loc, Identifier* target, EnclosingHandler* enclosinghandler, TryFinallyStatement* sourcetf) |
179 { | 179 { |
180 assert(!gIR->scopereturned()); | 180 assert(!gIR->scopereturned()); |
181 | 181 |
182 LabelStatement* lblstmt = DtoLabelStatement(target); | 182 LabelStatement* lblstmt = DtoLabelStatement(target); |
183 assert(lblstmt != NULL); | 183 assert(lblstmt != NULL); |
202 if(endfinally != lblstmt->enclosinghandler) | 202 if(endfinally != lblstmt->enclosinghandler) |
203 error(*loc, "cannot goto into try block"); | 203 error(*loc, "cannot goto into try block"); |
204 | 204 |
205 // goto into finally blocks is forbidden by the spec | 205 // goto into finally blocks is forbidden by the spec |
206 // though it should not be problematic to implement | 206 // though it should not be problematic to implement |
207 if(lblstmt->tf) | 207 if(lblstmt->tf != sourcetf) |
208 error(*loc, "spec disallows goto into finally block"); | 208 error(*loc, "spec disallows goto into finally block"); |
209 | 209 |
210 // emit code for finallys between goto and label | 210 // emit code for finallys between goto and label |
211 DtoEnclosingHandlers(enclosinghandler, endfinally); | 211 DtoEnclosingHandlers(enclosinghandler, endfinally); |
212 | 212 |