]> granicus.if.org Git - clang/commitdiff
Fix rdar://6103124, the only dummy blocks are ones without names. Named blocks
authorChris Lattner <sabre@nondot.org>
Fri, 25 Jul 2008 23:40:10 +0000 (23:40 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 25 Jul 2008 23:40:10 +0000 (23:40 +0000)
are important part of control flow structures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54078 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp
test/CodeGen/dostmt.c

index ff46fa69c3617a39fd9c5e02f353fc8f4bf486c6..679a0f7404a0fa03d3f1aaac699afb60a84c759d 100644 (file)
@@ -148,7 +148,7 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
 /// isDummyBlock - Return true if BB is an empty basic block
 /// with no predecessors.
 bool CodeGenFunction::isDummyBlock(const llvm::BasicBlock *BB) {
-  if (BB->empty() && pred_begin(BB) == pred_end(BB)) 
+  if (BB->empty() && pred_begin(BB) == pred_end(BB) && !BB->hasName()
     return true;
   return false;
 }
index b721974dc5747605f31d1dafe6e16c7bab271e81..63547da328c4f368250144722eeafed51d4e5f02 100644 (file)
@@ -1,7 +1,7 @@
-// RUN: clang %s -emit-llvm
+// RUN: clang %s -emit-llvm -o -
 
 int bar();
-int foo() {
+int test0() {
   int i;
   i = 1 + 2;
   do {
@@ -12,7 +12,7 @@ int foo() {
 }
 
 
-int foo1() {
+int test1() {
   int i;
   i = 1 + 2;
   do {
@@ -25,7 +25,7 @@ int foo1() {
 }
 
 
-int foo2() {
+int test2() {
   int i;
   i = 1 + 2;
   do {
@@ -38,7 +38,7 @@ int foo2() {
 }
 
 
-int foo3() {
+int test3() {
   int i;
   i = 1 + 2;
   do {
@@ -50,7 +50,7 @@ int foo3() {
 }
 
 
-int foo4() {
+int test4() {
   int i;
   i = 1 + 2;
   do {
@@ -60,3 +60,11 @@ int foo4() {
   } while(0);
   return i;
 }
+
+// rdar://6103124
+void test5() {
+  do { break; } while(0);
+}
+
+