2015-12-11 07:02:09 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-weak -fobjc-runtime-has-weak -emit-llvm %s -o - | FileCheck %s
|
2015-12-04 01:44:51 +08:00
|
|
|
|
|
|
|
// Checks metadata for properties in a few cases.
|
|
|
|
|
|
|
|
|
|
|
|
// Property from a class extension:
|
2015-12-11 07:02:09 +08:00
|
|
|
__attribute__((objc_root_class))
|
2015-12-04 01:44:51 +08:00
|
|
|
@interface Foo
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface Foo()
|
|
|
|
@property int myprop;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation Foo
|
|
|
|
@synthesize myprop = _myprop;
|
|
|
|
@end
|
|
|
|
// Metadata for _myprop should be present, and PROP_LIST for Foo should have
|
|
|
|
// only one entry.
|
2016-09-19 00:12:14 +08:00
|
|
|
// CHECK: = private unnamed_addr constant [12 x i8] c"Ti,V_myprop\00",
|
2019-05-10 01:43:52 +08:00
|
|
|
// CHECK: @"_OBJC_$_PROP_LIST_Foo" = internal global { i32, i32, [1 x %struct._prop_t] }
|
2015-12-04 01:44:51 +08:00
|
|
|
|
|
|
|
// Readonly property in interface made readwrite in a category:
|
2015-12-11 07:02:09 +08:00
|
|
|
__attribute__((objc_root_class))
|
2015-12-04 01:44:51 +08:00
|
|
|
@interface FooRO
|
|
|
|
@property (readonly) int evolvingprop;
|
2015-12-11 07:02:09 +08:00
|
|
|
@property (nonatomic,readonly,getter=isBooleanProp) int booleanProp;
|
|
|
|
@property (nonatomic,readonly,weak) Foo *weakProp;
|
2015-12-04 01:44:51 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface FooRO ()
|
|
|
|
@property int evolvingprop;
|
2015-12-11 07:02:09 +08:00
|
|
|
@property int booleanProp;
|
|
|
|
@property Foo *weakProp;
|
2015-12-04 01:44:51 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation FooRO
|
|
|
|
@synthesize evolvingprop = _evolvingprop;
|
|
|
|
@end
|
|
|
|
// 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.
|
2016-09-19 00:12:14 +08:00
|
|
|
// CHECK: [[evolvinggetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [13 x i8] c"evolvingprop\00"
|
|
|
|
// CHECK: [[evolvingsetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [18 x i8] c"Ti,V_evolvingprop\00",
|
|
|
|
// CHECK: [[booleanmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [34 x i8] c"Ti,N,GisBooleanProp,V_booleanProp\00"
|
|
|
|
// CHECK: [[weakmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [23 x i8] c"T@\22Foo\22,W,N,V_weakProp\00"
|
2019-05-10 01:43:52 +08:00
|
|
|
// CHECK: @"_OBJC_$_PROP_LIST_FooRO" = internal global { i32, i32, [3 x %struct._prop_t] }{{.*}}[[evolvinggetter]]{{.*}}[[evolvingsetter]]{{.*}}[[booleanmetadata]]
|