Test for the presence of EH branch-throughs instead of normal branch-throughs.
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
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index eb471ac..d6e498f 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -830,7 +830,7 @@
// 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);
diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp
index e22063a4..3a2a386 100644
--- a/test/CodeGenCXX/eh.cpp
+++ b/test/CodeGenCXX/eh.cpp
@@ -361,3 +361,21 @@
} 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) {
+ }
+ }
+}