| OLD | NEW |
| 1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -Wno-unreachable-code -Werror -
triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s | 1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -emit-llvm-only -verify %s -Wno
-unreachable-code |
| 2 // expected-no-diagnostics |
| 2 | 3 |
| 3 int val = 42; | 4 int val = 42; |
| 4 int& test1() { | 5 int& test1() { |
| 5 return throw val, val; | 6 return throw val, val; |
| 6 } | 7 } |
| 7 | 8 |
| 8 int test2() { | 9 int test2() { |
| 9 return val ? throw val : val; | 10 return val ? throw val : val; |
| 10 } | 11 } |
| 11 | 12 |
| 12 // rdar://problem/8608801 | 13 // rdar://problem/8608801 |
| 13 void test3() { | 14 void test3() { |
| 14 throw false; | 15 throw false; |
| 15 } | 16 } |
| 16 | 17 |
| 17 // PR10582 | 18 // PR10582 |
| 18 int test4() { | 19 int test4() { |
| 19 return 1 ? throw val : val; | 20 return 1 ? throw val : val; |
| 20 } | 21 } |
| 21 | |
| 22 // PR15923 | |
| 23 int test5(bool x, bool y, int z) { | |
| 24 return (x ? throw 1 : y) ? z : throw 2; | |
| 25 } | |
| 26 // CHECK: define i32 @_Z5test5bbi( | |
| 27 // CHECK: br i1 | |
| 28 // | |
| 29 // x.true: | |
| 30 // CHECK: call void @__cxa_throw( | |
| 31 // CHECK-NEXT: unreachable | |
| 32 // | |
| 33 // x.false: | |
| 34 // CHECK: br i1 | |
| 35 // | |
| 36 // y.true: | |
| 37 // CHECK: load i32* | |
| 38 // CHECK: br label | |
| 39 // | |
| 40 // y.false: | |
| 41 // CHECK: call void @__cxa_throw( | |
| 42 // CHECK-NEXT: unreachable | |
| 43 // | |
| 44 // end: | |
| 45 // CHECK: ret i32 | |
| OLD | NEW |