• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-weak -fobjc-runtime-has-weak -emit-llvm %s -o - | FileCheck %s
2
3// Checks metadata for properties in a few cases.
4
5
6// Property from a class extension:
7__attribute__((objc_root_class))
8@interface Foo
9@end
10
11@interface Foo()
12@property int myprop;
13@end
14
15@implementation Foo
16@synthesize myprop = _myprop;
17@end
18// Metadata for _myprop should be present, and PROP_LIST for Foo should have
19// only one entry.
20// CHECK: = private unnamed_addr constant [12 x i8] c"Ti,V_myprop\00",
21// CHECK: @"_OBJC_$_PROP_LIST_Foo" = internal global { i32, i32, [1 x %struct._prop_t] }
22
23// Readonly property in interface made readwrite in a category:
24__attribute__((objc_root_class))
25@interface FooRO
26@property (readonly) int evolvingprop;
27@property (nonatomic,readonly,getter=isBooleanProp) int booleanProp;
28@property (nonatomic,readonly,weak) Foo *weakProp;
29@end
30
31@interface FooRO ()
32@property int evolvingprop;
33@property int booleanProp;
34@property Foo *weakProp;
35@end
36
37@implementation FooRO
38@synthesize evolvingprop = _evolvingprop;
39@end
40// Metadata for _evolvingprop should be present, and PROP_LIST for FooRO should
41// still have only one entry, and the one entry should point to the version of
42// the property with a getter and setter.
43// CHECK: [[evolvinggetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [13 x i8] c"evolvingprop\00"
44// CHECK: [[evolvingsetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [18 x i8] c"Ti,V_evolvingprop\00",
45// CHECK: [[booleanmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [34 x i8] c"Ti,N,GisBooleanProp,V_booleanProp\00"
46// CHECK: [[weakmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [23 x i8] c"T@\22Foo\22,W,N,V_weakProp\00"
47// CHECK: @"_OBJC_$_PROP_LIST_FooRO" = internal global { i32, i32, [3 x %struct._prop_t] }{{.*}}[[evolvinggetter]]{{.*}}[[evolvingsetter]]{{.*}}[[booleanmetadata]]
48