1 // RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx10.10.0 -fobjc-runtime=macosx-10.10.0 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-WITHOUT-EMPTY-COLLECTIONS %s
2 // RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx10.11.0 -fobjc-runtime=macosx-10.11.0 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-WITH-EMPTY-COLLECTIONS %s
4 // RUN: %clang_cc1 -I %S/Inputs -triple arm64-apple-ios8.0 -fobjc-runtime=ios-8.0 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-WITHOUT-EMPTY-COLLECTIONS %s
5 // RUN: %clang_cc1 -I %S/Inputs -triple arm64-apple-ios9.0 -fobjc-runtime=ios-9.0 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-WITH-EMPTY-COLLECTIONS %s
7 // RUN: %clang_cc1 -I %S/Inputs -triple armv7k-apple-watchos2.0 -fobjc-runtime=watchos-1.0 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-WITHOUT-EMPTY-COLLECTIONS %s
8 // RUN: %clang_cc1 -I %S/Inputs -triple armv7k-apple-watchos2.0 -fobjc-runtime=watchos-2.0 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-WITH-EMPTY-COLLECTIONS %s
10 // RUN: %clang_cc1 -I %S/Inputs -triple arm64-apple-tvos8.0 -fobjc-runtime=ios-8.0 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-WITHOUT-EMPTY-COLLECTIONS %s
11 // RUN: %clang_cc1 -I %S/Inputs -triple arm64-apple-tvos9.0 -fobjc-runtime=ios-9.0 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-WITH-EMPTY-COLLECTIONS %s
13 #include "literal-support.h"
15 void test_empty_array(void) {
16 // CHECK-WITHOUT-EMPTY-COLLECTIONS-LABEL: define{{.*}} void @test_empty_array
17 // CHECK-WITHOUT-EMPTY-COLLECTIONS-NOT: ret void
18 // CHECK-WITHOUT-EMPTY-COLLECTIONS: {{call.*objc_msgSend}}
19 // CHECK-WITHOUT-EMPTY-COLLECTIONS-NOT: ret void
20 // CHECK-WITHOUT-EMPTY-COLLECTIONS: {{call.*llvm.objc.retainAutoreleasedReturnValue}}
21 // CHECK-WITHOUT-EMPTY-COLLECTIONS: ret void
23 // CHECK-WITH-EMPTY-COLLECTIONS-LABEL: define{{.*}} void @test_empty_array
24 // CHECK-WITH-EMPTY-COLLECTIONS-NOT: ret void
25 // CHECK-WITH-EMPTY-COLLECTIONS: load {{.*}} @__NSArray0__
26 // CHECK-WITH-EMPTY-COLLECTIONS-NOT: ret void
27 // CHECK-WITH-EMPTY-COLLECTIONS: {{call.*llvm.objc.retain\(}}
28 // CHECK-WITH-EMPTY-COLLECTIONS-NOT: ret void
29 // CHECK-WITH-EMPTY-COLLECTIONS: call void @llvm.objc.storeStrong
30 // CHECK-WITH-EMPTY-COLLECTIONS-NEXT: ret void
34 void test_empty_dictionary(void) {
35 // CHECK-WITHOUT-EMPTY-COLLECTIONS-LABEL: define{{.*}} void @test_empty_dictionary
36 // CHECK-WITHOUT-EMPTY-COLLECTIONS-NOT: ret void
37 // CHECK-WITHOUT-EMPTY-COLLECTIONS: {{call.*objc_msgSend}}
38 // CHECK-WITHOUT-EMPTY-COLLECTIONS-NOT: ret void
39 // CHECK-WITHOUT-EMPTY-COLLECTIONS: {{call.*llvm.objc.retainAutoreleasedReturnValue}}
40 // CHECK-WITHOUT-EMPTY-COLLECTIONS: ret void
42 // CHECK-WITH-EMPTY-COLLECTIONS-LABEL: define{{.*}} void @test_empty_dictionary
43 // CHECK-WITH-EMPTY-COLLECTIONS-NOT: ret void
44 // CHECK-WITH-EMPTY-COLLECTIONS: load {{.*}} @__NSDictionary0__{{.*}}!invariant.load
45 // CHECK-WITH-EMPTY-COLLECTIONS-NOT: ret void
46 // CHECK-WITH-EMPTY-COLLECTIONS: {{call.*llvm.objc.retain\(}}
47 // CHECK-WITH-EMPTY-COLLECTIONS-NOT: ret void
48 // CHECK-WITH-EMPTY-COLLECTIONS: call void @llvm.objc.storeStrong
49 // CHECK-WITH-EMPTY-COLLECTIONS-NEXT: ret void
50 NSDictionary *dict = @{};