1 | // RUN: %clang_cc1 -emit-llvm -fblocks -triple x86_64-apple-darwin -fstrict-return -o - %s | FileCheck %s |
2 | // RUN: %clang_cc1 -emit-llvm -fblocks -triple x86_64-apple-darwin -fstrict-return -O -o - %s | FileCheck %s |
3 | |
4 | @interface I |
5 | @end |
6 | |
7 | @implementation I |
8 | |
9 | - (int)method { |
10 | } |
11 | |
12 | @end |
13 | |
14 | enum Enum { |
15 | a |
16 | }; |
17 | |
18 | int (^block)(Enum) = ^int(Enum e) { |
19 | switch (e) { |
20 | case a: |
21 | return 1; |
22 | } |
23 | }; |
24 | |
25 | // Ensure that both methods and blocks don't use the -fstrict-return undefined |
26 | // behaviour optimization. |
27 | |
28 | // CHECK-NOT: call void @llvm.trap |
29 | // CHECK-NOT: unreachable |
30 | |