summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjC
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2015-12-10 23:02:09 +0000
committerDouglas Gregor <dgregor@apple.com>2015-12-10 23:02:09 +0000
commit9dd25b76964280b01964faa1724131c9eaa840c5 (patch)
treed6f91da677a974ff0ddbcc81982e0e6fb8dc14dd /clang/test/CodeGenObjC
parentf5d34b7b9d8b6c357977357bfa5159269a248c8c (diff)
downloadbcm5719-llvm-9dd25b76964280b01964faa1724131c9eaa840c5.tar.gz
bcm5719-llvm-9dd25b76964280b01964faa1724131c9eaa840c5.zip
Objective-C properties: merge attributes when redeclaring 'readonly' as 'readwrite' in an extension.
r251874 stopped back-patching the AST when an Objective-C 'readonly' property is redeclared in a class extension as 'readwrite'. However, it did not properly handle merging of Objective-C property attributes (e.g., getter name, ownership, atomicity) to the redeclaration, leading to bad metadata. Merge (and check!) those property attributes so we get the right metadata and reasonable ASTs. Fixes rdar://problem/23823989. llvm-svn: 255309
Diffstat (limited to 'clang/test/CodeGenObjC')
-rw-r--r--clang/test/CodeGenObjC/property-list-in-extension.m16
1 files changed, 12 insertions, 4 deletions
diff --git a/clang/test/CodeGenObjC/property-list-in-extension.m b/clang/test/CodeGenObjC/property-list-in-extension.m
index 18174fe6bab..878745e73e4 100644
--- a/clang/test/CodeGenObjC/property-list-in-extension.m
+++ b/clang/test/CodeGenObjC/property-list-in-extension.m
@@ -1,9 +1,10 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-weak -fobjc-runtime-has-weak -emit-llvm %s -o - | FileCheck %s
// Checks metadata for properties in a few cases.
// Property from a class extension:
+__attribute__((objc_root_class))
@interface Foo
@end
@@ -20,12 +21,17 @@
// CHECK: @"\01l_OBJC_$_PROP_LIST_Foo" = private global { i32, i32, [1 x %struct._prop_t] }
// Readonly property in interface made readwrite in a category:
+__attribute__((objc_root_class))
@interface FooRO
@property (readonly) int evolvingprop;
+@property (nonatomic,readonly,getter=isBooleanProp) int booleanProp;
+@property (nonatomic,readonly,weak) Foo *weakProp;
@end
@interface FooRO ()
@property int evolvingprop;
+@property int booleanProp;
+@property Foo *weakProp;
@end
@implementation FooRO
@@ -34,6 +40,8 @@
// Metadata for _evolvingprop should be present, and PROP_LIST for FooRO should
// still have only one entry, and the one entry should point to the version of
// the property with a getter and setter.
-// CHECK: [[getter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [13 x i8] c"evolvingprop\00"
-// CHECK: [[setter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [18 x i8] c"Ti,V_evolvingprop\00",
-// CHECK: @"\01l_OBJC_$_PROP_LIST_FooRO" = private global { i32, i32, [1 x %struct._prop_t] }{{.*}}[[getter]]{{.*}}[[setter]]
+// CHECK: [[evolvinggetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [13 x i8] c"evolvingprop\00"
+// CHECK: [[evolvingsetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [18 x i8] c"Ti,V_evolvingprop\00",
+// CHECK: [[booleanmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [34 x i8] c"Ti,N,GisBooleanProp,V_booleanProp\00"
+// CHECK: [[weakmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [23 x i8] c"T@\22Foo\22,W,N,V_weakProp\00"
+// CHECK: @"\01l_OBJC_$_PROP_LIST_FooRO" = private global { i32, i32, [3 x %struct._prop_t] }{{.*}}[[evolvinggetter]]{{.*}}[[evolvingsetter]]{{.*}}[[booleanmetadata]]
OpenPOWER on IntegriCloud