1 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -O2 -disable-llvm-passes -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -disable-llvm-passes -o - %s | FileCheck -check-prefix=NO-METADATA %s
3 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -O2 -disable-llvm-passes -o - %s -fobjc-arc-exceptions | FileCheck -check-prefix=NO-METADATA %s
5 // The front-end should emit clang.arc.no_objc_arc_exceptions in -fobjc-arc-exceptions
6 // mode when optimization is enabled, and not otherwise.
9 void not(void) __attribute__((nothrow));
11 // CHECK-LABEL: define{{.*}} void @test0(
12 // CHECK: call void @thrower(), !clang.arc.no_objc_arc_exceptions !
13 // CHECK: call void @not() [[NUW:#[0-9]+]], !clang.arc.no_objc_arc_exceptions !
14 // NO-METADATA-LABEL: define{{.*}} void @test0(
15 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
22 // CHECK-LABEL: define{{.*}} void @test1(
23 // CHECK: call void @thrower(), !clang.arc.no_objc_arc_exceptions !
24 // CHECK: call void @not() [[NUW]], !clang.arc.no_objc_arc_exceptions !
25 // NO-METADATA-LABEL: define{{.*}} void @test1(
26 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
36 // CHECK-LABEL: define{{.*}} void @test2(
37 // CHECK: invoke void (i8*, ...) @NSLog(i8* noundef bitcast (%struct.__NSConstantString_tag* @_unnamed_cfstring_ to i8*), i32* noundef %{{.*}})
38 // CHECK: to label %{{.*}} unwind label %{{.*}}, !clang.arc.no_objc_arc_exceptions !
39 // NO-METADATA-LABEL: define{{.*}} void @test2(
40 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
44 __attribute__((__blocks__(byref))) int x;
46 NSLog(@"Address of x outside of block: %p", &x);
50 // CHECK-LABEL: define{{.*}} void @test3(
51 // CHECK: invoke void %{{.*}}(i8* noundef %{{.*}})
52 // CHECK: to label %{{.*}} unwind label %{{.*}}, !clang.arc.no_objc_arc_exceptions !
53 // NO-METADATA-LABEL: define{{.*}} void @test3(
54 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
58 __attribute__((__blocks__(byref))) int x;
60 NSLog(@"Address of x in non-assigned block: %p", &x);
65 // CHECK-LABEL: define{{.*}} void @test4(
66 // CHECK: invoke void %{{.*}}(i8* noundef %{{.*}})
67 // CHECK: to label %{{.*}} unwind label %{{.*}}, !clang.arc.no_objc_arc_exceptions !
68 // NO-METADATA-LABEL: define{{.*}} void @test4(
69 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
73 __attribute__((__blocks__(byref))) int x;
75 NSLog(@"Address of x in assigned block: %p", &x);
81 // CHECK: attributes [[NUW]] = { nounwind }