diff options
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 3 | ||||
-rw-r--r-- | test/CodeGen/switch.c | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index d804ee6665..7986b4a113 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -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; diff --git a/test/CodeGen/switch.c b/test/CodeGen/switch.c index a21505ef89..056337465b 100644 --- a/test/CodeGen/switch.c +++ b/test/CodeGen/switch.c @@ -74,3 +74,14 @@ void foo5(){ } } +void foo6(){ + switch(0){ + } +} + +void foo7(){ + switch(0){ + foo7(); + } +} + |