]> granicus.if.org Git - clang/commitdiff
Test for the presence of EH branch-throughs instead of normal branch-throughs.
authorJohn McCall <rjmccall@apple.com>
Mon, 26 Jul 2010 22:44:58 +0000 (22:44 +0000)
committerJohn McCall <rjmccall@apple.com>
Mon, 26 Jul 2010 22:44:58 +0000 (22:44 +0000)
I knew this code duplication would bite me.

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

lib/CodeGen/CodeGenFunction.cpp
test/CodeGenCXX/eh.cpp

index eb471ac173dcda47ee243dd42b7d4f6bb89e9fc0..d6e498f453c25c0547bccffc6409e1653c8ca7a1 100644 (file)
@@ -830,7 +830,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
 
     // If we have exactly one branch-after and no branch-throughs, we
     // can dispatch it without a switch.
-    if (!Scope.hasBranchThroughs() &&
+    if (!Scope.hasEHBranchThroughs() &&
         Scope.getNumEHBranchAfters() == 1) {
       assert(!EHBranchThroughDest);
 
index e22063a4c120e3c8539a62e78aa394922b4879e4..3a2a38632f49fc1d8037c49667a6229527442cc1 100644 (file)
@@ -361,3 +361,21 @@ namespace test13 {
     } catch (int x) {}
   }
 }
+
+// rdar://problem/8231514
+namespace test14 {
+  struct A { ~A(); };
+  struct B { ~B(); };
+
+  B b();
+  void opaque();
+
+  void foo() {
+    A a;
+    try {
+      B str = b();
+      opaque();
+    } catch (int x) {
+    }
+  }
+}