summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2016-01-29 23:45:01 +0000
committerManman Ren <manman.ren@gmail.com>2016-01-29 23:45:01 +0000
commit96df0b33f6a253eb65a4088649c44c9b479e099a (patch)
tree76f936541adc5f3988f321338853e3da9089133e /clang/test
parent63634cb0bc6e3b33af062efe6e488276948c61b3 (diff)
downloadbcm5719-llvm-96df0b33f6a253eb65a4088649c44c9b479e099a.tar.gz
bcm5719-llvm-96df0b33f6a253eb65a4088649c44c9b479e099a.zip
Class Property: generate metadata for class properties in categories.
The list of class properties is saved in Old ABI: category->class_properties (category->size will be updated as well) New ABI: category->class_properties (a flag in objc_image_info to indicate whether or not the list of class properties is present) rdar://23891898 llvm-svn: 259267
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenObjC/metadata-class-properties.m24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/metadata-class-properties.m b/clang/test/CodeGenObjC/metadata-class-properties.m
new file mode 100644
index 00000000000..f5258424cac
--- /dev/null
+++ b/clang/test/CodeGenObjC/metadata-class-properties.m
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - -fobjc-runtime=macosx-fragile-10.5 %s | FileCheck -check-prefix=CHECK-FRAGILE %s
+
+// CHECK: @"\01l_OBJC_$_CLASS_PROP_LIST_Foo_$_Category" = private global {{.*}} section "__DATA, __objc_const", align 8
+// CHECK: @"\01l_OBJC_$_CATEGORY_Foo_$_Category" = private global %struct._category_t { {{.*}} @"\01l_OBJC_$_CLASS_PROP_LIST_Foo_$_Category" {{.*}} }, section "__DATA, __objc_const", align 8
+
+// CHECK: !{i32 1, !"Objective-C Class Properties", i32 64}
+
+// CHECK-FRAGILE: @"\01l_OBJC_$_CLASS_PROP_LIST_Foo_Category" = private global {{.*}} section "__OBJC,__property,regular,no_dead_strip", align 8
+// CHECK-FRAGILE: @OBJC_CATEGORY_Foo_Category = private global %struct._objc_category { {{.*}}, i32 64, {{.*}} @"\01l_OBJC_$_CLASS_PROP_LIST_Foo_Category" {{.*}} }, section "__OBJC,__category,regular,no_dead_strip", align 8
+
+// CHECK-FRAGILE: !{i32 1, !"Objective-C Class Properties", i32 64}
+
+@interface Foo @end
+
+@protocol Proto
+@property (class, readonly) int proto_property;
+@end
+
+@interface Foo (Category) <Proto> @end
+
+@implementation Foo (Category)
++(int)proto_property { return 0; }
+@end
OpenPOWER on IntegriCloud