1// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s
2
3@interface Super @end
4
5@interface X : Super
6{
7	int ivar1;
8	id ivar2;
9}
10@property (readonly) int x;
11@property id y;
12@end
13
14@implementation X
15@synthesize y;
16
17- (int)x { return 12; }
18+ (int)clsMeth { return 42; }
19- (id)meth { return ivar2; }
20@end
21
22// Check that we get an ivar offset variable for the synthesised ivar.
23// CHECK: @"__objc_ivar_offset_X.y.\01" = hidden global i32 16
24//
25// Check that we get a sensible metaclass method list.
26// CHECK: internal global { i8*, i32, i64, [1 x { i8* (i8*, i8*, ...)*, i8*, i8* }] }
27// CHECK-SAME: @_c_X__clsMeth
28
29// Check that we get a metaclass and that it is not an exposed symbol:
30// CHECK: @._OBJC_METACLASS_X = internal global
31
32// Check that we get a reference to the superclass symbol:
33// CHECK: @._OBJC_CLASS_Super = external global i8*
34
35// Check that we get an ivar list with all three ivars, in the correct order
36// CHECK: private global { i32, i64, [3 x { i8*, i8*, i32*, i32, i32 }] }
37// CHECK-SAME: @__objc_ivar_offset_X.ivar1.i
38// CHECK-SAME: @"__objc_ivar_offset_X.ivar2.\01"
39// CHECK-SAME: @"__objc_ivar_offset_X.y.\01"
40
41// Check that we get some plausible property metadata.
42// CHECK: private unnamed_addr constant [5 x i8] c"Ti,R\00", align 1
43// CHECK: private unnamed_addr constant [6 x i8] c"T@,Vy\00", align 1
44// CHECK: = internal global { i32, i32, i8*, [2 x { i8*, i8*, i8*, i8*, i8* }] } { i32 2, i32 40, i8* null,
45
46// Check that we get a class structure.
47// CHECK: @._OBJC_CLASS_X = global { { i8*, i8*, i8*, i64, i64, i64, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i64, i8* }*, i8*, i8*, i64, i64, i64, { i32, i64, [3 x { i8*, i8*, i32*, i32, i32 }] }*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i64, { i32, i32, i8*, [2 x { i8*, i8*, i8*, i8*, i8* }] }* }
48// CHECK-SAME: @._OBJC_METACLASS_X
49// CHECK-SAME: @._OBJC_CLASS_Super
50
51// And check that we get a pointer to it in the right place
52// CHECK: @._OBJC_REF_CLASS_X = global
53// CHECK-SAME: @._OBJC_CLASS_X
54// CHECK-SAME: section "__objc_class_refs"
55
56