Fies PR19040.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202892
91177308-0d34-0410-b5e6-
96231b3b80d8
}
static bool bodyEndsWithNoReturn(const CFGBlock::AdjacentBlock &AB) {
+ // If the predecessor is a normal CFG edge, then by definition
+ // the predecessor did not end with a 'noreturn'.
+ if (AB.getReachableBlock())
+ return false;
+
const CFGBlock *Pred = AB.getPossiblyUnreachableBlock();
assert(!AB.isReachable() && Pred);
return bodyEndsWithNoReturn(Pred);
dead(); // expected-warning {{will never be executed}}
}
+// Handle 'try' code dominating a dead return.
+enum PR19040_test_return_t
+{ PR19040_TEST_FAILURE };
+namespace PR19040_libtest
+{
+ class A {
+ public:
+ ~A ();
+ };
+}
+PR19040_test_return_t PR19040_fn1 ()
+{
+ try
+ {
+ throw PR19040_libtest::A ();
+ } catch (...)
+ {
+ return PR19040_TEST_FAILURE;
+ }
+ return PR19040_TEST_FAILURE; // expected-warning {{will never be executed}}
+}
+
+