annotate clang/test/CodeGenObjC/arc-no-arc-exceptions.m @ 180:680fa57a2f20

fix compile errors.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 30 May 2020 17:44:06 +0900
parents 1d019706d866
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -O2 -disable-llvm-passes -o - %s | FileCheck %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -disable-llvm-passes -o - %s | FileCheck -check-prefix=NO-METADATA %s
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -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
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 // The front-end should emit clang.arc.no_objc_arc_exceptions in -fobjc-arc-exceptions
anatofuz
parents:
diff changeset
6 // mode when optimization is enabled, and not otherwise.
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 void thrower(void);
anatofuz
parents:
diff changeset
9 void not(void) __attribute__((nothrow));
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 // CHECK-LABEL: define void @test0(
anatofuz
parents:
diff changeset
12 // CHECK: call void @thrower(), !clang.arc.no_objc_arc_exceptions !
anatofuz
parents:
diff changeset
13 // CHECK: call void @not() [[NUW:#[0-9]+]], !clang.arc.no_objc_arc_exceptions !
anatofuz
parents:
diff changeset
14 // NO-METADATA-LABEL: define void @test0(
anatofuz
parents:
diff changeset
15 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
anatofuz
parents:
diff changeset
16 // NO-METADATA: }
anatofuz
parents:
diff changeset
17 void test0(void) {
anatofuz
parents:
diff changeset
18 thrower();
anatofuz
parents:
diff changeset
19 not();
anatofuz
parents:
diff changeset
20 }
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 // CHECK-LABEL: define void @test1(
anatofuz
parents:
diff changeset
23 // CHECK: call void @thrower(), !clang.arc.no_objc_arc_exceptions !
anatofuz
parents:
diff changeset
24 // CHECK: call void @not() [[NUW]], !clang.arc.no_objc_arc_exceptions !
anatofuz
parents:
diff changeset
25 // NO-METADATA-LABEL: define void @test1(
anatofuz
parents:
diff changeset
26 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
anatofuz
parents:
diff changeset
27 // NO-METADATA: }
anatofuz
parents:
diff changeset
28 void test1(id x) {
anatofuz
parents:
diff changeset
29 id y = x;
anatofuz
parents:
diff changeset
30 thrower();
anatofuz
parents:
diff changeset
31 not();
anatofuz
parents:
diff changeset
32 }
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 void NSLog(id, ...);
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 // CHECK-LABEL: define void @test2(
anatofuz
parents:
diff changeset
37 // CHECK: invoke void (i8*, ...) @NSLog(i8* bitcast (%struct.__NSConstantString_tag* @_unnamed_cfstring_ to i8*), i32* %{{.*}})
anatofuz
parents:
diff changeset
38 // CHECK: to label %{{.*}} unwind label %{{.*}}, !clang.arc.no_objc_arc_exceptions !
anatofuz
parents:
diff changeset
39 // NO-METADATA-LABEL: define void @test2(
anatofuz
parents:
diff changeset
40 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
anatofuz
parents:
diff changeset
41 // NO-METADATA: }
anatofuz
parents:
diff changeset
42 void test2(void) {
anatofuz
parents:
diff changeset
43 @autoreleasepool {
anatofuz
parents:
diff changeset
44 __attribute__((__blocks__(byref))) int x;
anatofuz
parents:
diff changeset
45 ^{ (void)x; };
anatofuz
parents:
diff changeset
46 NSLog(@"Address of x outside of block: %p", &x);
anatofuz
parents:
diff changeset
47 }
anatofuz
parents:
diff changeset
48 }
anatofuz
parents:
diff changeset
49
anatofuz
parents:
diff changeset
50 // CHECK-LABEL: define void @test3(
anatofuz
parents:
diff changeset
51 // CHECK: invoke void %{{.*}}(i8* %{{.*}})
anatofuz
parents:
diff changeset
52 // CHECK: to label %{{.*}} unwind label %{{.*}}, !clang.arc.no_objc_arc_exceptions !
anatofuz
parents:
diff changeset
53 // NO-METADATA-LABEL: define void @test3(
anatofuz
parents:
diff changeset
54 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
anatofuz
parents:
diff changeset
55 // NO-METADATA: }
anatofuz
parents:
diff changeset
56 void test3(void) {
anatofuz
parents:
diff changeset
57 @autoreleasepool {
anatofuz
parents:
diff changeset
58 __attribute__((__blocks__(byref))) int x;
anatofuz
parents:
diff changeset
59 ^{
anatofuz
parents:
diff changeset
60 NSLog(@"Address of x in non-assigned block: %p", &x);
anatofuz
parents:
diff changeset
61 }();
anatofuz
parents:
diff changeset
62 }
anatofuz
parents:
diff changeset
63 }
anatofuz
parents:
diff changeset
64
anatofuz
parents:
diff changeset
65 // CHECK-LABEL: define void @test4(
anatofuz
parents:
diff changeset
66 // CHECK: invoke void %{{.*}}(i8* %{{.*}})
anatofuz
parents:
diff changeset
67 // CHECK: to label %{{.*}} unwind label %{{.*}}, !clang.arc.no_objc_arc_exceptions !
anatofuz
parents:
diff changeset
68 // NO-METADATA-LABEL: define void @test4(
anatofuz
parents:
diff changeset
69 // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions
anatofuz
parents:
diff changeset
70 // NO-METADATA: }
anatofuz
parents:
diff changeset
71 void test4(void) {
anatofuz
parents:
diff changeset
72 @autoreleasepool {
anatofuz
parents:
diff changeset
73 __attribute__((__blocks__(byref))) int x;
anatofuz
parents:
diff changeset
74 void (^b)(void) = ^{
anatofuz
parents:
diff changeset
75 NSLog(@"Address of x in assigned block: %p", &x);
anatofuz
parents:
diff changeset
76 };
anatofuz
parents:
diff changeset
77 b();
anatofuz
parents:
diff changeset
78 }
anatofuz
parents:
diff changeset
79 }
anatofuz
parents:
diff changeset
80
anatofuz
parents:
diff changeset
81 // CHECK: attributes [[NUW]] = { nounwind }