xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/objc-gc-aggr-assign.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CHECK-C %s
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CHECK-CP %s
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambucstatic int count;
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuctypedef struct S {
7*f4a2713aSLionel Sambuc   int ii;
8*f4a2713aSLionel Sambuc} SS;
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambucstruct type_s {
11*f4a2713aSLionel Sambuc   SS may_recurse;
12*f4a2713aSLionel Sambuc   id id_val;
13*f4a2713aSLionel Sambuc};
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc@interface NamedObject
16*f4a2713aSLionel Sambuc{
17*f4a2713aSLionel Sambuc  struct type_s type_s_ivar;
18*f4a2713aSLionel Sambuc}
19*f4a2713aSLionel Sambuc- (void) setSome : (struct type_s) arg;
20*f4a2713aSLionel Sambuc- (struct type_s) getSome;
21*f4a2713aSLionel Sambuc@property(assign) struct type_s aggre_prop;
22*f4a2713aSLionel Sambuc@end
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@implementation NamedObject
25*f4a2713aSLionel Sambuc- (void) setSome : (struct type_s) arg
26*f4a2713aSLionel Sambuc  {
27*f4a2713aSLionel Sambuc     type_s_ivar = arg;
28*f4a2713aSLionel Sambuc  }
29*f4a2713aSLionel Sambuc- (struct type_s) getSome
30*f4a2713aSLionel Sambuc  {
31*f4a2713aSLionel Sambuc    return type_s_ivar;
32*f4a2713aSLionel Sambuc  }
33*f4a2713aSLionel Sambuc@synthesize aggre_prop = type_s_ivar;
34*f4a2713aSLionel Sambuc@end
35*f4a2713aSLionel Sambuc
36*f4a2713aSLionel Sambucstruct type_s some = {{1234}, (id)0};
37*f4a2713aSLionel Sambuc
38*f4a2713aSLionel Sambucstruct type_s get(void)
39*f4a2713aSLionel Sambuc{
40*f4a2713aSLionel Sambuc  return some;
41*f4a2713aSLionel Sambuc}
42*f4a2713aSLionel Sambuc
43*f4a2713aSLionel Sambucvoid f(const struct type_s *in, struct type_s *out) {
44*f4a2713aSLionel Sambuc  *out = *in;
45*f4a2713aSLionel Sambuc}
46*f4a2713aSLionel Sambuc
47*f4a2713aSLionel Sambuc#ifdef __cplusplus
48*f4a2713aSLionel Sambucstruct Derived : type_s { };
49*f4a2713aSLionel Sambuc
50*f4a2713aSLionel Sambucvoid foo(Derived* src, Derived* dest) {
51*f4a2713aSLionel Sambuc        *dest = *src;
52*f4a2713aSLionel Sambuc}
53*f4a2713aSLionel Sambuc#endif
54*f4a2713aSLionel Sambuc
55*f4a2713aSLionel Sambuc// CHECK-C: call i8* @objc_memmove_collectable
56*f4a2713aSLionel Sambuc// CHECK-C: call i8* @objc_memmove_collectable
57*f4a2713aSLionel Sambuc// CHECK-C: call i8* @objc_memmove_collectable
58*f4a2713aSLionel Sambuc
59*f4a2713aSLionel Sambuc// CHECK-CP: call i8* @objc_memmove_collectable
60*f4a2713aSLionel Sambuc// CHECK-CP: call i8* @objc_memmove_collectable
61*f4a2713aSLionel Sambuc// CHECK-CP: call i8* @objc_memmove_collectable
62*f4a2713aSLionel Sambuc// CHECK-CP: call i8* @objc_memmove_collectable
63