mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Reenable error for gotos into or out of finally blocks.
This commit is contained in:
@@ -772,7 +772,7 @@ void AsmBlockStatement::toIR(IRState* p)
|
||||
sw->addCase(llvm::ConstantInt::get(llvm::IntegerType::get(32), it->second), casebb);
|
||||
|
||||
p->scope() = IRScope(casebb,bb);
|
||||
DtoGoto(loc, it->first);
|
||||
DtoGoto(loc, it->first, enclosingFinally);
|
||||
}
|
||||
|
||||
p->scope() = IRScope(bb,oldend);
|
||||
|
||||
@@ -172,7 +172,7 @@ LabelStatement* DtoLabelStatement(Identifier* ident)
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GOTO HELPER
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
void DtoGoto(Loc loc, Identifier* target)
|
||||
void DtoGoto(Loc loc, Identifier* target, TryFinallyStatement* sourceFinally)
|
||||
{
|
||||
assert(!gIR->scopereturned());
|
||||
|
||||
@@ -199,11 +199,10 @@ void DtoGoto(Loc loc, Identifier* target)
|
||||
|
||||
// goto into finally blocks is forbidden by the spec
|
||||
// but should work fine
|
||||
/*
|
||||
if(lblstmt->tf != sourcetf) {
|
||||
error(loc, "spec disallows goto into finally block");
|
||||
if(lblstmt->enclosingFinally != sourceFinally) {
|
||||
error(loc, "spec disallows goto into or out of finally block");
|
||||
fatal();
|
||||
}*/
|
||||
}
|
||||
|
||||
llvm::BranchInst::Create(targetBB, gIR->scopebb());
|
||||
}
|
||||
|
||||
@@ -45,8 +45,10 @@ void DtoAssert(Module* M, Loc loc, DValue* msg);
|
||||
|
||||
// return the LabelStatement from the current function with the given identifier or NULL if not found
|
||||
LabelStatement* DtoLabelStatement(Identifier* ident);
|
||||
// emit goto
|
||||
void DtoGoto(Loc loc, Identifier* target);
|
||||
|
||||
/// emits goto to LabelStatement with the target identifier
|
||||
/// the sourceFinally is only used for error checking
|
||||
void DtoGoto(Loc loc, Identifier* target, TryFinallyStatement* sourceFinally);
|
||||
|
||||
// Generates IR for enclosing handlers between the current state and
|
||||
// the scope created by the 'target' statement.
|
||||
|
||||
@@ -1288,7 +1288,7 @@ void GotoStatement::toIR(IRState* p)
|
||||
llvm::BasicBlock* oldend = gIR->scopeend();
|
||||
llvm::BasicBlock* bb = llvm::BasicBlock::Create("aftergoto", p->topfunc(), oldend);
|
||||
|
||||
DtoGoto(loc, label->ident);
|
||||
DtoGoto(loc, label->ident, enclosingFinally);
|
||||
|
||||
p->scope() = IRScope(bb,oldend);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user