Emit basic block for switch body; fixes PR2307.

llvm-svn: 50968
This commit is contained in:
Eli Friedman 2008-05-12 16:08:04 +00:00
parent ecb77385ab
commit 6a7087e455
2 changed files with 14 additions and 0 deletions

View File

@ -499,6 +499,9 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) {
llvm::BasicBlock *NextBlock = llvm::BasicBlock::Create("after.sw");
SwitchInsn = Builder.CreateSwitch(CondV, NextBlock);
// Create basic block for body of switch
StartBlock("body.sw");
// All break statements jump to NextBlock. If BreakContinueStack is non empty
// then reuse last ContinueBlock.
llvm::BasicBlock *ContinueBlock = NULL;

View File

@ -74,3 +74,14 @@ void foo5(){
}
}
void foo6(){
switch(0){
}
}
void foo7(){
switch(0){
foo7();
}
}