[cfe-commits] r50968 - in /cfe/trunk: lib/CodeGen/CGStmt.cpp test/CodeGen/switch.c
Eli Friedman
eli.friedman at gmail.com
Mon May 12 09:08:04 PDT 2008
Author: efriedma
Date: Mon May 12 11:08:04 2008
New Revision: 50968
URL: http://llvm.org/viewvc/llvm-project?rev=50968&view=rev
Log:
Emit basic block for switch body; fixes PR2307.
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/test/CodeGen/switch.c
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=50968&r1=50967&r2=50968&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon May 12 11:08:04 2008
@@ -499,6 +499,9 @@
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;
Modified: cfe/trunk/test/CodeGen/switch.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/switch.c?rev=50968&r1=50967&r2=50968&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/switch.c (original)
+++ cfe/trunk/test/CodeGen/switch.c Mon May 12 11:08:04 2008
@@ -74,3 +74,14 @@
}
}
+void foo6(){
+ switch(0){
+ }
+}
+
+void foo7(){
+ switch(0){
+ foo7();
+ }
+}
+
More information about the cfe-commits
mailing list